Super Easy PC Control of 110 Vac using a Crydom Solid-State Relay

Super Easy PC Control of 110 Vac using a Crydom Solid-State Relay
I'm getting ready to try my hand at doing some hot plate soldering. Therefore, I needed a way to control 110Vac from my PC.

This instructable shows how to easily control 110Vac from a serial output port on a PC. The serial port I used was a USB type. Any standard serial port should work.

The idea is to connect the DTR (data terminal ready) pin from the PC serial port to a Crydom solid-state relay. The Crydom relay accepts a control signal of 3 to 32 volts to turn on the solid-state relay. The Crydom relay can also handle up to -32 volts on the control input to the relay. See attached datasheet.

Under normally conditions the DTR signal switches between +10 volts and -10 volts. This works out perfectly for the Crydom relay. The Crydom relay turns on at anything above 3 volts. Any voltage below 1 volt is guaranteed to turn off the relay. So, using the +10 to -10 volts of the DTR signal is perfect. The Crydom relay has a maximum load of 2mA on the DTR signal.

Switching the DTR under program control is also really easy. I've attached a little Python script that toggles the DTR pin every couple of seconds. The Python script is only 16 lines long!

To make the Python code work you will need to add an extra little package to Python called PySerial. I've also attached the windows installer for PySerial to this instructable. With a quick Google search, you can find PySerial on Source Forge easily too.
 
Remove these adsRemove these ads by Signing Up
 

Step 1Wiring Crydom

Wiring Crydom
Caution! Make sure you tripe check everything when working with 110Vac.

The wiring circuit couldn't get much easier than this! The Crydom block is simply inline with the hot side of the 110Vac line. The neutral side passes right through. Pass the ground through too. But, also connect the ground to the heatsink/Crydom block to ground.

I know, I know, the wiring I used on the AC side is to small. I've got a really big Crydom relay (40 Amps!) so I should have some big mother wires. My house has 15 amp breakers so #12 wiring would be OK. I just grabbed an old PC cord and forgot how small the wires are. I think my wiring on the AC side is #18. So far I've just been playing with a 100 watt lamp, so no problem. I'll rewire before plugging in a big hot plate.
« Previous StepDownload PDFView All StepsNext Step »
32 comments
Jan 24, 2011. 8:37 AMcowen says:
I know this is an old Able but what would a circuit look like if you would use a parallel port instead of serial?

LPTs use multiple data lines (8) instead of the serials one line.

By comparison you can use lpt1, 2, and 3 with just 3 cards, where you need a serial port for each control port. USB to serial dongles would allow for more then 4 easily added ports.

Do you think you could email a simple .py file for that interface?

Thanks
Aug 26, 2010. 8:13 PMcgrooms says:
I have another question for you! Is there any way you can have multiple replays on one serial and if so What pins would I use?. My goal is to control multiple lights. or is that not possible and you have to use two serials pins 4 and 5
Aug 22, 2010. 12:27 PMcgrooms says:
Thanks so much for your help! I got it to work last night! I just needed for some reason to install python-serial and to specify what serial port I had to modify the code a little
Aug 21, 2010. 6:13 PMcgrooms says:
Thanks, I fix that problem now I have this error File "temp.py", line 7, in ser = serial.Serial( COM_PORT-1, BAUD, timeout=0.5, rtscts=0 ) File "/usr/lib/python2.6/dist-packages/serial/serialutil.py", line 166, in __init__ self.open() File "/usr/lib/python2.6/dist-packages/serial/serialposix.py", line 175, in open raise SerialException("could not open port %s: %s" % (self._port, msg)) serial.serialutil.SerialException: could not open port 6: [Errno 2] No such file or directory: '/dev/ttyS6'
Aug 13, 2010. 2:54 AMcgrooms says:
having the same problem getting errors File "test.py", line 8 print "On" ^ IndentationError: expected an indented block
May 4, 2010. 11:38 AMCrimson-Deity says:
I can't get this to work. All I get is a
errors.
May 5, 2010. 8:15 AMCrimson-Deity says:
Thanks for the quick respons ! :D

I have never, ever programmed ANYTHING before so I'm a noob to the max. Could you make a tutorial on how to use Python? I tried to copy and paste the "Test.py" content into the IDLE Python text thing, but some sort of error occured. My laptop is somewhere out of my reach at the moment so ill post a picture ASAP.
Jan 4, 2010. 6:17 AMfrankenp says:
Thanks!  I just built a similar device to switch off my old analog stereo gear (no remotes) when I put my computer to sleep.  Just tapped into the 5V line on a spare PC power connector.  The hand drawn diagram was very helpful.

