Servo driver dilemma with angles and continuous rotation servos
Rayman
Posts: 14,744
in Propeller 2
I've been happy with the servo driver in the Prop Tool Library, "jm_servo" up to now.
I like using angles 0..180 instead of microseconds.
But, seems need more resolution for my BoeBot, upgraded to Tank Bot and with P2 board.
With setting of 92 it slowly rotates one way and setting of 93, slowly rotates the other way.
Think I need to modify jm_servo to either be in tenths of degrees, or to add a calibration setting with finer resolution...
Comments
If it's a CR servo you should output a pulse for 0 degrees and then use a screwdriver to set it to the stop point. TBH, hobby servos with plastic gears don't have great resolution, anyway, so going with finer resolution is kind of wasted on them. That said...
jm_servo uses Smart Pin PWM mode so we are constrained by the system frequency and servo PWM timing.
You could change the unit timing to 0.1us, but then the period count would have to be 20_000_0 and will not fit into the 16-bits allowed by x.word[1].
If you can spare a cog you can use a Smart Pin to generate a pulse every 20ms. Here is a simple, 2-servo driver with 0.1us resolution that you can paste into your robot app.
This uses the process I used in my 8-channel servo driver for the P1 (am porting to the P2). Here's the output from the above code with servo 0 set to 2000.0us and servo 1 set to 1000.0 us.
Wow, I completely forgot about that zero adjustment pot.
Ok, never mind, all good here...