For an Arduino project I needed to switch 4 mains devices.
I am always deliberating wether to use a mechanical relay or a solidstate relay.
Solidstate relays used to be relatively expensive, and thus people constructed them from opto couplers and triacs, but there are some cheap SSR chips available. One of my favorites is the 39MF22 that is available for 1.80 euro. So I made a choice to build a solid state relay for my project.
I have to add though that a four channel relay board, ready made, is also not that expensive. So, before you build my solid state relay you may want to check out these options: http://dx.com/p/arduino-4-channel-5v-relay-module-expansion-board-137109 or even cheaper: https://dx.com/p/5v-4-channel-high-level-trigger-relay-module-for-arduino-red-157213 . In fact, these may even be slightly less expensive than the Solid state relay board I will be describing here.
Bill of materials:
4x 39MF22 from e.g. dickbest I believe it can switch 900 mA which is sufficient for most of my applications You could also use PR26MF12. It is pin compatible and switches 600 mA
4x 8 pins dil IC holder
4x LED in color of choice
4x 330 Ohm resistors
4x 2 pins screwconnector
1x 5 pins female header
1x 5 pins male header 90degrees
1x Tic-Tac peppermint dispenser The bigger one: 8.5x2x5 cm
1x piece of PCB 6x4.6 cm
For a snubber:
1x 100 Ohm resistor
1x 100 nF 600 V resistor
OK Stop right here. This circuit is meant to switch AC loads of 110 or 220 Volt. These voltages can and will kill you, so be careful and if you do not feel confident you know what you are doing, you should only use this for low AC voltage loads.
Also, as said, this circuit is for switching AC, it is not for DC. for switching DC a HCT4066 should be considered (depending on the load to be switched) or a mechanical relay
Step 1: Building a Four Channel SolidState Relay: the Circuit
The circuit is fairly easy the output from an arduino or other microprocessor is fed to the 39MF22 via a resistor and an LED that will light when the relay is activated.
The 330 Ohm resistor limits the current to the 39MF22 from a 5Volt output. If a higher output voltage is used, recalculate the value.
In calculating the resistor value for other voltages, take the following in consideration: The 39MF22 has forward voltage of 1.2 Volts. Current should be between 5 and 20 mA. Most green or red LED's have a forward voltage of 2 Volts. Therefore the value of R should be at least (Vcc-3.2)/20 (gives value in kOhm) and at most (Vcc-3.2)/5 (gives value in kOhm).
So for 5 Volts this would be 1.8/20=90 Ohm till 1.8/5=360 Ohm
This table will save you calculating the value of R2:
Voltage Minimal value Max value
5 90 360
6 140 560
7 190 760
8 240 960
9 290 1160
10 340 1360
11 390 1560
12 440 1760
13 490 1960
14 540 2160
15 590 2360
16 640 2560
17 690 2760
18 740 2960
Values in Ohms. Just chose one sort of in the middle of the range for your voltage.
The circuit only shows one channel so you will have to build this 4 times.
Step 2: Building a Four Channel SolidState Relay: the PCB
The PCB is quite easy. I have included the lay-out for download here. The file is a pdf file in the right size for the so called 'heat transfer method'.
You will find an extensive instruction on how that works in another tutorial here.
If you make your own PCB, make sure to leave some copper around pins 1 3 and 4 as that helps in cooling.
Mounting the board with components is pretty self explanatory, just watch the polarity of the LED.
At the left side of the PCB there is a 5 pin female header: 1 ground pin and 4 signal pins.
I attach to that using a 90 degree angled male header. Angled because I have put the entire board in a small plastic box that will not allow a straight header.
At the right side are the 4 AC mains switches. These function just like regular switches so they must be in series with the load one wants to switch.
The snubber network (the 100 ohm resistor and the 100nF in series) is not found on the PCB. These are connected over the switch contact of the SSR where it connects to the load.
An informative website on SSR's can be found here.
Step 3: Building a Four Channel SolidState Relay: the Box
I have used a large Tic-Tac peppermint box to encase the pcb. It measures 8.5x2x5 cm and the PCB fits nice and snug.
The signal cable is coming in through a hole at the left. The mains AC switcg cables come in through a hole at the right.
Once you are completely satisfied with its workings one could seal one or both holes with either hot glue or silicone around the wires
fruityfred made it!