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
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!
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
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!!
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.
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!
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.
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.
Thank you very much for sharing your research and knowledge concerning the YMFC-V2. It works so good. Great built, even for a noob (no knowledge of electronics). The Arduino Uno R3 as a flight controller? Got a new hobby, thanks to your information, youtube step by step instructions and code. Waarschijnlijk had ik dit beter in het Nederlands kunnen zetten. :)
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
Joop, I noticed in the code you have nicely setup pin 12 and pin 13 both as OUTPUTS. I want to use the on board led of the UNO as the led indicator (while quad copter is on the ground is good enough visible indication) instead of pin 12. So I am contemplating to change the code accordingly all 12's to 13 in the code and then I am going to use a small buzzer on pin 12 for low battery indication, while copter is in flight or on the ground, which proofed to be useful on other flight controllers too (//Turn on the led if battery voltage is to low. if(battery_voltage < 1050 && battery_voltage > 600)digitalWrite(12, HIGH);) Easy enough I think, just wanted to confirm with you and the other subscribers that I am on the right track.
Freddie Snijman Freddie, your on the right track. Only the line that you mentioned needs to be 12. The rest is set to 13 for the led on the Arduino Uno.
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?
Thanks so much Mr. Joop Brokking. You make me understand how the codes of flight controller works. I imagine how we can make own flight controller that has Return to Home Mode like Dji Drone and ect.....🤔
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
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
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.
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 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?
Hello Mr. Brokking, Thank you very much for your knowledgeable videos. We have one question regarding the PID controller equations. gyro_roll_input = (gyro_roll_input * 0.7) + ((gyro_roll / 65.5) * 0.3); //Gyro pid input is deg/sec. gyro_pitch_input = (gyro_pitch_input * 0.7) + ((gyro_pitch / 65.5) * 0.3);//Gyro pid input is deg/sec. gyro_yaw_input = (gyro_yaw_input * 0.7) + ((gyro_yaw / 65.5) * 0.3); //Gyro pid input is deg/sec. why are the values of gyro_roll and gyro_pitch (in dps) being used in the equations instead of the calculated angle_roll and angle_pitch for PID control? Thanks in advance.
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 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?
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.
Hi, i am sagar .A newbie to multirotor. awesome videos.... very helpful to me. need a help regarding hardware.i want to know what are the specifications of the motor u have used and also about the esc. thnks in advance......
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 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 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.
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.
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 ?
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.
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????!!!!
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?
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
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
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
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
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.
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
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
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
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, 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?
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
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 ?
Best series ever for Arduino FC DIY project! I will also start making one. I plan to use 328p but the nano/mini version and mpu-6050 gyro. My ESCs does not have even simonk on them just standatd ones I think 250hz is too much and I have to go with 50hz refresh rate. What to change in the app?
If your esc's don't support 250Hz refresh rate the quadcopter won't fly stable. 50Hz is to slow and won't give you a good flying experience. Most esc's can be flashed with other software. Try this first.
Joop Brokking but I am using those standard ESCs with my other quadcopters having APM (arduino mega 2650) and cc3d FC. They both have option to set the communication rate between 50-490hz so it is an option and possible. Also my APM quadcopter flies stable with those ESC in both communication rate setting, but with higher than 50 somtimes when giving slow throttle randomly a motor cannot start rotating. Once it starts fine it flies well. So it is only problem in altitude/gps hold modes when I have no direct control on throttle and coper flips somtime instead of takeoff.
In the code (line 225 - 226): //The refresh rate is 250Hz. That means the esc's need there pulse every 4ms. while(micros() - loop_timer < 4000); //We wait until 4000us are passed. Change the 4000 to whatever you need. So for 50Hz it is 20000.
Joop Brokking thank you! I am far from needing this now, but collecting the info. It is very good how you explain both arduino and fc related things so even if I won't succeed I would learn a lot! Thanks!
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
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!
Thanks for the compliments!
My Drone tutorial search stopped when i got ur video. U are God of drone for me 💐
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.....
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.
what a fantastic series, enjoyed every single minute of it. Thank you for spending the time to educate us! :-)
The content here is on par with any 3000 level engineering course I ever took. Thank you very much, glad to subscribe.
you are the man , no kidding
Thanks :-)
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!
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.
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
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!
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.
Thank you so much! These guides has helped me a lot for my upcoming 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.
Impressive series of building and performance of quad!!! It's inspiring!!! Thank You J.B.
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
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!
Truly an amazing lesson. Thank you for sharing you knowledge with us.
Fantastic! Luckily I can get hold of the specified gyro locally , meaning a quick start on building my own flight controller. 😎
Really it is worth watching. As you said it is very helpful for starting up with Quadcopter.
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.
Fantastic job! I will try build it. Thanks for showing us your jobs. I show them to my students
Hi.I would like to thank you for these wonderful videos especially fir your way of explainings.These videos are very educative.
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.
Awesome series sir. Thank you so much for these videos. Really helped a lot.
I made it and it works really well . I have a question 🙋 what happens if the receiver disconnect from transmitter . Will it land safely
Bedankt voor de zeer goeie informatie. Ik heb her zeer veel van geleerd!!
Kei gaaf man! Heb het al 3 keer gezien!
Hi
Thanks for your hard work and resulting series. It's mine to do in the near future.
Best regards
Thank you very much for sharing your research and knowledge concerning the YMFC-V2. It works so good. Great built, even for a noob (no knowledge of electronics). The Arduino Uno R3 as a flight controller? Got a new hobby, thanks to your information, youtube step by step instructions and code. Waarschijnlijk had ik dit beter in het Nederlands kunnen zetten. :)
Thanks Rob :-)
Brilliantly made and well described. Thank you Joop :)
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
Joop, I noticed in the code you have nicely setup pin 12 and pin 13 both as OUTPUTS. I want to use the on board led of the UNO as the led indicator (while quad copter is on the ground is good enough visible indication) instead of pin 12. So I am contemplating to change the code accordingly all 12's to 13 in the code and then I am going to use a small buzzer on pin 12 for low battery indication, while copter is in flight or on the ground, which proofed to be useful on other flight controllers too (//Turn on the led if battery voltage is to low.
if(battery_voltage < 1050 && battery_voltage > 600)digitalWrite(12, HIGH);)
Easy enough I think, just wanted to confirm with you and the other subscribers that I am on the right track.
Freddie Snijman Freddie, your on the right track. Only the line that you mentioned needs to be 12. The rest is set to 13 for the led on the Arduino Uno.
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?
Thanks so much Mr. Joop Brokking. You make me understand how the codes of flight controller works. I imagine how we can make own flight controller that has Return to Home Mode like Dji Drone and ect.....🤔
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
Great video & thumbs up. Cheers from sunny Sint Maarten
absolutely amazing detail and technical data . Top work
Thanks!
Awesome..!!!! :) Thank you for this great video.
Seems its very stable.
thanks for sharing the code.
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
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.
if you are using gyro only, then it will drift, and the quadcopter will tilt with time.
That's why I made the YMFC-AutoLevel: www.brokking.net/ymfc-al_main.html
Joop Brokking ok. And how was the performance of only the gyro.
Would you like to make a series for developing a micro quadcopter with NRF24L01+ ??
I think it will help us...
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..
WOWWW!!! awesome job sir. thanks very much :D
Great series of videos! Thank you ;)
Thank You so much for doing this video :) Great Project.
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.
Thank you for this great video series!
can i use bt module for control it without radio controller??
Hi sir i ask u why multiple (angle_pitch Or angle_roll) by 15 to find level_adjust. why this number (15)?
please help
Hello Mr. Brokking,
Thank you very much for your knowledgeable videos. We have one question regarding the PID controller equations.
gyro_roll_input = (gyro_roll_input * 0.7) + ((gyro_roll / 65.5) * 0.3); //Gyro pid input is deg/sec.
gyro_pitch_input = (gyro_pitch_input * 0.7) + ((gyro_pitch / 65.5) * 0.3);//Gyro pid input is deg/sec.
gyro_yaw_input = (gyro_yaw_input * 0.7) + ((gyro_yaw / 65.5) * 0.3); //Gyro pid input is deg/sec.
why are the values of gyro_roll and gyro_pitch (in dps) being used in the equations instead of the calculated angle_roll and angle_pitch for PID control?
Thanks in advance.
I explained the workings of the auto level in this video: th-cam.com/video/DYpHB-LfloI/w-d-xo.html
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 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?
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?
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.
Hi,
i am sagar .A newbie to multirotor. awesome videos.... very helpful to me. need a help regarding hardware.i want to know what are the specifications of the motor u have used and also about the esc.
thnks in advance......
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?
Very well done, great project and video
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
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 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.
Thank you also for sharing the code with us.
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.
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 Please help me. after i completed all setup. one motor is spinning faster than 3 motors. how can i fix?
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.
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
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?
this guy is a legend! no kidding!!!
Thank you very much. This was very usefull and interesting...
I'm very Thanks u to light me up.
Now i made it, it's so amazing performance.
Thank u so much!
Your welcome!
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
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
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
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%.
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.
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
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
Can you do part 7 connecting ultrasonic range finders
Dear Joop, why here you divided by 3500?
esc_1 += esc_1 * ((1240 - battery_voltage)/(float)3500);
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
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.
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.
Hey sir...u have done very well so how can i get the software programme for my quadcopter???
How about adding ultrasonic sensors for obstacle avoidance& indoor flight?!
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?
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
Thanks for your video. It's amazing!
For you next project, can you share to us how to build the own RC transmitter with joystick module for arduino?
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 ?
U deserve more like. Thank you
se puede hacer un control-emisor y receptor con NRF24L01 y arduinos para poder sustituir en skyfly controller?
Best series ever for Arduino FC DIY project! I will also start making one.
I plan to use 328p but the nano/mini version and mpu-6050 gyro.
My ESCs does not have even simonk on them just standatd ones I think 250hz is too much and I have to go with 50hz refresh rate. What to change in the app?
If your esc's don't support 250Hz refresh rate the quadcopter won't fly stable. 50Hz is to slow and won't give you a good flying experience. Most esc's can be flashed with other software. Try this first.
Joop Brokking but I am using those standard ESCs with my other quadcopters having APM (arduino mega 2650) and cc3d FC. They both have option to set the communication rate between 50-490hz so it is an option and possible. Also my APM quadcopter flies stable with those ESC in both communication rate setting, but with higher than 50 somtimes when giving slow throttle randomly a motor cannot start rotating. Once it starts fine it flies well. So it is only problem in altitude/gps hold modes when I have no direct control on throttle and coper flips somtime instead of takeoff.
In the code (line 225 - 226):
//The refresh rate is 250Hz. That means the esc's need there pulse every 4ms.
while(micros() - loop_timer < 4000); //We wait until 4000us are passed.
Change the 4000 to whatever you need. So for 50Hz it is 20000.
Joop Brokking thank you! I am far from needing this now, but collecting the info. It is very good how you explain both arduino and fc related things so even if I won't succeed I would learn a lot! Thanks!