Electronic – Least expensive way to plug in a microcontroller into 120V (without wall wart or batteries)

batteriesmicrocontrollerpowerpower supplywall-wart

I need to be able to power a Atmega168 by plugging it into a wall. The circuit is a little bit more complex but not too much. The Atmega168 needs between 1.8V and 5V at 200mA. The ideal solution needs to be contained all on the PCB board. No wall warts or batteries.

What is a good strategy or set of components that will allow this to be done safely and inexpensively? I'm new to the area but I have heard things about switched-mode power supply. Also, efficiency is not very important as long as it is not hot to the touch.

Best Answer

I don't know if these are inexpensive enough, but the simplest - and safest - way would be to use a commercial pcb mount power supply module like these:

enter image description here RECOM Power RAC01-05SC (Mouser)

enter image description here MYRRA 47122 (Newark)

Or else build a wall wart into your device. I've purchased commercial equipment that had a wall wart mounted internally by means of cable ties, with wires soldered to the wall wart's prongs.