Preface
Since I completed the last training camp and saw the cooperation with Xinyuan Semiconductor in this training camp, I also have some ideas. I have always wanted to develop a small drone by myself. Although I had previously imagined using the more mature STM series open source solution, now that we have this training camp, we must support a wave of domestic chips
no matter what. So, I started Design of UAV flight control circuit and development of driving algorithm
Since the UAV needs to be miniaturized, I chose a brushed motor, powered by a 3.7V lithium battery, and adjusted speed through PWM signal
2022.08.18 Record: Basic Complete the development of the drone's hardware body, sensor driver and overall flight control algorithm.
Text
overview
MCU: using CW32F030C8T6 chip, external 8MHz crystal oscillator, providing SW & TTL two programming methods;
power supply: 3.7V lithium battery power supply, DC-DC Boost to 5V, then step down to 3.3V through LDO;
button & indicator: Reset button; 3.3V power LED indicator; 2 programmable LED indicators; 4 programmable WS2812B lamp beads;
core module: The overall design scheme of MPU6050 attitude sensor module; BMP280 air pressure sensor module; buzzer module; serial communication module; coreless motor (brushed) drive module
is as follows:

The overall idea of the flight control algorithm (refer to Station B - Fengling Tiantian) is as follows Figure:
Function introduction PWM speed
regulation has been developed
: PWM signal has been generated through ATIM method & GTIM method to control the motor speed.
MPU6050 driver: Use the hardware IIC method to read the MPU6050 sensor data, and use the serial port to print and display it, as shown below:

Anonymous host computer debugging: Connect to the anonymous host computer, transmit attitude angle and other information, and debug the drone.

Flight control algorithm: transplant the open source flight control algorithm and make targeted adaptation according to the characteristics of the CW32 chip; filter the MPU6050 raw data, combine it with the control instructions, and use double closed-loop PID control to realize UAV flight control.
WiFi control: Currently the TCP protocol + transparent transmission method is used for network connection; currently the PC debugging software is used to send flight control instructions; the ESP-01 module communicates with the CW32 through the serial port, obtains flight attitude information, and sends control instructions to CW32;
Advanced target!
Host computer development: Use C++ language and Qt to develop a PC-side host computer that communicates with the ESP-01 module through WiFi. It can display aircraft status information in real time, provide virtual joystick mapping, and perform flight control through keyboard keys.
Physical picture of the finished product in
flight control circuit board
testing (temporarily using a third-party rack, and will design and print the adapted rack by ourselves in the future~)
To be continued
I have been quite busy in the past month, publishing papers, working on projects, etc., there is no need for this The man-machine solution itself is also a bit more complicated, resulting in slow progress, but I still feel sorry for it; I
finally insisted on completing it. Although there are some flaws (the PID parameters need to be tuned), I will continue to improve, so stay tuned!