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





Introduction: 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.

Step 1: 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.

Step 2: Python Test Code

Below is the magic Python code. Again, can't get much easier than this. I've also attached the code in a file called "".

import sys, serial
from time import sleep

BAUD = 9600

ser = serial.Serial( COM_PORT-1, BAUD, timeout=0.5, rtscts=0 )

# Toggle the DTR pin on for 15 seconds, then off for 5 seconds.
while ( 1 ) :
print "On"
ser.setDTR( 1 )
sleep( 15 )
print "Off"
ser.setDTR( 0 )
sleep( 5 )

Step 3: Be Careful

Before I use this Solid-State relay I'm going to mount some Plexiglas over the AC side of the relay. The 110Vac can really bite so be careful!

Hope this helps - Thanks,



    • Pro Tips Challenge

      Pro Tips Challenge
    • Paper Contest 2018

      Paper Contest 2018
    • Trash to Treasure

      Trash to Treasure

    We have a be nice policy.
    Please be positive and constructive.




    You can control TWO things with two CryDoms: one using DTR (Data Terminal ready), the other using the CTS (clear to send) lines. Just a thought. I'm building a circuit in this configuration, that will first turn on the front light of a haunted house mirror, count 30 seconds, then turn it off, turn on the back light, and take a picture with a webcam:
    I'll sense the switch with one of the other serial lines.

    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.

    That is a cool idea.

    I wonder if I could use my laptop's USB port? I'm assuming it switches off too when entering into sleep mode. I could use that to switch off my space heater I use under the desk.

    Nice idea,

    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.

    On my PC, the front USB ports turn off but the back ones only provide power...

    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.


    Really nice. I like how everything gets packaged into a plastic box. Being a computer guy 110Vac always makes me nervous. Having everything sealed up is nice.

    One thing to watch out for - the 3Amp rating is only good for Crydom modules that have a heat sink / good ventilation. I learned the hard way that the large module must be bolted to a heat sink. I'm not sure about the small modules you are using. But, packing them inside a small box might be a problem. Based on your mounting, I would derate them down to 1 amp.

    Looks good,

    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?


    This was really intended as a quick and easy way to control a single 110Vac device. I used it to control the temperature on an electric skillet while reflowing solder paste.

    If you want to control a bunch of outputs at the same time I would be inclined to use a Pic, MBed, Arduino embedded micro instead. With one USB connection you could control an unlimited number of output channels.

    Note, there are already these kind of devices on the market. Folks use them to control outdoor Christmas lights under computer control.

    Sorry I couldn't be more helpful. I've just never fooled much with the parallel port.

    Good Luck,

    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