Codey OnlineBiblioteka komponentów Arduino i ESP32 › 8-Channel Relay Module
8-Channel Relay Module
Wyjście

8-Channel Relay Module

8-kanałowy moduł przekaźnikowy, który umożliwia mikrokontrolerowi przełączanie ośmiu oddzielnych obciążeń za pomocą cyfrowych sygnałów sterujących. Ma złącza zasilania i masy oraz wejścia sterujące IN1-IN8, a także styki przekaźników dla każdego kanału z zaciskami NO/COM/NC do przełączania zewnętrznego obwodu.

Szerokość: 128.1 mm

Pinout — 8-Channel Relay Module

Pin Sygnał Opis
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

Przykładowy schemat połączeń — 8-Channel Relay Module

Z Do Przewód
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

Przykładowy kod Arduino — 8-Channel Relay Module

Ten przykład został napisany i sprawdzony kompilacją dla arduino-uno. Codey Online dostosuje go do każdej innej obsługiwanej płytki.

// 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);
}

Podobne komponenty

18650 3.7V Li-Ion Battery

18650 3.7V Li-Ion Battery

3-Channel 5V Relay Module

3-Channel 5V Relay Module

3W amplifier MAX98357A I2S DAC

3W amplifier MAX98357A I2S DAC

Active Buzzer Module

Active Buzzer Module

Zbuduj swój projekt Arduino lub ESP32 z pomocą AI

Opisz, co chcesz zbudować. Codey Online napisze kod, narysuje schemat połączeń, skompiluje projekt i wgra go na płytkę bezpośrednio z przeglądarki.

Zacznij za darmo