Closed felipesanches closed 8 years ago
@felipesanches,
As we talked on Garoa, We have plans to support PPM signals and Servos. But we are not sure, how this could be done. To make a Servo work on each particular board is easy. However, to write a one-size-fits-all code is not so easy.
We could consider two options:
There is almost a discusion on how to implement more Pin's functions:
https://groups.google.com/d/msgid/pingo-io/5a51d463-b853-4dfc-8da6-ffb93dd09577%40googlegroups.com?utm_medium=email&utm_source=footer
Maybe @ramalho could dispense some wisdom on this issue.
That's all folks.
After some googling:
Board | Servo support Status |
---|---|
Arduino | Firmata Prototocol suports Servos, so does PyMata |
Raspberry | RPI.GPIO does not support Servos. It can be implemented via software with PWM http://razzpisampler.oreilly.com/ch05.html . Occidentalis v0.2 distribution support on GPIO#18 |
pcDuino | Support it via Arduino IDE or via pwm-sunxi Kernel Module with some PWM hack. |
BeagleBone Black | Adafruit_BBIO and some PWM hack. https://learn.adafruit.com/controlling-a-servo-with-a-beaglebone-black/writing-a-program |
Galileo | Via Arduino IDE, or PWM hack https://github.com/mikalhart/galileo-Servo |
There is a recipe to get a Servo working on a PWM signal.
We need to test it.
Good research, thanks @vido!
On Wed, Nov 26, 2014 at 4:37 PM, Lucas Vido notifications@github.com wrote:
After some googling: Board Servo support Status Arduino Firmata Prototocol suports Servos, so does PyMata Raspberry RPI.GPIO does not support Servos. It can be implemented via software with PWM http://razzpisampler.oreilly.com/ch05.html . Occidentalis v0.2 distribution support on GPIO#18 pcDuino Support it via Arduino IDE or via pwm-sunxi Kernel Module with some PWM hack. BeagleBone Black Adafruit_BBIO and some PWM hack. https://learn.adafruit.com/controlling-a-servo-with-a-beaglebone-black/writing-a-program Galileo Via Arduino IDE, or PWM hack https://github.com/mikalhart/galileo-Servo
There is a recipe to get a Servo working on a PWM signal.
- Set your PWM frequency to 50Hz (to match the 20ms Servo's period)
- A duty-cycle of 2.5% represents 0.5ms, which is 0º for a Servo.
- A duty-cycle of 12.5% represents 2.5ms, which is 180º for a Servo.
We need to test it.
— Reply to this email directly or view it on GitHub https://github.com/garoa/pingo/issues/53#issuecomment-64691479.
Luciano Ramalho Twitter: @ramalhoorg
Professor em: http://python.pro.br Twitter: @pythonprobr
So folks this feature is top priority.
Last Sunday, I was working on the "Nativity scene" software. And I used a I2C PWM driver http://www.adafruit.com/datasheets/PCA9685.pdf Although it is a "LED controller optimized for LCD Red/Green/Blue/Amber (RGBA) color backlighting applications", you can drive servos.
It provides a 12bits (4096 states) duty cycle. Here is the math:
At 50Hz, we have a 20ms period.
0º is 0.5ms -> 20ms/0.5ms = 40
4096 / 40 = 102.4 ~ 103
90º is 1.5ms -> 20ms/1.5ms = 13.3
4096 / 13.3 = 307.9 ~ 308
180º is 2.5ms -> 20ms/2.5ms = 8
4096 / 8 = 512
Yes, this trick works. Any board with a setable PWM frequency, with at least 40 states, will work
So far:
Should Servo be a pingo.parts or should it be a Board.mode? Well, if it's implementation hangs upon each Board, we can't have it as pure pingo.parts. If a code is Board specific, than it should be within it's own Board driver. From this point of view, it makes sense to have a SERVO mode.
I felt this specific need while I was planning to control a set of servos for a remake of the Golly Ghost arcade.