Codey OnlineBiblioteca de componentes Arduino y ESP32 › 8-Channel Relay Module
8-Channel Relay Module
Salida

8-Channel Relay Module

Un módulo de relés de 8 canales que permite a un microcontrolador conmutar ocho cargas independientes mediante señales de control digitales. Tiene conexiones de alimentación y tierra, además de entradas de control IN1-IN8, y contactos de relé para cada canal con terminales NO/COM/NC para enrutar el circuito externo.

Ancho: 128.1 mm

Pinout — 8-Channel Relay Module

Pin Señal Descripción
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

Esquema de cableado de ejemplo — 8-Channel Relay Module

Desde Hasta Cable
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

Código Arduino de ejemplo — 8-Channel Relay Module

Este ejemplo se escribió y verificó por compilación para arduino-uno. Codey Online lo adapta a cualquier otra placa compatible.

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

Componentes relacionados

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

Crea tu proyecto de Arduino o ESP32 con IA

Describe lo que quieres construir. Codey Online escribe el codigo, dibuja el esquema de conexiones, lo compila y graba tu placa directamente desde el navegador.

Empieza gratis