PCA9685 PWM Driver
PCA9685 PWM Driver
This chip is actually used in two different modules. First it's used in the 16-channel I²C servo (and LED) drivers. Second, it's also used in Adafruit's motor shield. That's why apart from the main module, which lets you control the chip directly, there are also two others, specifically for the servos and the DC motors.
The source code is at https://bitbucket.org/thesheep/micropython-pca9685/src
The source code is at https://bitbucket.org/thesheep/micropython-pca9685/src
- VisualEcho
- Posts: 17
- Joined: Mon Jul 04, 2016 7:49 pm
- Location: Ann Arbor, Michigan
- Contact:
Re: PCA9685 PWM Driver
[quote="deshipu"]used in the 16-channel I²C servo (and LED) drivers[/quote]
Yes it is, and this is useful, thanks!
Yes it is, and this is useful, thanks!
- VisualEcho
- Posts: 17
- Joined: Mon Jul 04, 2016 7:49 pm
- Location: Ann Arbor, Michigan
- Contact:
Re: PCA9685 PWM Driver
I think there may be a bug in the servo.py file. In class init, setting period before calling _us2duty() (to set the min and max duty) seems like a good idea.
Re: PCA9685 PWM Driver
Argh, you are right. Sorry about it, I rearranged the lines for better reading and didn't test it afterwards.
Re: PCA9685 PWM Driver
Hi,
Thanks for this useful library.
As I'm a newbie a minimal code sample would be helpful for me.
I'm able to create a servo object, but I'm not able to make it move.
I have not understand what the "index" parameter stand for ? I guess it is related to the output selection, but it seems not to be directly the output number engraved on the board [0-15]
Thanks
Thanks for this useful library.
As I'm a newbie a minimal code sample would be helpful for me.
I'm able to create a servo object, but I'm not able to make it move.
I have not understand what the "index" parameter stand for ? I guess it is related to the output selection, but it seems not to be directly the output number engraved on the board [0-15]
Thanks
nodemcu V2 (amica)
micropython firmware Daily build 05/31/2016
micropython firmware Daily build 05/31/2016
Re: PCA9685 PWM Driver
Sorry for the lack of documentation, I will try to improve that a bit in the coming days.
You guessed correctly, "index" is the number of the board's output. Note that it starts with 0, so it may be off-by-one compared to what is printed on your board (I don't know which board you are using, so hard to say).
This should move all servos to the central positions:
You guessed correctly, "index" is the number of the board's output. Note that it starts with 0, so it may be off-by-one compared to what is printed on your board (I don't know which board you are using, so hard to say).
This should move all servos to the central positions:
Code: Select all
from machine import I2C, Pin
import servo
servos = servo.Servos(I2C(scl=Pin(5), sda=Pin(4))
for i in range(16):
servos.position(i, us=1500)
Re: PCA9685 PWM Driver
Thanks alot,
My mistake was not on the software side, I had reversed the polarity of the power port of the adafruit breakboard's.
Nota: when the power led is red, it means the power for the chip is ok (green would have been better thought ), it not mean power for servos is ok... But the board is protected from heedless guy and it's the most important (for me)
My mistake was not on the software side, I had reversed the polarity of the power port of the adafruit breakboard's.
Nota: when the power led is red, it means the power for the chip is ok (green would have been better thought ), it not mean power for servos is ok... But the board is protected from heedless guy and it's the most important (for me)
nodemcu V2 (amica)
micropython firmware Daily build 05/31/2016
micropython firmware Daily build 05/31/2016
Re: PCA9685 PWM Driver
hello,
I'm back playing with PCA9685 and your helpful library.
I see that it's also possible to drive DC motor, it's something I would want to try, but I don't understand how I should wiring it ?
What kind of motor should I be able to drive ?
I would like to recycle some two wire DC motors, does it could work ?
Thanks
I'm back playing with PCA9685 and your helpful library.
I see that it's also possible to drive DC motor, it's something I would want to try, but I don't understand how I should wiring it ?
What kind of motor should I be able to drive ?
I would like to recycle some two wire DC motors, does it could work ?
Thanks
nodemcu V2 (amica)
micropython firmware Daily build 05/31/2016
micropython firmware Daily build 05/31/2016
Re: PCA9685 PWM Driver
The motor.py library is for this shield: https://www.adafruit.com/products/2927
There is a schematic in its documentation if you want to recreate the same circuit.
There is a schematic in its documentation if you want to recreate the same circuit.
Re: PCA9685 PWM Driver
Thank a lot deshipu,
I understand,
I don't own a FeatherWing, but I think I can do it with a H bridge, type L298N
I understand,
I don't own a FeatherWing, but I think I can do it with a H bridge, type L298N
- Attachments
-
- L298N.png (50.83 KiB) Viewed 16057 times
nodemcu V2 (amica)
micropython firmware Daily build 05/31/2016
micropython firmware Daily build 05/31/2016