HUM: FOTEK SOLID STATE RELAY (SSR)

You are a beginner with Dasduino. Or electronics? A specific module caught your eye, but you do not know how to use it? Do not worry, HUM is here for you! How to Use Module (HUM) is a blog tutorials series by Soldered where you will find all you need in order to begin working with your favorite module. Tutorials include: technical characteristics, work principle, instructions on how to connect module with Dasduino and the basic code. Everything else is left to your imagination.
WARNING!! THIS LESSON IS NOT INTENDED FOR THOSE WHO HAVE NO EXPERIENCE WORKING WITH HIGH VOLTAGES, MAINS VOLTAGE OF 230V IS LIFE-THREATENING! Â
INTRODUCTION
Solid state relay (SSR) is an electronic switching device that switches a load of much higher power on or off to a small input signal. Its function is the same as electromechanical relay’s, only SSR does not have moving parts. Find out more about this type of relay and its work principle in the following text.
• Single-phase AC SSR
• Max. 380V(AC), 40A
• Bolt diameter 4mm
• Dimensions: 63mm x 45mm x 26mm
• Weight: 100g
HOW DOES IT WORK?
On the relay, we can see the four terminals labeled with 1, 2, 3 and 4. To the first two (1 and 2) we connect the load of higher power we want to control, and to the other two (3 and 4), we connect a microcontroller (input). The input signal (input) of the relay should be 3 to 32 V (DC), which means that the relay will turn on if the voltage between the plus and the minus is within that range. Usually, the minus binds to GND, and we give a positive voltage to the plus. Also, there is a red LED on the relay that visually displays the status of the relay (it lights up when it is on). The basic component of this relay is the so-called TRIAC. A TRIAC is a semiconductor component that has the ability to control alternating current. It will conduct when the control electrode is induced, and stopped when the control electrode is turned off and the current flowing through the TRIAC falls below a certain level.
The solid state of the relay includes some additional components that control the TRIAC and add some security measures. Let’s see how the inside of a Fotek SS relay looks like:
From this scheme, we see that the control side is optically isolated from the output side, so the combination of controlling the relay with a microcontroller is safe. When we give the excitation signal to the control side, a LED within the optical insulator will light up and trigger the control side of the TRIAC. On the control side of the TRIAC, there is also a circuit that detects the zero point of the AC voltage,
which means that if we want to turn the relay on at some point in time, the switch will first have to wait for input voltage to drop to 0V and then turn the relay on. This greatly reduces the appearance of electromagnetic interference, because by switching the relay on at some point in the period where the voltage is closer to the maximum value, sudden voltage spike occurs, which means high frequencies.
Next to the TRIAC, we see two additional components, a resistor and a capacitor. They are here to ensure the correct operation of the TRIAC in case we want to control the inductive loads and this branch is called a snubber circuit. When the inductive load is switched off, short high-voltage impulses may occur due to self-induction of the coil, and such an impulse may cause a random ignition of the TRIAC, or some unpredictable phenomena in the circuit. A snubber provides an additional route by which the current can “move around” the TRIAC and thus prevent a sudden ignition.
HOW TO CONNECT?
in this example, using the SSR relay and Dasduino, we will control a basic light bulb and turn it on or off through the Serial Monitor.
*Before you begin connecting, check that all high voltage is shut down, to ensure safe work!
1. Connect the plus(+) terminal of the relay to Dasduino pin 8 and minus(-) to GND
2. Connect one end of the light bulb to any relay terminal, and the other end to 0
3. To the second relay terminal, connect the phase*
ARDUINO CODE
#define SSR 8 // pin to which we connect the + terminal of the SSR
void
setup
() {
 Â
pinMode
(SSR,
OUTPUT
);
 Â
Serial.begin(9600);
 Â
digitalWrite
(SSR,
LOW
);
// switch the relay off initially
 Â
delay
(100);
// delay 100 ms
}
void
loop
() {
 Â
// wait until there is something to read
 Â
while
(Serial.available() == 0) {
   Â
delay
(150);
// without this delay, the deletion of other characters will not work
 Â
}
 Â
// when we enter something to Serial monitor, we actually send characters, not numbers
 Â
// if we enter 1 and it is not the same as number 1, we have actually sent number 49 (ASCII table)
 Â
// that is why we subtract the read number by 48, in order for Croduino to read the value we wanted
 Â
int
input = (Serial.read() - 48);
 Â
// if 1 is entered, turn the relay on
 Â
if
(input == 1) {
   Â
Serial.println(
"SSR is ON"
);
   Â
digitalWrite
(SSR,
HIGH
);
 Â
}
 Â
// if 0 is entered, turn the relay off
 Â
else
if
(input == 0 ) {
   Â
Serial.println(
"SSR is OFF"
);
   Â
digitalWrite
(SSR,
LOW
);
 Â
}
 Â
// otherwise print Error
 Â
else
{
   Â
Serial.println(
"Error"
);
 Â
}
 Â
// delete other characters, if more than one is sent
 Â
while
(Serial.available() > 0) {
   Â
Serial.read();
 Â
}
}