An Introduction to Solid State Relays

When we think of relays, we tend to think of those big mechanical things that make a satisfying ‘click’ when activated. As nice as they are for relay-based computers, there are times when you don’t want to deal with noise or the unreliability of moving parts. This is where solid-state relays (SSRs) are worth considering. They switch faster, silently, without bouncing or arcing, last longer, and don’t contain a big inductor.

Source Fotek SSR Specifications Sheet

An SSR consists of two or three standard components packed into a module (you can even build one yourself). The first component is an optocoupler which isolates your control circuit from the mains power that you are controlling. Second, a triac, silicon controlled rectifier, or MOSFET that switches the mains power using the output from the optocoupler. Finally, there is usually (but not always) a ‘zero-crossing detection circuit’. This causes the relay to wait until the current it is controlling reaches zero before shutting off. Most SSRs will similarly wait until the mains voltage crosses zero volts before switching on.

If a mechanical relay turns on or off near the peak voltage when supplying AC, there is a sudden drop or rise in current. If you have an inductive load such as an electric motor, this can cause a large transient voltage spike when you turn off the relay, as the magnetic field surrounding the inductive load collapses. Switching a relay during a peak in the mains voltage also causes an electric arc between the relay terminals, wearing them down and contributing to the mechanical failure of the relay.

When using an SSR that supports zero-crossing detection, it will maintain its state until the AC output waveform crosses zero on its own. At that point it turns on or off safely.

Dimming with an SSR

One downside to this behavior is that you cannot easily use typical SSRs as pulse-width modulated dimmers, despite their relatively fast switching speeds. Any time you try to control the ‘on’ time of the input signal, the zero-crossing detection will wait until the AC signal crosses zero before switching.

Another type of SSR, called a ‘random turn on’ solid state relay, is used to implement dimming. It works the same way as a normal SSR, except that there is no zero-crossing detection circuit. It simply turns on whenever it receives a signal. This lets you use only part of the AC waveform for certain types of loads such as lamps or heaters. It still waits until the zero-crossing point of the AC signal before turning off though.

SSRs come in DC and AC switching flavors. The type you need to use depends on the type of power you are switching. DC SSRs tend to use power MOSFETs or transistors to handle the switching, rather than triacs or silicon controlled rectifiers.

One quirk with AC SSRs is that measuring the change in resistance across the SSR output when you apply a signal across the input will not provide very useful information. You will continue to see a high resistance across the output. We measured 22 kΩ in this case, which did not let us conclude that the SSR was operating correctly. Bench testing SSRs prior to use is possible with a 9v battery and a lightbulb (PDF warning).

Other Downsides of an SSR

Another potential downside is that SSRs have lower resistance across the output terminals when off compared to mechanical relays, and some leakage current besides. The leakage is typically very small, but if you measure the output of an SSR connected to mains with a multimeter, you will likely register a voltage regardless of whether it is on or not.

Due to the internal construction of SSRs, they are only available in a single-pole, single throw (SPST) configuration. Single pole means that it can only control a single circuit, and single throw means that there are only two positions the switch can be in (one on, and one off state). Mechanical relays do not have this limitation and are available with multiple poles and throws.

SSRs generate more heat than an equivalent mechanical relay. This is because there is a voltage drop across the semiconductors inside the solid state relay, whereas a mechanical relay is just a conductor when active. It’s important to attach a heat sink to SSRs and allow sufficient airflow for any application drawing significant current. For a detailed treatment of SSR safety, check out this document from Omron (PDF warning). It also offers some useful design considerations for different types of load.

When Solid State and Mechanical Team Up

There are some situations where it is beneficial to use both an SSR and a mechanical relay. Lets say that the main shortcoming of SSRs in a design is that they generate more heat than an equivalent relay. Similarly, the main shortcoming of relays in the design is that they are at risk of mechanical failure due to arcing between the contacts every time they turn on.

In this case, it’s possible to combine the two parts in parallel with separate inputs. To activate it, the control system switches on the SSR first. This establishes a current through the load. Next, the control system activates the relay, which does not experience arcing because it’s essentially in parallel to a closed switch. Finally, after a short delay to allow the relay to debounce, the SSR is deactivated. Now all the current flows through the mechanical relay. This allows for an efficient and durable switch, while decreasing the heat sinking requirements for an SSR.

A Quick Test Application – Controlling an SSR with the ESP8266

SSRs have a few quirks, but seem like a viable alternative to mechanical relays in today’s fancy Internet of Switches. I’d rather focus on the interesting parts of my automation projects rather than mechanical failure, and frankly all the clicking noises can be a bit much. To get more familiar with SSRs, I built a simple test circuit based on a Fotek SSR-40DA SSR. It is similar in principle to this SSR switched outlet project.

The datasheet says they are rated for up to 40 amperes of current, although this requires a large heat sink, ventilation and genuine parts. In my test I’m using it to control a 47W fan using 220VAC, 50Hz mains power. A heat sink was not judged necessary for this quick test, but I added a one ampere fuse on the mains input to prevent it from being accidentally used for something large. When you have a lot of projects, it’s easy to forget the limitations of each a few months down the line.

I connected the digital output D0 of the ESP8266 directly to the inputs of the SSR. The chip was flashed with NodeMCU and programmed to toggle D0 when a capacitive touch switch was toggled, and I made it change the color of the status LED.

The first thing I noticed was that during the boot up sequence, the pins on the ESP8266 are briefly raised high. This caused the SSR to activate for a short time during startup, which is not acceptable! This can easily be fixed by inverting the signal in hardware with a transistor, then in software.

When the button was pressed, the fan turned on or off accordingly, and so did the indicator light on the SSR. Overall it was very straightforward, although I’ll certainly etch a board properly and add a heat sink before using it at higher currents or extended periods of time.

My mains wiring does not include an electrical ground. This is not due to negligence, but because I’m building this in Vietnam and there is no residential electrical grounding in this country’s infrastructure. If you have grounded residential wiring, please take advantage of that to make your design safer.

While it’s a trivial test, I learned two practical lessons. First, that the wiring takes up much more space than I thought it would. Second, keeping a safe distance between the wires carrying mains and the signal from the ESP8266 requires some thought in terms of case design (especially for the heat sink on the SSR). It’s not just a matter of stuffing it into a case, and if I’m not going to 3D print a custom one, I’ll certainly err on the side of something larger and with a distinct section for the high and low voltage components.  In other words, don’t just do this:

Cramming a haphazardly constructed project into a case is a less than excellent approach here.

I also learned that illuminated capacitive touch switches fit nicely into light switch enclosures, look pretty sweet, and fit flush with the wall if you trim a few bits of plastic. In later tests, the button is nowhere near the relay. It uses a second ESP8266 that sends a UDP packet to control the relay, and also listens for UDP packets to update the status of the indicator LED if something else turns off the system in question. It worked fine.

It has a certain “I’m afraid I can’t let you do that Dave” look when red.

Last of all, I’d like to note that counterfeit SSRs are extremely common. Typically, they will fail at currents significantly lower than their rating, even with correct heat sinks. While my SSRs may in fact be genuine, I assume they’re not and will use them well under the rated currents!

Source link

Leave a Reply

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