Self-Stabilizing Quadcopter (In Progress)
My goals for this project were to design and create my own functional quadcopter. I wanted a fun way to continue challenging myself while expanding my skills and learning more about arduino programming and other topics that my engineering courses or extracurriculars wouldn't necessarily cover. Originally starting out as a simpler project involving Solidworks CAD and Soldering, I quickly became interested in topics like sensor fusion and controls. Thus, I became prompted to develop a large portion of this project from scratch, including the software.
This personal project is still ongoing and in development.
(1) Current Assembled Drone
(2) Current Assembled Drone w/Propellers
Electronics Hardware
(3) ESC and Motor Connection
(4) PDB to ESC Power connections
(5) PDB to Flight Controller Power Connection
Prior to designing the frame, I selected electrical components based on preference and goals for this quadcopter. The main electronic components are:
Flight Controller: For the full flight control unit, I chose an Arduino Nano to function as the main flight controller, and an MPU-6050 Inertial measurement Unit. These options were easy to purchase and affordable. This Flight Control Unit can be seen in image (5). More Information about the flight controller is shared in the "Flight Controller and Software" section below.
Motors: I selected small, 2300KV motors rated for 2-3S Batteries. These motors are lightweight and designed for smaller drones, which fit my size and weight estimations of the drone at the time. This motor can be seen in image (3) and (4).
Electronic Speed Controllers (ESC): I chose four separate and independent 35A ESCs to drive and control the motors. All though there are all-in-one versions, these ESCs were more affordable while still being very lightweight. This ESC can be seen in image (3).
Power Distribution Board (PDB): Because I didn't choose an all-in-one ESC, which normally comes with a PDB included, I also required a dedicated PDB. The PDB I selected, shown in image (1), provides 5 different ESC power outputs, and both 12V and 5V regulated outputs. This is more than adequate for my quadcopter.
Battery: I chose a 3S (11.1 V), 2200 mAh Lithium-Polymer battery to power the motors and electronics on board. This battery is compatible with the voltage rating of my chosen motors and because I don't plan to have any long flights, should provide enough energy capacity.
All electrical connections between the Flight Controller, PDB, ESCs, and Motors were hand soldered and I also used Banana plugs to ensure they were easily disconnected and reconnected for testing/troubleshooting.
*Note: A receiver is also required on-board the drone for remote control, but that will come as more progress is completed.
Drone Frame Design and Manufacturing
(10) Physical Display of Drone Frame Modularity
For the frame, I chose an x-configuration with a size of about 8 inches (diagonally). Initially, as shown in image (9), I designed a simple, single piece frame in Solidworks CAD to custom fit my chosen electronics. However, after realizing it would be too large for my FDM 3-D Printer to print in one piece, I completely redesigned the frame to be modular, as shown in images (6), (7), and (8).
Similar to the electronics, the frame consists of of several main parts:
Main baseplate that secures both the Flight Controller and Power Distribution board.
Four two-piece arms that each house a motor and and ESC. Adding a second "covering" piece to the arm design not only covers up and better protects the ESC-Motor connections, but it also adds a bit more structural integrity to the arm under bending without adding much weight.
A Baseplate Cover that protects the Flight Controller and PDB in the event of a crash and adds a second layer of room to strap the battery and Receiver on to.
I assembled these parts together using M3 bolts/nuts and heat-set threaded inserts. For the first prototype, as shown in images (1) and (2), I 3D printed the entire frame using PLA filament. Overall, designing a modular frame allowed me to create redesigned test prints and fix tolerances much faster, as I only needed to print one or two small parts, rather than a single large part that would take significantly more time. It has also allowed me to replace broken or defective prints much more efficiently while reducing my total filament usage and costs.
Flight Controller
(14) Flight Controller Calibration Sequence LEDs Testing
As mentioned above, my Flight Control Unit mainly consists of an Arduino nano and an MPU-6050 Inertial Measurement Unit (IMU). The IMU has both a 3-axis gyroscope and a 3-axis accelerometer that allows me to measure angular velocities and linear accelerations, which are helpful for calculating the drone's attitude (Roll, Pitch, Yaw angles). The Arduino nano takes this sensor data, estimates current attitude, and calculates the necessary command outputs for the motors to stabilize the quadcopter in the air.
Image (11) shows the current version of my flight controller, with soldered connections. I originally connected the two boards using male to male jumper wires on the breadboard, but switching to soldered connections reduced the occurrence of loose connections and helped mitigate noisy readings from the IMU. I also added two LEDS to signal when the drone is in its sensor calibration sequence and when it has completed calibration and is ready for movement. A video of these Signal LEDs can be seen above and earlier protyping versions of the Flight Controller can be seen in images (12) and (13).
Flight Software
(15) Code Snippet of IMU Read function in Arduino IDE
(16) Code Snippet of Individual Gyro and Accelerometer State Estimation in Arduino IDE
(17) Code Snippet of Complementary Filter Implementation for State Estimation in Arduino IDE
I have also set out to program the flight software for my drone from scratch in the Arduino IDE. This includes critical functions, such as sensor data retrieval, attitude estimation, and flight control.
Currently, I have implemented my own library for configuring and reading data from my MPU-6050 IMU. Image (15) displays a snippet of my read function, which reads raw accelerometer and gyroscope data from the IMU registers and converts them into proper units (rad/s and g).
I have also implemented my own functions for estimating the drone's current Roll, Pitch, and Yaw. Image (16) shows a snippet of my attitude estimation based on the individual gyroscope and accelerometer sensor data. Although both sensors are technically capable of estimating the angular orientation of the drone on their own, the gyroscope value is prone to drifting over time and the Accelerometer is very prone to high frequency noise, causing inaccuracies. Thus, as shown in image (17), I implemented a complementary filter, a simple, yet effective form of sensor fusion. This combines the two estimated attitude values and allows me to more accurately determine the drone's Roll and Pitch (accelerometer cannot estimate Yaw). Although more advanced sensor fusion algorithms exist, such as a kalman filters, they often require more processing power, which my Arduino Nano is very limited in. I'm currently in the process of optimizing and testing this attitude estimation process to achieve more accurate results.
The full source code of my current flight software can be seen at my github here:
https://github.com/JoshCaratao/Quadrotor-AngleMode-FlightConroller
Matlab/Simulink Simulation
(18) Current Progress of my Position Controlled 3 Degree of Freedom Drone Simulation in Simulink
Finally, before implementing a Proportional-Integral-Derivative (PID) controller in Arduino to stabilize flight, I have also decided to create my own model and simulation in Matlab/Simulink to first gain a better understanding of the controller structure and tune PID Gains before physical flight testing. I am currently developing a position control simulation for a 2-Dimensional (3 Degree of Freedom) Drone. I plan on learning from this simulation and building a full, quadcopter simulation in Simulink that will allow me to better tune the PID gains for the physical quadcopter.
Image (18) shows the current structure of my simulation.
(19) Physical Testing of PWM Output/Command to ESC and Motors
(20) Physical Testing of Gyroscope Measurement
Videos (19) and (20) above show some of my progress and physical testing of my drone.