There are a lot of methods to power an Arduino from a large range of voltages:

  • USB cable from PC or from a phone charger or an USB hub
  • step down converters
  • step up converters
  • switching power supply
  • batteries (connected to the power jack or USB or to Vin)

What I can't seem to find is a small 220V-5V converter. I'd like to put an Arduino in the wall, under a light switch, so size matters.

The last resort option is to open a 5V phone charger and replace the metal prongs that go in a socket with two wires, and replace the USB socket with another pair of wires that go the Arduino board, but still, an Arduino Pro Mini or an Arduino Nano is smaller than the phone charger.

  • 5
    Check your insurance if you are covered in case of fire caused by your construction.
    – jippie
    Mar 19, 2014 at 19:13
  • @Josef Your comment looks like a question. If you have a new question please post it as such.
    – Nick Gammon
    Jul 3, 2018 at 12:19

14 Answers 14


The last resort option is to open a 5v phone charger and replace the metal prongs that go in a socket with two wires, and replace the usb socket with another pair of wires that go the arduino board, but still, an Arduino Pro Mini or an Arduino Nano is smaller than the phone charger.

You will probably have to do something like that.

Because of the nature of conversion between AC and DC, there has to be some large parts.* I'm not going to go into the specifics here. There is usually a diode bridge (because AC waveforms reverse the current ~60 times a second) and a transformer (to lower the voltage for the diode bridge). They almost always include a regulator and a capacitor to make sure voltage is exact and it outputs a "clean" power supply.

*Switching power supplies, although considerably more expensive, are a lot smaller and more power efficient.

This adapter seems to be the most compact adapter I can find for 220V. You'll never get something near the size you are desiring, even with a switching power supply. I don't know the size of the Amazon adapter I gave a link for, but in the US (120V), iPhone chargers are very small and they should fit in a standard depth outlet box (with a little room left over for relays and such). If you really need to get everything smaller, I recommend using a ATtiny chip.

How I recommend connecting this:

I would avoid ripping this apart at all costs from a safety perspective. It would be really easy to send 220V to your Arduino if you're not careful. If you absolutely have to, you might want to coat it with some non-conductive epoxy or other coding. Note: this may act as a thermal insulator, therefore reducing the lifespan of the part. You should just coil some wire around the prongs, and then melt a little solder onto each of the terminals. Then, cover that with electrical tape and pigtail (with a wire nut) into a source power line. Note: you probably are doing wiring that could be illegal in your area. Check your local building codes before attempting this.

After that, attach a USB cord to the socket and to the Arduino or the ATtiny/ATmega328 chip 5V/GND input (of coarse, after cutting and stripping one end of the USB cord). I would also, after finalizing all the code and circuitry, seal that with some epoxy or somehow add it to an enclosure to make sure you don't fry your Arduino if a loose wire touches the Arduino circuitry.

If you don't feel safe doing any of the above, don't do it. You can live without a Arduino light switch.

That being said, happy hacking! :P

  • I don't think you can get much smaller than this for a mains -> 5V converter that is isolated from the mains. There are tricks to get non-isolated low voltages, but they are not generally safe. Mar 19, 2014 at 16:15
  • Thank you, I will order a few of these adapters and post here with the results.
    – vlad b.
    Mar 19, 2014 at 18:49
  • @Vladb If you haven't ordered them already I would suggest asking a question on Amazon for the dimensions. Editing my post to suggest how to connect those to the wiring and your Arduino. Mar 19, 2014 at 18:58
  • @Vlad Updated post. Mar 19, 2014 at 19:13
  • No. This is big because it is a linear power supply where the transformer operates at line frequency and so must by physically larger. It's also unregulated and poorly filtered. Switching power supplies as have largely taken over in the past few years are much smaller, because their transformers are operated at the higher switching frequency. Aug 5, 2014 at 16:25

I can suggest you to try this : AC DC Step Down Converter

It is as small as the Apple's tiny cube, and it can be placed inside of a wall easily. (I'm personally using this with an arduino micro)

  • Thank you for the information, i have ordered a few of these too.
    – vlad b.
    Apr 4, 2014 at 6:11
  • 2
    Im not quite about things that go to the mains from aliexpress. Anyone used that thing? Jul 19, 2015 at 23:46

Nowadays, most smartphones come with a charger that is linked to the USB plug of the phone.

