Relay Module with Arduino
1. Introduction
A relay module is an electrically operated switch that allows a low-voltage device like an
Arduino to control high-voltage or high-current appliances such as lights, fans, motors,
and pumps. It provides electrical isolation between the control circuit and the load, making
it safe for IoT and automation applications.
In IoT systems, relay modules act as actuators, enabling remote control of electrical devices
through sensors, microcontrollers, or cloud platforms.
2. Relay Module Information
2.1 What is a Relay?
A relay is an electromagnetic switch that uses a small current to control a larger current.
When the relay coil is energized, it changes the position of internal contacts to open or close
a circuit.
2.2 Relay Module Components
A typical Arduino relay module consists of:
● Electromagnetic relay
● Transistor (to drive the relay coil)
● Optocoupler (for isolation in some modules)
● Flyback diode (protects from back EMF)
● Indicator LED
● Screw terminals (COM, NO, NC pins)
2.3 Relay Pin Description
Pin Description
VCC Power supply (5V)
GND Ground
IN Control signal from Arduino
COM Common terminal
NO Normally Open
NC Normally Closed
3. Relay Module Working
1. Arduino sends a signal to the relay.
2. The relay has a small electromagnet inside.
3. When current flows, the magnet pulls a switch.
4. This switch turns the appliance ON or OFF.
5. Arduino and appliance are not directly connected, so it is safe.
4. Circuit Connection (Arduino + Relay Module)
Connections:
● Relay VCC → Arduino 5V
● Relay GND → Arduino GND
● Relay IN → Arduino Digital Pin (e.g., D7)
● Load connected through COM and NO terminals
5. Sample Arduino Code
int relayPin = 7; // Relay connected to digital pin 7
void setup() {
pinMode(relayPin, OUTPUT);
}
void loop() {
digitalWrite(relayPin, HIGH); // Turn relay ON
delay(2000);
digitalWrite(relayPin, LOW); // Turn relay OFF
delay(2000);
Code Explanation:
● pinMode() sets the relay pin as output
● digitalWrite(HIGH) energizes the relay
● digitalWrite(LOW) de-energizes the relay
● Delay creates ON/OFF switching
6. Advantages of Relay Module
● It is safe to use
● Can control high voltage devices
● Easy to connect with Arduino
● Low cost
● Useful in automation
7. Disadvantages of Relay Module
● Makes clicking sound
● Mechanical parts can wear out
● Switching speed is slow
● Bigger in size
8. Applications of Relay Module in IoT
● Home automation (lights, fans, AC control)
● Smart irrigation systems
● Industrial automation
● Energy management systems
● Remote switching via IoT platforms
● Security systems
9. Conclusion
Relay modules play a vital role in IoT systems by bridging the gap between low-power
microcontrollers and high-power electrical devices. Their simplicity, reliability, and safety
features make them ideal for automation and control applications using Arduino.