15

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.

Alexis K
  • 2,719
  • 8
  • 30
  • 33
  • 2
    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. – Connor Wolf Jun 01 '12 at 04:42
  • it does have to interface with other components – Alexis K Jun 01 '12 at 04:58
  • 2
    They're you're stuck with a transformer or a wall wart. Period. – Connor Wolf Jun 01 '12 at 05:00
  • 1
    @Fake - yes, I came to the same conclusion when I read the word "safe". – stevenvh Jun 01 '12 at 05:03
  • I opened up a power supply that looked like it was a bridge rectifier that went into a ~2W resistor. Any suggestions on how something like this was working? Is this an off-line power supply? – Alexis K Jun 01 '12 at 05:04
  • 3
    @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. – stevenvh Jun 01 '12 at 05:08
  • yeah there does not appear to be a transformer in the circuit that I am looking at. – Alexis K Jun 01 '12 at 05:10
  • @AlexisK - Probably a power supply like the one in figure 5 of [this document](http://ww1.microchip.com/downloads/en/appnotes/00954A.pdf). Remember you can only use it in a completely closed enclosure. No wires to the outside, or other parts you can touch. – stevenvh Jun 01 '12 at 05:18
  • 1
    Do you really need 200 mA? The microprocessor itself will use far less. – markrages Jun 01 '12 at 05:21
  • @stevenvh thanks. I'll read more about it. Is the "high-order bit" that the floor and celing of the power supply get raised significaly but the difference between the floor and ceiling is still 5V? – Alexis K Jun 01 '12 at 05:22
  • @markrages if it is less, how would that change a proposed solution? – Alexis K Jun 01 '12 at 05:23
  • For example, if the current is just a few mA, you might be able to use a solar cell for power. – markrages Jun 01 '12 at 05:27
  • @AlexisK - I don't understand you last question. Please rephrase. Use your own words, I'm not sure "high-order bit" means anything here. – stevenvh Jun 01 '12 at 05:29
  • opps sorry. At a high level what is happening with resistive power supply? Is it offsetting the electical ground a lot? – Alexis K Jun 01 '12 at 06:10
  • @AlexisK - You don't offset ground. Ground is the reference everything else is related to. That's your 0V, the only thing you're sure of. – stevenvh Jun 01 '12 at 06:39
  • Is there some reason (other than price) you don't want to use a commercial pcb mount power supply module? I've seen some for less than $10. – Jeanne Pindar Jun 01 '12 at 14:22
  • 3
    @Jeanne - If you have a link to it that could be an answer. – stevenvh Jun 01 '12 at 14:42

4 Answers4

18

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?

stevenvh
  • 145,145
  • 21
  • 455
  • 667
  • 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? – Alexis K Jun 01 '12 at 05:12
  • @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. – stevenvh Jun 01 '12 at 05:15
  • thanks. Once I get a little more information about the transformer I'll check it out. – Alexis K Jun 01 '12 at 05:25
  • I thought [this 3V trafo](http://www.digikey.com/product-detail/en/165Z3/HM504-ND/270105) would be nice, until I saw the current: 50A :( – Federico Russo Jun 01 '12 at 14:32
  • @FedericoRusso and the price at $57.00. Do you know of another less expensive option? – Alexis K Jun 01 '12 at 22:50
  • @AlexisK: Oh, I didn't even see that. I turned away from it when I saw the current. Still steep for a 150VA transformer, I think. – Federico Russo Jun 02 '12 at 07:58
16

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.

Jeanne Pindar
  • 1,459
  • 1
  • 13
  • 16
  • @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. – lyndon Jun 01 '12 at 17:06
  • 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). – Jeanne Pindar Jun 01 '12 at 17:14
  • @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? – Alexis K Jun 01 '12 at 23:23
  • 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. – Jeanne Pindar Jun 02 '12 at 02:20
  • 2
    @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](http://cdn102.iofferphoto.com/img/item/169/865/718/QPv0.jpg) to connect the power cord. *Always do so!* – stevenvh Jun 02 '12 at 10:06
  • yes, thanks. I will. I should have been more clear. I was just looking for conceptually if it was ok. I will make sure to use a terminal. – Alexis K Jun 02 '12 at 18:45
11

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.

clabacchio
  • 13,481
  • 4
  • 40
  • 80
  • 2
    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. – kenny Jun 01 '12 at 13:10
  • 1
    @kenny well, you don't have to worry about safety, and it's going to be a small box anyway – clabacchio Jun 01 '12 at 13:12
  • 8
    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. – Kevin Vermeer Jun 01 '12 at 14:16
  • Apple charges you an arm and a leg for these. – stevenvh Jun 01 '12 at 15:25
  • @stevenvh: China doesn't :) I bought mine for 1 Euro – clabacchio Jun 01 '12 at 15:26
  • 5
    The Apple ones are far better than the $2 ones. Look at the various teardowns on Youtube. The cheap ones are scary. – markrages Jun 01 '12 at 15:58
  • @all Does anyone know if there exists an implementation of the above that can be mounted on a circuit board? Or is there is something like the above that has bare leads instead of a plug? I am not totally opposed to just putting the usb power supply inside my enclosure. It seems odd, but I guess I could be convinced. – Alexis K Jun 01 '12 at 22:53
5

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).

stevenvh
  • 145,145
  • 21
  • 455
  • 667
pault
  • 311
  • 2
  • 3