Un module relais 8 canaux qui permet à un microcontrôleur de commuter huit charges séparées à l’aide de signaux de commande numériques. Il dispose de connexions d’alimentation et de masse, ainsi que d’entrées de commande IN1 à IN8, et de contacts relais pour chaque canal avec bornes NO/COM/NC pour diriger le circuit externe.
| Broche | Signal | Description |
|---|---|---|
GND |
ground | Logic ground reference for MCU control inputs and VCC supply |
IN1 |
digital | Active-low control input for relay 1 — drive low to energize |
VCC |
power | Logic-side supply for optocouplers/input circuitry, typically 5V |
IN2 |
digital | Active-low control input for relay 2 — drive low to energize |
IN3 |
digital | Active-low control input for relay 3 — drive low to energize |
IN4 |
digital | Active-low control input for relay 4 — drive low to energize |
IN5 |
digital | Active-low control input for relay 5 — drive low to energize |
IN6 |
digital | Active-low control input for relay 6 — drive low to energize |
IN7 |
digital | Active-low control input for relay 7 — drive low to energize |
IN8 |
digital | Active-low control input for relay 8 — drive low to energize |
K1_NC |
digital | Normally-closed load contact for relay 1 — connected to COM when relay is off |
K1_COM |
digital | Common switched load terminal for relay 1 |
K1_NO |
digital | Normally-open load contact for relay 1 — connected to COM when relay energizes |
K2_NC |
digital | Normally-closed load contact for relay 2 — connected to COM when relay is off |
K2_COM |
digital | Common switched load terminal for relay 2 |
K2_NO |
digital | Normally-open load contact for relay 2 — connected to COM when relay energizes |
K3_NC |
digital | Normally-closed load contact for relay 3 — connected to COM when relay is off |
K3_COM |
digital | Common switched load terminal for relay 3 |
K3_NO |
digital | Normally-open load contact for relay 3 — connected to COM when relay energizes |
K4_NC |
digital | Normally-closed load contact for relay 4 — connected to COM when relay is off |
K4_COM |
digital | Common switched load terminal for relay 4 |
K4_NO |
digital | Normally-open load contact for relay 4 — connected to COM when relay energizes |
K5_NC |
digital | Normally-closed load contact for relay 5 — connected to COM when relay is off |
K5_COM |
digital | Common switched load terminal for relay 5 |
K5_NO |
digital | Normally-open load contact for relay 5 — connected to COM when relay energizes |
K6_NC |
digital | Normally-closed load contact for relay 6 — connected to COM when relay is off |
K6_COM |
digital | Common switched load terminal for relay 6 |
K6_NO |
digital | Normally-open load contact for relay 6 — connected to COM when relay energizes |
K7_NC |
digital | Normally-closed load contact for relay 7 — connected to COM when relay is off |
K7_COM |
digital | Common switched load terminal for relay 7 |
K7_NO |
digital | Normally-open load contact for relay 7 — connected to COM when relay energizes |
K8_NC |
digital | Normally-closed load contact for relay 8 — connected to COM when relay is off |
K8_COM |
digital | Common switched load terminal for relay 8 |
K8_NO |
digital | Normally-open load contact for relay 8 — connected to COM when relay energizes |
| De | Vers | Fil |
|---|---|---|
board:GND |
x1:GND |
black |
board:5V |
x1:VCC |
red |
board:D2 |
x1:IN1 |
green |
board:D3 |
x1:IN2 |
blue |
board:D4 |
x1:IN3 |
yellow |
board:D5 |
x1:IN4 |
purple |
board:D6 |
x1:IN5 |
cyan |
board:D7 |
x1:IN6 |
magenta |
board:D8 |
x1:IN7 |
brown |
board:D9 |
x1:IN8 |
pink |
Cet exemple a été écrit et vérifié à la compilation pour le arduino-uno. Codey Online l'adapte pour vous à toute autre carte prise en charge.
// Canonical example for an 8-channel relay module on Arduino Uno
// The relay inputs are active-low: LOW energizes the relay, HIGH turns it off.
const uint8_t relayPins[8] = {2, 3, 4, 5, 6, 7, 8, 9};
void setup() {
Serial.begin(9600);
while (!Serial) {
;
}
Serial.println("8-Channel Relay Module demo starting...");
// Set all relay control pins to OFF first.
for (uint8_t i = 0; i < 8; i++) {
pinMode(relayPins[i], OUTPUT);
digitalWrite(relayPins[i], HIGH); // active-low relay OFF
}
Serial.println("All relays OFF.");
}
void loop() {
// Turn each relay on one at a time, then off again.
for (uint8_t i = 0; i < 8; i++) {
Serial.print("Turning relay ");
Serial.print(i + 1);
Serial.println(" ON");
digitalWrite(relayPins[i], LOW); // active-low relay ON
delay(500);
Serial.print("Turning relay ");
Serial.print(i + 1);
Serial.println(" OFF");
digitalWrite(relayPins[i], HIGH); // active-low relay OFF
delay(250);
}
Serial.println("--- Cycle complete ---");
delay(1000);
}
Décrivez ce que vous voulez créer. Codey Online écrit le code, dessine le schéma de câblage, le compile et flashe votre carte directement depuis le navigateur.
Commencez gratuitement