Solid State Relay Switched Mains Rig

Introduction

For a number of my upcoming projects I need a rig to test the functionality of a solid state relay that would be driven by a microcontroller and switch the mains for other devices. Having done projects with similar requirements in the past I remembered how much pain it was to test the solid state relay (SSR) with naked mains cables running around, etc. This time I decided to create a marginally more sophisticated setup that would allow a quick, easy and safe way to do this. Also, now that I have made this once, I can reuse this rig in any future project with zero effort. Making this took about a day’s work – most of the time was spent on finding materials that suited my needs.

This mains output is switched by a solid state relay, baby! 🙂

Materials

Most of the parts I have recycled from old, discarded household devices, computers, etc. The only item that got specifically for this project is the solid state relay or SSR: it’s a cheap one that can handle 25A on its switched end.

An old, non-working printer (?) power supply has kindly donated its enclosure for this project. I just needed to make some minor adjustments for the sockets and cables passing through it and the enclosure story – the most difficult part of any project (for me) – was over!

As the mains input I chose a PC power cable, just cut off the end (that usually goes into the PC) and connected it directly to the appropriate terminals.

For the switched output I salvaged a female, panel-mounted 3 pole socket, recycled from an old and unusable UPS.

The control signal arrives to the unit through another cable borrowed from a non-working printer – I even left the barrel plug on it, so that I can easily connect to my bread boards easily.
Finally, I used some sticky rubber feet salvaged from some old satellite receiver so that it can stand nicely, without scratching whatever it is on.

Construction

First I gutted the power supply – I kept some parts from it for future projects and threw away the rest. Then I laid out all the components in it to make sure everything fits nicely. Using a Dremel I widened and deepened the hole on the sides for the (output) socket and the (input) cable.

Also, with the Dremel I created 3 new holes: one on the side for the cable of the control signal and two on the bottom for fixing the solid state relay.

These two screws hold the solid state relay in place.

The solid state relay is already secured and the control signals are attached.

It turned out that the output socket was too high and did not have any support at its bottom, so I cut a couple of rectangle shapes (of the dimensions of the socket profile) out of some left over 1mm thick polystyrene sheet and I superglued them to the bottom of the socket to provide a solid base for the socket.

While the glue was drying a huge “peg” was holding it in place.

When dried the base is so strong I couldn’t tear them apart with my hands.

After this only the connections had to be made which are trivial:

Yellow-green: connected between the input and output as well as the back of the solid state relay.
Brown: goes straight from the input to the output.
Blue: the input is connected to one of the relay’s switched terminals. Another piece of blue cable goes from the other terminal to the switched output.
Red and grey: control signals.

All the mains connections in place.

I created a small circle of hot glue on the input and control cables to prevent accidental cable strain.
The input and the control cables.

After attaching the sticky rubber feet it’s ready for the next experiment!

I could have complicated the circuit a bit further. An LED on the enclosure showing if it’s on or off would be nice (the enclosure even has a dedicated place for it), but in my case it’s not necessary as the switched circuit will give feedback on the state of the relay. I could have used sockets and connectors on all IO. I decided not to so that it’s simple and compact.

