Page 1 of 1
PID tunning
Posted: Mon May 21, 2012 11:15 pm
by Jlperan
First of all, I must contratulate the team and coloaborators for the excellent piece of software Multiwii is. I'm trying with PID tunning but I can't make IT flyng. As soon as I give power to the throttle the quadcopter IT starts shaking.
You can see it in this video.
http://www.youtube.com/watch?v=vMif7Kcv5isI've read a lot and watched a lot of video but I can't get it stable. I've modified one and all parameters.
Could you please help?
Thanks.
Re: PID tunning
Posted: Tue May 22, 2012 9:23 am
by bill516
Go back to default sketch and load the variables for your machine, mag gyro acc sensors etc. Ensure CofG is in the middle of your copter, move battery to get it there.
Set motors running at approx 50% if you have props on be very careful, check GUI trace for an almost flat line from gyro and acc, if trace is dancing all over the place you have vibration and it needs to be sorted before proceeding.
In gyro only mode, that is all other sensors switched off, using the GUI and set the Tx trims to give approx equal values at 50% rpm for all motors, if with props on be very careful. Test fly use and Tx trim to get hands off hover. You should not need to touch Tx trim again unless you make changes to your copter.
Once you have it hovering in gyro mode then re-connect to GUI, enable acc and calibrate, any other sensors off at this time, use stick trim function to get motor rpms approx equal if props on be very careful. Test fly and use stick trim function to get stable hover. Once you have it trimmed do not calibrate acc again as you will loose the stick trim settings, if you do calibrate you will have to re-do the stick trim sequence. If you make a note of how many stick movements and direction it requires it should be a straight forward thing to re-do.
You should now have a stable machine that hovers in gyro and acc modes. Now you can set up any other sensors you have and see about setting the PIDs. there is a link to PID tunning and theory on the FAQ page use that as your guide to setting PID's, thats' what I'm doing.
Re: PID tunning
Posted: Tue May 22, 2012 11:23 pm
by Jlperan
Thanks you very much. I'll try as soon as my baby let me sleep m
Re: PID tunning
Posted: Wed May 23, 2012 8:21 am
by bill516
That will be next year then.
Re: PID tunning
Posted: Wed May 23, 2012 9:07 am
by Pyrofer
next year? You don't have children do you...
Try 2020.
Re: PID tunning
Posted: Wed May 23, 2012 12:44 pm
by bill516
I do have children, but the youngest had just turned 18, not that stops her going daaaaad.
Re: PID tunning
Posted: Wed May 23, 2012 1:54 pm
by Jlperan
I got enough time to build the quadcopter in spare time. I think in the weekend I'll wake up early and do the tests.
Re: PID tunning
Posted: Sat May 26, 2012 1:53 pm
by Jlperan
ok, I finally got some time for this.
I´ve re-ballanced the props again and isolated the motors with a soft piece of some kind of sponge or plastic protector. The vibrations dissapeared.
I moved the battery to assure the cofg is in the middle of the quadcopter.
I´ve started with the checking of the flat line in the gyro and acc but noticed that motors are crazy as I increase the throttle. Propellers are on but the quad barely moves.
Look at it on this video.
http://www.youtube.com/watch?v=Fi2L4ndFTEUI´ve been working with PID tunning so don´t put an eye on that, the effect is the same with other values.
You may see the motors going crazy as I increase the throttle. I don´t even get to half throttle but I think there´s something wrong. Look at the gyro and acc values, quite stable for me.
My configuration as follows:
- Arduino Mega R3
- 6dof Drotek IMU
- 4 SS Hobbyking´s ESC
- 4 10x6 props.
- 4 Hextronix DT750 motors
Thanks in advance.
Re: PID tunning
Posted: Sat May 26, 2012 3:20 pm
by bill516
Looking at your vid you have a cycle time of approx 3000 I'm sure you should be seeing a cycle time of 6000. Make sure you have the correct sensor selected in the sketch, and the correct speed. Dont know if your i2c errors are from a previous test but there should be none
I've gotta be honest here I dont have one of these boards so I cant be more specific of what could be the cause, as you say you seem to have vibration under control just the rpms are up and down, you did calibrate all the esc's didnt you, although I'm not sure thats the problem. Easiest way is one at a time to the Rx to set throttle min and max values in them. Usual way is power on Rx then throttle to max, power on Tx, wait for beeps (you need a motor connected to esc to hear beeps, no props) then move throttle to min and wait for beeps. Power off and thats esc calibrated.
I hope someone else will jump in here with a proper answer for you as I dont have one.
Re: PID tunning
Posted: Sat May 26, 2012 3:33 pm
by Jlperan
Speed:
#define I2C_SPEED 100000L //100kHz normal mode, this value must be used for a genuine WMP
//#define I2C_SPEED 400000L //400kHz fast mode, it works only with some WMP clones
Sensor:
//#define DROTEK_10DOF_MS // Drotek 10DOF with ITG3200, BMA180, HMC5883, MS5611, LLC
#define DROTEK_6DOFv2 // Drotek 6DOF v2
//#define DROTEK_6DOF_MPU // Drotek 6DOF with MPU6050
ESC are super simple so no calibration is possible. Look at the manual:
http://www.hobbyking.com/hobbyking/stor ... 2091X7.docAnd errors are from this test.
Re: PID tunning
Posted: Sat May 26, 2012 4:08 pm
by kos
bill516 wrote:Looking at your vid you have a cycle time of approx 3000 I'm sure you should be seeing a cycle time of 6000.
that is for wmp + nunchuk .. ~3000 is normal for itg32xx+bma180
you have some aggressive pid .. please divide your P value with 2 , and start again
Roll Pitch P -> 3
level P -> 7
Re: PID tunning
Posted: Sat May 26, 2012 4:30 pm
by Jlperan
you have some aggressive pid .. please divide your P value with 2 , and start again
Roll Pitch P -> 3
level P -> 7
Tried. Motors did the same with that values.

