The 6 Relays Module is an electronic device that contains six individual relay switches capable of controlling multiple circuits independently. Relays are electromechanical switches that allow a low-power signal to control a higher power circuit, making them essential for interfacing microcontrollers like Arduino with high-power devices such as motors, lights, and other appliances.
Pin Number | Description |
---|---|
1 | IN1 (Control signal for Relay 1) |
2 | IN2 (Control signal for Relay 2) |
3 | IN3 (Control signal for Relay 3) |
4 | IN4 (Control signal for Relay 4) |
5 | IN5 (Control signal for Relay 5) |
6 | IN6 (Control signal for Relay 6) |
7 | GND (Ground) |
8 | VCC (Power supply for relays) |
9 | JD-VCC (Power supply for relay coils) |
Note: Some modules may have an opto-isolated input which separates the control circuit from the power circuit for safety and noise reduction. In such cases, JD-VCC and VCC may be separated, and an additional jumper or connection may be present.
// Define relay control pins
const int relayPins[] = {2, 3, 4, 5, 6, 7};
void setup() {
// Set all the relay control pins as outputs
for (int i = 0; i < 6; i++) {
pinMode(relayPins[i], OUTPUT);
digitalWrite(relayPins[i], HIGH); // Relays are usually active LOW
}
}
void loop() {
// Example: Turn on each relay for 1 second, then off
for (int i = 0; i < 6; i++) {
digitalWrite(relayPins[i], LOW); // Activate relay
delay(1000); // Wait for 1 second
digitalWrite(relayPins[i], HIGH); // Deactivate relay
delay(1000); // Wait for 1 second
}
}
FAQs: