Power esp8266 and led strip with a single source

I'm trying to build a wireless RGB led controller with a Wemos D1 mini, with this tutorial I've managed to light up the way I want.

But this setup would require 2 different power sources, one of 12V for the led strip and another of 5V for the ESP8266 board.

I know I can build a "voltage converter" because that's how those USB Car Cigarette Lighter Power Adapter / Charger work

So I'm thinking. Can I hack one of those adapters to receive a 12V input from the power grid outlet and provide a stable 5V for my board?

My board is a Wemos D1 mini, which takes a 3.3V. Could I, easily, provide this voltage?


P.S.: I have a background in computer science, I'm a developer and I'm starting to work with electronics, Arduino and stuff in this project, please be patient with me.

Isn't it easier to just power the Wemos D1 mini with a 5volt cellphone charger with micro-USB lead.
Leo..

Wawa:
Isn't it easier to just power the Wemos D1 mini with a 5volt cellphone charger with micro-USB lead.
Leo..

Yes, it is, but I want only one power source, like this:

A 12V to 3.3V buck converter will do the job just fine.

nicoskaralis:
I know I can build a "voltage converter" because that's how those USB Car Cigarette Lighter Power Adapter / Charger work

So I'm thinking. Can I hack one of those adapters to receive a 12V input from the power grid outlet and provide a stable 5V for my board?

You can get a step down regulator, which is essentially the electronics inside the car-cigarette-adaptor directly.

These regulators have an adjustable output voltage, which you would set to 5 V and input to your Wemos D1 on the board's 5V pin.

I'd recommend against providing 3.3V directly from the step down converter as this makes the wiring and performance of the step down converter more critical than would be with using the Wemos on-board regulator.

The item you are looking for is a dc-dc buck converter. Also known as a step-down.
Use the 12v for LEDs, parallel a line into buck to get 5v for the MCU.
I did that for a xmas light setup.

A dc-dc buck converter sounds exactly what I want.

Can you point me to a tutorial on how to use one?

You don't need a tutorial for that. You connect 12V at one end and your multimeter that the other end, set to the 20V range. Then adjust the tiny pot on the board to get 3.3V. Then disconnect your multimeter and connect the Wemos though it's 3V3 pin (and ground of course).

Cool, Thanks

I will try and post it here the results

MrMark:
I’d recommend against providing 3.3V directly from the step down converter as this makes the wiring and performance of the step down converter more critical than would be with using the Wemos on-board regulator.

Can you explain in more detail please?

These tiny ones work well.
s-l300 (14).jpg

s-l300 (14).jpg

PaulRB:

MrMark:
I'd recommend against providing 3.3V directly from the step down converter as this makes the wiring and performance of the step down converter more critical than would be with using the Wemos on-board regulator.

Can you explain in more detail please?

The ESP8266 uses a few tens of milliamps in normal operation, but when the radio is transmitting, the current consumption is much higher. I've seen brief current spike measurements on the order of 300 mA. Thus if the power supply is not robust there may be voltage sag at the ESP MCU which cause it to crash. This is a common problem with persons using the bare ESP modules (e.g. ESP-01) and much less a problem with persons using regulated power on module devices (e.g. NodeMCU or Wemos D1). It's also a fairly obscure pitfall and difficult to see without measurement equipment most hobbyists don't have on hand.

The potential issue with an off-board regulator is that the relatively high (compared to circuit board traces) resistance and inductance of the wires bringing in regulated power can cause significant voltage drops when the current spikes. That's not to say that off-board regulation can't be made to work, but enough people have experienced issues with ESP modules that it's a hazard best avoided unless there's a compelling reason to go there, particularly the electronics novice.

+1
Just set the buck to 5volt, and feed that into the 5volt pin of the WeMos.
The onboard linear 3.3volt regulator will take care of the rest.
Leo…

nicoskaralis:
I'm trying to build a wireless RGB led controller with a Wemos D1 mini, with this tutorial

A TIP31 with 1k base resistor to drive a LED strip is not a smart move.
Driving that with a 3.3volt pin is even worse.

A TIP120 with 330ohm base resistor could be much better (more light).
A mosfet is even better, assuming you can find one with low enough Vgs(th).
Leo..

