Servo calibration

I'm working some more with the servos and with the gearing I have the servos will move the hands 540 degrees (1-1/2 turns). The Arduino servo class takes inputs between 0 and 180. On my clock, this translates to 3 o'clock position being 0, 12 o'clock as 90 and 9 o'clock as 180 going around clockwise.
I needed a method to make sure that each of the 5 servos:
  • start and end at the same positions
  • can reliably hit each of the 12 clock positions reliably
The first one is pretty easy. When attaching a Servo object to a pin you specify the minimum and maximum time (in us) that the servo will use. Most servos use 1000us as a minimum and 2000us as a maximum. By altering this slightly for each servo I could get all the servos to start and end at the same position.
The second one was a little tougher. It turns out that a 10 degree Arduino input corresponds to one clock face position (30 degrees) for all the servos, but one servo would not reliably move to a position if the movement was too small (10 Arduino degrees). I wrote a subroutine in the Arduino code to take an offset factor defined for each servo (the first 4 are zero; servo5 uses an offset of 4) and the code causes the input value and goes a little farther to help push the servo to the desired position.
Here's an example of how it works: If the current position is 20, and we need to move to 30 the subroutine will actually move the servo to 34 for a couple seconds and then back to 30. If it's at 60 and we want to move to 50 the subroutine moves it to 46 for 2 seconds then to 50. It does this even for larger moves and seems to work pretty well for this stubborn servo.

Comments

Popular posts from this blog

V-22 Osprey Project - Design Changes for v3

Whereabouts Clock Update

Whereabouts Clock: New Clock Mechanism