I even divided values until 0.4 and got the same results.
Re: PID tunning
Posted: Sun May 27, 2012 8:30 am
by Jlperan
I'm thinking. May it be caused by the low quality ESCs?
Re: PID tunning
Posted: Sun May 27, 2012 10:33 am
by bill516
You've got the i2c rate at 100 it should be 400 according to the specs. That might explain the i2c errors.
Re: PID tunning
Posted: Sun May 27, 2012 11:09 am
by Jlperan
Changed to 400. Still getting the i2c errors

Re: PID tunning
Posted: Sun May 27, 2012 4:43 pm
by bill516
Bum I was hoping that would be the problem, Did you reset the pids to the default values, it just sounds to me as though the gyro is trying to stabilise the motors but the settings are too high as Kos said. If you read about the pid tuning from the links given inn the FAQ tab it tells you to drop I and D to zero, I would do that then see what the rpms do in the GUI. Re-check the connections for the i2c lines make sure you havn't got a dry or loose joint. Does the model respond in the GUI when you tilt it
Re: PID tunning
Posted: Mon May 28, 2012 10:37 am
by Jlperan
Thank you. I'll try to change values to defaults and give it a try ASAP.
PD: GUI always got good values about sensors.
I've already tried to test it with ESCs disconnected and motor response was fine on the gui. I'm still thinking about the low quality of the ESCs. Could it cause the erratic motor behaviour?
Thanks!
Re: PID tunning
Posted: Mon May 28, 2012 3:41 pm
by bill516
Its as possibility if the refresh rate is the esc's is not quick enough for the mega then they might be missing a signal or two.
Re: PID tunning
Posted: Mon May 28, 2012 4:50 pm
by Jlperan
Acording to Multiwii faq:
Be sure your ESC can support PPM with 490Hz refresh rate
For the MultiWii we need a fast update rate & ESC’s which can handle that.
There are a number of standard ESCs than can handle update rates of about 490 Hz, namely Turnigy Plush, Mystery Blue, HK SS and a few others.
The 490Hz basically means that the ESC gets 490 times per second an update.
A standard servo for example works at 50hz or is updated 50 times per second.
My ESCs are HK SS.
So, in theory that should not be the problem.
I will try again with default values but the first test was with that and was not satisfactory.

Re: PID tunning
Posted: Mon May 28, 2012 5:03 pm
by Jlperan
Interesting link:
http://www.oddcopter.com/2012/02/21/qua ... ntrollers/Quite sure it is caused by HK SS ESCs. Will buy turnigy ESCs and give it a try.
Looks like HK SS 18A ESCs may not be flasheable.
https://docs.google.com/spreadsheet/lv? ... zdBQkZZRlE
Re: PID tunning
Posted: Mon May 28, 2012 7:59 pm
by bill516
I used
http://www.hobbyking.com/hobbyking/stor ... oduct=6548 and these are flash-able, they work without flashing but they work better after. Make sure they are the card programmable ones. Just looked on HK and they are back order.
Re: PID tunning
Posted: Mon May 28, 2012 8:47 pm
by Jlperan
Re: PID tunning
Posted: Mon May 28, 2012 10:38 pm
by kos
hum ..
the ESC is sensing the motor rotation and is adjsuting the pulse accordingly
the MWI is not sensing the esc
What you see in the gui is the command sended to the esc . this is not the actual motor speed nor the ESC output.
Re: PID tunning
Posted: Mon May 28, 2012 11:22 pm
by Jlperan
Yeah, I also thought that but when I unplug the ESCs motors values in the GUI looks fine, even if I move the quad.
What I think is happening is the following:
- MWI sends a command to the ESC.
- The ESC does send a signal to the motor not corresponing to what has been received, i.e. a higher signal.
- The motor moves faster than expected and it lifts the quad a bit, causing a vibration detected by the MWI.
- MWI detects it and tries to compensate.
This effect increases on each cicle and in a few seconds motor are crazy.
Right?
Re: PID tunning
Posted: Tue May 29, 2012 1:18 am
by kos
your are using some 10x6 props .. do they realy fit ?
Re: PID tunning
Posted: Tue May 29, 2012 7:28 am
by Jlperan
Ummmm, fits on the motors. What do you mean?
Re: PID tunning
Posted: Tue May 29, 2012 7:19 pm
by kos
that "The motor moves faster" is in fact "the props create to much trust" ... worth trying with 10x4 or 11x4 or so .
Re: PID tunning
Posted: Tue May 29, 2012 10:39 pm
by Jlperan
You may be right.
I´ve read in this page this motor works well with APC 12x3.8
Would you try that or 10x4 or 11x4?
Thanks!
Re: PID tunning
Posted: Tue May 29, 2012 11:31 pm
by Jlperan
Can't be 12x3.8. Distance between motors is 12. I'll try 10x4.
Thanks!
Re: PID tunning
Posted: Mon Jun 04, 2012 4:42 pm
by Jlperan
Well, it's working now. I changed the props and noticed one of the motors was running slower than the others so I changed that motor and it's flying
Thanks for all!
Re: PID tunning
Posted: Sun Jul 08, 2012 10:49 pm
by riahut.com
bill516 wrote:In gyro only mode, that is all other sensors switched off....
How do I turn sensors on|off in GUI ?
Re: PID tunning
Posted: Mon Jul 09, 2012 9:45 am
by bill516
You leave the boxes in the GUI blank then the sensors wont be active. Or you assign them to switches and dont switch them on.