ESP8266 5v required to control 12v ceiling led's

Hello, i've just joined the forum as i'm awaiting delivery of a few ESP8266's and am rather stuck.

I have 13 MR16 12v LED's in my false ceiling. There is no access apart from where these bulbs fit, however i wish to give them WIFI control so that i can switch individual bulbs on or off.

The current setout is as follows:
240v -> 12v LED Controller -> MR16

I'm thinking that i can connect the relay in between a wire from the 12v output of the Relay, however i don't know how to get 5v to power the ESP8266. I

Could somebody please assist?

Hope i'm in the right forum..

Many Thanks

Depending on the voltage regulator on your ESP8266 breakout variant, you may be able to power it directly from the 12 volts from your LED controller, assuming your controller provides 12 volts DC fully isolated from the mains supply.
If that is not OK, you can use simply a micro USB cell phone charger.
The NodeMCU (Lolin) I'm looking at right now has an AMS1117 which can tolerate 15 volts.
13 relays sounds a lot, and their power consumption will be considerable. Maybe you should see if mosfets could be used instead. Also, the ESP8266 has a limited number of usable pins so you may have to cosider using a port expander like the MCP23017.

Take a look at buck voltage converters. They are only a few dollars.

Esp needs 3.3V, not 5V.

6v6gt:
Depending on the voltage regulator on your ESP8266 breakout variant, you may be able to power it directly from the 12 volts from your LED controller, assuming your controller provides 12 volts DC fully isolated from the mains supply.
If that is not OK, you can use simply a micro USB cell phone charger.
The NodeMCU (Lolin) I'm looking at right now has an AMS1117 which can tolerate 15 volts.
13 relays sounds a lot, and their power consumption will be considerable. Maybe you should see if mosfets could be used instead. Also, the ESP8266 has a limited number of usable pins so you may have to cosider using a port expander like the MCP23017.

Thank you for your reply. I also have a NodeMCU which also has a AMS1117 present. I'm afraid you've lost me with the mosfets. I thought i'd need a relay so that i could remotely switch on individual MR16's. Could you also elaborate on the microUSB charger to which you refer?
As someone also mentioned i thought that the ESP required only 3.3v? Sorry for being dim.. i'm rather new to all this

Use a buck converter to give you the 5v or 3v from the 12v.

Instead of a relay, you might want to use a MOS FET. IRF520

Doug101:
Use a buck converter to give you the 5v or 3v from the 12v.

Yes

Doug101:
IRF520

No. IRL520 perhaps. You need to choose one with Logic-level gate.

A MOSFET is a type of transistor. It can replace a relay in this type of application. MOSFETs are smaller, much lower power and don't click or wear out.

Why IRL520 and not a IRF520? I'm working on a similar project and have 45 IFR520. Working fine.

Doug101:
Why IRL520 and not a IRF520? I'm working on a similar project and have 45 IFR520. Working fine.

Yes, but working with what?

IRF520 has a gate threshold voltage between 2 and 4 volts. So if you are driving it with 5V logic, you are definitely exceeding the gate threshold and switching the MOSFET on. But even then, it might not be fully saturated and achieving its minimum on-resistance. That could result in some heat, voltage drop and earlier failure.

If you are driving it with 3.3V logic, that might not be enough to switch it on at all, certainly not to saturate it, resulting in a lot of heat and a pretty short life.

IRL520 has a gate threshold between 1 and 2 volts, so even with 3.3V logic, it should be reasonably saturated, stay cool and have a long life.

I'm using the 520.

For my application I'm using the output from a 2560 which is 5v. The bulbs I am using are mini-incandescent Christmas lights. There's no voltage on the blubs. I think operating voltage is around 2.5 but they are dimly lit. I'm driving them at 5 and found they blow at 10 - 11. 5v appears to be working.

Doug101:
I'm using the 520.

For my application I'm using the output from a 2560 which is 5v.

