Basic ESC and Adafruit 16 Channel PWM Servo Hat on Raspberry Pi using CircuitPython

Hi all,

I am trying to use the Adafruit 16 Channel PWM Servo Hat on a RaspberryPi 3 A+ to control the BlueRobotics Basic ESC and M200 Motor.

Adafruit has updated all of their libraries to CircuitPython and I’m struggling to make anything work based on previous (incomplete) examples that I’ve seen on the forum (e.g., Basic ESC with Raspberry Pi - #9 by rjehangir).

Has anyone had any success and would be willing to share a test code so that I can get this motor turning?

Cheers,

Camille

Hi @theMILLOgroup -
Welcome to the forums!

The example you link is to read incoming servo-style PWM signals, it sounds like you’re trying to send them!

The adafruit documentation seems straightforward, is there a reason you can’t install their CircuitPython library?
You’ll want to set the appropriate range for the connected ESC

kit.servo[0].set_pulse_width_range(1000, 2000)

When commanding the throttle, I would expect

kit.servo[0].angle = 90

to be the 0 throttle, 1500ms pulse width, with 0 and 180 maximum throttle in each direction.

It’s worth noting you can drive most pins on a Raspberry Pi with a servo signal without using a hat, although the accesory does provide more channels. The pigpiod library is what I’ve used in the past!