Arduino Uno Board Multirotor Flight Controller 19 May 2015
Code from Joop Brokking, from his youtube video series.
Project YFMC = your own multirotor flight controller.
Easy use of an Arduino Uno.
I am building this project currently, because besides the simplicity in design, the kindness and hard work from Joop, I can now train myself to fly a quad copter.
I have build close to 9x quad copters already. All of them did not last long due to chrashes or to upgrade the technology . My existing quadcopter is complete with all bells and whistels and I enjoy the copter regarding missionplanner and its capabilities, but still I cant fly very well and is really still learning to fly.
This easy quadcopter build, will enable me to see the project as a trainer. If I chrash, so be it, repair and fly again. Cheap, easy and a good opportunity.
Outstanding work from Joop the author and developer:
1. The code is like pure clean and neat and compiles perfect.
2. PID is explained and practically easy instructions to setup your own quad copter PID settings.
3. Awesome videos and neat instructions. Excellent coaching from Joop.
Attached is a photo gallery with descriptions as I go along.
I really build, or is building this quadcopter from second hand parts. Cost wise a bonus. The frame is from a previous project. I replaced some motor mounts and feet.
Motors 800KV with replaced bearings.
Four in one ESC from a previous attempt.
Buzzer for low battery audible indication on Pin 3 and onboard Uno led for visual indication regarding and during arming of motors.
I am waiting the delivery of the needed gyro board as suggsted by Joop in his video series.
Also waiting for a receiver. Four channel should be fine.
25 May 2015
The gyro breakout board arrived today.
I mounted the gyro, with dot facing left rear motor, to the underside of the UNO board level
I also mounted the buzzer for low battery voltage indication.
I changed some of the code(very little of course!) to accommodate the buzzer on pin 3 and pin 2 for ground, just for the sake of neat wiring and practicallity towards the UNO board.
01 June 2015
Got the receiver from Hobbyking that matches my old Turnigy radio.
Mounted the receiver adjacent to the gyro underneath the second level.
Connected the receiver to 5v and gnd. Uploaded Joops receiver sketch and all seems fine according to his video.
I will however do the subtrims of my radio to get exact results of 1500. Mine is currently 1497.
At this stage I have tested the receiver and the gyro with the given sketches.
Tomorrow I will calibrate the 4 in 1 ESC.
18 June 2015
Done, and got the quad copter motors running, but I need to replace them al four.
12 August 2015
Got the new motors.
Mounted and ready.
I will start with the PID settings shortly, all according to videos.
14 August 2015
And then, another lesson learned! My seconhand parts became my expensive part of it all!
I could not get to the PID setings. I was so exited to give it a go, but then my copter flipped or let me rather say, I know it was going to flip over, because I wanted to start with the PID settings and hold on to the copter exactly like Joops videos and immediately noticed the LF motor/prop pushing way more thrust than RR.
Then the game started, you know that thing of nearly sold your soul to satan? Very, very close! I tried to get into the PID settings to see if the PID settings influenced the bad behaviour of this copter. Up and down left and reight with PID and nothing positive.
Then we started to google. Also I remembered from previous builts similar situation and yes it was motor wires connected incorrectly, but not this time!
I googled some time, left the copter overnight, sleep over it again etc.
It was not incorrect motor wires. Checked that 100 times so to speak.
It was not props fitted/mounted incorrectly. Checked that into infinity!
It was not PID. Tried that, been there, got the T-shirt.
Again, I uploaded the sub arduino codes from Joops videos and confirmed everything is working perfectly (receiver, gyro etc) except this copter keeps on flipping diagonal LF towards RR.
Then I decided to change the brand new motors fitted , I changed RR to LF and the error stayed. If I say error, I mean the LF motor/prop thrust more than RR which is staying on the ground and therefore resulting the copter to flip diagonally so to speak. So the error persisted the same. I also used a multimeter to measure the current on all three wires going towards the motor and all motors, except for the RR side, displayed plus minus 300mA on throttel, without props of course. The RR motor delivered doubled that current like in plus minus 600mA. That was making me think. Knowing now, it is not my brand new motors. What a relieve.
Then I decided to change the QBrain 4 in 1 secondhand ESC motor wires. RR towards LF and the error moved along with it!!
Ok, ESC is the culprit. This makes sence to me if I think back of my previous copter builds and suspecting the ESC, but no, I wanted to use it again! Bad, bad of me!
Out with the secondhand esc, in with a new ESC order.
17 August 2015
No! Not yet!
My oldest son , also involved in quadcopter builds suggested we re calibrate the Qbrain 4 in 1 again, so we did and that worked!
Now, I experience something else.
Witht the final code uploaded, I cant arm the copter, nor getting the led to go out. I noticed my radio values are not the same as those of Jopp's video samples. To get htem the same by using subtrims does work, but then on radio display the ratio's looks way out. I am then able to arm, disarm the quadcopter, but copter wont lift at all. The correct method should be to access the radios end points and set the values properly.
20 August 2015
Eben assisted me with end points on my turigy 9x radio. We firstly made sure we end up with values like on Joops example video refarding the receiver arduino code. We also activated a new profile on the radio just for this copter build.
Then, we still could not get the led to go out with throttle down and of course could still not arm the quad copter.
So we decided to tweak the values in the code. The lines involved were the setup part for led to go out and the other lines in the loop regarding start and stop of the motors. That worked fine. I can now arm and dis arm the quad copter with ease.
I then decided two try and fly the copter. Now two scenarios developed in my mind:
1. Either my PID settings are up to nuggets, meaning not good or
2. The copter is so sensitive because I can not really fly a copter very well and I really experience the sensitivity of this machine. It was still flipping over, touching sides and props to the ground on very close distance from the ground. So, may be if I can lift the quad copter higher and see how to control it from there.
Batteries are charging on the moment. I will give it another try this afternoon in a more open field.
it is flying....
Dont ask how, not yet please. I think the copter was more upside down than up time in the air. Also the wind was strong, being another excuse, but the fact is I cant fly the quadcopter properly.
But it is working!!!
22 August 2015
It is flying way better now and I also had good control over the quad copter, however I still experience a fast oscillation while quadcopter is in the air.
What I have done is to redo the PID settings, again exactly as Joops instructions and my results are way more better. I think looking at Joops copter PID settings, one tends to think your own copter settings should be close, but that is for sure not the truth. So, I was way more aggressive with the d gain initially and ended up with better results.
My problem is now that I did change all PID settings upwards and downwards to get rid of that fast overcompensation, but currently my results getting nowhere neither up or down on PID settings. So, I am slightly confused and dont really know which one is the culprit.
The copter controls very well! Yaw, pitch roll, throttle all of them. Just that fast oscillation.
My concern is also the I gain. I can basically leave the value at zero, with no impact on the behaviour of the copter and not taking away the oscillation either.
Most probably I will redo the whole lot from scratch again and try and make sure to distinguish better between overcompensation and smoothness of PID settings, meaning to make sure you feel when the copter is restless or not.
27 August 2015
Yeahhhhh... done! It is all working nicely and stable and fully controllable. Today I tried a third attempt to set the PID and got it going in in less than five minutes.
Video to follow soon.
For a beginning, very stable quad copter. Surely I can further make the copter more stable, but for now, I am happy with the results. Once again , for those who are reading here; I followed Joops videos step by step and code by code. I tweaked the code somewhat to accommodate my Turnigy radio receiver after we had to set the endpoints of the radio. Could not get the led to go off at some stages and could not arm and disarm due to endpoints and tweaked values in the sketch. Also, it is important to destinguish properly between restless and smooth while the quad copter is in your hand during the D gain settings. I ended up way to high with D gain.
Then, when you start with the P gain "3" like Joops advice and your copter flips over, just keep on adding the P slighly until the quad copter lifts off . Then I added the I gain and whala....it worked.
Will do fine tuning as we go along.
Arduino Uno Board Flight Motor Controller.
The Uno board fits nicely, with enough space on the second level platform.
I will mount the receiver and gyro under that same platform, so it wont be as easy visible and somewhat guarded during chrashes.
|Back||Back to top|