Safe enclosures for solid state relays and mains current


Solid state relays can switch everyday mains-powered devices like lamps, but there’s danger inherent in working with household AC voltage. Victor wrote a tutorial on how to enclose the SSR in an old laptop power supply case. It’s simple to build, and it keeps you and your fingers safer than a bare board.

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.

Join the Conversation


  1. Make sure that all the cables are secured with cable ties so that a loose cable can not come in contact with another connection. One cable tie for the control cable and one for the live cables. Ring cable lugs properly crimped or soldered are a lot safer than raw copper wires as they can be tightly screwed in place. Good practise is to take one loose cable end and swing it around to see where it can reach. Appliances must handle this kind of single fault to conform with CE regulations.

    Depending on the load you are switching, an X2 or X1 rated capacitor between Live and Neutral on the line side of the solid state switch might help. For smaller loads maybe 100 nF and for larger load up to 1 or 2 uF. When the triac switches on, even with zero crossing triggering, there is a small current peak.

    Keep the low voltage cables and the line voltage cables separated, both for EMC issues and for safety. I have seen some strange issues with 12Volt+I2C cables in parallell with 230 Volts power cables. The 12 Volts were properly filtered and the I2C bus had both series resistors and a “strong” resistive pullup but occasionally the microcontroller had reboots. The board itself was already tested for EMC according to CE and passed the tests. A customer did not read the installation manual and had a noisy supply voltage.

  2. This is NOT a ‘safe’ enclosure. It’s safer than being in the open, but that’s about it. I don’t recommend this setup (as it’s presented) at all. One thing that you are really going to have to watch here is heatsinking. The SSR may be rated at 25A, but if you’re thinking that it’s going do that hooked up like this, think again! It certainly won’t handle anything even remotely close to that without *good* heatsinking (eg. < = 2C/W). SSR's can use back-to-back SCR's, cheap or lower current ones will probably use a triac as the output device, some nowadays use IGBT's (much less common though), but either way, for any decent sort of load they will most certainly need good heatsinking and a good quality thermal interface medium (non-conductive good quality heatsink paste or suitable thermal washer). Mounting this on a plastic case will mean you can only use it for very light loads, this would be limited to about 4A in the configuration shown.

    As Niklas pointed out, you want fit crimped (or well soldered) insulated eyelet lugs (also known as ring lugs) to all wires and use a shake-proof washer between the screw head and lug.

    Also the picture shows a long mounting screw protruding up to near the live terminals. Using a shorter screw to keep it well away from the terminals and reduce the chances of accidentally having that mounting screw *LIVE*. If you must use a long screw, cover it with 2 layers of heatshrink, just in case anything accidentally shorts. If there is any leakage to the screw for any reason, that screw would be live on the outside of the case if somebody touched it. You really should be fitting a Safety Earth with suitable crimped eyelet lug, along with star washers to the SSR Base. If using a heatsink, make sure that has a separate Earth point as well. Ensure you fit the protective plastic shroud to keep any fingers away, even though it's inside the case.

    There are different types too, some are just straight turn-on (when phase is at a suitable point), some have Zero Crossing, but you need to understand that there is Zero Voltage Crossing and Zero Current crossing types and combinations. If you're using a highly inductive load, you would likely want Zero Voltage turn on and Zero Current turn off, as the current will have a phase lag. A suitable RC snubber might also be needed for inductive loads, but in general, avoid switching highly reactive (inductive / capacitive) loads with an SSR unless you know what you're doing or you'll just get yourself into hot water.

    Don't forget fusing too! When something goes wrong, it's a lot less dramatic with a suitable fuse! For this sort of thing it should ideally be a HRC (High Rupture Capacity) – Not so bad if you're a Yank with 110V, but with 230-250V, the HRC is certainly recommended. Unless you're using a very low Amperage fuse (relative to the SSR capacity), you will likely want an F or FF speed rating, but depends a little on the type of load too. Most circuit breakers (especially plain thermal breakers) will be too slow to react unless specialised types and should only be used as a backup to a fuse.

    @Llyod – I believe Sparkfun had something similar to that that you could use (but using a normal relay not an SSR I believe) that they claimed was safe (but don't use their 'Beefcake' relay for mains, it's darn dangerous as I've told them various times, even with their 'new/updated/fixed up' model).

    Inductive or capacitive loads means you must de-rate the specs – in other words don't try to switch a big hefty transformer or a hefty SMPS and expect it to switch at the 'headline' specs, those specs are for plain resistive loads.

    I DO NOT endorse any of those products, use at your own risk. Play it safe and be very conservative when deciding the ratings, the last thing you want is someone getting hurt or having your house burn down, just because you were a little lazy or tried to skimp – especially as I'm guessing your insurance probably won't cover a home-made device that cooked and took your house/apartment tower/luxury condos with it!

Leave a comment

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.