14
\$\begingroup\$

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.

\$\endgroup\$
17
  • 2
    \$\begingroup\$ Does it need to interface with anything? Because there are ways to make an off-line power supply, but they cause the whole microprocessor to be at line-potential, so effectively you can not, and should not touch it when it's connected. \$\endgroup\$ Commented Jun 1, 2012 at 4:42
  • 2
    \$\begingroup\$ They're you're stuck with a transformer or a wall wart. Period. \$\endgroup\$ Commented Jun 1, 2012 at 5:00
  • 1
    \$\begingroup\$ @Fake - yes, I came to the same conclusion when I read the word "safe". \$\endgroup\$
    – stevenvh
    Commented Jun 1, 2012 at 5:03
  • 3
    \$\begingroup\$ @AlexisK - No transformer? You can make a mains power supply without transformer, but then it's not touch-safe. Touching any part may be lethal. \$\endgroup\$
    – stevenvh
    Commented Jun 1, 2012 at 5:08
  • 3
    \$\begingroup\$ @Jeanne - If you have a link to it that could be an answer. \$\endgroup\$
    – stevenvh
    Commented Jun 1, 2012 at 14:42

4 Answers 4

16
\$\begingroup\$

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.

\$\endgroup\$
6
  • \$\begingroup\$ @Jeanne: can you say what type of equipment it was? A client suggested that I do this (put a wall wart in the enclosure and route AC cable outside), but I felt it looked unprofessional so I used an OEM PC board switching supply instead. However, because of cost and space issues causing assembly headaches, I'm reconsidering their idea. \$\endgroup\$
    – lyndon
    Commented Jun 1, 2012 at 17:06
  • \$\begingroup\$ It was a reflow oven which appeared to have been converted from a commercial cooking oven. The wall wart was to power the added temperature sensing and control circuitry, which were mounted in a separate enclosure (not near the hot oven). \$\endgroup\$ Commented Jun 1, 2012 at 17:14
  • \$\begingroup\$ @JeannePindar firstly, thank you for the answer. I very much appreciate it! Can I hook up a clipped extension cord to the input of one of these can get out a clean 5V? Also, they are slightly pricey, but might be cheaper once all is said and done with getting a bunch of smaller component. Do they make any less expensive type of these devices? \$\endgroup\$
    – Alexis K
    Commented Jun 1, 2012 at 23:23
  • \$\begingroup\$ Those are meant for pcb mounting, so the pins are really too small to have the cord soldered directly to them. The output of those should be clean enough as long as you're not powering any sensitive analog circuits, but you should have bypass caps on your board anyway. Those are two of the less expensive ones carried by two of the major parts distributors. I make relatively expensive semi-custom equipment, so frankly, I don't pay much attention to price. \$\endgroup\$ Commented Jun 2, 2012 at 2:20
  • 2
    \$\begingroup\$ @AlexisK - What do you mean "clipped extension cord"? If it means what I think: don't! Never solder your power cord. Put the module nicely on your PCB, that's what it's meant for, and use a screw PCB terminal to connect the power cord. Always do so! \$\endgroup\$
    – stevenvh
    Commented Jun 2, 2012 at 10:06
18
\$\begingroup\$

If it needs to be safe you can't get around a transformer for isolation from the mains, and you'll probably end up with the classical linear power supply:

enter image description here

You probably can change a few things here. You say the AVR can work on 1.8V. How about the rest of the circuit? If 1.8V is enough there too you could use a lower voltage transformer. (Make sure the whole circuit can work at 1.8V. You can' use LEDs, for instance.) Digikey lists a 3.15V/600mA, but this isn't a PCB mount, otherwise it would be ideal. 3.15V AC combined with Schottky diodes for rectification give you more than 3.5V input to your regulator, which could be almost any LDO that can supply 200mA. (If you use a higher transformer voltage you'll have to use a different LDO, since this one is rated at 6V in maximum.)

This is the standard setup for a linear power supply. It may look a bit complicated, but you can't go more simple than this. The wall-wart is a nice alternative, why are you against that?

\$\endgroup\$
6
  • \$\begingroup\$ thanks for the answer. Is a switched-mode power supply something that is worth exploring for this? How trickey/available are the components to rebuild a wall-wart on the pcb? I'm having a little trouble finding the area to look for the pcb mountable transformers on digikey. Do you have a link to the right area to look? \$\endgroup\$
    – Alexis K
    Commented Jun 1, 2012 at 5:12
  • \$\begingroup\$ @AlexisK - I couldn't find the right transformer right away. I'll have another look later today. For the low-voltage solution I proposed a switcher wouldn't give you a real advantage. Even at 5V you only need 1W, so it's probably not worth it. \$\endgroup\$
    – stevenvh
    Commented Jun 1, 2012 at 5:15
  • \$\begingroup\$ thanks. Once I get a little more information about the transformer I'll check it out. \$\endgroup\$
    – Alexis K
    Commented Jun 1, 2012 at 5:25
  • \$\begingroup\$ I thought this 3V trafo would be nice, until I saw the current: 50A :( \$\endgroup\$ Commented Jun 1, 2012 at 14:32
  • \$\begingroup\$ @FedericoRusso and the price at $57.00. Do you know of another less expensive option? \$\endgroup\$
    – Alexis K
    Commented Jun 1, 2012 at 22:50
11
\$\begingroup\$

An elegant solution may be to use an USB wall wart like these:

Very nice form factor For those who don't like the British plug

and supply your circuit via the USB (like the Teensy). Then encase everything in the same box, letting the plug out.

DISCLAIMER: I know that this is an off-the-shelf solution, but I like it for two reasons:

  1. Safety: it will (hopefully) be certified, so you need only to deal with 5 V, leaving the problem to the manufacturer;

  2. Price: these plugs are found in places like dealextreme for down to 1 $, and mine is working well until now. If you make your own, only the components will be more expensive, and your time also.

\$\endgroup\$
7
  • 2
    \$\begingroup\$ How's is this more elegant than a regular wall wart? At least people won't think the USB device doesn't work or do anything. \$\endgroup\$
    – kenny
    Commented Jun 1, 2012 at 13:10
  • 1
    \$\begingroup\$ @kenny well, you don't have to worry about safety, and it's going to be a small box anyway \$\endgroup\$
    – clabacchio
    Commented Jun 1, 2012 at 13:12
  • 8
    \$\begingroup\$ Economies of scale are an incredible thing. It's simply astonishing that a manufactured, enclosed, shipped product with the overhead of a USB jack is less expensive than implementing a power supply. \$\endgroup\$ Commented Jun 1, 2012 at 14:16
  • \$\begingroup\$ Apple charges you an arm and a leg for these. \$\endgroup\$
    – stevenvh
    Commented Jun 1, 2012 at 15:25
  • 5
    \$\begingroup\$ The Apple ones are far better than the $2 ones. Look at the various teardowns on Youtube. The cheap ones are scary. \$\endgroup\$
    – markrages
    Commented Jun 1, 2012 at 15:58
5
\$\begingroup\$

A safe mains rated switchmode power power supply is quite a complex design. Have a look at this teardown of an iphone charger as an example. In that article the author mentions a switchmode Samsung cube charger for about $6 this charger may be a good option (possibly removed from its case and mounted on your PCB).

\$\endgroup\$

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.