0
\$\begingroup\$

I've found this esp with relay pack: enter image description here

The only thing missing for this board to work is the 5v dc power supply. Normally a 110vac-5vdc power supply will have some filtering and other things needed to charge batteries and so. I think these things can be removed from the equation. I need something that will still make the entire set (the relay shield with esp + power supply) very cheap.

I know that it's pretty easy to convert AC to DC using diodes and possibly other very very cheap components. What about converting from 110v to 5v? What is the minimum that needs to be done for the ESP to work without entering in a buggy state?

If possible, is there a tiny board available with this solution?

link for the product

\$\endgroup\$
6
  • \$\begingroup\$ The simplest is probably a capacitive dropper, used in many cheap designs. It's not very robust or safe of course, that's the price of cheapness. \$\endgroup\$ Commented Jul 31, 2018 at 4:52
  • \$\begingroup\$ es.aliexpress.com/store/product/… \$\endgroup\$ Commented Jul 31, 2018 at 4:59
  • 1
    \$\begingroup\$ The 110VAC-5VDC power supply is just that: a power supply. It does not charge batteries any better than it powers a Raspberry Pi. It's simply a regulated, but otherwise dumb, DC supply. Any battery charging/management smarts go with the battery itself, and not in the "wall-wart". \$\endgroup\$
    – AaronD
    Commented Jul 31, 2018 at 5:27
  • 4
    \$\begingroup\$ You may also find that the ESP requires a tightly regulated supply for guaranteed operation. By the time you re-engineer that, you might as well just use a wall-wart with micro-USB output. \$\endgroup\$
    – AaronD
    Commented Jul 31, 2018 at 5:30
  • 2
    \$\begingroup\$ HLK-PM01 for up to 600 mA. If below 1 A, the HLK-5M05. \$\endgroup\$
    – jonk
    Commented Jul 31, 2018 at 5:48

3 Answers 3

6
\$\begingroup\$

Well you did ask whats the simplest circuit so...

schematic

simulate this circuit – Schematic created using CircuitLab

You might prefer to just use an old 5V cellphone charger. This would be easier, and poses less risk of electrocution. On the subject of safety, the pcb layout pictured on Aliexpress appears to have insufficient clearance around the relay for mains voltages.

Now since the nervous nellies are getting their knickers in a twist about it being directly connected to the mains, and therefore dangerous. They seem to have failed to notice that

  • this is a completely legal design, from the electrical safety point of view, as you are using a wireless device, and while it is in a box, it is safe.
  • the power supply is no more dangerous that the wires and PCB connections to the switching relay when switching mains.
  • when working with "hot" circuits use an ELCB/GFCI

That said, while this is the simplest power supply (what you asked for), it is very inefficient, gets hot, and has the main safety concern - you can break the glass bulb. It would however be perfect for an IOT egg incubator, or dry cabinet, but not much else.


How to make a transformerless supply for some of these low cost wireless devices is a pretty interesting question. The usual trick is a series capacitor, but the capacitor gets big and expensive for higher currents, like those needed to operate a 5V coil relay (e.g. 80mA).

This trick uses a higher coil voltage (24V=lower current 16mA), and puts the relay in series with the 5V supply, so it doesn't increase the current when on at all.

schematic

simulate this circuit

Now if you touch the output and phase and neutral are swapped, a fatal shock is possible. But if we split the capacitor, then the current is limited regardless of which wire is phase. A 30mA shock in unlikely to kill, so this arrangement can be much less likely to be lethal. In fact you will observe that on 120V, the voltage will only be 60V, which the IEC considers "safe to touch with dry hands"

schematic

simulate this circuit

If we were using something much lower power than a relay, then if we used Type Y2 safety capacitors, and have current less than 3.5mA, which would run a bluetooth device for example, then it would be considered safe under IEC950 (according to this)

\$\endgroup\$
5
  • 1
    \$\begingroup\$ Given the wording of the question, I'm not convinced that the OP really knows all of what he's doing. I could have posted my own answer for a similar design, but didn't because he might just blindly wire it up and wonder why it keeps shocking people. (or worse) Never, EVER allow a connection from AC mains to user, no matter how convoluted it might be. \$\endgroup\$
    – AaronD
    Commented Jul 31, 2018 at 5:44
  • \$\begingroup\$ @AaronD I agree, but I'll do two things a) upvote b) add your warning to the answer. \$\endgroup\$ Commented Jul 31, 2018 at 8:42
  • \$\begingroup\$ Isn't transformer less designed circuit dangerous? \$\endgroup\$
    – MaNyYaCk
    Commented Jul 31, 2018 at 10:19
  • 1
    \$\begingroup\$ @MaNyYaCk mains live is dangerous, in portable appliance design mains neutral is also normally regarded as dangerous because of the possibilities of reverse polarity and lost neutrals. Therefore the output of a transformerless power supply must be regarded as dangerous. That doesn't mean a product containing a transformerless power supply must be dangerous, it just means that appropriate measures must be taken to prevent people from coming into contact with the dangerous conductors. \$\endgroup\$ Commented Jul 31, 2018 at 14:34
  • \$\begingroup\$ @PeterGreen I see. I would like to learn about those appropriate measure. Can you point me to some reliable sources? \$\endgroup\$
    – MaNyYaCk
    Commented Aug 1, 2018 at 4:46
1
\$\begingroup\$

The cheap soloution is generally some form of capacitive dropper. As Henry Chun says in his answer you probablly want to use a higher voltage relay to reduce current draw and he comes up with a neat design that puts the relay in series with the load.

However mains live is dangerous, in portable appliance design mains neutral is also normally regarded as dangerous because of the possibilities of reverse polarity and lost neutrals. Therefore the output of a transformerless power supply must be regarded as dangerous.

Therefore if you use a transformerless power supply you must be very careful to protect people from contact with dangerous circuitry. People in this case includes the end user of this product, but also people involved in it's development and servicing.

End users will likely be protected by putting the device in a sturdy box which is either insulated or earthed, but this raises several questions.

  1. How will users interact with the device, obviously wifi is the main method but wifi requires setup. How will that be handled? will there be any buttons or indicators? if so you need to ensure that those buttons/indicators are designed in such a way that they provide adequate insulation.
  2. How will you mount the device in the box. If you use metal mounting hardware on a plastic box then that can potentially provide a means for dangerous voltages to make their way from inside to outside.

Development and service personell will likely be protected through procedures. Maybe those will involve a method of powering the system from a safe bench supply, maybe they will involve an isolated programmer, maybe they will involve programming the module out of circuit, either way those procedures need to be thought through.

\$\endgroup\$
1
\$\begingroup\$

The maximum draw of the ESP8266 can approach 200mA. The relay will draw 75mA or so, so you should probably budget for 250mA.

enter image description here

While you could use a few watt 120VAC:10VAC transformer, 1A bridge rectifier, capacitor (perhaps 2200uF/16VDC) and LM7805 regulator bolted to some metal for a heat sink (4 components total), I would suggest a 120VAC:5VDC USB "charger" as the practical solution.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.