I am building a light I can control from the command line across WiFi. I've got a Raspberry Pi Zero, a tiny little WiFi dongle from ModMyPi and a relay with VCC, Ground and IN pins. I also bought one of these AC240V to DC5V step down buck converters because I would like to put the whole lot in a box and power it all from the mains.

I thought this would be fine, but when I put all the modules together and get it working the Pi intermittently just turns off and won't show any signs of life until I unplug and reboot the device again.

The problem must be with the power supply - is it too simple/cheap a device? When I measure the voltage across the Pi it varies wildly when the Pi is working, whereas a normal USB charger maintains a steady voltage. Am I missing something? Is there some kind of module I can buy which produces the same quality of 5V DC as a USB charger? Or something (like a capacitor??) I can add to the circuit to ensure a steady voltage?

  • 2
    ⚠⚡ Be aware, that PSU may not be safe & meet CE mark / BEAB approval standards! I cannot accurately judge the spacing between the LIVE Primary and the Isolated Secondary sides of the Transformer/Circuitry but you really want 7 to 8 mm minimum. Also there are no obvious markings on the transformer device that it has been constructed to meet the (fairly stringent) construction requirements for insulation between the two sides. As such, although you may indeed get 5V between the output terminals, but they could both be more than the (safety) limit (in the UK) of 48 Volts away from ground. ⚠⚡
    – SlySven
    Mar 9, 2017 at 13:43
  • E.g. I can see the same device for sale from multiple retailers and on some of them if you look closely on the bottom of the PWB near where the "U2" marking (for the opto-isolator that provide feedback across the "mains barrier") is placed close to one of the secondary transformer pins such that that pin (on the "secondary" side) looks quite close to the opto-isolator pin that has a thin track that goes off to/under the diode marked "D5". The gap there cannot class as a "double-insulation" layer (~6 mm) - though it may be enough for "single-insulation" (~3 mm) but that isn't enough in the UK!
    – SlySven
    Mar 9, 2017 at 13:54
  • ... unless the equipment is housed in an earthed metal box; the mains leads are secured to the PWB with two means of fixing (mechanically retained as well as by solder) and one (probably the negative supply output but it need not be) point in the secondary circuit is bonded to the earth/chassis connection. Also any interconnection wires or anything else in the same enclosure must be mechanically restrained to keep wires from the "secondary"/"isolated" area (the bits with the RPi in that can get touched by users?) entering the "primary"/"LIVE" side that is wired up the mains & visa-versa.
    – SlySven
    Mar 9, 2017 at 14:06
  • I'm inclined to agree with SlySven's assessment above - exercise some serious caution when dealing with cheap things plugged into mains voltage electrics. If it's behaving unexpectedly and you're not sure why, the best policy is to either seek hands-on expert advice locally, or just bin it. It's not worth risking fires or injuries for the tenner it'll cost you for a sensible PSU. I wouldn't plug this in until I was at someone else's test bench.
    – goobering
    Mar 9, 2017 at 14:18
  • Thanks for the detailed warning here. Excellent to get some clarity about these units. I assumed that if you can buy these little things in the UK that must mean they reach safety standards - evidently this is not always the case!
    – Matty
    Mar 14, 2017 at 10:29

2 Answers 2


My personal preference for getting 240V down to something less lethal that'll work with a Pi is an enclosed switched mode power supply. They're pretty safe to work with, are easily mountable, quite robust, and tend to produce fairly stable output. They're not nearly as cheap or tiny as your current module but I think they're also quite a bit more likely to work, and less likely to kill you.

Suitable units in the current/voltage range you're looking for, such as this MeanWell RS-15-5 cost around about £7-£10. The specs for that module are:

  • Output voltage: 5 V DC
  • Adjustable voltage range: 4.75–5.5 V DC
  • Output current: 3 A
  • Output: 15 W
  • Efficiency: 77 %
  • Ripple: 80 mV

  • Closed design (case), screw terminals

  • Switch for 115 V/230 V input voltage
  • Overload protection by means of shutdown, auto recovery
  • Protected against short circuit, overload, excess voltage
  • Long-life 105°C electrolytic capacitors

Additional technical data:

  • Input voltage range: 88–132/176–264 V AC (47–63 Hz), 248–373 V DC
  • Inrush current, max. 65 A
  • Leakage current: max. 2 mA
  • Output voltage adjustment: +10/-5%
  • Overload protection: >105%
  • Insulation voltage:
    • I/P-O/P: 3000 V AC
    • I/P-FG: 1500 V AC
    • O/P-FG: 500 V AC
  • Operating temperature range: -25 - +70 °C
  • Dimensions (L x W x H): 62.5 x 51 x 28mm
  • Weight: 130 g
  • This looks like an excellent solution goobering - thanks for the link, I think I'll try this!
    – Matty
    Mar 14, 2017 at 10:26

It's possible that the current from the buck converter is not stable enough. If it works for a while before it shuts off, that'd be my guess. 700 mA should be enough for the Pi Zero and a wifi dongle. https://www.raspberrypi.org/help/faqs/#powerReqs

You could also try a 700 mA USB Charger.

If that works, try measuring the current in your 5V line.

  • Hey, thanks for this. I tried measuring the current in line during operation when using a 700mA USB charger. It showed around 200mA, which seems about right. The USB charger works fine but the problem is I don't want to have to use two 240V plugs - I want to power the light and the Pi from the same plug.
    – Matty
    Mar 8, 2017 at 18:15

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.