A Relay 4 Channel 5V module is an electronic device that allows a low-power signal to control up to four high-power circuits. It uses electromagnetic coils to open or close the circuits, effectively acting as a switch. This module is particularly useful when you need to control multiple AC/DC loads with digital signals from microcontrollers like Arduino.
Pin Number | Description | Type |
---|---|---|
IN1 | Input signal 1 | Digital |
IN2 | Input signal 2 | Digital |
IN3 | Input signal 3 | Digital |
IN4 | Input signal 4 | Digital |
GND | Ground | Power |
VCC | 5V Power Supply | Power |
JD-VCC | Relay Power Supply | Power |
NO1-NO4 | Normally Open Contact | Output |
COM1-COM4 | Common Contact | Output |
NC1-NC4 | Normally Closed Contact | Output |
// Define relay control pins
const int relayPins[] = {2, 3, 4, 5};
void setup() {
// Initialize all relay pins as outputs
for (int i = 0; i < 4; i++) {
pinMode(relayPins[i], OUTPUT);
digitalWrite(relayPins[i], HIGH); // Start with all relays off
}
}
void loop() {
// Example: Turn on each relay for 2 seconds sequentially
for (int i = 0; i < 4; i++) {
digitalWrite(relayPins[i], LOW); // Turn on relay
delay(2000); // Wait for 2 seconds
digitalWrite(relayPins[i], HIGH); // Turn off relay
}
}
Q: Can I control the relay module with a 3.3V signal? A: While the module is designed for 5V logic, some 3.3V signals may be sufficient to trigger the relay. However, it is not guaranteed and a level shifter might be required.
Q: Do I need to supply power to both VCC and JD-VCC? A: VCC is for the logic circuit, and JD-VCC is for the relay coils. For higher power applications, it is recommended to provide separate power to JD-VCC.
Q: Can I switch AC loads with this relay module? A: Yes, the relay module can switch both AC and DC loads, but ensure the load does not exceed the rated voltage and current.
Remember to always follow safety precautions when working with high voltage or current to prevent injury or damage to equipment.