loading
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.

Advertisement

<p>is it possible to use it withoud LED`s ? what resistor should i use then ?</p>
<p>sure. use a 470-560 ohm</p>
<p>thats what i thought so ! thanks ! :)</p><p>i have ordered AQH3223 which seems to be capable of 1.2A load :)</p>
<p>I think the solid state relay that I use can take 50mA so there is some leeway.<br>Your AQH also has a nominal 50mA forward current.<br>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<br> </p>
Hmm, where did you find that 6v forward voltage ? Datasheet say it is 1.21 to max 1.3v. Or am i wrong ?
<p>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.<br>However... you can use it to dim a light then if you add a seperate zerocross detector.<br>The 3213 would have been a zerocross ssri</p>
<p>Hello,</p><p>Thanks for a quick reply.</p><p>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 ?</p>
<p>Well I have to correct you coz you are wrong. :-)<br>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 <br>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</p>
<p>I am wrong. I looked in the max ratings. Apologies</p><p>http://pdf.datasheetcatalog.com/datasheets/166/379804_DS.pdf</p>
<p>Hello Again,</p><p>Do you know what is the current draw of 39MF22 ?</p>
<p>do you mean the maximum current it can process? that is in the datasheet too. it is 900mA. Primary it is 50mA.<br>However, with 900mA it needs decent heatsink. Usually that is a coppersurface on the pcb, soldered to all 3 kathodes</p>
<p>Well actually im thinking how much current do i need to drive it .</p><p>Im using PCF8574 Expander and it can deliver up to 20mA per channel with total 100mA for all of them at the same time.</p><p>Let say like regular relay takes 80mA to drive coil - then i would need transistor for ich output to drive relay</p><p>I would really like to avoid transistors and use expanders only, but the question is how much current does 39MF22 take to operate</p>
<p>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</p>
<p>Hi, </p><p>How many devices (say, ceiling fans) can a single channel Solid State Relay control?</p>
<p>Hi Shruti, that depends on the solidstate relay used and the wattage of the devices.<br>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.<br><br>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.<br>Also consider just using a mechanical relay</p>
<p>Hi, Thank you! Will check the specs. But just as a general question, <br>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? <a href="http://www.ebay.in/itm/172057529563?aff_source=Sok-Goog" rel="nofollow">http://www.ebay.in/itm/172057529563?aff_source=Sok...</a></p><p>or this, with an opto-coupler <a href="http://www.ebay.in/itm/151965022571?aff_source=Sok-Goog" rel="nofollow">http://www.ebay.in/itm/151965022571?aff_source=Sok...</a></p><p>Can it control speed of say, 4 fans minimum?</p>
<p>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.<br>Still, for any inductive load i probably would choose a mechanical relay<br><br>If you ask me, both links are the same, just a big difference in price</p>
<p>Thank you for your help!</p>
<p>my pleasure</p>
<p>Works like a charm, thank you so much for this tutorial!</p>
<p>my pleasure. thanks for your picture</p>
<p>Hi,</p><p>Thanks for the fast reply. </p><p>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.</p><p>Do you have eagle-scheamtics/board documents? If so, I can customize them for 4 simple SSR and 1 dimmer for PWM control.</p><p>Thanks &amp; regards,</p><p>mahadevan</p>
<p>yes i remember :-)<br>I made this in Fritzing. I prefer that one over eagle :-)</p><p>But as you can see in step 2 it is a very easy lay-out. should take you 5-10 minutes in eagle to set that up</p>
<p>Hi,</p><p>Thanks for your kind advice. It seems that I can't get (39MF22, PR26MF12, S26MD02 ) in India. So I am planning to use following SSR (PANASONIC ELECTRIC WORKS - AQH3223AJ - SSR, 600V, 1.2A) . Link is <a href="http://in.element14.com/panasonic-electric-works/aqh3223aj/ssr-600v-1-2a/dp/2095718" rel="nofollow">http://in.element14.com/panasonic-electric-works/aqh3223aj/ssr-600v-1-2a/dp/2095718</a></p><p></p><p>Can I use AQH3223AJ as replacement ?</p><p>It seems AQH3223AJ is having random-fire-crossing (as opposed to zero-cross-firing in SSR mentioned by you). So will it be OK to use this part?</p><p>As AQH3223AJ support random-cross-firing, can I use it for Fan-Control (inductive load)?</p><p>Thanks &amp; regards,</p><p>mahadevan</p>
<p>Small correction:</p><p>I do get 39MF22, PR26MF12, S26MD02 from element14 in India, but I can buy AQH3223AJ for 1.5$ :)</p>
<p>you can use that one as a replacement, but i doubt if the pins would be compatibel so u may have to change your lay out. Yet, if it has random firing be prepared for a lot more spikes on your mains line and i would advise a good filter. Yes can use it for a fan... but use a good filter<br>Only reason i used the 39mf22 was because it was relatively cheap</p>
<p>Hi,</p><p>Thanks for the reply.</p><p>I will ensure in my circuit about the pin compatibility. Thank you very much for your suggestion.</p><p>I would like to use the filter, but I am not sure how the circuit looks like with filter. If you don't mind, would you please let me know how a good-filter can be incorporated . You can write here or send an email to me at sgorti at.the.rate gmail.com with the values for LRC components for the good filter. Maximum Resistive/Inductance load would be less than 100W @220/240V with 50Hz.</p><p>Thanks &amp; regards,</p><p>mahadevan</p>
<p>Hi, </p><p>Thanks for great circuit &amp; detailed description.</p><p>What is equivalent for 39MF22? Can I use S26MD02 as replacement for 220V AC? </p><p>Where should I put Snubber (R and C) components? Should they be connected (line or neutral) ? Please let me know.</p><p>Can I use this to load tube lights with copper-chokes and electronic chokes with &lt; 60W?</p><p>Can I use this to PWM control for fans ( &lt; 60W )?</p><p>To reduce accidental shortage on AC lines, can I apply glue on AC lines to avoid short circuits ( Question is any heat transfer area need to be kept for AC side of SSR or not ).</p><p>Thanks in advance,</p><p>mahadevan</p>
<p>Mahadevan<br>in principle every ssr can be used that is suitable for the load you want to switch. I have chosen the 39mf22 because it was very cheap, but the S26MD02 is certaily useable. It has a different pin lay out though.<br>A snubber is usually not strictly necessary with a pure Ohmian resistance but if you want to switch a motor i would recommend it.. Usually the snubber is put over the poles of the TRIAC, in this case pin 8 and 6, but one can also try put them over the connections of the load.<br><br>I have not tried it myself but I think one could switch a tube light with this.<br>It is not suitable for PWM control. the reason for that is that the 39mf22 has a built in zerocrossing control. Therefore when you send your pwm signal, it will still wait for the next zerocross and thus screw up your timing.<br>If it didn't have a zerocross you would still be in the dark because your pwm signal will then switch on the SSR in random phases of the AC cycle and thus may sometimes send full peak and sometimes send 0 volt.<br>If you want to do kindoff a pwm with AC you have two options: edge/phase cutting or pulse skip modulation. Both techniques are possible with the circuit in this link: </p><p><a href="http://www.instructables.com/id/Arduino-controlled-light-dimmer-The-circuit/" rel="nofollow">http://www.instructables.com/id/Arduino-controlled...</a></p><p>Once you connected your AC lines there is no problem putting some glue on them/in between them.<br><br>Good luck</p>
<p>I&rsquo;m working on a project which is about making a rescue <br>robot . I have struggling with it for 4 months and now all the mechanical works <br>had been done . but I&rsquo;m facing difficulty in make the robot to work with rf <br>module can u plzz help me&hellip;</p><p>I want make transmitter and receiver that can control the <br>motion&hellip;I mean that receiver should have control 8 dc gear motor and each dc <br>motor should have a forward and backward botton to control the motion &hellip;&hellip;can u <br>kindly help me with this project &hellip;.if u can make the circuit board diagram for <br>the PCB &hellip;.or any other suggestion plz reply&hellip;&hellip;mail me at &ldquo;sunny1995gagan@gmail.com&rdquo;</p>
<p>synny, it is kind off a far cry from having questions on a 4 channel solid state relay and designing and building an rf controlled 8 dc back and forth motor project.<br>I dont want to be unfriendly but you are asking something here. Anyway, as I do not know your platform at all, I will make some suggestions what you can do.<br>RF transceiver modules can be picked up from dx.com for just a few euro's and can easily be controlled by a microprocessor. Presuming you are using a microcontroller in your robot, you can buy again for a few euro, a 2 or 4 channel motordriver from dx.com in which you can reverse polarity. you need either 4 or 2. hook these up to a pin of the microprocessor and you can control direction. If you also need to control speed you need 2 pins per motor.<br><br>Hook up the receiver and let your program take actionon the motors according to what you send.<br>Attach the transmitter to another microprocessor, or just to buttons, depending on how sophisticated you want to make it and off u go.<br><br>Amother possibility is to buy a ready made transceiver set like for model planes, with the amount of channels you need</p><p>Good luck</p>
I looked up the data sheet for the DIP used here (39MF22). My question is can this really switch 120+ low current voltage? I simply don't see that in the data sheet, but I could be wrong. I would like to use this circuit to switch christmas lights that I am working on. Do you think this will work with one strand of normal christmas lights? <br>
Tiger5248 <br>Though I cannot try it myself as i have no 120 Volts, I see no reason why it should not. The low current should not make a difference
I built your relay design into an Arduino circuit, but the relays don't seem to be working like SPST switches, like I expected (there is no continuity between pin 6 and 8 when the relay is activated). <br> <br>https://dl.dropbox.com/u/324863/IMG_20121028_152031.jpg <br> <br>Please forgive me, as I know very little about electronics - I simply cobbled together a few circuit designs I've come across (5V regulator, Arduino, MIDI input, and your relay design).
Ben, sorry for my late reply, I did not see your question come in. Well the 39MF22 is not exactly a single-pole, single-throw switch it is a solid state relay and the switching takes place with a triac. <br>When you say that thereis no continuity between pin 6 and 8 I get the impression that you just measured that with a multimeter and that will not give proper results. <br>You really need to see pin 6 and 8 as the poles of a AC current swith. Have you actually tried to swith an AC load with it? <br>Your picture looked impressive :-) even though i could not really see what was on it because of the burning LED's. Anyway, let me know what you are trying to switch and wether that is an AC load or a DC load <br>
Thanks for the reply! :) <br> <br>Yes, the LEDs are probably a bit too bright, especially that green power indicator. <br> <br>The relay section will be connected to 1/4&quot; TRS cables for switching channels on a guitar amp - thus, very small current. I'm a bit too gun-shy to do anything with AC at this point; I think I'm a bit of a novice to attempt anything as dangerous as that. <br> <br>I could've used mechanical relays, but I was attracted to the smaller form factor of SSRs, as I'm trying to make the board as reasonably small as possible, so as to fit into a specific-sized hammond enclosure. <br> <br>I'm learning things as I go along, and I was pleased with how things turned out, even though it's only a semi-functional circuit. That said, I'm glad that parts and DIY PCB fabrication are as cheap as they are. :)
I doubt if the channels on a guitar amp can be switched by a solid state relay, so that is where your problem lies. You do however now have a midi controlled lamp switch :-) <br>If you do not want to use small relays, use the 4066 (either a HEF4066 or a HCT4066) that is a bidirectional switch (4 per IC I think) that can be controlled with an enable pin
a HCT4066 costs about 0.25 euro and has 4 channels so that is cheaper than the 4 x 39MF22 (4x1.80) and probably smaller as well
If you are indeed switching DC then the 39MF22 is not suitable for that. It is better then to use e.g. a HEF 4066 if the current is not too big or otherwise a small reed relay
Farnell has the PR39MF51NSZF SSR for just over a &pound; in the UK. <br> <br>The datasheet suggests that you might have problems with inductive loads (motors, solenoids) if the voltage rate of change on switching is high (&lt; 100v per us) and suggests in that case a snubber (R and C in parallel) between pins 6 and 8 - they suggest starting values of 0.022uF and 47ohms - what works will vary with the type of load. <br> <br>So if anyone has problems with erratic switching of motors, etc, they might want to experiment with different values of R and C between those pins.
That should have been &quot;( &gt; 100v per microsecond)&quot;, of course.
Thanks Mikeatboduel. Netherlands is not the cheapest country where electronics parts (and many other things) are concerned. 1.80 euro's is about 1.45 pounds.<br><br>You are right with regard to the datasheet and switching inductive loads is the very reason why i always hesitate vetween a mechanical relay and an SSR. In another tutorial in which I use the 39MF22 I think I indicated use of a snubber network (100R/100nF). I think though it might be better to have that directly over the contacts of the inductive load. E.g. in a socket where it plugs in.<br><br>Having said that. I have been using the 39MF22 for some time already to switch pumps and that has not given any problems yet.<br><br>
Let me just add that the 39MF22 is suitable for currents up to 900mA. The max load I have been switching with it was 100 wats and the max inductive load might have been 20 wats and that goes very well. If you'd want to switch a 198 wats (the max) inductive load, I would definitely use a snubber and probably a fuse as well, probably even choose a different relay.

About This Instructable

30,307views

54favorites

License:

Bio: I am a physician by trade. After a career in the pharmeceutical world I decided to take it a bit slower and do things I ... More »
More by diy_bloke:Home automation with ESP8266 and 433 MHz Switches Monitoring humidity, temperature in the hen house: DHT11, DS18B20, ESP8266 Building a Simple and cheap egg incubator 
Add instructable to: