I want to create an inverter LED light source. I would be using 2 COB LED lights rated at 4 volt DC, 8 watt. My idea is that when the phase is connected, I want the light to glow and at the same time charge the battery. When the phase is not available I want the bulb to use battery back up and glow.

For an I AC to DC converter, I have two options:

Option 1: transformerless power supply:


simulate this circuit – Schematic created using CircuitLab

Is the circuit diagram is correct?

Option 2: transformer power supply:


simulate this circuit

Is this circuit diagram correct?

Which one is beginner friendly?

  • 1
    \$\begingroup\$ by 'glow' do you mean lit at full rating, or glowing dimly so they can be found in the dark / indicate that it's connected? \$\endgroup\$
    – Neil_UK
    Dec 4, 2023 at 13:30
  • 1
    \$\begingroup\$ Terminology tip: neither of those circuits is an "inverter". Inverters convert DC into AC. You're doing the opposite. \$\endgroup\$
    – Transistor
    Dec 4, 2023 at 13:35
  • \$\begingroup\$ Yeah. Both circuit consist of rectifiers. \$\endgroup\$
    – liaifat85
    Dec 4, 2023 at 16:04
  • 1
    \$\begingroup\$ If you only need 8W that's like 1.6A. Get a 3A USB charger and you should be good to go. It'll probably be cheaper too and also much more easily replaceable \$\endgroup\$
    – slebetman
    Dec 5, 2023 at 3:34

2 Answers 2


The first circuit - capacitive dropper - is totally unsafe, it has a direct connection to the mains. I'm not going to comment on that circuit further, except to note that several important component specifications for mains connection are not shown on the diagram.

The second circuit is much safer, with its isolation from the mains, meaning only the L/N transformer terminals are unsafe. It's a reasonable circuit for a 5 V supply, though the specified transformer output voltage might be a tad low for the regulator dropout voltage, given silicon diodes and C1 droop when supplying nearly 2 A to fully light your LEDs.

However, if you had to ask the question, I'd guess your electronic skill and awareness level is not really up to keeping you properly safe from ANY DIY thing connected to the mains. I would advise you to buy a plug-in wall-wart type of power supply delivering 5 V.

  • 1
    \$\begingroup\$ Thanks for your answer, I would definitely use a ready made 220V AC to 5V DC module which uses a transformer for my DIY project. \$\endgroup\$
    – user357345
    Dec 5, 2023 at 9:26
  • 1
    \$\begingroup\$ Another reason to buy a power supply is that option 2 is a linear power supply circuit which is really inefficient compared to a modern switch-mode power supply. It also has higher parts costs because of the big lump of copper and iron. The only time this century I've designed a linear power supply (OK, power supply design isn't something I do much) was when I needed exceptionally low noise and good regulation on a ±12V photodiode amplifier supply. The low-noise dual-rail PSUs I could buy had too high a minimum current requirement. \$\endgroup\$
    – Chris H
    Dec 5, 2023 at 14:23
  • \$\begingroup\$ I agree on the power supply. However, the "battery charger" part is not addressed by this answer. \$\endgroup\$
    – Jon Watte
    Dec 5, 2023 at 20:01
  • \$\begingroup\$ @JonWatte this is correct but there are small UPS units or PS/UPS units that could provide this. You describe complications in your own answer that significantly increase the difficulty of homemade battery backup. +1 to this answer for identifying a great potential hazard and hopefully there are enough other interesting aspects of this DIY project that the power supply can be ignored. \$\endgroup\$ Dec 5, 2023 at 23:09
  • \$\begingroup\$ "Totally unsafe" is too strong. Many, if not most, off-the-shelf LED bulbs are non-isolated for efficiency and cost reasons. It's dangerous if you don't know what you're doing, which is likely true for all DIY projects. The second circuit can be unsafe if you don't use a safety isolation-rated transformer, properly fuse it, etc. \$\endgroup\$
    – user71659
    Dec 5, 2023 at 23:27

There are two questions here, really:

  1. how to get 8 Watts out of a mains connection
  2. how to provide a battery backup

The absolutely easiest way to get 8 Watts out of a mains connection is to use a cheap, ubiquitous, 5V/2A or 5V/2.5A USB wall wart. You can also buy these things as components from suppliers like Digi-Key or Mouser, although you'll likely pay more in singles than you'd pay for the USB charger from Amazon.

To get a battery backup, you need to choose a battery chemistry, and then have the appropriate circuitry to support safely charging the batteries, without overcharging them. Lithium batteries are extra annoying here, because they don't like being "floated" at their top voltage; doing so leads to premature wear-out.

Also, if your LEDs need 4V to develop full current (2 A if it's 8 Watts) then a bare Lithium battery isn't enough; it will quickly drop to about ~3.8V, and it will slowly discharge through to 3.2V or so at "fully discharged." Thus, you will need some kind of boost/buck regulator when the battery is powering the LEDs. Ideally with an undervoltage cut-off to prevent the battery from being over-discharged and damaged/destroyed.

Finally, there's the "provide 500 mA regulated current to the LEDs" part -- LEDs for illumination are typically specified on drive current, not specific voltage!

Your final solution block diagram would look something like:

Power Supply <-> Battery Manager <-> Current Regulator <-> LED

Each of these typically use IC-based circuits, and many of these ICs aren't even available in through-hole packages, so you might need to buy break-out boards for each block if you want to wire it up on a breadboard.


Your Answer

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