Controlling serious electricity

Working with household or mains voltages
(110VAC / 240VAC)

It is a Really Bad Idea for hobbyists to work with household electricity, i.e. 110v in the USA, 240v in many other places. There is the chance that you will kill yourself or others. Also consider that if you only have a "little" problem, for instance you start a fire, you may find that your insurance is void, you may be sued for the damage you've caused. You may be prosecuted for illegal wiring.

Make a mistake with hobbyist electronics, running from safe-for-hobbyist sources of power, and you may fry some components. There are "things" you need to know about AC which you won't learn from surfing the web which can really "bite" you. Take for instance the concepts or AC, and "live" and "neutral". The moderately knowledgeable hobbyist would tell you that AC current alternates, first goes one way, then the other, and so it does. So why, then, if you connect a voltmeter between one of the wires in your household supply and the metal junction box it is housed in does the voltmeter read 110 (or 240) volts, but connect to the other wire and you see zero? (If you are curious about that, there's a discussion of household alternating current at MrFixit, but that's interesting academic stuff... not trade school training to equip you to fool around with 110 volts AC.) I've also written a page for you about the plugs and sockets used with household electricity. I've said a bit more there about "live" and "neutral".

One last safety concern, and then we'll get to how you can do it, if you feel inclined....

If you have a computer controlling something electric, be sure you are willing for it to be turned on automatically. I once had a computer controlled heater. One spring, as the days became warmer, I gradually forgot it was computer controlled. One day I realized that I'd draped a jacket over the heater, having forgotten it could be turned on by the computer. It was just a very happy coincidence that we didn't get a stretch of cold weather before I noticed.

Anyway... Want to use your own electronics to turn on "ordinary", 110 or 240 volt devices? There are ways which avoid some of the dangers.

Before I go into them, here's a design issue to consider....

Take something a simple as a light which you want to come on from 6pm to 10pm, to make your home look occupied when you are out. You can arrange something like that controlled by an Arduino or similar. You'll need something like an extension cord with a "switch" in it, a switch which can be controlled by the low voltages of an Arduinoor other is powered up, working properly. (A relay, perhaps.) But what about when the Arduino is not powered up? Will the light be on? Or off? If you create the "extension cord with switch", you can arrange things to work either way, and sometimes it will matter. In some of my "extension cords with switches", the switches are set up to be closed when the microcontroller input is absent... which makes the extension cords "ordinary" when I don't need to use them with microprocessor control. In addition, for some projects, such an "extension cord" gives me a more "fail-safe" result.

