# Voltage drop after writing to slave register with I2C protocol

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!

Your battery isnt capable of providing sufficient current to the motor phases.

AA cells are meant for low current operation - few hundred mA, and I haven't seen AA cells powering any power hungry devices like motors or pumps.

Now to answer why the LED on the shield fades, I want you to take a look at the capacity-voltage characteristics (mAh - V curve) of the AA cell you are using. A cell, being a power source, can deliver power only up to some extent - Pmax. As the load current increases, the open circuit voltage of the cell drops until the load isn't removed. As the load is removed, the cell voltage rises to its open circuit voltage, OCV. (OCV level will decrease as the cell is aged/ used) . So a AA cell rated at 1.5v cell voltage, will obviously have less voltage across its terminals when connected to heavy loads.

Now because your motor draws high current, the cell voltage will drop. As the circuit continues to operate, the energy stored in the cell decreases and hence the maximum deliverable power and hence the cell voltage. This justifies the fading of LED on the shield. As the cell voltage falls below the brownout level of the micro controller, the micro controller will turn off.

Like you said, the shield turns ON after a while. This can be justified by the point I mentioned above - when load is removed, the OCV of the cell rises. When OCV becomes greater than the brownout level of the microcontroller, the MCU and hence the shield powers up!

Now, for the solution to this problem, I will recommend you switch to Li-ion cells. Stacking AA cells in parallel will only make the battery bulkier. Instead use 2 Li-ion cells connected in series. Generally, 18650 cells are rated at 2600mAh. Li-ion cells can give maximum of 2C A of current i.e 2x2600 mA = 5200mA in this case. That too for a size equal to 2 AA cells!

• Thanks for this answer. I'm always worried about pushing too much current into a system with bigger batteries, but I forget that the system dictates how much current it draws, not the other way around... I'll try the 2 18650 cells in series and see how it goes. May 9, 2019 at 14:27
• Yes you got that right! A circuit draws only that much current which it needs (unless you are operating in Constant Current mode ,some way. This is a different topic of discussion). Anyways, try out the above methods and let me know how the circuit works! May 9, 2019 at 16:55

What you describe sounds like a typical "brownout" behaviour of the steppers to me. If I see it correctly your motor draws up to 1A per phase. Now looking up what current are typically achievable with AA batteries (in series) we find information like https://www.powerstream.com/AA-tests.htm or http://lygte-info.dk/pic/BatteryAA/data/AA%20batteries%20at%201A.png .

So I guess that the current supply capability of your batteries is not high enough. While you can increase the voltage via putting more batteries in series the current they can supply does not increase that way. You could try to put two batteries stacks in parallel (which I would not advice as this could lead to reversed voltages at some of the batteries if one path of paralleled stacks has a higher voltage than the other, which can be the case e.g. if the batteries "ages" differently).

I would recommend to switch to a more potent battery type or other power supply.

• Great resource, I'll keep that graph handy! May 9, 2019 at 14:27