Powering ESP32 and Servo Motor with a Battery – What Do I Need?

Hi everyone,

I’m working on a project involving an ESP32 NodeMCU and a MG996R servo motor. Currently, the ESP32 is on a breadboard and connected to my PC via USB. The servo motor is also connected to the breadboard, and everything works fine so far.

In the future, I’d like to power the whole setup with a battery. From my research, I’ve learned that the ESP32 requires 3.3V and the servo motor 5V.

My question is:

  • What kind of battery setup do I need to make this work?
  • I know it makes no sense but should I use an 8V battery and regulate the voltage, or connect, for example, four 2V batteries in series?

I’m a beginner and would greatly appreciate some guidance on what components I need to buy and how to set them up.

Thank you in advance for your help!

Generally, a separate battery for the servo is best, as that avoids malfunctions due to the severe electrical noise that servos inject into the power supply. Don't forget to connect the grounds.

If your ESP32 dev board has a 5V pin, you can power the ESP32 by applying 5V to that pin, and there will be a 3.3V regulator on the board to provide the ESP32 with the 3.3V it needs

1 Like

Thank you for the answers so far. To make clear, the Input/output voltage of my ESP32 is 3,3V. The Power supply voltage (USB) 5V. The Servo MG996R has a operating voltage of 4.8 to 7.2 V.

Does this mean that I need a power supply that supplies at least the ESP (to which the servo is connected) with 4.8V? I was thinking about buying two of these batteries and connecting them in series so that the voltage adds up to 6V:

Ah, and as I mentioned the Servo is directly connected to the ESP32 at the moment. So..

  • the GND cable of the Servo goes into the GND-Pin of the ESP,
  • the 5V cable of the Servo goes into the 5V-Pin of the ESP and
  • the PWM cable of the Servo goes into a PWM-Pin of the ESP (in my case GPIO12)

When I connect the 5V cable and the GND cable to the Power Supply as jremington mentioned above, how do I power the ESP? Do I need another battery for that?

Sorry for the dumb questions :sweat_smile:

Hi, @nikfli
Welcome to the forum.

You will notice that you are powering the ESP32 from the 5V USB, so it can be powered with 5V.


It has a 5V pin (bottom left hand corner of the diagram) that you can apply 5V supply to and that will power the controller.

Tom.. :smiley: :+1: :coffee: :australia:

I moved your topic to a more appropriate forum category @nikfli.

The Nano ESP32 category you chose is only used for discussions directly related to the Arduino Nano ESP32 board.

In the future, please take the time to pick the forum category that best suits the subject of your question. There is an "About the _____ category" topic at the top of each category that explains its purpose.

Thanks in advance for your cooperation.

Thank you for your answer! I think I now understand how the cabling should be set up. Both the ESP and the servo are connected to the same power supply, sharing both the 5V and GND lines. Additionally, the servo is connected to the appropriate GPIO pin, as expected.

However, I still have a question about the battery setup. Since the servo operates at 4.8V and the ESP requires 3.3V, I probably need a total of at least 8.1V to power both components. The most economical way to achieve this would be to connect the batteries in series, correct?

Nooo..
You have already stated that you have your project operating off a 5V supply.
Connect your 5V "battery" supply there.
I don't think you will find a 5V battery.

The two of the batteries you posted in #4 will give 6V when connected in series.

Is there a reason you want to go to battery power?

What is you project, what does it operate?

Tom.. :smiley: :+1: :coffee: :australia:

Thanks for your fast response! I'm working on a digital door lock for a university project. It will be Bluetooth-controlled and mounted on a door, so I need an external way to power both the ESP and the servo.

If I understand correctly, I would need to connect both the servo's 5V cable and the "battery "to the 5V pin of the ESP, is that right? So I just leave everything as it is and just add an extra cable from the battery supply to the 5V pin.

And regarding the 6V I get from the batteries in series: Is it a problem if I supply 6V instead of 5V? I don’t want the servo to underperform due to insufficient voltage. I already have some problems with the 5V, because if the servo rotates too quickly, it disconnects from the pc and reconnects immediately afterwards, but does not carry out the movement completely.

Thanks in advance

Yes, leave everything as you have it.

You would need a DC-DC converter to get to 5V.

Have you measured the current consumption when the servo operates and when your project is asleep?

The drop out would be the servo current consumption causing the 5V to overload.

Tom... :smiley: :+1: :coffee: :australia:

Did you forget about the current the battery must be able to deliver.
The MG996R briefly draws 2.5Amp every times it starts moving.
A battery holder with four NiMH batteries could work.
Leo..

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.