Something else novices may not know about: If you use a relay, you should have a diode. This is explained in my page about EMP snubbing diodes, which dissipate the reverse voltage spike which arises when the coil is de-energized. (I am going to mention some relay modules from Winford Engineering in a moment. From the online schematic for the modules, you can see they incorporate such a diode, along with an LED, in both their passive and TTL modules.

Solutions for 110v....

(See also, further down the page, solutions for 110 and/ or 240...)

First candidate: PowerSwitchTail

The PowerSwitch Tail is a very neat... in several senses of the word... solution, which I commend to you.

Adapting text which used to be at the supplier's site...

"You just connect one wire from the PowerSwitch Tail to the Arduino's ground, and another to a free I/O pin on the Arduino (or on almost any other micro-controller) and now you can safely control many standard 120VAC devices which connect to a standard 3-prong outlet. (i.e. NEMA 5-15R)."

The PowerSwitch Tail uses an opto-islator in addition to other components, which is "costs nothijng" layer of protection I always welcome.

Offered in NO (normally open) and NC versions. $20+p&p as kit, or $26+p&p assembled at 11/18.

The same company also offer similar devices, but with a built in 5v/ 500mA power supply available to the outside world. $33+p&p assembled at 11/18. Yes, you can supply 5v yourself... but is the premium for a nice, neat, tidy soultion too high?

A quick note for people with the antique PowerTailSwitch version 1: It drew more current from the controller than the version 2 switch does. Enough that you needed to take some care to avoid over-taxing your Arduino. Nothing major. And I doubt there are many version 1 switches changing owners by now. The version 2 is clearly marked, Roman numeral "II" as part of name.

PowerSwitchTail also sell a similar device which controls the power with a triac, aka SSR (solid state relay). Load capacity: 120vac, 300 watts maximum continuous load, non-inductive. See more comments about that in the notes below about the 240v version of it. $20+p&p assembled at 11/18.


So... at this point (11/18) just three candidates, one supplier. There were more, once upon a time, hence the broad structure of the page which may at present seem odd.

Solutions for 240v supplies....

... (sometimes happy to switch 110v, too.)

Good news!

The suppliers of the PowerSwitch Tail (already mentioned above) have, since at least 7/11, been selling "kit" versions of two devices for switching 240v. One uses a relay, the other a triac, aka SSR (solid state switch.)

Construction is not difficult, though it does involve soldering. (The suppliers give "Heathkit grade" (good) assembly instructions, downloadable before you buy.) A good enclosure is included. (Essential for safety). Whole relay kit: $20 + shipping at 7/11. This product has been around since 6/11. I like established safety products! (The triac based unit is $15.). So! No excuses now, people on 240v... there are reasonable ways to switch mains voltages safely! (At 11/18, the shipping was $20. You can find the shipping for where you are by "ordering" a PowerSwitch Tail, going forward from "cart" to "pay" via PayPal. Shipping is calculated at that stage, but it is still not too late to cancel out, if you decide the shipping was too much.)

At this point, you can read on, for more details about the PowerSwitch products, or skip down the page to some alternatives...

At the PowerSwitchTail page for 240v devices, you will see two units for what we're talking about. They are the PowerSwitchTail kit, PSTK-240, and the PowerSSRTail kit, PSSRTK-240. You will also the ZeroCrossTail kit. This generates a digital signal which tells any monitoring device the moments when the AC power is crossing the 0v point in its cycle. Useful for many things... but this third kit is not for turning the power on and off.

You will find more details at the PowerSwitchTail.com page, of course, but here are a few...

Both: Designed to operate with 200-240 VAC single-pole mains. These kits are not intended for use in the US or Canada or other countries where two-pole switching is required.

Both: Controlled by a low DC voltage (e.g. Arudino or Pi output. Or any other!) Supplied with three resistors for one component of the finished switch. The resistor you install determines the correct voltage for activating he relay/SSR. The available choices are: 3-5 vdc, 5-12 vdc, or 12-24 vdc.) The minimum current to activate the device: 3 mA.

Both: Three terminals on the "low voltage" (controlling) side. "+in", "-in", and Ground. If you were driving the device from, say, an Arduino, up would connect the digital output from the Arduino to "+in", and the ground (i.e. "0v" rail) of Arduino to "-in". The "Ground" connector on the low voltage terminal gives you a connection if you want it to the mains (high voltage) ground. There is no provision to configure the PowerSwitch or PowerSSR to be "on" when the output from the Arduino is low, by the way. It will be on when the output is high. This isn't a "problem" in my view... but some devices can be set up either way.

PowerSwitch Tail: Uses an electromechanical relay, so you hear a "click" when the device's state is changed. Although the relay, at the heart of the circuit can handle more the device is "only" safe up to 20 amps because that's the limit for safe use imposed by the size of the traces (aka tracks) on the PCB. (The "over-spec" of the relay means you can be confident of a long life.)

