Relay Module

A relay is an electrically operated switch that can be turned on or off, letting the current go through or not, and can be controlled with low voltages, like the 5V provided by the Arduino pins.

Controlling a relay module with the Arduino is as simple as controlling any other output as we’ll see later on.

This relay module has two channels (those blue cubes). There are other models with one, four and eight channels. This module should be powered with 5V, which is appropriate to use with an Arduino. There are other relay modules that are powered using 3.3V, which is ideal for ESP32, ESP8266, and other microcontrollers.

Relay Pin out

The following figure shows the relay module pin out.

The six pins on the left side of the relay module connect high voltage, and the pins on the right side connect the component that requires low voltage—the Arduino pins.

Mains voltage connections

The high-voltage side has two connectors, each with three sockets: common (COM), normally closed (NC), and normally open (NO).

  • COM: common pin
  • NC (Normally Closed):the normally closed configuration is used when you want the relay to be closed by default, meaning the current is flowing unless you send a signal from the Arduino to the relay module to open the circuit and stop the current.
  • NO (Normally Open):the normally open configuration works the other way around: the relay is always open, so the circuit is broken unless you send a signal from the Arduino to close the circuit.

If you just want to light up a lamp occasionally, it is better to use a normally-open circuit configuration.

Pin wiring

The low-voltage side has a set of four pins and a set of three pins.

The set at the right consists of VCC and GND to power up the module, and input 1 (IN1) and input 2 (IN2) to control the bottom and top relays, respectively.

The second set of pins consists of GNDVCC, and JD-VCC pins. The JD-VCC pin powers the electromagnet of the relay.

The connections between the relay module and the Arduino are really simple:

  • GND: goes to ground
  • IN1: controls the first relay (it will be connected to an Arduino digital pin)
  • IN2: controls the second relay (it should be connected to an Arduino digital pin if you are using this second relay. Otherwise, you don’t need to connect it)
  • VCC: goes to 5V

 

 

Interfacing With Arduino:

Code:

void setup() {

  // put your setup code here, to run once:

  pinMode(11,OUTPUT);

 

 

}

 

void loop() {

  // put your main code here, to run repeatedly:

  digitalWrite(11,HIGH);

  delay(500);

  digitalWrite(11,LOW);

 

}

 

Application:

  • Relays are used for isolatinga low voltage circuit from high voltage circuit.
  • They are used for controlling multiple
  • They are also used as automatic change over.
  • Microprocessorsuse relays to control a heavy electrical load.
  • Overload relays are used for protection of motorfrom overload & electrical failure.

 

Reference:

https://maker.pro/arduino/projects/driving-a-relay-with-an-arduino

https://circuitdigest.com/microcontroller-projects/arduino-relay-control

https://www.electronicshub.org/arduino-relay-control/

https://www.circuitbasics.com/setting-up-a-5v-relay-on-the-arduino/