As a mechanical engineering undergrad, you are definitely one of the best instructors I've come across. Very simple and straightforward explanations that would have made my controls classes much easier to follow. I hope to code my own autonomous quad with referencing this as my foundation. Thanks for your hard work in these videos!
This was an awesome series, thanks so much for taking the time to make it! I was going to use an off the shelf type flight controller for my own tricopter project, but this series has single single-handedly given me the confidence to have a go at making my own :)
Thanks for the tutorial ... I built my quad as per the instructions given in this video and finally flew it. It was actually 3 years back when the series of videos had been posted online. Its really amazing. :D
Thanks for the video tutorial. Not only did you show me how to try building a quad-copter, you also showed me a lot about the Atmega328 chip and it's properties I never knew existed. The interrupts are one feature I didn't know about and will prove useful in other projects. Thank you so very much for sharing the videos because they taught me a lot. You are one smart and sharing guy! P.S. I love the donation part on your site. I always believed in paying it forward.
A quick question I hope you can answer. I bought a GY-521 gyro that from my understanding is the same as a MPU-6050. But when I run the "Find Gyro" sketch, it can't find it. I also tried the gyro using the MultiWii code and the MultiWiiconf program and it seems to work. Is there any way I can get this gyro to work in the code you've created. I'd rather not use the MutiWii if possible. Not that it isn't great code. I'd just rather try this using your code. Thanks for any help you might be able to give me. Dave
two years ago i dreamed to biuld a quad using arduino but i didnt know where to start but when i watched your vids two mothes ago i got motivated i kept watching your vids and started gathering parts and now i almost there to make it fly thank to god and you very much my dear and nice friend
This is the only video of its kind that I was able to find on the tube. Short, detailed, and no nonsense. This video will get popular in very short order. Thanks for posting the code as well. This is the best demonstration of code/hardware out there. I love it! Subbed, and thumbed!
this is the simplest but the best tutorial i've ever seen. i've been having problems with PID for stability and you gave me answers. YOU are the MAN! Thanks a lot!
Joop; You rock... I have never had this explained so clearly and concisely as you have done here..It's great to know how it works, but WHY it works is what you went into in depth and is what gives so much value to what you have done. Thank you so much!!
Men like you make dreams come true for all of us ,,mortals'' that can't program :) Extraordinary work and my compliments. I've decided to start my own build after your sketches. Thank you very very much!
Awesome, certainly I will build one for me. A great series, short videos but with a clear explanation regarding the matter. Thank you very much for sharing your knowledge with all of us.
I am building an RC version of Opener’s Black Fly VTOL aircraft. Do suppose this code could be modified to achieve the flight characteristics of that aircraft? I would image it’s just a matter of adjusting the desired pitch attitude of the PID from 0 to 90 degrees and back again as the aircraft transitions from vertical to horizontal flight. Guessing also I’d need to blend the roll and yaw commands as the motors tilt back and forth. What do you think?
Is it possible to reconstruct this project without any Tx/Rx components. Communicate with the microcontroller using wifi for a starting point and getting it to only hover at proximity in a controlled space, sending pulse width commands directly from the development platform onto the MCU, via a while loop waiting for user input for a pulse width? Purely for testing reasons?
hello, i have made the arduino based drone, but now i am using bmp180 altitude sensor in it. the problem is that it takes very long to read the data, and the loop is 2000us. please share the method you have for altitude sensor
Hi, cool video, I am building a quadcopter with arduino too but I have a problem. when I connect the battery, the engine and the receiver to the ESC nothing happends and the voltage go down to zero, do you think is a problem of the battery or of the receiver? how can I contact you?
I calibrated ESC, checked gyro and receiver data. All Good. Setup run. All Good. I did reduced a bit of vibrations and checked for EMF data, made an EXCEL chart. It looks quite alright. But still, when I try to fly drone, its violent and rolls over instantly. I tried changing PID settings with no real change. I give up after two months of building this project..
Great series, Joop! The code is very understandable due to the videos and comments in the sketch. I may modify it for my tricopter. Thanks and keep up the good work.
Enjoyed the tutorials a lot! Used a lot of it as inspiration for building my own setup. I have a problem though, one of my motors spin slower than the others. I did the calibration of all the ESC's and the motors start at the same time.. just not at the same speed. Any suggestions? (clearly might just be a faulty motor) Im just thinking of implementing som sort of trim, since one cannot be sure that all motors act the same.
hi Joop i have one problem can solve my problem. My gyro sensor is not working properly when i see in monitor angel change automatically plz tell me how to solve
hi, I am working on a Quadcopter safety feature for my college project, I need to power four motors for propellers + an extra motor for the safety system. Can I do that using Arduino Uno? please help
Hello , Your videos are amazing and they helped me build my own quad copter as well as understanding the code aspect of them. However I still have a problem with the MPU-6050 noise levels , ive shortened the wires as much as possible and pushed the ESC's as far as possible yet my readings are still bad compared to the ones on your Q and A on your site. Would using another gyro give better results?
Make sure that the props and motors are balanced. This can also be a source of noise on the gyro data. If the noise persist you could try another gyro.
Is it necessary to solder the jumper cables from the receiver to the Arduino ports ... would it be okay to use the jumper cables that have male to female connections ?
Hi Joop, Is it possible to implement altitude hold by reading gyro and accelerometer only ? I've seen people usually using baro and gps for this. Does your quad have alt hold on this video ? I assume its very hard to fly without this feature, is it not ? Does every pitch and rolling will change climbing/dropping rate?
tasiotas In this video I have no altitude hold. It's not very hard to fly it like this. It just takes some practice. The gyro can't be used for altitude hold. A combination of baro, gps and accelerometer will give the best result.
thanks, one more question. When you hold roll throttle at maximum(right stick push right), quadcopter will start rolling until it reaches max defined roll angle, or it will continue to increase roll until it will flip upside down ? Im trying to imagine how quad will behave with your code. I have very simple quad(Syma x5c-1) and Im not sure if radio inputs are the same as yours. When I push roll stick to maximum value, quad is just continuously drifting sideways and gaining speed.
Wondeful work Joop. I have built the quadcopter using the parts listed in your webside. I have passed the setup procedure, calibrated the esc's and uploading the final flight controller program to the quadcopter. Then, I am finally making some tests keeping the quadcopter in my hand to see how it is reacting. And the issue is that when I am giving a a roll or pitch command from the FS6 transmitter, the quadcopter is reacting but is not coming back to initial state when I am coming back to the initial position with the transmitter command. Any idea ? Thanks. Fabrice
If you use the YMFC-3D software the quadcopter will stay in it's current position. If you use the YMFC-AL (auto-level) the quadcopter will automatically level itself. www.brokking.net/ymfc-al_main.html
Joop, was wondering whether I shall declare the variable int receiver_input_channel_1 in the Flight Controller program ...... as volatile int receiver_input_channel_1...... as I am using IDE Arduino 1.8.0 and in reference to the modification I made in the Setup program which was working. Thanks. Fabrice
Sir, Our motors are of 2200 kv and our battery is 2200 mah.....will it work on 2200mah battery....what should we do...either increase the battery V or decrease the motor rating ?
Hello Joop, I have fabricated a quad and used your code and schematic with arduino UNO, but I have a problem when I move the stick to the roll or pitch and then I leave free the stick and this returned to center position ,the quad do not stop and follows the moving in the initial direction of the stick, the pid_output_pitch, pid_output_roll still high after I returned the stick to the center position and the quad follows the moving. I used your PID cosntant: p_gain: 1.3 i_gain: 0.05 d_gain: 15 I think to change d_gain to 0 What can I do? Thanks
I tried in the past to build the quad with no success.I can't really understand the PID part on the code and in general. Do you know any websites or PDFs that i could read and learn the PID algorithm and then implement it in my own projects? Just to copy your code, use it and not understand how it works, isn't practical because i can't use it or adapt it in other projects.
hi sir joop. i am also making a quadcopter but i dont have a stick reciever. i just want to test the stability of my quadcopter.. its okay if i will just try to hang my quadcopter and try to move in diffferent direction to test its stability? its okay if i will not include the code of the receiver? tnx
Hey Joop thanks for sharing your learning!. I have a question.Is it required to calibrate the esc after uploading the code? cuz i have already calibrated them individually and on uploading the code the motors just keep beeping and dont move at all. Is this happening because i haven't calibrated them properly or something else? Help me out here!
+DoGstrer quantum You need to calibrate the esc's with a 1000-2000us pulse to get them to work correctly. Use the Arduino sketch of part 2 to setup your transmitter. After that calibrate the esc's with the throttle output of your receiver.
Dear sir; I have questions about flight controller code. My english is not well. But I watched your all videos a lot of times. First question; in which line we have identified the signals from the given signal. What is counter_channel_1(2-3-4)? I wonder this in which line receiver_channel_1 = receiver_input[1] ? For example if(receiver_input_channel_3 > 1050) how do it know receiver_input_channel_3=receiver_input[3]? I hope you will see my message. Thank you for everythings.
sir i am also making a quadcoptor project ,but based on serial communication , i am stuck in a part where the analog joystick values (0,1024) ,is converted to angular velocity,in your part 5 tutorial you did something like , setpoint=(value -1)/3,my question is ,how the setpoint is converted from analog to angular velocity ,because when i print those values it just shows analog value range from -350,to +350, and thnks for those tutorial it really helped me understand the basics
The setpoint tells the PID controller how fast the angular motion of the quadcopter should be. With a normal receiver the setpoint is +/- 500 / 3 = +/- 166 degrees per second. This is because the gyro feedback is also in degrees per second. So for example: if the roll stick is max to the left the roll setpoint is -500 / 3 = -166 degrees per second. The PID controller will control the motors in such way until the gyro's output matches the -166 degrees per second.
Can i ask you one question? If the answer is YES. My question is " why did you choose 4 pins ( 4.5.6.7) for PWM purpose? As you know, arduino uno doesn't distribute PWM on every single pin. I mean there are 6 pins PWM (3 9 10 11 have the hertz and 5 6 have the same one). Can you explain for me. Thank you very much. And i am still looking forward to seeing your Answer. Once again. Thanks
+Joe Prince Maybe in the future. But not now. I'm currently working on my own flight controller and I don't have the time to do another video session like this.
hi again one more thing to ask. i have seen all ur videos. i want to ask that in ur project u only used gyro n not any other sensor..... Why so?? i also saw various videos n they all have used gyro n accelerometer in compact. so there is any diff in that. please clarify my doubt. i am a newbie to this. Please help me out... Thnks in advance..
Hi Mr. Brokking, I have some issues with the code. For the YMFC-3D V2, I have successfully went through all of the setup procedures and calibrated the ESC's. I can also upload the flight controller code also. When I pitch forward, the quadcopter's nose pitches forward as I wanted to. When I bring the pitch throttle back to center position, the quadcopter does not become horizontal again, it remains the same pitch angle as it was before. It will remain the same angle until I change it again with the transmitter, which really stresses me out. Gyro seems to work, but will not return to its horizontal level again once i release the sticks. Do you know what the problem is? Also i tried your YMFC-AL code also, but for that code, the LED remains on. Thanks in advance for your help.
The YMFC-3D is a 3D flight controller. That means that you have to manually level the quadcopter as you described. The YMFC-AL has an auto level feature that levels the quadcopter when you release the sticks. Please check the Q&A page to see why the LED stays on (question 9): www.brokking.net/ymfc-al_qanda.html
Thanks for the for the tutorial ...grate ...i have MADE a quad copter CONTROLLER with AURDINO due , now it is in the PID tuning phase ....i had used the standard libraries for sensor s like mpu6050 dmp , ms5611 , PID etc ...even in the hardware i had used level shifters ( mosfet based ..for me txb108 was not worked well ) even i can see that with some print functions i am able to run my loop running less than a micro ... my tuning setup is quad copter is tied with rope in an welded iron stand .. while tuning in level position there is small wobbling..can u plz guide me here to correct it .
Hi joop,i want to ask you two questions 1)I'm using spi protocol for 9dof(3axis gyro-accelerometer-magnetometer) sensor lsm9ds1,could it cause any problem?I'm asking because you are using i2c protocol. 2)In my code the refresh rate is 350 Hz,do you think it's the right thing to do? Isn't ther system more stabilized with the frequency? Thanks.
Hello. I Have made a camera Gimbal for my Quadcopter with some servo motors. and i need some help on how to connect to the receiver, so i could control it with my transmitter. So can you help me????
HI! I just want to ask if ever that I want to add an anti-collision feature to this drone. What advice can you give me or what should I do? thank you sir
Hi Joop. I am building an autonomous quadcopter that uses the arduino, mpu6050 and turnigy ESCs. the main idea at the moment is to basically make it hover. How can I modify the code u included to fit an arduino quadcopter without the use of a radio transmitter?
The Receiver_Input_channel_1 is not defined as output or in put ....and so on with other receivers ...but u are still receiving the values in ur setup program how is this possible...???. Plis help me...sir actuallt i want to understand each line of your code and write my own.... M facing these problems...its been three days i m researching on it....help me sir...😭
greetings, as a university project me and my friends want to build a self leveling quadcopter, but we want to give our inputs without an rf controller, someway within the computer connected. Do you have any possible/optimal ideas for this method, and a source code more suitable for this method? (without rf controller) Thanks in advance :)
Am trying to implement it with arduino mega 2560 but am not getting it to work since Interrupts and external interrupts differ from arduino uno. Am having trouble with editing your Code to just let it work with mega 2560. If you please just give me an advice or hint so i can work with. And Your work is Amazing thanks for sharing it.
when my stick is down the throtle indicate 1012 the yaw vary between 1496 1492 and 1500 when the stick is in the middle position on the monitor how can i correcte it ?
I really liked this project so i did it for a project and when I tried to fly it 2 of the motors seemed to have more power than the other 2 and I don't know why
Hey. I just completed this, but my Quad is tilting in one direction. I made sure to follow the directions exactly. I checked the directions of all 4 motors (2 ope ones moving cow and the other 2 cw). everything from part 1-5 seems to work perfectly. Im too afraid to try it....
you can try it . because it also happened to me. then i fixed my battery in middle . and properly set the frame(nuts). and all done. the i gave throttle about 1600 and it gone .
Absolutely the best!! I am so amazed at your knowledge. You have a very good approach for delivering this content. Your site is very well organized and documented. I did find some link errors but not a big deal because I found what needed on the site Downloads. I have learned so much from this series. I went as far as transcribing your voice track to the the steps with screenshots. I am in the process of gather all parts then plan to first tackle the YMF-AL project. I am a bit concerned that it appears you are not really responding to us so wondering what I will do when I have show stop problems.
Great job!!thanks for making those awesome tutorials and explaining everything clearly. I'm into building a tricopter and tried to modify the code accordingly but I'm not getting the movements correct ; especially the yaw movement as it is controlled by servo. Can you explain the changes I need to make in code for the same or upload a short tutorial for the same?
Hey there. I've built my own quadcopter and controller by a wifi board that connects to another Arduino. I'm noticing that testing the motors via the wifi, they have sudden increases in speed. However, when directly initializing the motor through the Arduino mounted on the quadcopter, this doesnt happen. Would this be due to fluctuations in the wifi signal?
I was reading the gyroscope datasheet again and i noticed something made me thinking ... In the source code you set the Control register 1 (20h) to b00001111 or x0F. With the first four bits to zero according to datasheet's table 21 the gyro output data rate (ODR) is set to 100 Hz with 12.5Hz cut-off low pass filtering. The flight controller's loop is running at 250 Hz. If we divide those numbers, the gyro data is updated once for every 20 cycles of the main loop ? or maybe i've lost it ? Could we increase the update rate of the gyro for better stability ? Did you do it for a purpose ? Maybe to easily match the output update rate with an accelerometer in the main 250hz loop? Do an accelerometer need to have the same or higher output data rate with a gyro to work properly for pid control in the main 250hz loop?
theodor drymonis Hi, despite the 100Hz ODR the angular rates are updated constantly after each read. So when you log the data you will see different values with every loop. The main advantage with the 100Hz ODR is the filter setting of LPF1 (low pass filter 1). This is set to 32Hz with an ODR of 100Hz. Setting the ODR to 200Hz or higher causes a higher setting of the LPF1 filter. 54Hz, 78Hz, 93Hz for respectively 200, 400 and 800Hz. This will cause more noise on the data output that you have to filter manually. The 12.5Hz cut-off refers to the setting of Low pass filter 2. This filter is bypassed by default. Therefore the 12.5Hz is meaningless. I tested most of the ODR settings (with and without LPF2) and found that the 100Hz setting gave the best results. There is more information in the 'L3G4200 AN4504 application note'.
Joop Brokking Thanks again for your help ... Your datasheet show this clearly! I don't know if i missed it in my L3GD20H datasheet but i couldn't find this information about the Low Pass Filter 1 cutoff frequencies . I could only see the presence of LPF1 in the block diagram.
On you video programming the ESCs you have the motors wobble, mention to reduce the number to.. My audio was distorted, I tried several times, but it sounds like either 50% or 15% Thanks for the reply
Hey i followed the whole process and uploaded all the codes correctly but when i go to fly the drone is not arming and the first two motors just keeping beeping please help
HI ........ I have a question for my quadcopter .... how do i have the fastest PID parameter for my quadcopter .. i have reference from start to end video ... Now that I'm having trouble with PID parameters, give me a way to refer to your PID method ... I hope to be able to use your code: P
This was so awesome not only did this series help me begin to develop my own flight controller but it taught so much more about arduino uno and programming in general. Than you for all your time and efforts. I have been looking at using an mpu 6050 to build a dual PID taking in the orientation angle not just the angular rate. Have you worked with this sensor at all?
Hi Joop , thank for your tutorial, I have working muy quadcopter now, your vídeos help me a lot. just I have a question...... I'm having problem the drone is dropping during flight, I use your code to fix this (esc*(1240-battert_volt)/flota(3800)); just that I set 2200 unless 3800 and iy works for a while..m like a 5 or 10 minutes and after that the drone start to dropping a lot, I have a 5000mah 11.1 volts. can you explain me why this happen or give me a solution to this?
+leon felipe cordero palacios (esc*(1240-battert_volt)/flota(3800)); is causing an overflow problem that causes you quad to drop quickly. Integers are -32,768 to 32,767. Example: A esc puls of 1500 and a voltage drop of 22 results in 33000 (overflow). Use it as (watch the difference in parentheses): esc_1 += esc_1 * ((1240 - battery_voltage)/(float)3500);
Finally i flew my quadcopter bases on YMFC-3D . $pecial thanx to you sir joop but can you please tell me that if you plug your battery when the quad is already in 45 degree angle from the surface.(calibration also done when it was at 45 degree) then if you leave it to fly will it be fly simply at 0 degree(simple quad) ?
That is good news! If you start the quadcopter at a 45 degree angle it will start and stay in that angle until you steer it level. It's a 3D quadcopter and does not auto level. The YMFC-AL that I'm currently working on will auto level because it uses the accelerometer to know what is down. With only a gyro the quadcopter does not know what is down. It only knows when it is rotating.
+Joop Brokking sir actually when i give it throttle about 1500 at which it takes off to the ground and when all other(roll pitch yaw sticks are in middle means at 1500 +/- 4 ) then it goes a little to right and doesn't stop just slowly slowly go to right. what is the problem ?
It could be a vibration problem or the quad moved a little during the calibration. If it moves slowly it means that the PID controller get a non-zero setpoint or gyro feedback.
Hi the project is awesome !! I Followed all your video and worked well with my setup. I have an issue to start the motors in the last code .. (Part 6) .. when I plug the battery the esc sounds , gyro calibration starts, then I put the throttle down and the LED turns off . but when I make the sticks movements to start the motors , nothing happen.
+Dakr drone Did you calibrate your transmitter with the program I wrote for part 2 (receiver). All channels work in the right direction and the travel is 1000-2000us with 1500 as center position. Next you need to calibrate the esc's with the 1000-2000us pulse. You can use the throttle output of your receiver for this. Otherwise the quadcopter will not start.
+Joop Brokking First of all, let me start by complementing you on this great video series. The step by step build is really helpful for people wanting to build their first quadcopter like myself. I have just finished my build and i am now calibrating the pid settings to get the quad perfectly stable. When it lifts off the gyro seems to be working well, i can feel it correcting when i move the quadcopter. But i have noticed something: when i use any of the channels (lets say pitch) i can put the stick forward (to 2000) and the quadcopter pitches forward. But when i put the stick back in the middle position (1500) , the quad stays in a pitched position , it does not return to a horizontal position. In order to do that i have to pitch back manually to get it somewhat level. Is this supposed to fly this way? i would imagine that the quad always returns to a center position when the sticks are in the middle at 1500. I have followed all your steps and the reciever seems to be set up correctly moving between 1000 to 2000 with 1500 as the middle. parts list : A2212 1000kv engines hobbysky 30a esc's gy-50 l3g4200d gyro Flysky fs-t6b transmitter multistar 3s 11.1v 4000mah if you could clarify this for me and the way you are supposed to control the quadcopter i would greatly appriciate it. thanks in advance and again, great series !
+Tom T Yes, the quad is supposed to fly this way. Auto level is only possible with an accelerometer. So you need to learn to fly it as it is. It's difficult but not impossible.
Thank you! But is there any specific reason why you prefer calculating angles from a gyro and accelero over using an IMU like the MPU-6050 which can give you angle data directly?
Hey guys i am currently trying to build my drone with arduino uno. I am trying to make the drone without using a radio controller, just by sending pulses to the arduino from my computer. Does this work the same way when trying to connect to the gyro and make the connections? Thanks
Awesome videos, I enjoyed every one. Edit: I see you have provided two videos that clearly explain the answer to my question. Thanks. I have one query regarding the gyros. It may have been explained and may have I missed it so apologies if that is the case. Considering the output from the gyro is in degrees/per second and there is no absolute values available for Yaw, Roll and Pitch is it possible that an amount of drift (relative to the initial start position) can creep in overtime. My thinking is that repeated sudden sharp changes due to turbulence or wind may not be accurately captured over time due to delays in the processing loop and missed minute changes may sum over time. For example I imagine that if the frame is forced by outside source at any fixed angle for some time then the outputs from the gyro will approach zero and the PID controllers errors will tend toward zero over time and no longer try to correct the angle error. I was trying to see from the flight footage if this the case but it seemed to be able to return to perfectly level. If the behaviour I describe is real then I suspect that it is almost negligible and not worth any concern. I am just curious if my theory holds any weight. Thanks for some very informative, detailed, well produced videos. Cheers
Thanks a lot I have made this and perfectly flying, but I have plan to build a 250mm drone, whether this code fit for 250mm or else we change any PID VALUES????!!!!
I'm a 16 year old who spent the last few months hitting my head against a wall. I've also been trying to make a flight controller using an Arduino by implementing some of your code, but my quadcopter seems to simply fall out of the sky when I'm attempting aggressive maneuvers, any ideas why (if hovers and flies around just fine)? I'm using the mpu6050 as the IMU with the 5Khz Digital Low Pass Filter (the only one that the quad stays stable with). Ps. Could it be due to vibration? Should i get an anti vibration mount for the Arduino?
Gabriel, I cannot help you with this problem. There are so many things that can be wrong. From programming to hardware. You might try to get a L3G4200 or L3GD20H gyro and build the YMFC-3D. Just to get you started.
Thanks for your very good series. I watched all 6 videos . Could you please tell me what battery you suggest for this project. there are different types in the market and I don't know which one to choose in terms of voltage and amperage. Thanks in advance.
+Ehsan Keshtgar In this series I use a 11.1V (3S) / 3800mAh 20C Lipo. But a 2200mAh will also work fine. But don't use a 4S because it will screw up the voltage deviser ad the analog input.
I have done stick scaling and all the other stuff but when I run the final code as soon it is armed my motors start running at a high speed without any throttle. So please help me to control the speed of motors.
Hello Joop, First, thanks a lot for uploading these videos and sharing your excellent job. I have a question for you. When i start my quadcopter, the Rear Left motor doesn't start, i have to move the right stick from my RC for making it work. What could it be happening?
Joop Brokking Thanks a lot again! while(receiver_input_channel_3 < 990 || receiver_input_channel_3 > 1020 || receiver_input_channel_4 < 1400){ start ++; PORTD |= B11110000; delayMicroseconds(2000); // I just had to modify this, from 1000 to 2000. PORTD &= B00001111; delay(3); if(start == 125){ digitalWrite(12, !digitalRead(12)); start = 0; } } start = 0; Now at the beginning, my 4 motors start at the same time and velocity.
As a mechanical engineering undergrad, you are definitely one of the best instructors I've come across. Very simple and straightforward explanations that would have made my controls classes much easier to follow. I hope to code my own autonomous quad with referencing this as my foundation. Thanks for your hard work in these videos!
This was an awesome series, thanks so much for taking the time to make it! I was going to use an off the shelf type flight controller for my own tricopter project, but this series has single single-handedly given me the confidence to have a go at making my own :)
D.B. That's good to hear.
Thanks for the tutorial ... I built my quad as per the instructions given in this video and finally flew it. It was actually 3 years back when the series of videos had been posted online. Its really amazing. :D
Thanks for the video tutorial. Not only did you show me how to try building a quad-copter, you also showed me a lot about the Atmega328 chip and it's properties I never knew existed. The interrupts are one feature I didn't know about and will prove useful in other projects. Thank you so very much for sharing the videos because they taught me a lot. You are one smart and sharing guy! P.S. I love the donation part on your site. I always believed in paying it forward.
Thank you for your positive reaction. This keeps me motivated and enthusiastic about what I do.
A quick question I hope you can answer. I bought a GY-521 gyro that from my understanding is the same as a MPU-6050. But when I run the "Find Gyro" sketch, it can't find it. I also tried the gyro using the MultiWii code and the MultiWiiconf program and it seems to work.
Is there any way I can get this gyro to work in the code you've created. I'd rather not use the MutiWii if possible. Not that it isn't great code. I'd just rather try this using your code.
Thanks for any help you might be able to give me.
Dave
Yes, you could use the YMFC-3D version 2. It supports the MPU-6050. Click on question 1 on how to get started: www.brokking.net/ymfc-3d_v2_qanda.html
That worked great. Thank you for the info.
two years ago i dreamed to biuld a quad using arduino but i didnt know where to start but when i watched your vids two mothes ago i got motivated i kept watching your vids and started gathering parts and now i almost there to make it fly thank to god and you very much my dear and nice friend
you are the man , no kidding
Thanks :-)
This is the only video of its kind that I was able to find on the tube. Short, detailed, and no nonsense. This video will get popular in very short order. Thanks for posting the code as well. This is the best demonstration of code/hardware out there. I love it! Subbed, and thumbed!
this is the simplest but the best tutorial i've ever seen. i've been having problems with PID for stability and you gave me answers. YOU are the MAN! Thanks a lot!
Thanks for the compliments!
what a fantastic series, enjoyed every single minute of it. Thank you for spending the time to educate us! :-)
This has to be one of the finest if not the best video series on this subject. Everyone should watch and get the code. So say I.....
The content here is on par with any 3000 level engineering course I ever took. Thank you very much, glad to subscribe.
My Drone tutorial search stopped when i got ur video. U are God of drone for me 💐
Dude, awesome job, seriously. I've been looking for something like this for a while now. It's so exciting to finally get my controller working
Joop; You rock... I have never had this explained so clearly and concisely as you have done here..It's great to know how it works, but WHY it works is what you went into in depth and is what gives so much value to what you have done. Thank you so much!!
+John Wilkins Thank you for your message positive message!
Men like you make dreams come true for all of us ,,mortals'' that can't program :)
Extraordinary work and my compliments.
I've decided to start my own build after your sketches.
Thank you very very much!
djquaky Thanks for the compliments!
Awesome, certainly I will build one for me.
A great series, short videos but with a clear explanation regarding the matter.
Thank you very much for sharing your knowledge with all of us.
I made it and it works really well . I have a question 🙋 what happens if the receiver disconnect from transmitter . Will it land safely
I am building an RC version of Opener’s Black Fly VTOL aircraft. Do suppose this code could be modified to achieve the flight characteristics of that aircraft? I would image it’s just a matter of adjusting the desired pitch attitude of the PID from 0 to 90 degrees and back again as the aircraft transitions from vertical to horizontal flight. Guessing also I’d need to blend the roll and yaw commands as the motors tilt back and forth. What do you think?
This serie was extremely helpful!! If you ever come to NY, lets go for a beer lol
+Julian Tejera-Sosa I'll keep that in mind ;-)
Absolutely beautiful. Loved the ending flight
Thank you again for a fantastic series... I have watched them all, and I know I will study them many more times.
John Colvin Thanks!
Joop, you are the best ! Thank you for helping us with your high-quality educational tutorials.
Impressive series of building and performance of quad!!! It's inspiring!!! Thank You J.B.
Is it possible to reconstruct this project without any Tx/Rx components. Communicate with the microcontroller using wifi for a starting point and getting it to only hover at proximity in a controlled space, sending pulse width commands directly from the development platform onto the MCU, via a while loop waiting for user input for a pulse width? Purely for testing reasons?
hello, i have made the arduino based drone, but now i am using bmp180 altitude sensor in it. the problem is that it takes very long to read the data, and the loop is 2000us. please share the method you have for altitude sensor
Hi, cool video, I am building a quadcopter with arduino too but I have a problem. when I connect the battery, the engine and the receiver to the ESC nothing happends and the voltage go down to zero, do you think is a problem of the battery or of the receiver?
how can I contact you?
hey joop i like your tut very much and i m planning to build my own but i wanna ask which motor have you used ?of how many kv?
I calibrated ESC, checked gyro and receiver data. All Good. Setup run. All Good. I did reduced a bit of vibrations and checked for EMF data, made an EXCEL chart. It looks quite alright. But still, when I try to fly drone, its violent and rolls over instantly. I tried changing PID settings with no real change. I give up after two months of building this project..
Great series, Joop! The code is very understandable due to the videos and comments in the sketch. I may modify it for my tricopter.
Thanks and keep up the good work.
Thank you so much! These guides has helped me a lot for my upcoming project!
Enjoyed the tutorials a lot! Used a lot of it as inspiration for building my own setup.
I have a problem though, one of my motors spin slower than the others. I did the calibration of all the ESC's and the motors start at the same time.. just not at the same speed.
Any suggestions? (clearly might just be a faulty motor)
Im just thinking of implementing som sort of trim, since one cannot be sure that all motors act the same.
If you use the YMFC-3D version 2 all the motors should start at the same speed after calibration. If not you might have a faulty ESC or motor.
I have finished my Quad according to your describtion. If works perfectly :) ....... Thankyou man, great Job and very good explained. All the Best :)
+Orion Sirous Thanks for the compliments and happy flying!
hi Joop i have one problem can solve my problem. My gyro sensor is not working properly when i see in monitor angel change automatically plz tell me how to solve
hi, I am working on a Quadcopter safety feature for my college project, I need to power four motors for propellers + an extra motor for the safety system. Can I do that using Arduino Uno? please help
Hello , Your videos are amazing and they helped me build my own quad copter as well as understanding the code aspect of them. However I still have a problem with the MPU-6050 noise levels , ive shortened the wires as much as possible and pushed the ESC's as far as possible yet my readings are still bad compared to the ones on your Q and A on your site. Would using another gyro give better results?
Make sure that the props and motors are balanced. This can also be a source of noise on the gyro data. If the noise persist you could try another gyro.
Is it necessary to solder the jumper cables from the receiver to the Arduino ports ... would it be okay to use the jumper cables that have male to female connections ?
Hi Joop,
Is it possible to implement altitude hold by reading gyro and accelerometer only ?
I've seen people usually using baro and gps for this. Does your quad have alt hold on this video ? I assume its very hard to fly without this feature, is it not ? Does every pitch and rolling will change climbing/dropping rate?
tasiotas In this video I have no altitude hold. It's not very hard to fly it like this. It just takes some practice.
The gyro can't be used for altitude hold. A combination of baro, gps and accelerometer will give the best result.
thanks, one more question.
When you hold roll throttle at maximum(right stick push right), quadcopter will start rolling until it reaches max defined roll angle, or it will continue to increase roll until it will flip upside down ?
Im trying to imagine how quad will behave with your code. I have very simple quad(Syma x5c-1) and Im not sure if radio inputs are the same as yours. When I push roll stick to maximum value, quad is just continuously drifting sideways and gaining speed.
Wondeful work Joop. I have built the quadcopter using the parts listed in your webside. I have passed the setup procedure, calibrated the esc's and uploading the final flight controller program to the quadcopter. Then, I am finally making some tests keeping the quadcopter in my hand to see how it is reacting. And the issue is that when I am giving a a roll or pitch command from the FS6 transmitter, the quadcopter is reacting but is not coming back to initial state when I am coming back to the initial position with the transmitter command. Any idea ? Thanks. Fabrice
If you use the YMFC-3D software the quadcopter will stay in it's current position. If you use the YMFC-AL (auto-level) the quadcopter will automatically level itself.
www.brokking.net/ymfc-al_main.html
Thanks for clarification. I am using the YMFC 3D V2 software... I may use the serial connection to print the esc1 2 3 and 4 to see how they react.
Joop, was wondering whether I shall declare the variable int receiver_input_channel_1 in the Flight Controller program ...... as volatile int receiver_input_channel_1...... as I am using IDE Arduino 1.8.0 and in reference to the modification I made in the Setup program which was working. Thanks. Fabrice
Sir, Our motors are of 2200 kv and our battery is 2200 mah.....will it work on 2200mah battery....what should we do...either increase the battery V or decrease the motor rating ?
Hello Joop, I have fabricated a quad and used your code and schematic with arduino UNO, but I have a problem when I move the stick to the roll or pitch and then I leave free the stick and this returned to center position ,the quad do not stop and follows the moving in the initial direction of the stick,
the pid_output_pitch, pid_output_roll still high after I returned the stick to the center position and the quad follows the moving.
I used your PID cosntant:
p_gain: 1.3
i_gain: 0.05
d_gain: 15
I think to change d_gain to 0
What can I do?
Thanks
I tried in the past to build the quad with no success.I can't really understand the PID part on the code and in general. Do you know any websites or PDFs that i could read and learn the PID algorithm and then implement it in my own projects? Just to copy your code, use it and not understand how it works, isn't practical because i can't use it or adapt it in other projects.
Awesome. Hei, its possible to add an GPS in this project. Arduino uno work fine, or is not indicated?
Douglas Melchiors A GPS is not possible because you need a auto level function first. And the Arduino Uno is not powerful enough to do all this.
hi sir joop. i am also making a quadcopter but i dont have a stick reciever. i just want to test the stability of my quadcopter.. its okay if i will just try to hang my quadcopter and try to move in diffferent direction to test its stability? its okay if i will not include the code of the receiver? tnx
there are 2 type of flysky like that, the first one left analog stay in the middle and the second one stay in the bottom. which one should i use Mr?
Use the one where the left stick stays in it's position (so not self centering).
are you using a electronic speed controller and do you need it on every drone
Hey Joop thanks for sharing your learning!. I have a question.Is it required to calibrate the esc after uploading the code? cuz i have already calibrated them individually and on uploading the code the motors just keep beeping and dont move at all. Is this happening because i haven't calibrated them properly or something else? Help me out here!
+DoGstrer quantum You need to calibrate the esc's with a 1000-2000us pulse to get them to work correctly. Use the Arduino sketch of part 2 to setup your transmitter. After that calibrate the esc's with the throttle output of your receiver.
Hi sir i ask u why multiple (angle_pitch Or angle_roll) by 15 to find level_adjust. why this number (15)?
please help
Dear sir;
I have questions about flight controller code. My english is not well. But I watched your all videos a lot of times. First question;
in which line we have identified the signals from the given signal. What is counter_channel_1(2-3-4)? I wonder this in which line receiver_channel_1 = receiver_input[1] ? For example if(receiver_input_channel_3 > 1050)
how do it know receiver_input_channel_3=receiver_input[3]?
I hope you will see my message.
Thank you for everythings.
sir i am also making a quadcoptor project ,but based on serial communication , i am stuck in a part where the analog joystick values (0,1024) ,is converted to angular velocity,in your part 5 tutorial you did something like , setpoint=(value -1)/3,my question is ,how the setpoint is converted from analog to angular velocity ,because when i print those values it just shows analog value range from -350,to +350, and thnks for those tutorial it really helped me understand the basics
The setpoint tells the PID controller how fast the angular motion of the quadcopter should be.
With a normal receiver the setpoint is +/- 500 / 3 = +/- 166 degrees per second. This is because the gyro feedback is also in degrees per second.
So for example: if the roll stick is max to the left the roll setpoint is -500 / 3 = -166 degrees per second. The PID controller will control the motors in such way until the gyro's output matches the -166 degrees per second.
Can i ask you one question? If the answer is YES. My question is " why did you choose 4 pins ( 4.5.6.7) for PWM purpose? As you know, arduino uno doesn't distribute PWM on every single pin. I mean there are 6 pins PWM (3 9 10 11 have the hertz and 5 6 have the same one). Can you explain for me. Thank you very much. And i am still looking forward to seeing your Answer. Once again. Thanks
The answer to your question can be found in this video: th-cam.com/video/fqEkVcqxtU8/w-d-xo.html
Joop - is there any possibility of you doing a video with a stabilize PID loop (using roll, pitch, and yaw) feeding into the rate loop?
+Joe Prince Maybe in the future. But not now. I'm currently working on my own flight controller and I don't have the time to do another video session like this.
+Joop Brokking I completely understand - best of luck with your flight controller!
Really it is worth watching. As you said it is very helpful for starting up with Quadcopter.
hi
again one more thing to ask. i have seen all ur videos. i want to ask that in ur project u only used gyro n not any other sensor..... Why so??
i also saw various videos n they all have used gyro n accelerometer in compact.
so there is any diff in that. please clarify my doubt. i am a newbie to this.
Please help me out...
Thnks in advance..
because gyro is used to make it balance . but if you want to make it auto level then an accelerometer is needed.
Hi Mr. Brokking, I have some issues with the code. For the YMFC-3D V2, I have successfully went through all of the setup procedures and calibrated the ESC's. I can also upload the flight controller code also. When I pitch forward, the quadcopter's nose pitches forward as I wanted to. When I bring the pitch throttle back to center position, the quadcopter does not become horizontal again, it remains the same pitch angle as it was before. It will remain the same angle until I change it again with the transmitter, which really stresses me out. Gyro seems to work, but will not return to its horizontal level again once i release the sticks. Do you know what the problem is? Also i tried your YMFC-AL code also, but for that code, the LED remains on. Thanks in advance for your help.
The YMFC-3D is a 3D flight controller. That means that you have to manually level the quadcopter as you described. The YMFC-AL has an auto level feature that levels the quadcopter when you release the sticks. Please check the Q&A page to see why the LED stays on (question 9):
www.brokking.net/ymfc-al_qanda.html
Thanks for the for the tutorial ...grate ...i have MADE a quad copter CONTROLLER with AURDINO due , now it is in the PID tuning phase ....i had used the standard libraries for sensor s like mpu6050 dmp , ms5611 , PID etc ...even in the hardware i had used level shifters ( mosfet based ..for me txb108 was not worked well ) even i can see that with some print functions i am able to run my loop running less than a micro ... my tuning setup is quad copter is tied with rope in an welded iron stand .. while tuning in level position there is small wobbling..can u plz guide me here to correct it .
Hi joop,i want to ask you two questions
1)I'm using spi protocol for 9dof(3axis gyro-accelerometer-magnetometer) sensor lsm9ds1,could it cause any problem?I'm asking because you are using i2c protocol.
2)In my code the refresh rate is 350 Hz,do you think it's the right thing to do?
Isn't ther system more stabilized with the frequency?
Thanks.
1) It can work but you have to modify the code yourself.
2) A higher refresh rate means more corrections per second. So you should be fine.
wow dude, this is soooooo cool. i picked up a da vinci jr last week and got some arduino boards coming soon. this look so cool.
Hello.
I Have made a camera Gimbal for my Quadcopter with some servo motors.
and i need some help on how to connect to the receiver, so i could control it with my transmitter.
So can you help me????
Truly an amazing lesson. Thank you for sharing you knowledge with us.
HI! I just want to ask if ever that I want to add an anti-collision feature to this drone. What advice can you give me or what should I do? thank you sir
Hi Joop. I am building an autonomous quadcopter that uses the arduino, mpu6050 and turnigy ESCs. the main idea at the moment is to basically make it hover. How can I modify the code u included to fit an arduino quadcopter without the use of a radio transmitter?
+Tahmed Adnan Sorry but I can't help you with that. It's involved and can't be explained in a few lines.
Fantastic job! I will try build it. Thanks for showing us your jobs. I show them to my students
Kei gaaf man! Heb het al 3 keer gezien!
Bedankt voor de zeer goeie informatie. Ik heb her zeer veel van geleerd!!
The Receiver_Input_channel_1 is not defined as output or in put ....and so on with other receivers ...but u are still receiving the values in ur setup program how is this possible...???.
Plis help me...sir actuallt i want to understand each line of your code and write my own....
M facing these problems...its been three days i m researching on it....help me sir...😭
greetings, as a university project me and my friends want to build a self leveling quadcopter, but we want to give our inputs without an rf controller, someway within the computer connected. Do you have any possible/optimal ideas for this method, and a source code more suitable for this method? (without rf controller) Thanks in advance :)
Hi.I would like to thank you for these wonderful videos especially fir your way of explainings.These videos are very educative.
Am trying to implement it with arduino mega 2560 but am not getting it to work since Interrupts and external interrupts differ from arduino uno. Am having trouble with editing your Code to just let it work with mega 2560. If you please just give me an advice or hint so i can work with. And Your work is Amazing thanks for sharing it.
when my stick is down the throtle indicate 1012 the yaw vary between 1496 1492 and 1500 when the stick is in the middle position on the monitor how can i correcte it ?
I really liked this project so i did it for a project and when I tried to fly it 2 of the motors seemed to have more power than the other 2 and I don't know why
Dear Joop, why here you divided by 3500?
esc_1 += esc_1 * ((1240 - battery_voltage)/(float)3500);
Hey. I just completed this, but my Quad is tilting in one direction. I made sure to follow the directions exactly. I checked the directions of all 4 motors (2 ope ones moving cow and the other 2 cw). everything from part 1-5 seems to work perfectly. Im too afraid to try it....
you can try it .
because it also happened to me. then i fixed my battery in middle . and properly set the frame(nuts). and all done. the i gave throttle about 1600 and it gone .
hi i am facing problem in my project. can you please provide me email so i can contact you.
my email: harshit996@gmail.com
How about adding ultrasonic sensors for obstacle avoidance& indoor flight?!
Absolutely the best!! I am so amazed at your knowledge. You have a very good approach for delivering this content. Your site is very well organized and documented. I did find some link errors but not a big deal because I found what needed on the site Downloads. I have learned so much from this series. I went as far as transcribing your voice track to the the steps with screenshots. I am in the process of gather all parts then plan to first tackle the YMF-AL project. I am a bit concerned that it appears you are not really responding to us so wondering what I will do when I have show stop problems.
Great job!!thanks for making those awesome tutorials and explaining everything clearly. I'm into building a tricopter and tried to modify the code accordingly but I'm not getting the movements correct ; especially the yaw movement as it is controlled by servo. Can you explain the changes I need to make in code for the same or upload a short tutorial for the same?
I cannot help you with that because I never tried it before.
Hey there. I've built my own quadcopter and controller by a wifi board that connects to another Arduino. I'm noticing that testing the motors via the wifi, they have sudden increases in speed. However, when directly initializing the motor through the Arduino mounted on the quadcopter, this doesnt happen. Would this be due to fluctuations in the wifi signal?
Check the data that is received by the Arduino and check if the wifi signals are changing.
I was reading the gyroscope datasheet again and i noticed something made me thinking ... In the source code you set the Control register 1 (20h) to b00001111 or x0F. With the first four bits to zero according to datasheet's table 21 the gyro output data rate (ODR) is set to 100 Hz with 12.5Hz cut-off low pass filtering. The flight controller's loop is running at 250 Hz. If we divide those numbers, the gyro data is updated once for every 20 cycles of the main loop ? or maybe i've lost it ? Could we increase the update rate of the gyro for better stability ? Did you do it for a purpose ? Maybe to easily match the output update rate with an accelerometer in the main 250hz loop? Do an accelerometer need to have the same or higher output data rate with a gyro to work properly for pid control in the main 250hz loop?
theodor drymonis Hi, despite the 100Hz ODR the angular rates are updated constantly after each read. So when you log the data you will see different values with every loop. The main advantage with the 100Hz ODR is the filter setting of LPF1 (low pass filter 1). This is set to 32Hz with an ODR of 100Hz.
Setting the ODR to 200Hz or higher causes a higher setting of the LPF1 filter. 54Hz, 78Hz, 93Hz for respectively 200, 400 and 800Hz. This will cause more noise on the data output that you have to filter manually.
The 12.5Hz cut-off refers to the setting of Low pass filter 2. This filter is bypassed by default. Therefore the 12.5Hz is meaningless.
I tested most of the ODR settings (with and without LPF2) and found that the 100Hz setting gave the best results. There is more information in the 'L3G4200 AN4504 application note'.
Joop Brokking Thanks again for your help ... Your datasheet show this clearly! I don't know if i missed it in my L3GD20H datasheet but i couldn't find this information about the Low Pass Filter 1 cutoff frequencies . I could only see the presence of LPF1 in the block diagram.
On you video programming the ESCs you have the motors wobble, mention to reduce the number to.. My audio was distorted, I tried several times, but it sounds like either 50% or 15% Thanks for the reply
Could you give me the video name / part and the time so I can check what I meant?
YMFC-3D part 5 around time 14:10 "adjusting PID
It's 50%.
Sir do we have to only upload the code in this video or we have to upload all codes which u showed in ur earlier videos?
Please use the YMFC-AL code and the setup procedure on this page: www.brokking.net/ymfc-al_main.html
Hey i followed the whole process and uploaded all the codes correctly but when i go to fly the drone is not arming and the first two motors just keeping beeping please help
HI ........ I have a question for my quadcopter .... how do i have the fastest PID parameter for my quadcopter .. i have reference from start to end video ... Now that I'm having trouble with PID parameters, give me a way to refer to your PID method ... I hope to be able to use your code: P
This was so awesome not only did this series help me begin to develop my own flight controller but it taught so much more about arduino uno and programming in general. Than you for all your time and efforts. I have been looking at using an mpu 6050 to build a dual PID taking in the orientation angle not just the angular rate. Have you worked with this sensor at all?
hey im planning using esp8266 and mpu 6050 to send the gyro data to my pc and show it on VB,, is it possible ?
Hi Joop , thank for your tutorial, I have working muy quadcopter now, your vídeos help me a lot. just I have a question...... I'm having problem the drone is dropping during flight, I use your code to fix this (esc*(1240-battert_volt)/flota(3800)); just that I set 2200 unless 3800 and iy works for a while..m like a 5 or 10 minutes and after that the drone start to dropping a lot, I have a 5000mah 11.1 volts. can you explain me why this happen or give me a solution to this?
+leon felipe cordero palacios
(esc*(1240-battert_volt)/flota(3800)); is causing an overflow problem that causes you quad to drop quickly. Integers are -32,768 to 32,767.
Example: A esc puls of 1500 and a voltage drop of 22 results in 33000 (overflow).
Use it as (watch the difference in parentheses):
esc_1 += esc_1 * ((1240 - battery_voltage)/(float)3500);
Hi Please help me. after i completed all setup. one motor is spinning faster than 3 motors. how can i fix?
Is there a reason why you did not use servo library inside your code to control motors?
because if you use command writeMicroseconds then there will be jitter and frequency problem and it will not be perfect .
Would you like to make a series for developing a micro quadcopter with NRF24L01+ ??
I think it will help us...
Finally i flew my quadcopter bases on YMFC-3D .
$pecial thanx to you sir joop
but can you please tell me that if you plug your battery when the quad is already in 45 degree angle from the surface.(calibration also done when it was at 45 degree)
then if you leave it to fly will it be fly simply at 0 degree(simple quad) ?
That is good news! If you start the quadcopter at a 45 degree angle it will start and stay in that angle until you steer it level. It's a 3D quadcopter and does not auto level.
The YMFC-AL that I'm currently working on will auto level because it uses the accelerometer to know what is down. With only a gyro the quadcopter does not know what is down. It only knows when it is rotating.
+Joop Brokking thank you so much sir.
+Joop Brokking
sir actually when i give it throttle about 1500 at which it takes off to the ground and when all other(roll pitch yaw sticks are in middle means at 1500 +/- 4 ) then it goes a little to right and doesn't stop just slowly slowly go to right.
what is the problem ?
It could be a vibration problem or the quad moved a little during the calibration. If it moves slowly it means that the PID controller get a non-zero setpoint or gyro feedback.
Hi the project is awesome !! I Followed all your video and worked well with my setup. I have an issue to start the motors in the last code .. (Part 6) .. when I plug the battery the esc sounds , gyro calibration starts, then I put the throttle down and the LED turns off . but when I make the sticks movements to start the motors , nothing happen.
+Dakr drone Did you calibrate your transmitter with the program I wrote for part 2 (receiver). All channels work in the right direction and the travel is 1000-2000us with 1500 as center position.
Next you need to calibrate the esc's with the 1000-2000us pulse. You can use the throttle output of your receiver for this.
Otherwise the quadcopter will not start.
+Joop Brokking I found what was the problem .. my transmitter limits are diferent to the program, now its working. Thanks awesome job!!!!
+Joop Brokking First of all, let me start by complementing you on this great video series. The step by step build is really helpful for people wanting to build their first quadcopter like myself.
I have just finished my build and i am now calibrating the pid settings to get the quad perfectly stable. When it lifts off the gyro seems to be working well, i can feel it correcting when i move the quadcopter. But i have noticed something: when i use any of the channels (lets say pitch) i can put the stick forward (to 2000) and the quadcopter pitches forward. But when i put the stick back in the middle position (1500) , the quad stays in a pitched position , it does not return to a horizontal position. In order to do that i have to pitch back manually to get it somewhat level. Is this supposed to fly this way? i would imagine that the quad always returns to a center position when the sticks are in the middle at 1500. I have followed all your steps and the reciever seems to be set up correctly moving between 1000 to 2000 with 1500 as the middle.
parts list :
A2212 1000kv engines
hobbysky 30a esc's
gy-50 l3g4200d gyro
Flysky fs-t6b transmitter
multistar 3s 11.1v 4000mah
if you could clarify this for me and the way you are supposed to control the quadcopter i would greatly appriciate it.
thanks in advance and again, great series !
+Tom T Yes, the quad is supposed to fly this way. Auto level is only possible with an accelerometer.
So you need to learn to fly it as it is. It's difficult but not impossible.
+Joop Brokking Any advice on how to proceed with auto leveling using an accelerometer for this same setup?
Karnik Ram
This site helped me a lot when I started with auto leveling.
www.starlino.com/imu_guide.html
Thank you!
But is there any specific reason why you prefer calculating angles from a gyro and accelero over using an IMU like the MPU-6050 which can give you angle data directly?
Karnik Ram
I like to use my own algorithms.
Hey guys i am currently trying to build my drone with arduino uno. I am trying to make the drone without using a radio controller, just by sending pulses to the arduino from my computer. Does this work the same way when trying to connect to the gyro and make the connections?
Thanks
great job, thank you very much I just have a question, why does the RC sends 1000 and 2000 to the ESC´s?. Thank you for uploading all this info
jackg8a That is the way to get the esc's to work.
ok i´ll try it thank you very much for all this videos
if I constrain the ESC´s from 0 to 255 will it work the same way? or why does it need to be 1000 to 3500?
hai, im done with hardware and dumped code in to it,but when i connect battery n receiver there is no action.is there any method to start?
Awesome videos, I enjoyed every one.
Edit: I see you have provided two videos that clearly explain the answer to my question. Thanks.
I have one query regarding the gyros. It may have been explained and may have I missed it so apologies if that is the case.
Considering the output from the gyro is in degrees/per second and there is no absolute values available for Yaw, Roll and Pitch is it possible that an amount of drift (relative to the initial start position) can creep in overtime.
My thinking is that repeated sudden sharp changes due to turbulence or wind may not be accurately captured over time due to delays in the processing loop and missed minute changes may sum over time.
For example I imagine that if the frame is forced by outside source at any fixed angle for some time then the outputs from the gyro will approach zero and the PID controllers errors will tend toward zero over time and no longer try to correct the angle error.
I was trying to see from the flight footage if this the case but it seemed to be able to return to perfectly level.
If the behaviour I describe is real then I suspect that it is almost negligible and not worth any concern.
I am just curious if my theory holds any weight.
Thanks for some very informative, detailed, well produced videos.
Cheers
Thanks a lot I have made this and perfectly flying, but I have plan to build a 250mm drone, whether this code fit for 250mm or else we change any PID VALUES????!!!!
You probably need to change the PID setting. What values you need to use? I have no idea because I never build an 250 quad.
@@Joop_Brokking tnq
I'm a 16 year old who spent the last few months hitting my head against a wall. I've also been trying to make a flight controller using an Arduino by implementing some of your code, but my quadcopter seems to simply fall out of the sky when I'm attempting aggressive maneuvers, any ideas why (if hovers and flies around just fine)? I'm using the mpu6050 as the IMU with the 5Khz Digital Low Pass Filter (the only one that the quad stays stable with).
Ps. Could it be due to vibration? Should i get an anti vibration mount for the Arduino?
+Gabriel Fernandes Im also using 2 different motors/esc
could it also be my power supply? im using the esc 5v output to power the ardui o
Gabriel, I cannot help you with this problem. There are so many things that can be wrong. From programming to hardware.
You might try to get a L3G4200 or L3GD20H gyro and build the YMFC-3D. Just to get you started.
Any recommendations on adding a GPS unit and Autopilot to this?
Thanks for your very good series. I watched all 6 videos . Could you please tell me what battery you suggest for this project. there are different types in the market and I don't know which one to choose in terms of voltage and amperage. Thanks in advance.
+Ehsan Keshtgar In this series I use a 11.1V (3S) / 3800mAh 20C Lipo. But a 2200mAh will also work fine. But don't use a 4S because it will screw up the voltage deviser ad the analog input.
I have done stick scaling and all the other stuff but when I run the final code as soon it is armed my motors start running at a high speed without any throttle. So please help me to control the speed of motors.
+simraan shaikh The motors start spinning @ 1200us pulse. Lower the 1200 to 1100 in line 206 till 209 in the main program.
Hello Joop,
First, thanks a lot for uploading these videos and sharing your excellent job.
I have a question for you.
When i start my quadcopter, the Rear Left motor doesn't start, i have to move the right stick from my RC for making it work.
What could it be happening?
Pedro Daniel Have you calibrated the esc's with the program that I wrote for part 4?
Joop Brokking Thanks a lot again!
while(receiver_input_channel_3 < 990 || receiver_input_channel_3 > 1020 || receiver_input_channel_4 < 1400){
start ++;
PORTD |= B11110000;
delayMicroseconds(2000); // I just had to modify this, from 1000 to 2000.
PORTD &= B00001111;
delay(3);
if(start == 125){
digitalWrite(12, !digitalRead(12));
start = 0;
}
}
start = 0;
Now at the beginning, my 4 motors start at the same time and velocity.
Pedro Daniel That's good to hear. So two seconds is to long for the esc to initialize. Good job!
Joop Brokking You were right, two seconds was too long for the esc. I changed it for 1090 and works great. Thanks!!!