I'm trying to control this bipolar stepper motor with an Adafruit Huzzah32 (ESP32) board and a stepper driver shield.
Power sources:
- ESP32: 5V USB port
- Shield: 4 AA-batteries in series
I programmed the board in micropython and it starts as intended. I'm using an older library from Adafruit to control the stepper and this code at launch:
import time
import machine
import stepper
i2c = machine.I2C(scl=machine.Pin(22), sda=machine.Pin(23))
steppers = stepper.Steppers(i2c)
s1 = steppers.get_stepper(1)
while True:
for i in range(100):
s1.onestep(stepper.FORWARD,stepper.DOUBLE)
time.sleep(0.01)
But after a few seconds, the LED on the shield fades out and the stepper slows down until completely stopping.
When I do:
s1.cpa9685.i2c.writeto_mem(s1.pwma, 0x00, 0x00)
s1.cpa9685.i2c.writeto_mem(s1.pwmb, 0x00, 0x00)
The shield LED lights up again.
I thought the back EMF from the stepper was limiting the current on the shield, so I increased the power source up to 10V by adding more AA-batteries in series. That didn't fix anything, the shield keeps shutting off after a few stepper steps.
Do you know what I'm doing wrong? I'm way out of my league here. Thanks in advance!