Jan 4, 2010. 4:00 PMfrankenp says:
Pics of my build mentioned above.  I used two small 3A relays one for each plug..  3 amps per plug is more than enough for my use and the relays fit nicely inside a two gang box.
100_1108.JPG100_1112.JPG100_1113.JPG
Jan 4, 2010. 7:54 AMfrankenp says:
My PC keeps the USB ports turned on during sleep.... so I had to use a power plug.  Some PC's keep their USB powered while others do not.  I like having USB powered during sleep because I can use my wireless usb keyboard to wake the PC.
Aug 1, 2011. 8:33 AMuberdum05 says:
On my PC, the front USB ports turn off but the back ones only provide power...
Apr 4, 2009. 10:39 AMSwishercutter says:
I remember when I was in electronics, building a SSR was one of our last projects. Then we had to use our "8088 Primer Trainer" (kit using an 8088 processor to learn to program machine language) to turn on 3 items, a light bulb, a blender and a drill press. So we had to break up into groups of 3 and hook up the hardware to the computer then write the necessary code to turn on one item for 3 seconds then the next and so on. Lots of fun...and we actually built the relays also..if I remember right they were capable of over 20A @ 120V...although its been a number of years.
Apr 5, 2009. 7:47 PMSwishercutter says:
I have no experience with the Crydom or any other manufactured SSR's. Just the ones we built from scratch for educational purposes. I never extensively tested it but it seemed to do just fine. I imagine there may be some issues with the initial current requirements of a large inductive load like a motor (there are ways around that) but they worked in the short term amount of time for our final lab exam. I will have to find the schematic with the part numbers and show how to build one from scratch sometime. Although, I never seem to find the time to actually do an instructable on anything though.
Apr 5, 2009. 7:08 PMalex-sharetskiy says:
you could just use a pull-up transistor and a regular relay
Apr 4, 2009. 5:20 PMcirvin says:
That's quite a heatsink you have on that SSR. I have a few of these wired up in a steel electrical box with a plug in my dorm to switch a 600 watt lamp, without a heatsink attached. I haven't noticed any appreciable heating of the units. Please comment when you test this out, I'd like to know how your device behaves under your load.
Apr 5, 2009. 11:59 AMRazorConcepts says:
Hmm I found some cheap-no-name brand SSRs on ebay for $7.50 shipped. Will try that out, I looked at the prices on the Crydom relays... WOW
Apr 5, 2009. 2:46 AMgentry says:
How much did that SSR cost? I found some 15a Sharp brand ones at digikey for about $5.
Apr 4, 2009. 9:01 AMgwhamilton says:
What are the chances of powering the SSR from a USB port? The 5 volt signal should work. I work with SSR's everyday but I need to find a program to switch USB power. Thanks
Apr 4, 2009. 12:56 PMedwardchen says:
Pretty easily, you should be able to grab an FTDI type device and just use that as an USB to Serial converter, you should be able to use the TTL serial signal straight from the FTDI to switch the SSR. Other than that, you can follow this instructable for the rest of the instructions.
Apr 4, 2009. 10:45 AMSwishercutter says:
Honestly, I know very little about USB programming but since it is a serial connection I would imagine that it would be easy to make a hardware serial to parallel converter with some flip flops on the output set up to drive the relays (not really as simple as I make it sound, but not too bad). By doing this you will not only be able to control power, you will be able to control multiple relays using BCD (Binary Coded Decimal) or something similar to specify which relay is being controlled. With flip flops on the output it makes it so that an item turns on and waits for another signal to turn off (also makes it so you don't have to send a different message to turn off the item, just send the same on message to switch the flip flop).
Apr 4, 2009. 2:40 AMBerserk87 says:
cool. i was looking for ways to control high voltage with low voltage things like computers or micro controllers.
Apr 3, 2009. 6:51 PMservodave says:
Cool. Best thing about this is that the computer is optically isolated from the ac line. I've built dozens of these for the research lab I work for over the years. SOOOOO Useful for turning things off and on--solenoids, fans, small motors. Usually I put a BNC bulkhead connector on the input and a neon lamp on the output for diagnostics. You might want to add a fuse and some sort of enclosure with vent holes and a fan if you are pushing a lot of power though the relay. Maybe gut an old PC power supply to get the power entry module. Other than that: good show!

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
53
Followers
16
Author:jimk3038(www.ph-elec.com)
Founder of Powerhouse Electronics. For more info goto: www.ph-elec.com