This is a simple project which allows an Arduino or any other microcontroller to control high current and high voltages, in this case 110V main electricity. A whole new world opens once the Arduino can start controlling the main electricity which our everyday appliances and gadgets plug into. This is the first part in a series of write-ups as I develop my customer salami/charcuterie curing environment in a refrigerator. Part of this project involves having an Arduino control main voltages in order to regulate temperature, humidity and airflow of the drying environment. This is all done through the use of 4 relays and a simple circuit to interface to the Arduino.
First a warning: The project described within describes creating a circuit to control main electricity. Main (110V/220V) voltages and currents will kill and start fires. The circuits and wiring described below may not meet industry standards or government regulations. The user should evaluate all circuits and wiring themselves for safety prior to use. The author does not accept any liability for use of the circuit or project described within. USE AT YOUR OWN RISK.
Here is a basic wall outlet, costs about 59 cents at Home Depot. In the picture above, the longer slot on the left is the neutral leg of the terminal. The right, smaller slot is the “hot” leg of the terminal supplying the 110 volts. The final round prong is the ground terminal. It is important in future steps to wire the hot terminal to the relay. This way, when the relay is open or off, there is no voltage supplied to the outlet or the attached appliance. This is much safer than breaking the neutral leg with the relay, as voltage on the hot leg will still be supplied to the outlet and whatever is plugged into it.
Here is a side view of the relay. You can see a the short between the two outlets. For this project I want to be able to control each outlet individually, so the hot jumper is removed by bending back and forth with pliers until the metal breaks. This allows the outlets to be supplied electricity separately.
Here the jumper is removed. Now both outlets can we wired and controlled individually.
Finally the extra tabs out the end of the outlet are removed, so it will fit into the chosen housing. As we will be using two sets of outlets, the same steps are performed for another separate outlet.
The housing is shown above, it is also sold by Home Depot for a few dollars and holds the outlets in place in order to be mounted to the project box.
The two outlets are installed in the face-place by the three supplied screws.
Looking at the back of the outlets, the neutrals are all shorted together. I accidentally removed the jumper on the neutral side, so I needed to add the jumpers back in for each pair of outlets. I left at least one of the wire inserts available for the neutral wire coming from the power cord. White wire is used for neutral wiring. When using the wire inserts and stranded wires, the wires need to stripped and tinned with a soldering iron so they can be inserted.
I took the opportunity to add in the hots which use black wire. They are about 6 inches long and will eventually plug into the relay board. A note about using the wire inserts, I have been told it is better to use the screw terminals, as they are rated for higher current. In the future I plan to, but as this will be used for lower current applications I am not too worried about it.
The outlets and housing are all ready to be assembled with the relay board. All 4 outlets are labeled.
Above is the front side of the 4 Port Relay Board. The relays are 10 amps, but the traces on the board are not large enough to carry the full current. I wouldn't go much over a few amps for each of the outlets. The fridge will be the highest current draw, with compressor start-up as high as 10 amps and running in the 3-4 amp range. The 10 amps will be a momentary transient, so I am not too worried about the heat generated by the temporarily high current.
Backside of the relay board is above. Traces were made as large as possible and a thick layer of solder was applied to help lower the resistance, and in turn heat generation. The common hot, has a piece of solder wick embedded to help decrease the resistance of the pad.
The relay board is attached to the leads of the outlets.
Once the wires all hooked up, the bottom of the board is covered with electrical tape.
This extra insulation ensures the main pads will not come in contact with any metallic surfaces. The housing is plastic, so this shouldn’t be a concern, but the extra insulation doesn’t hurt.
The plastic housing is made to be placed behind the drywall of a wall. It is a nice large and cheap enclosure also sold by Home Depot for a few dollars.
The mounting brackets molded to the housing were removed with dikes and then sanded down. Two holes are drilled in the housing, one for the power cord and the other for the 4 relay control wires.
The power cord is from a 100 foot orange extension cord from Home Depot. About 10 feet were cut off of the male side of the cord. The 100 foot cord was purchased, so the extra wire could be used to wire all the above connections. The ends are prepped to be hooked up.
Some people like to tie a knot for stress relief. I prefer to use two zip ties tightened against the wires. These have always held for me and are less bulky than a knot in the cord.
The power cord is wired into the relay and the outlets. Again, white wires are for neutral, black wires for hots, and green wires for ground. It is tempting to use the black wire for the ground, as used in many low voltage circuits, but this is incorrect, irresponsible and dangerous for home wiring.
The relay board is placed in the bottom of the housing. It is not mounted in place, instead the spring force from all the wires hold it firmly in place.
With all the wires tucked into the enclosure, the two screws are used to hold it all together.
Finally the power cord is plugged into the wall, and the signal wires are hooked up to an Arduino. Yes, outlet 1 works. There you have it, now the Arduino can control main electricity.
A test of outlet 2. Outlets 3 and 4 work as well.
Above is the outlet operating at 10 Hz just for demonstration. Yes, I know it is a CFL bulb and shouldn't be switched on and off fast, but thanks to California, I could not find a normal bulb in my house. The clicking of the mechanical relay can be heard.
In actual applications, mechanical relays would not be used for items operating in the Hertz range such as PWM control or PWM PID controllers. Circuits switching this fast should use solid state relays. The mechanical relays above are perfect for refrigerator control, where the appliance will be turned on and off every 10 minutes or so to regulate the temperature.
All of the above designs and code are licensed under the GNU General Public License and the Sparkfun Beerware License (you buy me a beer if you use this and we meet someday):
Copyright (C) 2011 Mike Ragsdale
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.