Introduction: Building a Four Channel SolidState Relay
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
41 Comments
6 years ago
is it possible to use it withoud LED`s ? what resistor should i use then ?
Reply 6 years ago
sure. use a 470-560 ohm
Reply 6 years ago
thats what i thought so ! thanks ! :)
i have ordered AQH3223 which seems to be capable of 1.2A load :)
Reply 6 years ago
I think the solid state relay that I use can take 50mA so there is some leeway.
Your AQH also has a nominal 50mA forward current.
You may however encounter another problem as the AQH3223 has a forward voltage of 6 Volts, so that makes my advice on the resistors completely useless and your Arduino might be barely suitable to drive the AQH Led and if it does, the Arduinoport might get overloaded
Reply 6 years ago
Hmm, where did you find that 6v forward voltage ? Datasheet say it is 1.21 to max 1.3v. Or am i wrong ?
Reply 6 years ago
just one more remark about the AQH3223 it is non-zero cross. That is not a huge problem but it may give a bit more disturbance on the mains line.
However... you can use it to dim a light then if you add a seperate zerocross detector.
The 3213 would have been a zerocross ssri
Reply 6 years ago
Hello,
Thanks for a quick reply.
Correct me if im wrong, but according to AQH3223 max INPUT is 6v. so i should be able to drive it straight from lets say arduino output without LED in the middle, without even using any resistor ? 3223 should take as much current as it needs, right ?
Reply 6 years ago
Well I have to correct you coz you are wrong. :-)
Ofcourse you dont need the series LED. I only put that in there to see if the channel was on, but you do need a series resistor. The nominal trigger current of the AQH3223 is 10mA, but recommended is 20mA. The forward Voltage is 1.18 Volt
If you connect it straight to an Arduinopin you will fry your Arduino as you have no control over the current. As the Arduino will give 5 volt and the forward voltage is 1.18 you have 5-1.18 =3.82Volt that has to drop over a resistor at 20mA so that resistor needs to be 3820/20=191 Ohm. Use a 200 ohm resistor
Reply 6 years ago
I am wrong. I looked in the max ratings. Apologies
http://pdf.datasheetcatalog.com/datasheets/166/379804_DS.pdf
Reply 6 years ago
Hello Again,
Do you know what is the current draw of 39MF22 ?
Reply 6 years ago
do you mean the maximum current it can process? that is in the datasheet too. it is 900mA. Primary it is 50mA.
However, with 900mA it needs decent heatsink. Usually that is a coppersurface on the pcb, soldered to all 3 kathodes
Reply 6 years ago
Well actually im thinking how much current do i need to drive it .
Im using PCF8574 Expander and it can deliver up to 20mA per channel with total 100mA for all of them at the same time.
Let say like regular relay takes 80mA to drive coil - then i would need transistor for ich output to drive relay
I would really like to avoid transistors and use expanders only, but the question is how much current does 39MF22 take to operate
Reply 6 years ago
the 39MF22 has a max input current of 50mA. However you dont need to use that much. In the configuration that I use I have yellow LEDs those have a forward voltage of 2Volt. So from the 3 Volt left there is a current of 3000/330=9mA driving it succesfully. Your 20mA/channel therefore is more than enough
7 years ago
Hi,
How many devices (say, ceiling fans) can a single channel Solid State Relay control?
Reply 7 years ago
Hi Shruti, that depends on the solidstate relay used and the wattage of the devices.
The 39MF22 can take 900mA so if your total load stays below that current you are fine. So at 230 Volts that would be a total Wattage of 207 Watt. A Ceiling fan is usually between 25 and 75 Watts. So I guess it would be safe to switch two.
If you want to switch a higher load, you either have to use a more capable SSR or start using a TRIAC, coz that is usually less pricy than a heavy SSR.
Also consider just using a mechanical relay
Reply 7 years ago
Hi, Thank you! Will check the specs. But just as a general question,
If I have to control about 4 fans in a small room.. and I buy a Ready to use relay is this one that I have been looking at okay? http://www.ebay.in/itm/172057529563?aff_source=Sok...
or this, with an opto-coupler http://www.ebay.in/itm/151965022571?aff_source=Sok...
Can it control speed of say, 4 fans minimum?
Reply 7 years ago
The OMRON G3MB can switch 2 ampere so in total that is 440 Watt. So as long as the total of your 4 fans doesnt go beyond 440 Watt (Which it probably wont) it should be OK. I do not know the OMRON well enough to know if it needs a heatsink for full power. But then again, you have two of those on a board so in total you can switch 880 Watt. So if you switch 2 fans per channel, I dont really foresee any problems.
Still, for any inductive load i probably would choose a mechanical relay
If you ask me, both links are the same, just a big difference in price
Reply 7 years ago
Thank you for your help!
Reply 7 years ago
my pleasure
8 years ago on Introduction
Hi,
Thanks for the fast reply.
Earlier I have seen you dimmer circuit and I asked PWM question as components are lesser. Actually I need 4 simple tube lights where there is no need of PWM(copper chokes -- which could be inductive while tubelight starting) and 1 fan (here PWM is neede). So I will club this circuit with your other dimmer circuit.
Do you have eagle-scheamtics/board documents? If so, I can customize them for 4 simple SSR and 1 dimmer for PWM control.
Thanks & regards,
mahadevan