Stanley H.I. Lio‎ > ‎

RC Servo and PID - "Autotune"

The robotic arm built for the magnetic field measurement project leaves several things to be desired.

  • After a new servo is installed, finding the mapping between PWM duration and DH angles is done manually with pen and protractor. I want to automate this.
  • The arm trembles and oscillates at certain poses. I want to be able to tune the PID parameters of the RC servos, and experiment with different control algorithms.
I can use the IMU mounted on the arm to automate these tasks, or even use computer vision. Would be interesting to have the computer auto-tune the PID parameters.

I also want to go one step further and combine computer vision with the arm.

Move the arm with real-time input devices such as mouse, keyboard, gamepad, camera etc.

Was about to buy some OpenServo boards from SparkFun. While checking dimension of the board to make sure they will fit my Hitec HS-5485HB servos, it turns out the Hitec uses an Atmega48 as a controller with a pair of 5A MOSFET drivers. As if that's not awesome enough, the ISP pins (MOSI, MISO, RST, SCK, powers) are broken out to exposed vias. That means I can reprogram it with my own control algorithm (PID tuning in mind), change the control interface (UART serial instead of PWM), or have it do different things entirely (use it as input device for example - your imagination is the limit).

At $20 a piece it also makes a good platform for experimenting with feedback control and PID-related stuff.

[update 1]
Turns out the HS-7954SH also uses the same Atmega48, although with a slightly different driver circuit (it uses the ME4542). Thinking of Hitec's marketing claim "this new circuit has twice the resolution of our original circuit", I wonder how they manage to get "twice the resolution" out of the same chip...

Anyway, now I can just reprogram the Hitec instead of buying OpenServo boards. Awesome.