Author Topic: PID Tuning in Self Balancing Bot  (Read 1604 times)

0 Members and 1 Guest are viewing this topic.

Offline sagnikbasuTopic starter

  • Contributor
  • Posts: 19
  • Country: in
PID Tuning in Self Balancing Bot
« on: March 08, 2017, 05:26:57 pm »
Hi,

So I made a self-balancing bot and tuned it perfectly with a PID control loop.

The problem is that as soon as I change the battery, the Kp, Kd, Ki constant changes and I need to tune it again.I know that it is due to change in motor characteristics due to change in battery voltage.

So is there a way I can resolve this problem i.e. I do not want to tune the bot again as soon as I replace or recharge my battery.

Thanks for your help.
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4193
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: PID Tuning in Self Balancing Bot
« Reply #1 on: March 08, 2017, 05:42:28 pm »
You can create a P(Vbat) relation and change the pid settings automatically depending on battery voltage.
Or create a more constant motor drive.

Or, pid auto tune. However, with an unrecoverable system, this can be conplicated. Eg: you can't stop pid and expect a safe condition. It will fall over.
 

Offline kosine

  • Regular Contributor
  • *
  • Posts: 158
  • Country: gb
Re: PID Tuning in Self Balancing Bot
« Reply #2 on: March 08, 2017, 05:50:05 pm »
Maybe use a voltage regulator to ensure the motors are always at the same voltage level?

(I've only used PIDs for heater control systems, which are fairly slow. Even then, optimising the settings can be tricky at times. High speed PID sounds even harder to get right!)
 

Offline ajb

  • Super Contributor
  • ***
  • Posts: 2733
  • Country: us
Re: PID Tuning in Self Balancing Bot
« Reply #3 on: March 08, 2017, 06:15:13 pm »
Rather than adjusting the PID constants in relation to the battery voltage, you should be able to scale the drive signal (the output of the PID loop) to the motors in relation to the battery voltage.  Higher battery voltage->smaller drive signal for a given PID state.  Done properly, this should give you a constant relationship between the drive signal from the PID and the motor torque.

Another option would be to regulate the motor current and have the output of the PID loop control the setpoint for the current loop.  Obviously this requires additional hardware that you may not have in your robot, but it eliminates the battery voltage from the equation--as long as you design the system to operate effectively even at minimum battery voltage, since this will affect the possible current drive range.  The current loop doesn't even necessarily need to be PID--a simple threshold detector that steers a PWM signal can be effective, if it's fast enough, and comes with dithering built-in.  More advanced implementations could use an MCU's DAC and analog comparator peripherals to implement a comparator-based current loop.  See app notes for MCU-based switching converters for some hints.
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 28013
  • Country: nl
    • NCT Developments
Re: PID Tuning in Self Balancing Bot
« Reply #4 on: March 08, 2017, 06:47:38 pm »
Aren't self balancing things Kalman filter territory?
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf