HI,
What is the best (and cheapest) way to convert 220V AC to 5/3.3V DC for powering Nodemcu? The nodemcu will be connected to a relay so it needs to be powered 24/7 x 365 days reliably. Also need a small module (mobile chargers are out of scope) as they need to be enclosed in a small box.
How does Sonoff basic convert the 220V to 5V AC, considering the whole device is so cheap?
Please don't suggest Hi-Link AC-DC 220V-5V Step-Down Power Supply Module or similar as they are relatively expensive compared to cost of other components.
Any advice?
Temerity:
HI,
What is the best (and cheapest) way to convert 220V AC to 5/3.3V DC for powering Nodemcu? The nodemcu will be connected to a relay so it needs to be powered 24/7 x 365 days reliably. Also need a small module (mobile chargers are out of scope) as they need to be enclosed in a small box.
How does Sonoff basic convert the 220V to 5V AC, considering the whole device is so cheap?
Please don't suggest Hi-Link AC-DC 220V-5V Step-Down Power Supply Module or similar as they are relatively expensive compared to cost of other components.
Any advice?
Wrong engineering parameter. Should be "what is the cost of failure"?
Paul
What is the maximum current the converter will supply?
Paul_KD7HB:
Wrong engineering parameter. Should be "what is the cost of failure"?
Paul
Can you suggest a viable solution?
Temerity:
Also need a small module (mobile chargers are out of scope) as they need to be enclosed in a small box.
This makes no sense to me. Mobile phone chargers and similar 5V wall-wart PSUs are tiny, cheap, reliable and as common as mud. What on earth would make you want to reject this option? You are not going to find a cheaper more reliable PSU. They're regulator approved, as safe as well.
If the form factor really bothers you, then take a dremel to it and extract the PSU board(s) from inside a wall wart.
Computer power supplies work well, just make sure that if it has a green wire to connect that to ground using a resistor (otherwise it won't work).
Henradrie:
Computer power supplies work well, just make sure that if it has a green wire to connect that to ground using a resistor (otherwise it won't work).
Methinks you are making fun of the OP! 
Temerity:
Also need a small module (mobile chargers are out of scope) as they need to be enclosed in a small box.
It's OK, we do think he was being unreasonable unrealistic too. 
the better the question the better the answer.
you can get a 220v cell phone charger and use that to power your Arduino
when you say 'lamp'
I think 100 watt Metal Halide as that is the type of lamps I use day in and day out.
they are powered by a ballast that is wired to take in the 120/208/203 or 277 volts available here in the US in most factories and then converts to the power needed for the lamp.
we also use a lot of fluorescent lamps, same thing, get the correct ballast. most are universal and can be wired for 120/208/230/277 volts.
so, for your lamp, just use the proper ballast.
of course, if your lamp is different, then you will need to be a bit more specific.
In re-reading your post, it sounds like you want to bring 220v to a circuit board.
this is pretty much illegal.
this falls into the category of, if you are not trained in high voltages, you should not be touching them.
you must have circuit protection that is rated lower than the wires it is connect to.
the wires from your home circuit breaker panel are rated for more power than the circuit breakers.
that way the breakers fail (trip) before the wires melt.
if you bring 220V into an enclosure, to meet code, it must be physically separated from any low voltages.
but this is already more information that you have given.
if you want to see how a sonoff does it, look at the cost of parts when you buy 10,000
and then buy a sonoff and take it apart.
the only safe way is to get a 220v plug, plug in a power supply like a cell phone charger or computer supply or one with more power that you can get from any sources on-line.
as a note, if you are intending to play with 220 volts, the fun and games are lethal with the smallest mistake.
even professional electricians are methodical and careful. wear safety glasses as melted copper and human eyes are not a good mix. I have heard more times than I can count that electricity is like a coiled snake and is only waiting for the opportunity.
Temerity:
Please don't suggest Hi-Link AC-DC 220V-5V Step-Down Power Supply Module or similar as they are relatively expensive compared to cost of other components.
can you give us your threshold of the cost of a human life ?
if the unit fails and someone gets electrocuted it is good to have some baseline of the price threshold.
I would offer that if you put a device in a residence that would add to the number of casualties and even the cost of rebuilding.
Temerity:
How does Sonoff basic convert the 220V to 5V AC, considering the whole device is so cheap?
You mean THIS? https://www.banggood.com/DIY-Wi-Fi-Wireless-Switch-For-Smart-Home-With-ABS-Shell-p-1019971.html?cur_warehouse=USA
From low-price banggood, only $9 plus $3 shipping cheap!
Amazon sells a 4-pack for $26.
And I have bought regulated switching power supplies 5V 1A for less than $3 many times.... but whoops, the prices got Trumped-Up by our Idiot-In-Chief so now it's more winning for someone, just not us. I'm guessing that "winning" is the new way to spell "inflation".
Still, less than $4 for 1.
https://www.ebay.com/itm/USB-Double-Wall-Fast-Charger-Adapter-1A-2A-5V-For-Android-Galaxy-iPhone-New/202629164511?hash=item2f2da3addf:m:miW4z2E_GDMcIP9xaDVYgbQ
And that is certified by what authority?
The ones I get work fine.
I have nice 60W OEM switching power supplies with adjustable output voltage but they're bigger and cost twice as much. Real nice though, screw terminal inputs and outputs with hinged plastic cover. The case is perforated sheet steel, there is no fan and they do sell beefier supplies.
These don't have adjustable output but
Low end there is 5V 2A for $1.28. It looks right about what the OP ordered for less than $2.
Temerity:
Can you suggest a viable solution?
When you answer the question.
Paul
GoForSmoke:
The ones I get work fine.
I suppose they do.
Recently I bought a couple of (Edit: don't bother looking - eBay link long disappeared!
- some sort of Li-Po battery charger) these:

Of course, I tried one out, being careful not to touch the battery while plugged in except by a quick flick of the finger.
The other one I of course, disassembled, finding two of the screws under the back label.
Isolation between primary and secondary circuits whose tracks run together for considerable distances on the phenolic PCB is of the order of 1 mm and whatever interleaving is between the windings unseen in the tiny transformer. Double insulated it is not! 
I very much doubt this would pass any standards authority in the "first world"; and I would be rather surprised if those unbranded wall chargers would differ. Especially noting how much of the casing depth is taken up by the USB sockets! I know Apple ones (genuine) are cleverly built, but the teardown articles on these others are alarming.
Paul__B:
And that is certified by what authority?
Mine seem to have either CE or UL and other recycle and use symbols.
I got my wall warts through a seller that is emphatic about only selling dependable, regulated supplies.