That was my point. You are using the IRF520 with a 5V Arduino, so you are exceeding the gate threshold by at least 1V. And it sounds like the current is low, so even if the mosfets are not fully saturated, heat is not going to be much of a problem for you. But the OP is using a 3.3V Arduino and those MR16 will draw more current, even though they are led not incandescent, so the IRL520 would be a better choice for the OP. There are many other logic level MOSFETs available, of course, such as stp16nf06l.

You learn something new everyday. I always thought that Relays were the defacto switch. I've known of Mosfets for years but never knew what they were about until now.

My concern is that if i tap a Mosfet into the wires leading out of the 12v LED Transformer to drive both the 5V ESP8266 as well as the 12v LED Bulb that it would put strain on the transformer.. is this correct? I don't want to burn the house down.

Thanks

You keep saying 5V. It's 3.3V.

If I were you I would test the circuit for several days to check it does not get warm before I put it in the ceiling.

What power are the MR16 bulbs? If they are 3W, then the current for all 13 of them will be around 3/1213=3.25A. The esp will draw around 80mA at 3.3V. The mosfets almost nothing. The DC-DC converter will draw about 803.3/12/0.85=25mA at 12V to supply the 80mA at 3.3V, assuming it is 85% efficient. That's less than an extra 1% for the transformer to handle.

On to your next problem. You want to control 13 bulbs individually so you will need 13 MOSFETs. The esp only has around 8 pins you can use for controlling the MOSFETs. What was your plan? Are the MR16 dimmable and do you want to dim them?

PaulRB:
You keep saying 5V. It's 3.3V.
. . .

It does have a voltage regulator which addresses the issue of powering at 5volts even if the contained module runs natively at 3.3volts.

Of course, the pin voltage of 3.3v is relevant for driving, say a mosfet.

In this instance, however, it is not clear if a logic level mosfet is necessary since the OP is yet to produce a wiring diagram of how he intends to integrate his new devolpment in the existing circuit.

If the existing manual switches are high side, which they usually are, then it could make sense to use a non-logic level P channel mosfet on the high side which would be driven by a NPN transistor

The OP already has a nodeMCU and has ordered some more esp8266 but did not say whether they are bare modules or development boards, so they might not have regulators. Either way, if you are going to use a DC-DC convertor, you might as well set it for 3.3V any bypass any regulator. Setting the DC-DC convertor to 5V and using a 3.3V regulator as well would only use more current and create more heat than necessary.

I don't understand your comment about switching on the high side. The existing switch is almost certain to be switching the live wire of the mains AC that feeds the 12V AC-DC transformer. For switching the DC voltage, a low side n-channel MOSFET would be easier, wouldn't it? Am I missing your point? With this type of lighting, the + & - 12V is normally isolated from mains neutral/earth and fed to each light in parallel.

The IRL520 almost certainly won't work well with an ESP8266, as 3.3V is simply not enough to really switch it on. It's the lower-current version of the IRL540, and that one won't deliver as little as 1-2A (it's rated for 28A current) with a 3.3V gate voltage.

From personal experience I can tell you that the IRLML2502 (can handle 4.2A) and PMV16XN (up to 8.6A) are suitable for switching with 3.3V. Minor disadvantage: SOT-23 package only, so you may want to add a breakout board for easier handling.

There do exist MOSFETS that switch well at 3.3V in through-hole packages but they're rare.

PaulRB:
. . .

I don't understand your comment about switching on the high side. The existing switch is almost certain to be switching the live wire of the mains AC that feeds the 12V AC-DC transformer. For switching the DC voltage, a low side n-channel MOSFET would be easier, wouldn't it? Am I missing your point? With this type of lighting, the + & - 12V is normally isolated from mains neutral/earth and fed to each light in parallel.

I see now there are no existing switches on the low voltage supply to the lamps so the OP is probably free to switch either power rail. You are correct. Doing this on the low side is usually easier when the switched circuit has a different voltage to the driver because it needs only a (logic level) N channel mosfet. Under some circumstances, though, it is not so easy, for example a car headlamp where the light bulb is grounded very close to the mounting and there is only a high side wire to tap into, so a high side solution is the practical one.