Close

firmware V2 "strong PID"

A project log for strong servo motor with a wiper motor

Here is how to reuse cheap and strong wiper motors to make an extremely powerful servo motor (linear actuator for exemple)

JP GleyzesJP Gleyzes 10/12/2022 at 07:400 Comments

The version2 of the firmware is accessible on my Github

It's a "strong PID" tuning where the motor reaches its target. in one shot.

PID coefficients are quite agressive, but overshoot is very limited and motor does not oscillate.

 //PID stuff
  input = getMotorPos();

  Kp = 6000;                     // start with an almost fully proportionnal PID
  Ki = 20.;
  Kd = 100. ;

  myPID.SetTunings(Kp, Ki, Kd);
  myPID.Compute();

A compensation factor of the "inertia" of the rotor is introduced (should be tuned if you change motor).

#define INERTIA  1155./4096. //inertia of motor when stopping (PID over shoot on sensor position)

 This acts as a bias to setpoint value.

 //turn the PID on
  setpoint =  targetRot - INERTIA; //setpoint is this target number corrected of the INERTIA bias

Results are impressively good !

Discussions