DIY Arduino Drone: How to Make Guide!
by GizmoWizard in Circuits > Arduino
4023 Views, 50 Favorites, 0 Comments
DIY Arduino Drone: How to Make Guide!
Who needs fancy pre-built drones when you can create your own aerial masterpiece? This Instructable is your one-stop shop for building a killer Arduino drone – and believe me, it's way cooler (and probably cheaper) than anything you'll find at the store.
We'll be using an Arduino board as the brain of our operation, programming it to control the motors and send your drone soaring through the sky. Think of it as a big, flying and customisable robot you built yourself – how awesome is that?
This guide is perfect for anyone who wants to:
- Experience the thrill of building a drone from scratch
- Learn the basics of Arduino programming and flight control
- Unleash your inner mad scientist (well, maybe just a drone enthusiast, but meh)
So, if you're ready to ditch the store-bought and build something truly unique, then strap on your metaphorical goggles and let's get building!
Supplies
Supplies you need to build this project: (WARNING: If you can't get these items, please buy things very close to this, otherwise the drone won't work.)
2.1000 KV Brushless Drone Motors x4
3.30A ESC x4
4. Propellors x4
6.2200 MAH Lithium Polymer Battery
7.XT60 Female and Male Connectors (available at any electronics store)
Soldering the Battery Connector and the ESCs
PDB is the Power Distribution Board. It is the frame's bottom plate, with square pads all around. You solder the ESCs to the PDB as shown above. Check the polarity is correct!
Also, you can see an extra set of solder pads. These are for the battery connections. Solder the female XT60 connector to the pad. Check that the red wire is going to the positive contact and the black wire is going to the negative contact.
Building Up the Frame
Okay, so now's the time to build up the frame. Screw the arms to the bottom plate and reroute the ESCs through the "armpits" (the tiny arches). Then zip tie the ESCs to the underside of the frame. After cutting off the extra zip tie plastic, screw on the top plate. That's pretty simple since there are ... 16 screws!! Yeah, losing ONE screw is bad enough. It'll make the top plate VERY unstable, and that's bad because we'll be mounting our electronics on top of it. so, please do not continue if you lost a screw. Get another one immediately!
Now the thing's lookin' like a drone...
Circuit Building
Here's the schematic. Don't worry about the blued-out areas, that's not important. This design was EXHAUSTING to make and I even destroyed an old Arduino Uno accidentally as I was working on the power circuit.
Connect up everything and try to arrange the wires neatly, using loads of cable ties and electrical tape. I'm working on a top case and will add the STL files in a later update.
I used some MAHOSIVE cable ties to attach the battery firmly to the lower deck of the drone frame.
After that's done, (it takes a lot of time and do it with patience, as putting too much force on a wire can either disconnect it or even rip it from the connector) let's get on with the programming!
NOTE: I've given the MPU-6050 gyro orientation image too. I've oriented my drone in the given direction. You can orient YOUR drone any way you like but know that the front and back will change!
UPDATE (04/07/2024):
I finally managed to get the case done and here are the STL files!
Programming the Drone Part 1
Okay to get started, download the attached files. Open up the Arduino IDE.
Pro tip: Always open up Arduino IDE with admin privileges. This will fix MANY issues with uploading and accessing the Arduino through the Serial Monitor.
First, open up the ClearEEPROM sketch and upload it.
NOTE: If previous sketches are still loaded in the Arduino, upload a blank sketch and then upload the ClearEEPROM sketch.
Second, open up the DroneSetup sketch. Set the Serial monitor to 57600 baud and upload the sketch.
NOTE: Connect the Flysky transmitter BEFORE uploading the sketch.
Then go to the Serial Monitor and follow the instructions.
After the setup is done, go to the next step.
Balancing the Motors and Props
This step is critical to the drone's stable flight. If you skip this step like an idiot, then your props won't be stable and the drone will bounce and will be uncontrollable, like in the given video where I divebombed my brother. (What? it was an accident.)
Mount the props on the motors and check if the counterclockwise and clockwise props are in the right position. Upload the ESCCalibrate program and open the Arduino serial monitor at 57600baud. Send '1' via the serial monitor and wait for the response "Test motor 1 (right front CCW.)".
The numbers that are printed on the screen represent the amount of vibration measured by the accelerometer. This is not a standardized value and should only be used to minimize the amount of vibration of your quadcopter.
Hold the quadcopter firmly down, place the throttle in the lowest position and connect the flight battery. Now slowly increase the throttle until motor 1 starts to spin. Check the direction of rotation and that the prop produces upward thrust. If the motor rotates in the wrong direction you need to switch two of the three motor wires. Put the throttle in the lowest position to stop the motor.
Now hold the motor frame firmly in your hand and increase the throttle to half throttle. Check the numbers on the screen and also memorize the vibrations that you feel with your hand that is holding the motor frame.
Thats done! Your drone should be nearly ready to fly.
Downloads
Programming the Drone Part 2
This step is straightforward to implement and let's quickly do it!
Download the FlightController sketch and upload it to the drone. Then disconnect the drone and connect the battery. You should hear a series of beeps like this: "Beep, beep, beep, BEEP!". If you got that combination, that's all right! If you didn't, then you didn't clear the EEPROM correctly.
NOTES:
If you upload the ClearEEPROM sketch and saw a warning before the uploading, that's all right, don't panic.
If you're facing problems after following the tutorial, please comment below. I'll try to solve your problem.
If the IDE gives some folder errors press OK and continue.
UPDATE (27/07/2024):
There's an update to the existing code, I found that the drone's unstable even with all the steps. The PID variables were tweaked a bit to compensate for weight. Go to the section where the variables like PID_gain, PID_roll, etc are and delete them. Then replace with:
float pid_p_gain_roll = 1.0;
float pid_i_gain_roll = 0.03;
float pid_d_gain_roll = 15.0;
int pid_max_roll = 400;
float pid_p_gain_pitch = 1.0;
float pid_i_gain_pitch = 0.03;
float pid_d_gain_pitch = 15.0;
int pid_max_pitch = 400;
float pid_p_gain_yaw = 3.0;
float pid_i_gain_yaw = 0.015;
float pid_d_gain_yaw = 0.0;
int pid_max_yaw = 400;
boolean auto_level = true;
Downloads
Flying the Drone
First, put the drone in a flat and open space. Then follow these steps:
- Connect the drone battery. You should hear the beeps we talked about earlier.
- Start up the FlySky. It should have a charged battery and should be clean of dirt and grime.
- After connecting, quickly push the yaw stick to the left to arm the drone(specific for this drone only)
- The drone motors should equally spin up to 10% throttle. The drone should not lift off yet.
- Centre the throttle stick(50% power). The drone should lift off and hover 5 feet off the ground.
- Release all controls. The drone should hover stably and not shoot off like a cannon. if it does do that(or becomes unstable), then you didn't follow the prop balancing step.
- Done!
And that's it!
If you're facing problems even after following the flight control tutorial, then please comment below. I'll try to solve your problem.
Conclusion
This was the hugest project I ever built and it's wonderful.
I hope you enjoyed building this with me and flying it too!
If you liked this, then please follow my Instructables channel and favourite this Instructable, as it helps a lot.
I'll see you next time!