1

I've been struggling with this for a while : am looking for a way to power an ESP32 microcontroller (at 3.3V, or 2.6-3.6V) from a 220V line.

I am trying to do this using only my home'e electrical wires (no plug, so can't use a USB charger).

The question I'm looking an answer for could be reformulante to : What composent is used in USB chargers to produce a 5 or 3.3V signal from 110 or 220 V line at home ?

Apologies if this is a duplicate, I've tried googling and reasearching on this site but keep coming up with irrelevant subjects. Ideally, I'd find a ready made (black box type) component I can buy. It is important this composent be very small.

kmn
  • 115
  • 4
  • 4
    Just use a wall wart? You don't want to be messing with mains power if you don't have a very good idea of what you're doing, that stuff's deadly. – Hearth Aug 27 '19 at 20:28
  • 2
    "... can't use a USB charger ..." and then you want to know what components are in one so you can make one! You won't build one as cheaply, small and, in most cases, as safe as one you can purchase. Vote to close as "too broad". – Transistor Aug 27 '19 at 20:33
  • 1
    What problem are you *really* trying to solve? This sounds like an [XY Problem](https://en.wikipedia.org/wiki/XY_problem). – TimWescott Aug 27 '19 at 20:38
  • You are looking for an off line regulator. Be sure to check local building codes before you try to actually do whatever you're thinking of doing. – TimWescott Aug 27 '19 at 20:39
  • 1
    The "component" used in a USB charger is really several components - a Switch Mode Power Supply (SMPS). As @Transistor says, you can't make one as small, cheap, and safe, as buying a ready-made one. – Peter Bennett Aug 27 '19 at 20:43
  • 3
    Suggest we leave this question here as a signpost to the discussion on transformerless power supply (and why it is such a hazardous, dangerous approach): https://electronics.stackexchange.com/questions/359107/transformerless-power-supply/359113#359113 – MarkU Aug 27 '19 at 21:09
  • I'm already using a relay to switch the line, (working on a home automation project). The setup is very safe. @TimWescott it's in a garage! – kmn Aug 27 '19 at 21:26
  • @TimWescott Basically what I'm trying to solve is find the name of the component that will achieve this transformation - without necessarily rebuilding one – kmn Aug 27 '19 at 21:27
  • 1
    “In a garage” lol that has absolutely nothing to do with your safety! – Tyler Aug 27 '19 at 21:27
  • @Tyler, was replying to a comment in which TimWescott mentionner BUILDING CODES. Hope that's clear now. Read the thread – kmn Aug 27 '19 at 21:28
  • 1
    Garages burn, too. I already told you you're looking for an off-line regulator. Put in a junction box with an outlet from the home store, then plug a USB charger into it. It'll be easier, cheaper, and safer. – TimWescott Aug 27 '19 at 21:29
  • You could buy a DIN-rail power supply. It has screw terminals and can be mounted inside a cabinet. But this should be done by a qualified electrician as well. – Ariser Aug 27 '19 at 21:36
  • If you are working on a home automation project, have you thought about a PLC? They can be powered straight from an outlet, are programmable, and can control relays. – Tyler Aug 27 '19 at 22:27
  • 1
    https://www.digikey.com/product-detail/en/mean-well-usa-inc/IRM-01-3.3/1866-2996-ND/7704615 – Bruce Abbott Aug 27 '19 at 22:38
  • 1
    Hey, closer-crew, OP isn't asking about a product, they are asking about an approach to a problem. Knock it off! – hacktastical Aug 28 '19 at 03:52
  • @BruceAbbott great suggestion, thank you! modules such as this one are exactly what I'm looking for, I just couldn't research it since I didm't know what they were called. – kmn Aug 28 '19 at 15:54

2 Answers2

4

A typical USB charger will use a reduced-size version of a switch-mode power supply (SMPS). This kind of power supply has an isolated, low-voltage output called a SELV, or Safety Extra Low Voltage. Supplies of this type are 'touch-safe', meaning their isolation and low voltage means that contact with the secondary poses almost no hazard (leakage is below 3mA.)

Wall-wart DC supplies are also SELV type. These can be SMPS or traditional step-down transformer type.

As to "what's inside", an off-the-line SMPS is a collection of components. The main ones are the input bridge to make DC, a switching controller, a flyback pulse transformer, and an output circuit. The transformer is key to making it safe to use, as it provides isolation for the secondary.

Pre-made modules that accept 110/220V on wires and make 3.3V output are available and common, which meet SELV isolation limits.

But I recommend another approach. Use a step-down transformer (12 ~ 24VAC) to supply a pig-tailed AC-DC 5V regulator. This kind of low voltage AC wiring is popular for controls like thermostats, doorbells, sprinkler valves, patio lights, etc., so it's cheap and easy to find. It's popular for home automation stuff.

Why do it this way? You avoid the issue of running 220V to your system. This will be safer to work with than using straight off-the-line to your power supply board.

This kind of 12 ~ 24V AC transformer is a common item called a 'bell transformer'. There are even versions that mount directly onto a junction box in place of a cover plate, so it does double duty of covering over the primary voltage wiring, and providing the safe, low-voltage secondary for your use.

hacktastical
  • 49,832
  • 2
  • 47
  • 138
  • Thank you! SELV type SMPS modules are exactly the answer I was looking for! Not sure why others gave me irrelevant answers or marked this as off topic (if you don’t know the name of what you’re looking for where else would you ask ?) – kmn Aug 28 '19 at 12:20
2

Some USB chargers uses a transformer, rectifier (4 diodes) and and LDO (or DC to DC converter). Doubly insulated power supplies might only use a rectifier and a switched power supply. The problem is several of these components use high voltage and need to be built to regulatory standards or they are likely violate local fire code. It would also be much more costly to buy the components separately and try and build your own power supply.

It would be less difficult to add a receptacle for a power supply and use a regular off the shelf power supply.

Voltage Spike
  • 75,799
  • 36
  • 80
  • 208
  • 2
    _"Some USB chargers uses a transformer, rectifier (4 diodes) and and LDO"_ - I'm highly sceptical of that. Can you show an example of an actual USB charger that has a linear power supply? – marcelm Aug 27 '19 at 21:09