I have a small project that controls a relay based on my arduino sensor input values. Since my project enclosure is already getting an ac connection, could I use a voltage regulator or some other approach to ensure that the microcontroller was getting the appropriate voltage? It seems like I could take apart (or just use) a dc plug but I wanted to do it myself if possible.
Thanks in advance for any help.
Look at eBay:
Lots on eBay
ryancanulla:
could I use a voltage regulator or some other approach to ensure that the microcontroller was getting the appropriate voltage?
Yes.
Easiest to do yourself, research 7805-based or any similar linear regulator scheme.
Probably shouldn't let anyone do anything till he makes his own power supply.
Thanks Pancake, I was researching the 7805. My understanding was that this was not the most efficient way when coming from 110v since it would require a rather large heat sync. Any insight you have would be greatly appreciated...
Also - Thanks larry! I'll likely just use an AC->DC usb converter (inside the enclosure) for the time being until I can figure out the proper way to regulate the voltage...
When coming from main you can't use a 7805. Just stick with a module to keep away the unsafe 10V (or 230v here...) Any USB charger will do just fine.
Thanks Pancake, I was researching the 7805. My understanding was that this was not the most efficient way when coming from 110v since it would require a rather large heat sync. Any insight you have would be greatly appreciated...
You need a "power supply" to isolate the AC voltage (for safety) and convert it to low-voltage DC. (The Arudino already has an on-board 5V regulator similar to the 7805.)
You can build or buy a power supply. I usually start my projects by building the power supply. You can build a power supply with a transformer, diodes (usually a bridge rectifier) and a capacitor (usually 1000uF or so). Then, you can optionally add voltage regulator.
Note that the capacitor charges-up to the AC voltage peak, which is 1.4 times the RMS voltage.... i.e. If you use a 12VAC transformer you'll end-up with about 17VDC. ...That's just the approximate unregulated voltage... There is about 0.7V dropped across each diode, but the transformer will usually put out more than it's rated voltage at no load (or with a light load) and the actual voltage depends on the AC power line voltage which will vary a bit.
Regular 50/60Hz AC transformers are bulky. A switching supply operates at higher frequencies and the transformer can be smaller, but it's very difficult to build your own switching power supply (and the transformers are not easy to find) so if you want a switching supply, buy one.
A switching regulator is slightly more complicated than a linear regulator (it requires an inductor) but that's something you can build yourself.