21 Comments

  1. Anonymous

    I would add a fuse to the 'hot' line leg in case the connected load has issues. I would also have used a mechanical relay or motor contactor as the power switching device, and drive that with the SSR. Mechanical relays are more fault tolerant than SSR's.

  2. You might not NEED to develop with mains, but it can be fun to mess around. This is a great form factor btw, I might have to make a few for myself! Also – if the wire is flexible enough I like to twist a small knot into the wire then pull the knot down to the hole before hot-gluing in place. It may be unnecessary but it feels more resilient to accidental tugs.

  3. Anonymous

    This, you really should switch phase (the brown wire) not neutral. Even when the relay is off you will still get a shock if you touch the output. If you switch phase instead the output will be safe(r) when the relay is switched off.

  4. Anonymous

    Great; FYI a little constructive criticism:
    1) Mains terminals on IEC would benefit from heat shrink.
    2) Earth solder on IEC looks a little dry
    3) If this were high current, soldering is in-advised – Well made crimps are better
    4) Hot glu is not robust – a hot day/hot relay will soften glue. Consider a mechanical strain relief like clamp or knot (just noticed someone else said that)

  5. Anonymous

    Since I'm testing a toaster oven controller in a similar fashion right now, and build up something similar, I'm impressed with your design… very clean looking. It certainly would be good to cut away under the relay and add a heat sink. My relay is screwed to a metal receptacle box to help dissipate heat, but it doesn't look as nice as your setup. Switching the hot would certainly be a better idea. Lastly, the comment about testing without the mains is only partially valid. I tested my initial code with an LED, but now I'm trying to dial in an Arduino PID controller that must read the actual oven temperature using a thermocouple, so I don't know how I could develop it without the mains voltage. Once it's finalized I'll mount the Arduino and relay in the control section of the toaster oven, but for now the control box is very handy. Thanks for sharing… nice work!

  6. Anonymous

    In an application like this you should switch BOTH, and short the phase and neutral on the load side to Earth when off. Depending on what sort of building you are in, there could be nearly 300V between NEUTRAL and Earth (unbalanced load on multi phase power, common in industrial and office buildings). For prototyping and experimenting I'd certainly want to make sure the high voltage side of the load is completely dead when switched off.

  7. Hey. I am a licensed electrician in Canada. You must ONLY switch the HOT! As someone else pointed out if you do not then the equipment is floating at mains potential and is not only a safety concern but if it starts a fire and the insurance inspection flags this device as the cause you are liable for all damages!

    When working with mains voltages of any kind it is always preferable to switch both the HOT and the Identified (Neutral) but legally you only need to switch the hot.

    Just to give an example: Your lightbulb in your shop broke and you turn off the switch to replace it. In order to get the base out you stick anything (finger, screwdriver, potato) in to twist it out. Well if you touch the filament and earth you will draw the entire "Fault Current" of the circuit. (This is dependant on the breaker but most household breakers are 5,000-10,000A for a few cycles before trip!!) IF you are on an aluminum ladder on concrete your body has around 100k ohm resistance a good portion of that current will be travelling down your arm and across your HEART!

    If you had switched the hot wire at the light switch as is code then the only wires connected back to your breaker panel would have been the neutral and ground which are tied together in your panel and have no difference of potential.

    I don't mean to rag on yea but I can not impress the importance of safety at line voltages. I work with 120-600V every day and have seen equipment and breakers explode when subjected to full fault currents.

  8. I see most commenters noticed that I break the neutral wire instead of the live one. Let me give some background info on this:
    Where I live (Greece) wall sockets are NOT polarized, i.e. even if all the sockets were standardized and, say, had the live wire on the left, I could still plug in a device either way. For this reason, I simply CANNOT remember which colour is which in a mains cable, since it has zero meaning for me.

    Some of you mentioned to use two SSRs to break both wires. This would be great, but would use much space and I don't really need it for my experiments.

    About the current throughput and the lack of heat sink: The reason I didn't put any heat sink on the SSR is because I don't have a lot of current flowing through in my CURRENT experiments. Of course, I know that when I will need to switch something heavier, I will modify this rig or will make another one.

    Finally: THANKS to all of you guys, who commented on this article taking MY safety so seriously!!!

  9. Handy guide of plug types, looks like there should be polarized F-type plugs in Greece, but you're there and I'm not 🙂
    http://users.telenet.be/worldstandards/electricity.htm

    I've found this color code guide useful and have drawn a few reminder diagrams from it:
    http://www.allaboutcircuits.com/vol_5/chpt_2/2.html

    Also important to make sure your wire gauges are up to the task:
    http://www.csgnetwork.com/wiresizecalc.html

    And, as was mentioned previously– crimp connectors for high power connections are the way to go! Much easier to manage and more flexible long-term than soldering!

    Happy hacking– stay safe and follow the guidance people are offering you!

  10. Thank you, Salsa! Useful tables, although even according to the tables you mention the F-type socket/connector is NOT polarized 🙂

    Thanks anyway, I'm sure I'll use these links in the future!!!

  11. First time I hear about this, I checked their site and it seems I re-invented the wheel. They seem to be similar. The difference is that I made this on my own, and it doesn't cost me $25.99 🙂

  12. In that case (Greece's unpolarized plugs), you need to break not only ONE random wire, but BOTH wires. Period. 'nuff said.

    Btw.: I'm German, we have the same 'problem' with unpolarized plugs (infact the same type of sockets/plugs). Yes, a single wire switch is okay for things like a desktop light. But if you want to change the light bulb and it breaks, the only reasonable way to go is to unplug it. As Trevor said, there is a 50% chance to have an unpleasant experience touching a filament.

    If you do this project for safety reasons, It's just stupid to say 'a double pole SSR uses too much space' (paraphrasing). No offence meant. If you want to be safe, your solution is just an illusion.

    If you want to be safe,
    a) have an appropriate circuit breaker in your house installation (I'll take take as given if your house is reasonably new and well, there are all those EU regulations…)
    b) have a residual-current device (RCD), or residual-current circuit breaker (RCCB) between you and your power source
    c) use a 1:1 transformer 239V/230V or a combination of a 230/xV and xV/230V. This will make the secondary side float, so a single contact of your body with the circuit will not return any current to earth.
    d) use a double throw _relay_ (not SSR) to control the secondary side. With a SSR, there are only some Angstroms of silicon between the contacts – with a relay, you'll have a few millimetres of air
    e) as an old professional told me: Working on a mains powered device, you always have either the power plug or one hand in a pocket of your trousers. That way, you are sure, the device is either properly powered off (and thus safe to work on) or at least you can't make a two-hand contact and send a current through your body

    Play safe.

  13. If you live in a location (Germany, Greece, etc) where the hot wire can not be identified and you don't have the space/$$ to do two complete SSR's. Then why not use one SSR and one Relay. Have a 2nd signal line that says, I'm going to do PWM, that turns on the standard DPDT or DPST relay allowing you to toggle the SSR to do your PWM. When your not using the PWM you simply turn off the signal line thus cutting the power to the relay and cutting off both power lines. If you used a DPDT you could also use a cap across the lines to allow back drain when in the "off" position.

    Great project, and just a thought. Here in the US, and other countries I've worked in where they "key" the hot line, it is still a good idea to use a double break type setup. Even here we get a lot of stupid home owners that think they know what they are doing and wire the frigging plug, switch, or whatever backwards :(. 110 sucks, 220 makes ya twitch

    – Jeremy

  14. Very good idea, Jeremy, thank you. I will most likely make these changes soon. I also think this is the way to go, even if you have polarized plugs.
    Once, when living in Ireland I had to do some maintenance on a ceiling light in my home. I switched off the main circuit breaker for the house and I was still electrocuted… ended up in the ER, but, luckily, nothing bad happened… I was released after a few hours…

Your thoughts?

This site uses Akismet to reduce spam. Learn how your comment data is processed.