0

I'm currently working on a self-balancing robot with an Arduino Uno and a 10DOF ADXL345 sensor. Everything is going fine until I got to this PID tuning part. I've read about it several times but I'm unable to get the desired results. Can somebody give a detailed guide on PID tuning? Thank you.

1
  • How tall is it? How fast do the measurements and adjustments have to happen to keep things from falling down? How fast are they happening? Where is the code? – Dave X Jan 25 '16 at 14:28
1

Maybe you can help yourself with this tutorial for PID line follower robot. I successfully tuned my PID for line following and had some success with PID for wall following with sonar.

3
  • Thanks. Let me try it first. I'll tell you when it works :) – Aung Khant Ko Jan 25 '16 at 12:24
  • That tutorial looks pretty good. One difference from most discussions and usages of the normal Arduino PID control is that it focuses on error by putting the setpoint outside the PID algorithm as "Tp", so you can use the arduino PID like this if you do those calcs outside. And "I just take the maximum value we want to send to the motor's power control (100) and divide by the maximum useable error value. For our line following robot we've assumed the maximum error is 5 so our guess at Kp is 100/5=20. When the error is +5 the motor's power will swing by 100 units." is the crux of PID tuning. – Dave X Jan 25 '16 at 14:25
  • Thanks man. Didn't get the desired results yet but I'm a lot closer now. The robot is much more stable now. Thanks man – Aung Khant Ko Jan 26 '16 at 10:01
1

In real life there is no set equation to find the PID values. At best you'll get close with equations and then need to tune the parameters.

For anyone into PID loops have a read of this. I've found it to be excellent.

My advice is to:

  • only use P
  • set I & D to 0
  • get it and good as you can by trial and error
  • add I and trial it too

D is for experts really and may cause weird/undesirable jitter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.