You should run it on plain solid floor, at a higher speed, may be on a bike. Still your balancing logic is working. What about running on a tight rope (with a safety harness)?
Hey, I'm doing the exact same project with these component, but I'm having a problem when tuning the PID gain, I can't get it balances even around 3 second, Can you tell me how can you tune the PID so well??? thank you so much
Hi Well I spent some weeks tuning this and learning how to. You should look at all the videos you find that explain PID controllers. the PWM (motor controling value) P ( the angle measured from the MPU) target angle should be zero so if it measures 50 when upright make P = measurement - 50 I = I + P ( I = value acculmulated over time ) D = P this time - P last time ( this assumes each cycle is roughly the same length of time). Timing can really be thrown out by delays in communication between Arduino and MPU due to noise caused by the PWM signal to the DC Motors! PWM = P*coefficient + I*coefficient + D*coefficient start with all coefficient set to zero. tune P by increasing its coefficient until you get as good as you can get. then Increase the coefficient of D this should dampen any oscillation or over shoot. finally I is used to compensate for long term error like adding a weight to one side. and is the least important component. sorry for delay in response Hope this helps please let me know how you get on Yours Peter
Thanks for replying Peter!!! I finally got it balance, I change the sensor filter to Kalman filter instead of Complementary filter, But I am still not understanding quiet well about PID. I'm planning controlling the robot by an Bluetooth module, but I'm having some problems when changing the Setpoint, It falls down immediately, seem like it overshoots too much. Do you have any idea of that?
Hi Good to hear you have made some progress No that does not sound familiar I did have trouble with the GPU locking up then it would fall over but that was due to electrical noise from motors. when something odd happens I usually trace the variables through the program using a Serial.print() to check that they are not going out of range or you haven't cast a float to an int by mistake Yours peter
this took me six months.... but its a really satisfying project. the pwm driving the motors creates interference that can lock up the gyro :( so probably better to have separate power supply. the bits i have used are freely available on ebay , and fit together easily but you should still be pretty pleased with yourself getting this to work. All the best.
The motors speed is varied by Pulse Width Modulation.This square wave generates a lots of electrical noise! which interferes with communication between the Arduino and the MY-6050 gyro. The large capacitor acts as a smoothing capacitor across the battery pack. I put capacitors across the motors they provide a short circuit for noise from the motors and the wires to the motors pass through ferrite beads twice the ferrite also absorbs electrical noise. Without this the MY-6050 gyro would lock up and the robot falls over....
no I only used 1 3900 μF across the batteries ( i only had a picture with two caps ) the capacitors on the motors are small ceramic i don't know the values. I salvaged them from a power supply. a quick google around on the subject of DC motor noise dug out these values 0.1 μF or 0.47 μF have a look at www.x2y.com/publications/dcmotors/feb14-05.pdf
Very well done Mr. Black. I really look forward to building this. Thank you for taking the time to make the video as well as the tutorial.
You should run it on plain solid floor, at a higher speed, may be on a bike. Still your balancing logic is working. What about running on a tight rope (with a safety harness)?
Hey, I'm doing the exact same project with these component, but I'm having a problem when tuning the PID gain, I can't get it balances even around 3 second, Can you tell me how can you tune the PID so well??? thank you so much
Hi
Well I spent some weeks tuning this and learning how to.
You should look at all the videos you find that explain PID controllers.
the PWM (motor controling value)
P ( the angle measured from the MPU) target angle should be zero so if it measures 50 when upright make P = measurement - 50
I = I + P ( I = value acculmulated over time )
D = P this time - P last time ( this assumes each cycle is roughly the same length of time).
Timing can really be thrown out by delays in communication between Arduino and MPU due to noise caused by the PWM signal to the DC Motors!
PWM = P*coefficient + I*coefficient + D*coefficient
start with all coefficient set to zero.
tune P by increasing its coefficient until you get as good as you can get.
then
Increase the coefficient of D this should dampen any oscillation or over shoot.
finally I is used to compensate for long term error like adding a weight to one side.
and is the least important component.
sorry for delay in response
Hope this helps
please let me know how you get on
Yours
Peter
Thanks for replying Peter!!! I finally got it balance, I change the sensor filter to Kalman filter instead of Complementary filter, But I am still not understanding quiet well about PID. I'm planning controlling the robot by an Bluetooth module, but I'm having some problems when changing the Setpoint, It falls down immediately, seem like it overshoots too much. Do you have any idea of that?
Hi Good to hear you have made some progress
No that does not sound familiar
I did have trouble with the GPU locking up
then it would fall over
but that was due to electrical noise from motors.
when something odd happens I usually trace the variables through the program using a Serial.print() to check that they are not going out of range
or you haven't cast a float to an int by mistake
Yours
peter
Thanks for nice advices Peter!!! You had an excellent work. Hope you can do some more interesting stuffs.
All the best.
Thai Hoang Nguyen
It's very good
This, without PID controller ?
this took me six months....
but its a really satisfying project.
the pwm driving the motors creates interference that can lock up the gyro :(
so probably better to have separate power supply.
the bits i have used are freely available on ebay , and fit together easily
but you should still be pretty pleased with yourself getting this to work.
All the best.
Y el Diagrama de conexiones ?????
where did you use "10V 3900uf Capaictor"?
The motors speed is varied by Pulse Width Modulation.This square wave generates a lots of electrical noise! which interferes with communication between the Arduino and the MY-6050 gyro.
The large capacitor acts as a smoothing capacitor across the battery pack.
I put capacitors across the motors they provide a short circuit for noise from the motors and the wires to the motors pass through ferrite beads twice the ferrite also absorbs electrical noise.
Without this the MY-6050 gyro would lock up and the robot falls over....
Thank you. This means that "10V 3900uf Capaictor" is used between motor terminals . And this Capacitor are non-polar ?
no
I only used 1 3900 μF across the batteries ( i only had a picture with two caps )
the capacitors on the motors are small ceramic
i don't know the values. I salvaged them from a power supply.
a quick google around on the subject of DC motor noise dug out these values 0.1 μF or 0.47 μF
have a look at www.x2y.com/publications/dcmotors/feb14-05.pdf
Peter Black
thank you very much!