PID controlled Servo's

photon
Tags: #<Tag:0x00007fe222ebb318>

#1

I am working on a servo based robotic arm. Right now i am just using the servo library to set the angle of the arm. However, i was wondering if i used PID to control the movement of the arm it would give a more “natural” movement to it? If yes, which PID library is best suited for this task?


#2

The library contains this https://build.particle.io/libs/pid/2.0.0 which you could try?


#3

A servo automatically moves to the set angle (as determined by its PWM signal) as quickly as the hardware allows. There’s no reason you need to set it to the destination angle in one step, however. You can pick intermediate steps, for example making them have smaller angle deltas (slower) at the start and end positions, and large angle deltas (faster) in the middle, which would probably look more natural.


#4

Yeah this is what i am trying to do.

Would you suggest I can achieve this via PID control, or is there anything else more suited for something like this?


#5

If you’re rolling your own servo controller then pid all the way. A hobby servo would already have this control built in. Here’s a nice one with diagrams.