Skip to content

Latest commit

 

History

History
119 lines (94 loc) · 5.05 KB

File metadata and controls

119 lines (94 loc) · 5.05 KB

Quadcopter UAV

The goal of the project is to create a fully operational model of a quadcopter UAV, which can be controlled with a Xbox controller. The project utilises the MPU6050, which combines MEMS accelerometer and gyroscope into a single IC. The combination of sensor readings from the IMU combined with an adequate mathematical model and a regulating system allows to make a quadcopter with a stable control system.

Project implementation

The MCU used in the project implementation is STM32F103xxxx an ARM Cortex-M3 mi- crocontrollers. The MPU6050 has been used as a sensor. It is an inertial measurement unit (IMU), a MEMS integrated circuit combining in itself an accelerometer and a gyroscope. For easy and intuitive reading of the sensor data at the code level, a library for initialising and handling the MPU has been written. It uses the built-in I2C bus which is used to exchange data between the IMU and MCU. The transmission is made in 400kHz mode. In order to save MCU execution time, a DMA controller has been used, allowing for sending data from RAM to the peripheral. Similarly, a library for nRF24L01 radio module has been written. nRF24L01 is being used for digital radio transmission between the UAV and a PC. It is connected to the MCU by the SPI bus and also uses the DMA mechanism. Another nRF connected to the PC is used to communicate with the quadcopter. The transceivers are used in order to read telemetry data and for piloting the UAV using an Xbox controller connected to the PC.

To keep the UAV stable it is essential to keep it at a set (stable) angle during movement. For instance, when we want the drone to fly up vertically, the roll and pitch angle have to be set to 0 degrees. The IMU supplies the data about displacement and angular velocity and a suitable mathematical model processes the data in order to estimate the angles. Finally the integration of data from both sensors with the help of filtration algorithms, such as complementary filter or Kalman filter allows us to gain precise information about the angles and for effective stabilisation of the quadcopter during flight. In our project we used the Kalman filter. It is an aimed at estimating the actual state of the system based on the observer measurements with Gaussian noise. The algorithm works in two main steps: estimation of the state of the system based on previous state and correcting it during the next measurement. Kalman filter uses the mathematical model and data about Gaussian noise in order to minimalise the estimates and measurement unceirtanties. The angle estimates and yaw angular velocity is fed into the regulation system consisitng of three PID regulators for every quantity. The PID regulator works by minimising the difference between the actual state of the system and a desirable reference state.

More detailed documentation has been placed in the project submodule "documentation".

Building Firmware

  1. Clone the Repository:
git clone https://github.com/Cyberdom123/quadcopter-dsp.git
cd quadcopter-dsp
  1. Initialize and Update Submodules:
git submodule update --init --recursive
  1. Install Required Tools:
  • Ensure you have the ARM GCC toolchain installed.
  • Ensure you have CMake version 3.22 or higher installed.
  • Install stlink for flashing the firmware to the STM32 MCU.
  1. Build the Firmware:
cd firmware
cmake -S . -B build/
cd build
cmake --build
  1. Flash the Firmware:
cmake --build . --target fc-stm32.flash_stlink
  1. Run the Quadcopter:
  • Power up the quadcopter and ensure all connections are secure.
  • Use the Xbox controller connected to the PC to control the quadcopter.
  1. Troubleshooting:
  • Refer to the detailed documentation in the documentation submodule for troubleshooting steps and additional information.

Running Scripts

  1. Navigate to the Scripts Directory:
cd scripts
  1. Install required pip packages
pip3 install -r requirements.txt
  1. Run the Desired Script:
  • Ensure you have Python installed.
  • Execute the script using Python:
python3 script_name.py
  1. Available Scripts:
  • gamepad_controller.py: This script is responsible for handling the gamepad input and translating it into commands for the quadcopter.
  • EMA.ipynb: This Jupyter notebook contains the implementation and analysis of the Exponential Moving Average (EMA) filter.
  • IIR.ipynb: This Jupyter notebook includes the design and analysis of Infinite Impulse Response (IIR) filters.

Components list

  • 7x20mm 3.7V DC 46500RPM Motors CCW
  • 7x20mm 3.7V DC 46500RPM Motors CW
  • Transceiver: 2.4GHz NRF24L01
  • LiPo Battery: 520mAh 75C
  • Gyroscope/Accelerometer: MPU6050
  • Pressure Sensor: BMP280
  • MCU: STM32F103C8T6/STM32F103C6T6