The charger for my HTC says: 5V, 1A, I guess this voltage must be regulated (but I haven't checked it has the charger is sealed).

enter image description here

The charger itself has a female USB socket on which you can plug any USB cord to link to your Arduino.

IMPORTANT! I have never tried it myself! I would not bet my life on it! It would be wise to check the output voltage is well regulated.

  • 1
    It's regulated. I've cracked those units open to use the circuit inside in other projects. It's amazingly compact.
    – futurebird
    Aug 26, 2015 at 8:18
  • Simplest and cheapest solution...if it's good enough for Samsung et al then it's... Jul 21, 2018 at 19:33

I use this one, 5V, 3W, very small, and only $3 on Aliexpress. http://www.hlktech.net/product_detail.php?ProId=54


The smallest is probably a plug-in USB charger such as Apple's tiny cube. The cheapest is bound to be a ~9v (output) wall-wart scrounged from the lost and found in a tourist's/traveller's hotel.


There are small board-mount AC/DC converters like this one http://www.digikey.com/product-detail/en/BP5063-5/BP5063-5-ND/658569


An obvious answer has been omitted which is: transformerless power supply. If your average power requirements are low (<10mA) then this is the most compact way to achieve the desired voltage.

For an in-depth study see: http://ww1.microchip.com/downloads/en/AppNotes/00954A.pdf

Another solution: jeelabs.org /2011/11/27/ultra-low-power-supply/

Some limitations:

  • safety - NONE - your circuit might now be floating at line voltage
  • heat dissipation - calculate here: www. daycounter.com/Circuits/Transformerless-Power-Supplies/Transformerless-Power-Supplies.phtml
  • low current - no servos or relays
  • voltage fluctuations on the line might affect the circuit
  • Best answer, much smaller than other options.
    – bigjosh
    Jul 20, 2015 at 4:31

wanted to do a similar thing and I found and just ordered these:


A fully sealed power supply, disk-shaped, 5cm diameter and 11mm thick. THey are available in 3.3V, 5V, and 12V. They are designed to be put inside walls or behind switches.

  • That's pretty neat. The product is discontinued anyway. Is there a version around that can output 2A instead of 600ma?
    – Codebeat
    Sep 6, 2016 at 20:27

Try an LED driver. Their typical output is 11.8V DC, which is in perfect specs for the Arduino. You can find them nowadays in all shapes and sizes, round or square, low profile or boxy. A 500ma version (6W) is more than enough for your needs.


Try something like this. It's 29x15mm and does 220V AC to 5V/3W DC.

  • This one is 51 x 30 x 17.5mm
    – Colin
    Dec 27, 2018 at 8:38

What if you replace the nearest outlet with some kind of USB Wall Socket and attach to that (either through a standard USB plug, or inside the wall) ?


This looks like the smallest and cheapest one from all of the above mentioned: http://www.ebay.co.uk/itm/AC-DC-Power-Supply-Buck-Converter-Step-Down-Module-5V-700mA-for-Arduino-U-/121355318138

  • 1
    It would be helpful if you mentioned some of the details of that converter in your answer. Oct 28, 2014 at 16:18
  • Ordered a few of these, will add comment with the results when I get them.
    – vlad b.
    Nov 10, 2014 at 18:07

Nov 2016 Here is a list of compact PCB mounted power supplies that are small (~50mmx25mmx20mm) from Mouser:


These all take in 120-240VAC and provide outputs in the range of 3 - 5 vdc with varying options for current.

The 5V 1A from Meanwell (IRM-05-5) looks like a good deal at $8.52 each. http://www.mouser.com/ProductDetail/Mean-Well/IRM-05-5/?qs=sGAEpiMZZMuWiaalG5TUgH52QN1%252bIKAVmGC9ENLDVf688EuOMfqROg%3d%3d


  • Wow, that's a nice one. Does it have output galvanically isolated from input (i.e. "can I touch the board powered by this thingie")? The datasheet mentions resistance between input and output and also has a couple of coils on schematics, but I'm still not sure.
    – Equidamoid
    Jul 1, 2017 at 21:09
  • 1
    The datasheet quotes "Isolation Class II". See: en.wikipedia.org/wiki/Appliance_classes#Class_II
    – Paul Carew
    Jul 2, 2017 at 7:11

It's entirely dependent on whether or not you want to isolate the circuit from the mains. You could use a drop resistor a rectifier and a 5v zener diode but I do not recommend this if you are a hobbyist, in fact I don't recommend this at all, but it is done by some manufacturers with appropriate circuit protection.

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.