Codey OnlineArduino- & ESP32-componentenbibliotheek › 8-Channel Relay Module
8-Channel Relay Module
Output

8-Channel Relay Module

Een 8-kanaals relaismodule waarmee een microcontroller acht aparte lasten schakelt met digitale stuursignalen. De module heeft voeding- en groundaansluitingen plus IN1-IN8 stuuringangen, en voor elk kanaal relaiscontacten met NO/COM/NC-aansluitingen om het externe circuit te schakelen.

Breedte: 128.1 mm

Pinout — 8-Channel Relay Module

Pin Signaal Beschrijving
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

Voorbeeld-aansluitschema — 8-Channel Relay Module

Van Naar Draad
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

Voorbeeld-Arduinocode — 8-Channel Relay Module

Dit voorbeeld is geschreven en compile-gecheckt voor de arduino-uno. Codey Online past het voor je aan naar elk ander ondersteund board.

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

Vergelijkbare componenten

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

Bouw je Arduino- of ESP32-project met AI

Beschrijf wat je wilt bouwen. Codey Online schrijft de code, tekent het aansluitschema, compileert het en flasht je board rechtstreeks vanuit de browser.

Gratis starten