A 2-Channel Relay is an electronic device that functions as an electrically operated switch. It allows a low-power signal to control a much higher power circuit. This particular 2-channel relay operates at 5V and can handle a maximum current of 10A per channel. It is commonly used in applications where it is necessary to control high power devices such as motors, lights, and other appliances with a low-power signal from a microcontroller like an Arduino UNO.
Pin Number | Description | Type |
---|---|---|
1 | VCC | Power |
2 | GND | Ground |
3 | IN1 | Input |
4 | IN2 | Input |
5 | COM1 (Common) | Output |
6 | NO1 (Normally Open) | Output |
7 | NC1 (Normally Closed) | Output |
8 | COM2 (Common) | Output |
9 | NO2 (Normally Open) | Output |
10 | NC2 (Normally Closed) | Output |
// 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 (Normally Open state)
digitalWrite(relayPin1, LOW);
digitalWrite(relayPin2, LOW);
}
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 control this relay with a 3.3V signal? A: While the relay operates at 5V, some 5V relays can be triggered with a 3.3V signal. However, it is best to check the datasheet or test the relay with a 3.3V signal to ensure reliable operation.
Q: Is it safe to control mains voltage with this relay? A: Yes, the relay can switch mains voltage, but you must ensure proper safety precautions and isolation. If unsure, seek professional assistance.
Q: Can I use PWM to control the relay? A: Relays are not designed for high-speed switching and using PWM is not recommended. They are intended for on/off control with a sufficient delay between switching.