110 V ac powering arduino

I am building a relay controlled outlet that plugs into an existing outlet. I have the whole circuit figured out, I have done it large scale before but im trying to condense the project down into a small convienient unit, but then I though "How am a going to constantly keep the arduino powered?" It would be pointless to run an 9v DC adapter to another outlet and I dont know how long a 9v battery would hold up powering an uno(next revision is going to be micro) with two relays..... and 9v's are expensive.... So what Im asking is, is there any way to tap into the power im pulling from the outlet and drop it down to a friendly 5v-9v dc..... I was thinking about scrapping an old cell phone charger and harvesting the board with a usb port but im not sure..... any Ideas?

You can build a simple unregulated power supply with a transformer, a full-wave rectifier, and a capacitor. (Note that AC voltage has a peak about 1.4 times the RMS value, so a 6V transformer will work.) The Arduino has a 5V voltage regulator on the board, so you don't need a regulated supply.

Take a look at [u]this page[/u]. The 3rd circuit (the one with 4 diodes) is the one I usually build. You can buy the 4 diodes pre-wired in one package as a [u]full-wave bridge rectifier[/u].

Or, you can look for a switching power supply module. (It's usually not economical or practical to build a switching power supply yourself.)

AC transformers tend to be bulky, and you might find a smaller switching supply module. Switching supplies can take-up space too, and they do have transformers but the transformers work at higher frequencies so they can be smaller.

And if you ever want to build a regulated power supply you can add a regulator chip and a couple of capacitors. I've built quite a few power supplies using LM7805 (and similar) voltage regulators.

jpsnow6:
I was thinking about scrapping an old cell phone charger and harvesting the board with a USB port but I'm not sure...

Sounds fine to me.

jpsnow6:
It would be pointless to run an 9v DC adapter to another outlet

Sounds perfectly appropriate to me. Use a double-adapter. OTOH, given that you are building the relay unit with an appropriate housing, you certainly should be able to mount the adapter in the same housing and arrange to parallel the input.

I am leaning towards the salvaged charger option, I should just have to de-solder the outlet prongs and tie into the 110v ac input that i am initially getting from the wall, or I could do a double input and have one dedicated line for the 9v DC converter my relays are rated for 10 amps at 110v ac and since all I am powering is lights, I could safely run two outlets with one relay. Im feeling Tony Starkish with this project at the moment..... im not saying my project is amazing, I mean my first model is huge and bulky and looks like I built it in a cave.... but I ordered some individual relay modules today to swap out my 4 relay shield, Ill pick up some actual outlets and not use a hacked up extension cord, and I am going to swap out the UNO with a micro, a mini, or maybe if im feeling froggy, ill grab the sparx wifi enabled microcontroller so I can attach this to my network. But here is a link to see my "MK1"

Thanks for the help guys.

Have a look at these http://www.aliexpress.com/item/Free-shipping-ESP8266-serial-WIFI-AP-STA-AP-STA-coexistence-mode/2026783748.html
for Wifi access. I don't have one yet, but they look great for this purpose. I would suggest a Micro in that case, because the USB does not block the HardwareSerial that you need to communicate.

For power you could also have a look at these
http://www.aliexpress.com/item/5pcs-lot-Switched-Module-4W-800mA-Step-Down-Regulated-Power-Supplies-AC-90-240V-110-220/751818023.html
But they are not really cheaper and probably not smaller than a scrapped phone charger. These ones should contain something quite small
http://www.aliexpress.com/item/wholesale-2pcs-5V-1A-EU-Plug-USB-Power-Home-AC-Travel-Wall-Charger-Adapter-For-iphone/1999031133.html

Note that you need to supply the 5V to the 5V Pin, since the linear voltage regulator on Vin needs more then 5V (around 7?) to make 5V.

So today I was scrounging through my junk drawers and I found a 9v 1 amp wall wart charger for.... well who the hell knows what its for.... but jackpot it actually has the right end for my uno and after pulling it apart it has a relatively small footprint... 1.5" x 2.5" or 40 x 63 mm. Can I use 9v 1a to power the micro?, I know the uno is fine but im new to the micro. Ive checked the pinout but that is far from helpfull.

jpsnow6:
Can I use 9v 1a to power the micro?

According to this, the micro has the same 7-12V recommended (6-20 max) as the Uno.

Yes, the voltage of the Vin Pin is regulated with a linear voltage regulator. Know, however, that this just dissipates the excessive power, so with 9V, nearly half of the power is lost there. Of course, that may not relevant, but the regulator is rated up to 1A., so it is up to 4W loss.

ElCaron:
but the regulator is rated up to 1A.,

Not without a heatsink, it isn't!

The 9v "Wall Wart" - most commonly used for telephone modems in days past - is most likely not a regulated switchmode supply and will run up to at least 12V with little or no load - and a bare Arduino Micro is a very light load.

That probably isn't a problem however as long as the regulator is rated for 15V or more input as if the regulator does have to supply a heavier load, the voltage on the "Wall Wart" will drop to 9V or so. It may be as well to check those voltages though.

You guys are awesome this project is moving along so well with your help. the 9v 1a power suplly feeds the uno and the micro perfectly. I wired it in paralell with my relays and it powered right up. So now it runs standalone with only one outlet needed I checked my voltages and everything seems good. The harvested power supply drops 110 ac down to 9v dc @ 1a. Now just to figure out the wireless feature and my prototype will be done.... then on to making it smaller. Thank you all so much. Kudos to everybody who helped.