Go with setting the convertor to 5V then, to keep MrMark and Wawa happy. It's less efficient and more energy will be uneccessarily wasted as heat in the Wemos' regulator, but they are worried you might use wires that would be too long or too thin between the convertor and the Wemos that would be a problem at 3.3V but not quite long or thin enough to be a problem at 5V.

PaulRB:
Go with setting the convertor to 5V then, to keep MrMark and Wawa happy. It's less efficient and more energy will be uneccessarily wasted as heat in the Wemos' regulator, but apparently my idea too hazardous for novices.

I like the idea of using the onboard regulator, here in my city the power source are known for burning some home appliances and it is not easy to replace components here (2-3 weeks for replacement)

Wawa:
A TIP31 with 1k base resistor to drive a LED strip is not a smart move.
Driving that with a 3.3volt pin is even worse.

A TIP120 with 330ohm base resistor could be much better (more light).
A mosfet is even better, assuming you can find one with low enough Vgs(th).
Leo..

Thank you for your suggestion. I am still having this problem of LEDs not bright enough.

Can you explain to me how to calculate the best resistor to use?

I have only TIP31 transistors and a couple of resistors (1k, 220, 480 and others I can't remember right now), I could get more but that will take a long time

Base current for that transistor needs to be ~10% of the collector current for full saturation.

Question is, how much current is the strip channel drawing.

Example:
Strip length is 5meter, and has 60 LEDs/meter.
Strip uses 20mA per three LEDs (one colour).
That's 300/3 = 100*0.02A = 2Amp per colour channel.
That means a transistor base current of 10%, or 0.2Amp, or 200mA.
No Arduino pin can provide that.

Solution is using a darlington (mentioned in StackExchange and in post#13), or a mosfet with very low Vgs(th).
Leo..

Wawa:
Base current for that transistor needs to be ~10% of the collector current for full saturation.

Question is, how much current is the strip channel drawing.

Example:
Strip length is 5meter, and has 60 LEDs/meter.
Strip uses 20mA per three LEDs (one colour).
That's 300/3 = 100*0.02A = 2Amp per colour channel.
That means a transistor base current of 10%, or 0.2Amp, or 200mA.
No Arduino pin can provide that.

Solution is using a darlington (mentioned in StackExchange and in post#13), or a mosfet with very low Vgs(th).
Leo..

I understand what you are saying, but it is making more confused. At the moment I want to understand how to calculate these values.

What if my strip uses a different resistance, how do I calculate the values I need?
You didn't mention a resistor to connect between the GPIO and the transistor, should I assume any will work?

on the side note: Let's say I've cut the strip to 1m, can I still use the same circuit for 5m? Will that damage the LEDs?

What I need right now is a back to basics approach. What I know:

  • I know I can't connect the strip directly to the Arduino's power source because 3.3V is not enough to power the entire LED strip
  • I know I can't power a channel on the strip with the Arduino's GPIO current because the current is too low to pass all strip resistors
  • I know the current needed on the strip is close to 2A but the original power source is only 1A (12V) and seems to work fine so I need to measure the current used
  • I know a transistor can increase the current pulled from the power source

What I want to know:

  • How do I choose a transistor that will give me all the current I need?
  • How do I calculate the best resistance that is needed from the GPIO to the transistor?
  • Assuming I'm stuck with a transistor, how do I calculate the resistance needed to pass enough current?
  • If I'm using a darlington, how do I calculate the resistance needed to pass enough current?

I've run these simulations on the EveryCircuit app:

This is the current circuit

This is the darlington version suggested

These simulations did not help me understand what changed. I mean, I can see the current changing, but I did not see any difference in the simulated LEDs output

I'm sorry to drag this for so long, but like I've said. I'm new to all this

Are you sure your RGB LED strip is 12V ?

The ones WS2812B I bought were 5V. Granted there may be new technology that I am not aware of.

I run mine from a 5V/10A AC adapter.

ieee488:
Are you sure your RGB LED strip is 12V ?

The ones WS2812B I bought were 5V. Granted there may be new technology that I am not aware of.

I run mine from a 5V/10A AC adapter.

I'm sure, my LED strip is an SMD 5050 that uses the remote controller bellow and has 4 wires: +12V, R, G, B