Browse our Blog. You will find multiple applications, solutions, code examples. Navigate using the tag cloud or search using specific criteria

Connecting an external solid-state relay on a digital output

Learning about industrial PLC for industrial automation


On this blog, we will show you how to use a solid state relay to turn on a light which works, for example, at 220V. Just as we use a light, you can use every device you need like water pumps, engines etc. In this way, you can see that if you need more relays than our PLC has, you can control an external relay using a digital output. 


To work with one digital output, you need to have one of our industrial Arduino based PLC from the families Mduino or Ardbox because you need 24V to commute de relay. A part from the programmable logic controller, you will also need a solid state relay ( 10 A 30V DC - 10 A 250V AC ), a power supply voltage (24V), the Arduino IDE platform and connection to the monofasic line (220V). 

Solid state relay (SSR)

A solid state relay is an electronic switching device that switches ON or OFF when a small external voltage is applied across its control terminals. SSR's consists of a sensor which responds to an appropriate input ( control signal), a solid-state electronic switching device which switches power to the load circuitry, and a coupling mechanism to enable the control signal to activate this switch without mechanical parts. The relay may be designed to switch either AC or DC to the load. It serves the name function as an electromechanical relay, but has no moving parts.

SSR use power semiconductor devices such as thyristors and transistors, to switch currents up to around a hundred amperes. Also, it has fast switching speeds compared with electromechanical relays, and it has no physical contacts to wear out.  The control signal must be coupled to the controlled circuit in a way which provides galvanic isolation between both circuits. 

Many SSR's use optical coupling. The control voltage turn On an internal LED which illuminates and switches on a photo-sensitive diode, the diode current turns on a back-to-back thyristor, SCR or MOSFET to switch the load. The optical coupling allows the control circuit to be electrically isolated from the load. 


Here we can see how we have to do the connection between the PLC Arduino, the light, the relay and finally to the 220V line.

As we can see, the digital output Q0.0 and GND from the industrial controller Arduino turns on the relay, after this the 220V line which is connected to the 11, by commutation takes out the voltage by the terminal 14.



There is the code to activate the Q0.0 to turn on the relay. This is just an example, so you can take this part of code and put it in your own code adapting it to your needs, I mean you can activate the Q0.0 when you need using a conditional if

const int  relay = Q0_0;
void setup() {
  Serial.begin(9600);    //begin serial port
  pinMode(relay, OUTPUT);  // define the output
void loop(){
  digitalWrite(relay, HIGH);   // Put the output at HIGH
  delay(1000);               // Wait for a second
  digitalWrite(relay, LOW);    // Put the output at LOW
  delay(1000);               // Wait for a second

Do you want more information?

Just fill the form!

Tell me more!