Thursday, November 3, 2011

Building a 8 Channel Solid State Relay Board

Have you ever seen videos of those insane Christmas light displays? Those displays are usually controlled by large banks of solid state relays turning on and off each strand to time with the music. I bough a bunch of these relays on eBay and wanted to make my own general purpose controller that I could use in other projects.

Warning: Mains electricity is dangerous if not handled properly. Do not try and do this project unless you have sufficient training in handling it.

The Relays
The solid state relays I used were super simple. Mine were a little different but in general this class of relay all look the same. There are 4 screw terminals on either side of the relay. (1) and (2) are the load that's switched on an off, the polarity of which doesn't matter and on my relays could be up to 240V and 10A AC (on this one it's 25A). (3) and (4) are the input that controls the relay. The polarity does matter here and the control voltage can be anywhere between 3 to 32VDC.  This wide range of input voltages makes it really easy to control with something like an Arduino.

Step 1: Safely wiring all the mains electronics

A very important part of any project like this is to correctly and safely wire the mains electricity part of the board. When you are dealing with low voltages while tinkering with electronics, if you mess up the worst thing that can happen is you destroy your circuit. With mains electricity you can kill yourself or start a fire.

As a result, it was important to safely contain any of the AC components so they could not be accidentally touched as well as ensure complete connections so there was no unintended buildup of heat. I used a set of 4 junction boxes each with 4 plugs (two on each channel) as the way to connect whatever was being controlled. Out of those I ran wire of a proper gauge to plugs and plugged them into power strips. I considered going less bulky but decided since this was my first big AC project, that I'd keep the safety as simple as possible.

The harder part was safely putting the relays in line with this circuit. I snipped one wire out of each of the cables and attached the (1) and (2) terminals on the relay in series with it. I then screwed the relays down on the wood and covered them with plexiglass.

With that all set up I was successfully able to turn off each of these circuits using a 9V battery.

Step 2: Control

The control for this project was very simple. Each of those relays is essentially just an LED. All that I needed to do was hook up the positive side of each terminal to a different digital out on my Arduino and then all the negative sides to ground. I ran all of this cabeling through a set of DB9 connectors to keep it sane. Also, since I wanted to be able to remove the Arduino from wherever this board was installed, I mounted it in it's own enclosure with a female DB9 connector.

Step 3: Program

The code for this project on the Arduino and the computer was dead simple. The Arduino just read a byte off of the serial port and turned on the relays corresponding to the bits in that byte. The computer just writes bytes to the serial port.

Here's the final result. Definitely a bit bulkier than it needs to be, but it works and it's safe.

Technologies: Solid State Relays, A/C Electronics, Arduino


GaelicChamberMusic said...

Hi there, have you some video of your "light show"? Can you post your Arduino code?

lastchancename said...

I certainly appreciate where you're coming from, but safety first usually includes a ground wire on 3-pin circuits.
Even though lights are often 2-wire (LN), the metal boxes and some lighting may use the third pin you have in those socket boxes.
Just sayin'

George Mark said...

thanks for sharing valuable article. I would like to see more this kind of informative article. you may also find Waterproof plastic connector USA : Waterproof plastic connector USAWaterproof plastic connector USA