A 4 channel relay module is an electronic device designed to control up to four high-power electrical loads using low-power control signals. This module is an essential component in various applications such as home automation systems, robotics, and industrial control systems. It acts as an electrically operated switch, which can be controlled by a microcontroller like an Arduino UNO.
Pin Name | Description |
---|---|
VCC | Connect to 5V power supply |
GND | Connect to ground |
IN1 | Control signal for Relay 1 (active LOW/HIGH) |
IN2 | Control signal for Relay 2 (active LOW/HIGH) |
IN3 | Control signal for Relay 3 (active LOW/HIGH) |
IN4 | Control signal for Relay 4 (active LOW/HIGH) |
NO1-NO4 | Normally Open contact for Relays 1-4 |
NC1-NC4 | Normally Closed contact for Relays 1-4 |
COM1-COM4 | Common contact for Relays 1-4 |
Powering the Module:
Connecting Control Signals:
Connecting Loads:
// Define relay control pins
const int relay1 = 2;
const int relay2 = 3;
const int relay3 = 4;
const int relay4 = 5;
void setup() {
// Set relay pins as outputs
pinMode(relay1, OUTPUT);
pinMode(relay2, OUTPUT);
pinMode(relay3, OUTPUT);
pinMode(relay4, OUTPUT);
}
void loop() {
// Turn on all relays
digitalWrite(relay1, HIGH);
digitalWrite(relay2, HIGH);
digitalWrite(relay3, HIGH);
digitalWrite(relay4, HIGH);
delay(1000); // Wait for 1 second
// Turn off all relays
digitalWrite(relay1, LOW);
digitalWrite(relay2, LOW);
digitalWrite(relay3, LOW);
digitalWrite(relay4, LOW);
delay(1000); // Wait for 1 second
}
Q: Can I control the relay module with a 3.3V signal? A: Some relay modules can be triggered with 3.3V, but it's essential to check the specific module's requirements.
Q: Is it safe to control AC mains with this relay module? A: Yes, but it should be done by a qualified electrician and with proper safety measures in place.
Q: Can I use PWM to control the relay? A: Relays are not designed for PWM control and should only be used for on/off control.
Q: How do I know if the relay is in NO or NC mode? A: The relay is in NO mode when the control signal is HIGH (or LOW if designed as active LOW), and in NC mode when the control signal is not applied.