# Safe to power LED strip via ESP32 GPIO

I want to rewire a battery powered LED strip (as shown in the picture below) to power via an ESP32's GPIO pin. I have a ESP32 NodeMCU Development Board, powered via USB.

The LED strip has specified 3,2V/20mA for the 100 LEDs. It originally uses three AA batteries. From what I've gathered the ESP32 should have a max current output of 40mA.

Other than the LED strip, the ESP32 uses WiFi and addresses a DHT22.

The goal would be to turn the LEDs on/off via a GPIO, for example:

``````pinMode(4, OUTPUT);
digitalWrite(4, HIGH);
digitalWrite(4, LOW);
``````

Would it be safe to power the LED strip via a GPIO pin?

...3,2V/20mA for the 100 LEDs...

From here we find this comment:

Most common LED’s require a forward operating voltage of between approximately 1.2 to 3.6 volts with a forward current rating of about 10 to 30 mA, with 12 to 20 mA being the most common range.

(Actually there are low current LED on the market now that only need about 3mA to operate. Let us assume this is what you have for our calculations.)

So, given the above is true, and if your string of LEDs were all in parallel and had average specifications, we calculate the current and voltage of the string of 100 LEDs:

``````Current: 100 x 3mA = 300mA or 0.3 Amps
``````

(Note: When designing with LED you should always refer to that LED's specification. The above 30mA and 2 Volts is only a guess.)

So, even if your LEDs are of the low current type, you can see a string of 100 such LED in parallel exceeds the initial expected current for the entire string of 100 LEDs.

This assumes the LEDs are in parallel and the power source is a constant voltage. What if the LEDs are in series? Then you would need a constant current power source. Again let's assume the individual LED specifications are 2 Volts and 3 mA. Now the calculations might look like this:

``````Current: About 3mA.
Voltage: 100 x 2 Volts = 200 Volts
``````

Obviously the voltage far exceeds the capability of three 1.5 Volt batteries.

Ah! Bigclivedotcom gives us some insight in his 2017 youtube video about repairing several variations of low voltage LED strings. The 3 different strings he uses in his video address how these LED strings can be made such that different voltage and current sources can be used to power them.

In conclusion it is likely your string of LED will require more current to power then a GPIO pin who's maximum current rating is only 40mA can provide safely.

• If you still want to use this string of LED @emma.makes I can extend the answer to describe a possible approach. But it would involve soldering and adding resistors and using a voltage / current meter. It would be simpler to buy loose LEDs and resistors. But that wouldn't be as fun. Jun 27, 2021 at 13:54
• so you say the LED string in Question will no light with 3 AA batteries? but that is a working product not a DIY
– Juraj
Jun 27, 2021 at 14:41
• @st2000 Thank you for your elaborate answer! I have no problems with soldering and adding resistors! I could also measure the current drawn by the LEDs when powered by the three AA batteries. One alternative I see, is to use the 3.3V power pin from the ESP32 and control power with a transistor via GPIO. Jun 27, 2021 at 14:50
• @Juraj, I have no doubt that the LED string in the question lights up using 3 x 1.5 Volt batteries. But I don't know how the string of LEDs are connected. Guessing, I might assume they are connected in what BigClive called a Z arrangement. Possibly 50 parallel groups of 2 in series LEDs. That might give us about 4 Volts at about 150mA (given that (again, this is a guess) each LED is rated 2 Volts at 3 mA). Such a load is reasonable for 3 in series AA 1.5 Volt batteries. Jun 27, 2021 at 15:17
• @emma.makes, that's a great idea to control the string of 100 LED using a transistor. But the ESP32 usually runs on 3.3 Volts. Before going down this road consider testing if the string of 100 LEDs will light up using a 3.3 Volt power supply. And while you are doing that consider testing the current to find the necessary capacity of the transistor you will be using to control the string of 100 LEDs. (Can you switch voltages higher then 3.3 Volts such as the 3 x AA 1.5 volt batteries? Yes. You just need to take care how you design the circuit.) Jun 27, 2021 at 15:24