5
$\begingroup$

so I am working on a Self Balancing Bot with Arduino Mega. I'm using 12V 200 RPM motors with built in 840 PPR quadrature encoders. The torque rating is as follows:

Rated Torque: 2.4 Kg-cm Stall Torque: 6 Kg-cm

As of now I've implemented a simple PID controller (based on Brett Beauregard's PID library) to minimize only the tilt angle error. Still haven't implemented PID using the encoder for the position error.

I've tried a lot to tune the PID values. The robot is quite stable when it is standing its own. However, here's the issue, when the robot tilts by an angle greater than 7-8 degrees (or when it is pushed slightly) from its stable position, the motors start rotating at the maximum speed (PWM: 255) and the robot still doesn't seem to recover back and just keeps running and then finally falls down in the direction in which it was moving. It doesn't seem to recover at all.

Is it just a problem with the PID tuning? As I said earlier, it's stable for the range -5 to +5 degrees (0 degrees is the upright position) without oscillating much. However it is not able to recover for errors greater than 7 degrees.

Or could this be an issue with the robot being too heavy and insufficient counter motor torque? Total weight of the robot is around 1 kg (including the motors). I'm using 2200 mAh LiPo battery and have placed it at the highest level so as to decrease the angular acceleration.

Would implementing the PID feedback for encoders as well solve this issue? Also do suggest some links on how to implement dual PID using an IMU and encoders to correct tilt angle and position. I'm planning to use cascaded PID controllers in which the encoder PID measures the error in position and its output will be the set-point for the angle PID loop which in turn will control the PWM of the motors. So if there's an offset in position the angle set-point will change to, let say -2 degrees (from upright 0 degrees). So now the angle PID will make the robot move in order to correct the angle offset and therefore the position error also gets corrected. Is this a good method. Any other suggestions or different approaches to this?

$\endgroup$

1 Answer 1

4
$\begingroup$

Just a hint from my extensive experience from self balancing robots:

  • The most important aspect of a self balancing robot, is the actuator acceleration (torque) control.

(...) the motors start rotating at the maximum speed (PWM: 255) and the robot still doesn't seem to recover back and just keeps running and then finally falls down in the direction in which it was moving. It doesn't seem to recover at all.

Because to balance, the robot needs shifts in velocity, i.e. acceleration (produced by motor torque). If your motor saturates, the control cannot execute the balancing action: accelerate to shift the center of mass.

Furthermore, the relationship between the tilt angle, and the required motor acceleration is not linear. i.e. to recover from 5 deg may require 0.1 N.m from the motors, and to recover from 7 deg may require 1.0 N.m.

Would implementing the PID feedback for encoders as well solve this issue?

You definitely should have PID for motor control. How do you make sure the motors are performing the velocity/torque that the balancing PID requested?

I'm planning to use cascaded PID controllers in which the encoder PID measures the error in position and its output will be the set-point for the angle PID loop which in turn will control the PWM of the motors.

Yest, looks good! See similar question: Self balancing robot control system strategies

$\endgroup$
3
  • $\begingroup$ Out of curiosity, how one does test that the motors perform the requested torque/velocity? The only thing that can really be measured freely while in motion is the voltage and current at the motor. Is there an experimental strategy to do this? If so, please elaborate. $\endgroup$
    – Paul
    Commented Jan 12, 2017 at 19:35
  • $\begingroup$ I'm not versed in power electronics. But from my fiddling around with some motor control libraries I got the understanding that by having a characterized model of your motor, you could estimate the produced torque from the voltage applied, currents and stator velocity. See the case of Field Oriented Control for brushless motors. $\endgroup$
    – vmatos
    Commented Jan 13, 2017 at 9:57
  • $\begingroup$ @Paul For velocity is very easy. Just mount an encoder to the shaft of the motor. $\endgroup$
    – vmatos
    Commented Jan 13, 2017 at 9:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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