TURFPTAx Uncategorized PCA9685 MicroPython

PCA9685 MicroPython

I love using the PCA9685 servo motor driver boards for my silly robots. Sometimes I even use them for more serious projects like a robotic hand to show a proof of concept prosthetic sensor. Either way these inexpensive PWM driver boards are I2C, have a separate line for the motor power, and have solder jumpers to change the I2C address! That last one is my favorite because who doesn’t want to hook up 20+ SSD1306 screens on a project? 😀

Anyways Adafruit used to support micropython but they have shifted to circuitpython.

I don’t like circuit python so i’m sticking with micropython.

As a tinkerer, hacker, and tryin’ to be do gooder’, I often want to make sure that my projects can be completed with relative ease for me and anyone wanting to try something similarly silly as my designs. I chose micropython.

The main reason I use micropython is because the drivers for periphrial devices are written in plain ol’ python or micropython instead of a compiled file. The benefit of python on microcontrollers is the REPL environment and the lack of need to compile anything.
Have a question about a module? Just poke at it with ‘dir()’.


So if you just snag the pca9685.py and the servo.py file from this repository and put them on your micropython board you can call them easily such as this:

from machine import I2C, Pin
import servo
servos = servo.Servos(I2C(scl=Pin(37),sda=Pin(39)))
servos. Position(0,us=1500)

Related Post