A two-channel relay is an electromechanical device that allows for the control of two separate circuits by a low-power signal. The 5V two-channel relay is particularly suitable for use with microcontrollers like the Arduino UNO, where it can be used to switch higher power loads than the microcontroller can handle directly. Common applications include home automation, such as controlling lights, motors, and other household appliances.
Pin Number | Description | Notes |
---|---|---|
1 | VCC | 5V power supply to the relay |
2 | GND | Ground |
3 | IN1 | Input signal for Relay 1 |
4 | IN2 | Input signal for Relay 2 |
5 | COM1 | Common pin for Relay 1 |
6 | NO1 | Normally Open pin for Relay 1 |
7 | NC1 | Normally Closed pin for Relay 1 |
8 | COM2 | Common pin for Relay 2 |
9 | NO2 | Normally Open pin for Relay 2 |
10 | NC2 | Normally Closed pin for Relay 2 |
Powering the Relay:
Connecting the Control Signal:
Connecting the Load:
// 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);
}
void loop() {
// Turn on Relay 1
digitalWrite(relayPin1, HIGH);
delay(1000); // Wait for 1 second
// Turn off Relay 1
digitalWrite(relayPin1, LOW);
delay(1000); // Wait for 1 second
// Turn on Relay 2
digitalWrite(relayPin2, HIGH);
delay(1000); // Wait for 1 second
// Turn off Relay 2
digitalWrite(relayPin2, LOW);
delay(1000); // Wait for 1 second
}
Q: Can I use this relay with a 3.3V microcontroller? A: Yes, but ensure that the trigger voltage threshold is met for reliable operation.
Q: Is it necessary to use an external power supply? A: It is recommended if the load requires more current than the microcontroller can provide.
Q: Can I control the relay with PWM? A: No, the relay requires a steady high or low signal to switch states.