Introduction
Requirements
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. Apart 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 a connection to the monophasic 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 consist of a sensor that responds to an appropriate input ( control signal), a solid-state electronic switching device that 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 uses 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 that 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.Â
Hardware
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.
Software
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 to use 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 }
Connecting an external solid-state relay on a digital output