Powering Stepper Motor and DFPlayer with ESP32S3 on Battery

Hello everyone,

I'm currently working on a project that involves using the XIAO ESP32S3 module with a 3.7V lithium battery. The module has a built-in power management chip that allows it to be powered by the battery or to charge the battery through the USB port.

However, I'm facing a challenge in powering a NEMA11 stepper motor and a DFPlayer mini while running on battery. The 5V pin on the XIAO ESP32S3 seems to be only available when the module is connected to USB. I need a stable 5V output to power these components, but I'm unsure how to achieve this without USB connection.

I'm seeking a solution that allows me to use the ESP32S3's integrated battery charging controller while also providing a consistent 5V output for the stepper motor and DFPlayer mini, without the need for an additional battery charging controller. But I don't know if that would disturb the battery charging controller. One thought is to step up the voltage from the 3.3V pin on the Arduino, or perhaps connect the step-up converter in parallel with the battery pins for the ESP32S3. This setup could potentially allow me to draw 5V from the 3.7V LiPo while maintaining the ESP32S3 as the battery controller.

Another possibility is to run the DFPlayer mini and the TMC2208 at 3.3V using the Arduino's pin. However, I haven't soldered the battery to the ESP32S3 yet to test these ideas, as I'm keen to avoid any potential damage to the module.

I've received some advice suggesting that there's a small circuitry to select between VBUS (if connected) and VBAT, called "VIN". Therefore, I should connect any load, including the regulator, to VIN rather than VBAT. But I don't know what that means.

Could anyone provide some insights or a proven method to power the stepper motor and DFPlayer mini with a consistent 5V supply while running on battery? I would greatly appreciate any advice or suggestions on how to proceed with this setup.

Thank you in advance for your help!

What have you found i your research? What are the power requirements of the hardware items? How long is a charge to last? Here is some information that may help:
Gil's Crispy Critter Rules, they apply to processor hardware:
Rule #1. A Power Supply the Arduino is NOT!
Rule #2. Never Connect Anything Inductive (motor, speaker) to an Arduino!
Rule #3 Don't connecting or disconnecting wires with power on.
Rule #4 Do not apply power to any pin unless you know what you are doing.
Rule #5 Do not exceed maximum Voltages.
Rule #6 Many will not power a transmitter.
LaryD's Corollary's
Coro #1 when first starting out, add a 220R resistor in series with both Input and Output pins.
Coro #2 buy a DMM (Digital Multi-meter) to measure voltages, currents and resistance.
Violating these rules tends to make crispy critters out of Arduinos.
Hint: It is best to keep the wires under 25cm/10" for good performance.

2 Likes

Involves? Some school project?
That module is good to make some wireless 3.3V sensor setup, not to power stepper motors.

@formeo If I could give that advice more likes I would, maybe as many as 100. This is 100% EXTREMELY sound advice. My short version is do NOT power any motor from any MPU/MCU!

No, it's not a school project. However, I must admit, I wouldn't mind going back to school! English isn't my native language, so I apologize for any incorrect phrasing. I chose it because of the WiFi module, battery charging, and USB-C features. It seemed like a perfect fit for my project. The only issue I'm facing is figuring out how to power the stepper motor using the same battery as the ESP.

Alright, that means the option of using a step-up converter on the 3.3V pin is no longer viable. I had a feeling that might be the case, but I figured it wouldn't hurt to ask just in case.

Before you purchase other components, study your stepper motor datasheet and try to estimate how much juice you need out of it. Steppers are often driven with much higher voltage eg. 12V through a stepper driver circuit.
If you decide to go with 5V, there are "power bank" modules around that have all needed circuits to charge and protect battery and step up/down voltage.

In my research, I've found that the power requirements for the hardware items should not exceed approximately 1.8A. I've read that the DFPlayer mini can draw up to 1A at maximum. The battery life will depend on usage, so I've opted for a 2000mAh battery for now. But that is exchangeable.

Regarding Gil's Crispy Critter Rules:

  1. I understand that the power supply for the Arduino is not suitable for this project.
  2. I won't connect anything inductive, like a motor or speaker, directly to the Arduino. Instead, I use optocouplers to separate the logic circuits.
  3. I won't apply power to any pin unless I'm certain of what I'm doing, which is why I'm seeking advice here.
  4. I'll make sure not to exceed the maximum voltages.

But now back to addressing the issue of powering the stepper motor and controlling the battery via the ESP, I had considered using a step-up module in parallel with the battery and connecting a relay to the Arduino's 5V pin. The relay would be activated when 5V (voltage lowered for the relay logic) is present on the pin. However, I'm open to suggestions!

Stepper Motor Specifications:

  • Model: NEMA 11-01
  • Motor Type: Bipolar Stepper
  • Holding Torque: 55 mN·m
  • Phase Resistance: 11.9 ohms
  • Rated Voltage: 5.0 V
  • Rated Current: 0.42 A
  • Step Angle: 1.8 degrees

Ok, so the motor needs 420mA, how much power can the XIAO supply? I bet it is only 10% or less of that. You need a 12V high power supply for the stepper. If you want it to be portable, then either an 11.6V RC LIPO plus a special charger, or a 4S 18650 (if you can find non-fakes) but that will only provide 1,200 mAh or about 20 minutes run time. Proper charging of the LiIon 18650's also requires a special charger. This is probably the best and is what I have (3 chargers total) https://www.skyrc.com/MC3000_Charger?from=nav

Why try the difficult 'in parallel' arrangement, you have to get a big battery for the stepper, then a much smaller for the XIAO.

I'm having difficulty understanding this part. If the motor operates correctly with 5V, why would a 12V supply be necessary? The current setup is as follows:

charging controller -> 3.7V battery -> 5V step-up converter -> {ESP VIN} and {motor driver}

However, this setup results in two charging controllers, and I'm not utilizing the ESP's built-in battery charging controller.

What I would prefer is:

{ESP <--> battery} -> 5V -> motor

In this scenario, I want to directly connect the ESP to the battery and obtain 5V to power the motor, while still using the ESP's integrated battery charging controller.

Did you fail to understand that the board can NOT provide more than a few milli-amps?
Are you 100% sure the stepper only wants 5V, I have never seen that, they(small) usually work best with between 12 and 24v
Give us a link to the stepper motor.

If you are sure it operates correctly with 5V, then it's ok.
If you need more juice out of them you need to increase voltage. I have steppers that have nameplate voltage <5V, but I drive them at 60V.

@formeo YEP, that's how they work. Might I suggest a basic course in steppers before attempting this project?

I'm still confused. If the motor operates on 5V and it indeed runs on 5V, why would I need to use a higher voltage? This would unnecessarily complicate the setup, as the DFPlayer mini requires 5V, the ESP operates on 3.3V, and the motor has a different voltage requirement. It seems more logical to maintain the existing 5V setup for the motor and find a way to power the DFPlayer mini and ESP from the same battery source without increasing the voltage.

I agree, if you have verified in practice that your motor works like you want/need at 5V, it's ok.
It's just not the way to get max speed/torque from the motor.

Go ahead, see what happens.

I apologize for the inconvenience, but I've uploaded the motor information here:

I understand that the ESP cannot provide the necessary amperage for the motor. Therefore, I had the idea of using a relay to supply the current directly from the battery while cutting the connection during charging. This way, the motor would be powered without overloading the ESP.

First, you can't 'overload' a sink. Normal devices draw current. You need to learn OHMS LAW.
If the motor works well at 5V, then you still need a separate PSU or provide isolation since the motor will create a lot of noise on the 5V line possibly damaging the board.