PowerSSR Tail: Uses a triac (aka SSR), and so operates silently. You should limit the device to loads of no more than 300 watts. (The triac would need a better heat sink if you wanted to use more power. The triac is rated for 8 amps, but will be too hot, if used at that level. (Apologies for the mix of amps and watts... that's how I had the information from people who know more than me about these things, and they may have had reasons.)


sf-innovations.co.uk/mains-switch-widget.htm is nice kit from a UK for switching 240v. This required "assembly", but no soldering... I merely had to connect the 240 in/ 240 out cables to some screw terminals, and close up the box. Don't be confused by their page. You SHOULD buy the "Mains Switch Widget. It is just the core module and a good enclosure. (£18 +p&p at 11/18) You can buy the just core module, "Mains Switch Relay 2", or, on its own, then enclosure (£9.50). But unless you have other provision to enclose the unit, you are defeating the point (safety) if you skip an enclosure. (I'm no "health and safety clipboard man", but with 240v safety is neglected at your (great) peril. And you need to know a lot to know enough, in this area. Unless you are licensed electrical engineer: Do what you think is "sufficient"... and then double what you've done!).


An "either voltage" solution is offered by Winford Engineering of Bay City, Michigan. (The information in this section was harvested from the web in June 2011.. but a quick check at 11/18 seemed to suggest that Winford still sold relay modules. The link takes you to just one of many similar Winford offerings. If you spot any enclosed units, please let me know?)

They offer relay modules with screw terminal connections, so you will need to arrange safe enclosures and safe connections to a plug (household electricity in) and socket (controlled household electricity out).

All of their modules are built around 15A SPDT relay... so, among other things, you can set one of these up to pass the household electricity through if the input from the microcontroller is absent, or only if it is present. Whichever you want.

Maybe I was just being dim, but it took me a while to work my way through the different options offered by Winford. Here's my attempt to set them out....

a) As it says on their site: "Please note that the relay coil voltage you select has no effect whatsoever on the voltages you can switch with the relay contacts."

b) Next choice: 2 relays per module or four? At 6/11, the 2 relay module (at 6/11 $33, only available in the "TTL" version... not a "problem".)

c) "TTL" or "Passive" version: The "TTL" version (aka "Logic Controlled") is essentially the "passive" version with a transistor. The control input goes to the base of the transistor. The voltage for the coil... 5, 12, 24 or 48... fed to the module separately... is switched on or off by the transistor. For most of the uses I would anticipate for the readers I would anticipate for this site, the "TTL" version is worth the slight extra you pay for it.

d) Coil voltage: The modules are supplied with relays requiring any one of 4 different coil voltages. Chose whatever is convenient, given what else you have on hand in your system. If you have a passive module, your input to it must supply the voltage the coil requires. If you have the TTL module, the voltage you apply to the control input can be from 2.7VDC up through 30VDC is fine, as long as adequate current is available. (The datasheet reports that the current needed is about 2mA if the input is at 5v.) Note: The coils are designed to operate off of DC supplies. I think it would be quite simple to tap into a 24v AC supply, as used in some home HVAC control circuits to produce an adequate 24v DC for the Winford modules, but my expertise isn't high enough for me to pass on my guess as to "the answer" to that want!

Prices (6/11, excl p&p)... the same for different coil voltage variants of each...

Passive: 4 relay module: $45

TTL: 2 relay module: $33 TTL: 4 relay module: $55

Further Reading, Further Products....

There's an excellent discussion of the above subjects, and related matters, on a page provide by www.ArduinoInfo.MyWikis.Net. That wiki derives from an excellent resource started by the people behind the YourDuino store... they are worthy of support. You may remember them as being "in Austraila". No longer true. They have two bases of operation- one in the US... great for US customers, of course, and one in China, useful for many other customers.

   Search this site                 powered by FreeFind
Site Map    What's New    Search

Ad from page's editor: Yes.. I do enjoy compiling these things for you... hope they are helpful. However.. this doesn't pay my bills!!! If you find this stuff useful, (and you run an MS-DOS or Windows PC) please visit my freeware and shareware page, Sheepdog Software (tm), download something, and circulate it for me? At least (please) send an 'I liked the parallel port use page, and I'm from (country/ state)' email? (No... I don't do spam.) Links on your page to this page would also be appreciated!
Click here to visit editor's freeware, shareware page.

Don't forget to check out the programs for controlling the state of the parallel port at my shareware site. There are two free programs there... one for toggling bits, the other for using the computer as a timer via the parallel port.

Here is how you can contact this page's editor.
Click here for more Arduino specific material.
Click here to go up to general page about electronics by editor of this page.
Click here to go up to general page about electronic projects by editor of this page.
Why does this page have a script that loads a tiny graphic? I have my web traffic monitored for me by eXTReMe tracker. They offer a free tracker. If you want to try it, check out eXTReMe's site. The Google panels and the search panel are also script based.

Valid HTML 4.01 Transitional Page tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org

....... P a g e . . . E n d s .....