Page 2 of 3

Re: Servo library

Posted: Sun Sep 04, 2016 8:29 am
by dhylands
The Servo library only gives 10 usec resolution.

If you use something like this:
https://github.com/dhylands/upy-example ... py#L10-L13
then you can get 1 usec resolution (at 50 Hz or 100 Hz).

Re: Servo library

Posted: Sun Sep 04, 2016 9:12 am
by deshipu
Of course that will only work with a single servo, and only on the specific board you are using. Also, servos have a dead band (to avoid oscillations), so they won't react to small changes in the duty cycle length anyways.

Re: Servo library

Posted: Mon Sep 05, 2016 7:36 am
by pythoncoder
deshipu wrote:...servos have a dead band (to avoid oscillations)...
In which case the designer of their control system should be shot ;) A dead band really shouldn't be necessary!

Re: Servo library

Posted: Mon Sep 05, 2016 7:44 am
by deshipu
What can I say, those are cheap servos, this has been a traditional solution in the "industry" for decades, and they can't really say what load/inertia they will have to handle (to tune the PID properly). Smart servos are probably better designed, but they use a completely different protocol, usually based on half-duplex UART.

Re: Servo library

Posted: Sun Jan 01, 2017 11:26 pm
by mflmartin
Hi!

I have 2 questions:

Can you control a 360 degrees servo with this driver?

And, could we control 2 or more servos with an ESP-12 for instance?

Thanks!


Sent from my iPhone using Tapatalk

Re: Servo library

Posted: Mon Jan 02, 2017 9:31 am
by deshipu
mflmartin wrote: Can you control a 360 degrees servo with this driver?
You can control any servo that takes a standard servo PWM signal. Continuous rotation servos usually do.
mflmartin wrote: And, could we control 2 or more servos with an ESP-12 for instance?
Since the MicroPython's PWM class works with 8 of the GPIO pins, you can control up to 8 servos. Technically it would be possible to control up to ten, if you re-used the serial pins, but the PWM class doesn't work with those currently.

Servo library

Posted: Mon Jan 02, 2017 10:35 am
by mflmartin
Thanks!

And, from your experience, if I wanted to know the position of a continuous servo motor or dc motor, what would you use? A homing switch with a hall effect magnet for instance?
I want to make an analog clock, but I want to be able to know where the handle are (or where their start position is). What do you think?

Thanks!

Re: Servo library

Posted: Mon Jan 02, 2017 11:23 am
by deshipu
You would use encoders of some kind, but I really don't have much experience with this, so can't recommend anything. At this point you might consider using a stepper motor or even a normal DC motor, as the servos don't really give you much, since you need to do your own PID control loop with your own encoder anyways.

Re: Servo library

Posted: Mon Jan 02, 2017 11:37 am
by mflmartin
deshipu wrote:You would use encoders of some kind, but I really don't have much experience with this, so can't recommend anything. At this point you might consider using a stepper motor or even a normal DC motor, as the servos don't really give you much, since you need to do your own PID control loop with your own encoder anyways.
I see. Thanks for the guidelines, and, of course, the driver!! Image.


Sent from my iPhone using Tapatalk

Re: Servo library

Posted: Mon Jan 02, 2017 11:43 am
by pythoncoder
An easy way might be to use a standard 180 degree servo and gear it up 2:1. The only snag is that at (say) 11.59 the clock's hand would sweep through 354 degrees backwards to get to 12.00.