A Relay Module 2 Channel is an electronic device that enables control of high voltage and high current loads with low voltage signals, typically from a microcontroller like an Arduino. This module contains two independent relays that can switch on and off separately. It is commonly used in home automation, industrial controls, and other applications where interfacing between low-level logic and high-power devices is required.
Pin | Description |
---|---|
VCC | Connect to 5V power supply |
GND | Connect to ground |
IN1 | Control signal for Relay 1 (active LOW) |
IN2 | Control signal for Relay 2 (active LOW) |
NO1 | Normally Open contact for Relay 1 |
NC1 | Normally Closed contact for Relay 1 |
COM1 | Common contact for Relay 1 |
NO2 | Normally Open contact for Relay 2 |
NC2 | Normally Closed contact for Relay 2 |
COM2 | Common contact for Relay 2 |
// Define relay control pins
const int relayPin1 = 2;
const int relayPin2 = 3;
void setup() {
// Set relay pins as output
pinMode(relayPin1, OUTPUT);
pinMode(relayPin2, OUTPUT);
// Initialize relays to OFF (Relays are active LOW)
digitalWrite(relayPin1, HIGH);
digitalWrite(relayPin2, HIGH);
}
void loop() {
// Turn on Relay 1
digitalWrite(relayPin1, LOW);
delay(1000); // Wait for 1 second
// Turn off Relay 1
digitalWrite(relayPin1, HIGH);
delay(1000); // Wait for 1 second
// Turn on Relay 2
digitalWrite(relayPin2, LOW);
delay(1000); // Wait for 1 second
// Turn off Relay 2
digitalWrite(relayPin2, HIGH);
delay(1000); // Wait for 1 second
}
Q: Can I control the relay module with a 3.3V signal? A: While the relay module is designed for 5V logic, some modules may work with 3.3V signals. Check the module's datasheet or test it with a 3.3V signal.
Q: How can I know if the relay is in the NO or NC state? A: When the relay is not powered, the NO contact is open, and the NC contact is closed. Applying a LOW signal to the IN pin will switch the relay to the opposite state.
Q: Is it safe to switch AC loads with this relay module? A: Yes, as long as the load does not exceed the maximum voltage and current ratings of the relay. Always follow safety precautions when working with AC mains.