Switching mains--best way to power Arduino?

It's another mains-switching project (PID temp controller; you just can't have enough of 'em); I've been using SSRs in the past (may switch to an optoisolator/TRIAC for cost), but more to the point, until now I've used an external "wall wart" to power the Arduino.

That's fine, but I made a kit for my sister who immediately complained about all the wires :slight_smile: So I'd like to simplify the box to put the mains switching and the +5v supply in one box rather than have a separate power supply.

(in other words, a power section with high voltage AC in, switchable high voltage AC out, and then a three-terminal connector coming out which would connect to my Arduino with +5v, gnd, and signal in to the power board for switching, bit like a Powerswitch Tail with a power supply output)

Looking at "mount it to the PCB" SMPS units, the ones I found were $12ish--seems expensive, and I know cheap wall warts can be really cheap. I don't need this to be switching (though the smaller size is nice), but I do want it to switch between 120v and 230v without a jumper.

What's the best solution? I would think a small transformer/rectifier would work great but a touch bulkier and inefficient and I can't figure out how to seamlessly swap the voltage.

I feel like this has to be "solved" for the Arduino community already, but of course power requirements can vary. Even so, I've been reading up on power supply design for hours and my head is spinning.

I puchased a couple of these a few weeks ago but I haven't had a chance to try them out yet. $3 each ain't bad and they handle a fairly broad voltage range. Perhaps if anyone else has used something like this they could chime in.

http://www.ebay.com/itm/5pcs-New-5V-1A-built-in-industrial-power-switching-power-supply-board-module-/261055148156?pt=LH_DefaultDomain_0&hash=item3cc819707c

What's preventing you from just hooking up the wallwart to the mains being switched? So mains will come into, one branch of it goes to your wallart and another to the load. Completely unseen by the user.

Wouldn't that have been much simpler / cheaper?

Simpler/cheaper, and would get the job done (it's one of the first things I considered). But a) not nearly as elegant, and if I'm going to have the PCB made, may as well put the power supply right on it, b) still probably wouldn't be small and tidy enough to satisfy my sister, and c) if I ever kitbiz the thing, it just wouldn't be as "nice" and professional as I'd like. Besides which, I just want to really understand how they work better.

Something like the units JerseyGuy posted would probably do the trick but again if I ever make a kit, repeatability of purchase is really important and getting the components from a distributor would be easier than getting kits from ebay.

What I may wind up doing is just getting a switching wall wart, cracking it open, and copying it, but I'd really anticipated a cheap open-source arduino switching multivoltage power supply to already be out there...

dhenry:
What's preventing you from just hooking up the wallwart to the mains being switched? So mains will come into, one branch of it goes to your wallart and another to the load. Completely unseen by the user.

Wouldn't that have been much simpler / cheaper?

I have a car starter pack that works like this. I took it apart to get the SLA battery out, and inside it was just a wallwart zip tied to the case, with an extension cord hot-glued to it. The other end of the wallwart just had the wires soldered to the PCB. I took another one apart for my boss, and it had the same setup.

Wallwarts are mass produced for everything, this generally makes them cheaper than anything designed to be mounted on a breadboard.