0
\$\begingroup\$

So I have a fake "arduino" that I put together (The main components on a breadboard, i.e. ATmega328, capacitors, ocilator, etc) and I am trying to use it to overide a light switch (When the light switch is off, power is off, when it is on, the microprocessor can shut it off manually, or leave it on.)

Anyway, I have everything deesigned and working, but now I want to figure out a way that I can power the ATMega from the electricity flowing through the lightswitch. It will be inside the the wall, so I can't use a tradition wall AC to 5V converter, and I am having trouble finding what I am looking for on google, so does anybody here have a solution? How can I power an ATMega328 from the electricity flowing through a lightswitch? DO I need to set up a power 'limiter' somehow?

\$\endgroup\$
2
  • \$\begingroup\$ What power draw does your device have? \$\endgroup\$ Commented Jun 4, 2013 at 3:41
  • \$\begingroup\$ Is the galvanic isolation between the mains AC and the Arduino required? What does the whole device do? \$\endgroup\$ Commented Jun 4, 2013 at 4:03

2 Answers 2

2
\$\begingroup\$

You should be VERY careful when working with line voltage in close proximity to low voltage electronics. It's easy to make a mistake and fry a circuit, or worse.

That being said, the cheapest and most realistic way to do this would be to run the Micro controller from a separate wall wort, and use a large relay to control the flow of AC current. There are plenty of wall converters that you can take apart and miniaturize enough to fit inside a wall, eg. an apple iPhone charger. The relay would then be directly in line with the switch, as in the schematic. When the switch is off, the microcontroller has no effect. When the power is on, the microcontroller will have control of the current the same way the light switch does, without shutting itself off.

CircuitLab Schematic x8zfpz

This is just a very high-level overview, but should serve as a good place to start.

\$\endgroup\$
5
  • 1
    \$\begingroup\$ If OP does decide to put anything in a wall, a review of applicable codes might be in order. A junction box behind drywall, for example, may not meet code. Some sort of small accessible panel or load center might be a good housing. Check the code. Jay Greco's initial safety warning bears repeating. I concur with using a relay. \$\endgroup\$
    – mikeY
    Commented Jun 4, 2013 at 4:20
  • 1
    \$\begingroup\$ @mikeY Absolutely. I can't put enough emphasis on the safety repercussions, and a review of building codes would be very smart. Finding a safe (and approved) way to enclose the device and a strong focus on isolation are both critical. \$\endgroup\$
    – Jay Greco
    Commented Jun 4, 2013 at 4:22
  • \$\begingroup\$ I understand the safety side up it, and I will be checking with codes and regulations too. My question, however, is how could I go about making my own wall converter out of new electronics parts? My goal with this is to do it all by individual parts, not taking apart any prebuilt devices. \$\endgroup\$
    – geekman
    Commented Jun 4, 2013 at 5:22
  • \$\begingroup\$ You'll be very hard pressed to make your own converter. There is a reason you're having a hard time finding what you want on google; creating your own power supply is actually quite a challenge. The most efficient type of supply used in smaller wall converters (read: no large transformers) is switching. To give you an idea of how it works and how complex it is, this is a good article to read. \$\endgroup\$
    – Jay Greco
    Commented Jun 4, 2013 at 5:28
  • \$\begingroup\$ Do you think there would be any boards available to do this then? Rather than taking stuff out of a charger? \$\endgroup\$
    – geekman
    Commented Jun 4, 2013 at 14:04
0
\$\begingroup\$

I haven't tried it, but you could use one of these:

http://www.gearbest.com/development-boards/pp_139882.html

Specs: Under environment 25 degrees, 80 percent load conditions, MTBF greater than 16,000 hours ● Working temperature: -20 - 60 degrees ● Relative humidity: 40 - 90 percent RH ● Input voltage range: AC 85V - 265V ● Input current: 0.0273(AC110V), 0.014(AC220V) ● Input surge current: 20A ● Output voltage range: 4.9 - 5.1V ● Output current range: 0A - 650mA ● Output power: 3W ● Output efficiency: 85 percent

\$\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.