Introduction: Arduino Quadcopter
Its not only a Quadcopter ,,,, Its a open source Machine!!!!
Many of you face a problem when it comes to Flight Controller which is the brain of the Multirotor. There are plenty of ready-made pre-flashed Flight controllers in the market for cheap, But have you thought of building your own Flight controller with your Arduino? So this is the right place to understand and build your own Flight controller for your Quadcopter or Multirotor with your Arduino.
Now the questions come, Where and how do I get the code for the quadcopter? So the answer is Multiwii.
MultiWii is a Very popular flight controller software for DIY Multi-rotors with a large community. It has Support various Multi-copters with advanced features such as Bluetooth Control by your Smartphone, OLED Display, Barometer, Magnetometer, GPS position hold and return to home, LED strips and many more. So let’s build our Flight controller using Arduino!
Step 1: Flight Controller Designing
Here are the Schematics for the flight controller board. you can make one on your general purpose PCB or can Order a PCB from manufacturer as i did.
ESC Connections
- D3 << ESC 1 Signal Pin
- D9 << ESC 3 Signal Pin
- D10 << ESC 2 Signal Pin
- D11 << ESC 4 Signal Pin
Bluetooth Module Connections
- TX << RX
- RX << TX
MPU-6050 Connections
- A4 << SDA
- A5 << SCL
LED Indiacator
- D8 << Anode Leg of LED
Receiver Connections
- D2 << Throttle
- D4 << Elerons
- D5 << Ailerons
- D6 << Rudder
- D7 << AUX 1
Step 2: Building a Frame
I bought a DJI 450 frame and attached my motors and everything on it. Yo can see the video on how i did it.
Step 3: Attaching the Flight Controller Onto the Frame
Then finally attach the esc and reciever onto the board as shown in the schematics and everything is done!!!!!
Comments
Question 3 years ago
I have been working on an Arduino based flight controller for quad-copters. I have written a PID controller to balance the quad(on one axis), but after 15 seconds, it starts oscillating violently and eventually gets out of control. I have been trying to tune the Gain values, but it doesn't seem to be helping much. From what I know, increasing the differential gain helps dampen over-correction, but it doesn't seem to be helping that much. I would appreciate any advice on how to fix the oscillation problem. What I want is a stable quad-copter that can still arrive at the target position quickly. Thanks!
Here is my code:
//These are my PID Gain values
pGain = 0.13;
iGain = 0.004;
dGain = 0.62;
//This is my PID controller that runs each loop
error = target - (int)angle_roll_output;
//Proportional term
P = (float)error * pGain;
//Integral term
errorsum += error;
if(errorsum > sumlimit){
errorsum = sumlimit;
}else if(errorsum < -sumlimit) {
errorsum = -sumlimit;
}
I = (float)errorsum * iGain;
//Differential term
errorslope = error - lasterror;
D = (float)errorslope * dGain;
lasterror = error;
correction = (int)(P + I + D);
if(correction > 20){
correction = 20;
}else if(correction < -20) {
correction = -20;
}