Commandé avant 14h00 un jour ouvrable = expédié le jour même 30 jours de délai de rétractation Garantie d’un an
← Retour à l’aperçu

La lecture charge la vidéo depuis YouTube.

Schéma de câblage et exemple de code

Voici comment connecter le Module relais 5 V bas à un Arduino UNO ou à un ESP32, avec un exemple de sketch que tu peux téléverser directement.

Commande de relais active-low 5V

Ce projet montre comment contrôler un module relais active-low 5V avec un Arduino Uno. Le sketch bascule le relais ON et OFF toutes les deux secondes tout en affichant l'état actuel dans le Serial Monitor. Comme il s'agit d'un module active-low, mettre la broche de contrôle à LOW active le relais, et la mettre à HIGH le désactive.

Schéma de câblage : Module relais 5 V bas sur un Arduino UNO
Schéma de câblage · Cliquez pour agrandir
Tableau de câblage : Module relais 5 V bas sur un Arduino UNO
Tableau de câblage · Cliquez pour agrandir
5V_Active_Low_Relay_Control.ino · compilé et testé
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : 5V Active-Low Relay Control
 *  Board     : Arduino UNO (arduino:avr:uno)
 *  Parts     : Relais Module 5v Low
 *  Libraries : none (built-in)
 *
 *  Codey Online is an AI-powered browser IDE for Arduino and ESP32.
 *  Describe your project and Codey writes the code, draws the wiring
 *  diagram and uploads it to your board, straight from the browser.
 *  This code is free to use, modify and share, without warranty.
 * ==================================================================
 */

// Pin configuration
const int relayPin = 7;

void setup() {
  // Set the relay pin as output
  pinMode(relayPin, OUTPUT);
  
  // Active-low relay: default to OFF (HIGH state)
  digitalWrite(relayPin, HIGH);

  Serial.begin(115200);
  while (!Serial) {
    ; // Wait for serial port to connect
  }

  Serial.println(F("5V Relay Module Demo Started"));
  Serial.println(F("Relay will toggle every 2 seconds."));
}

void loop() {
  // Turn relay ON (active LOW)
  Serial.println(F("Relay: ON"));
  digitalWrite(relayPin, LOW);
  delay(2000);

  // Turn relay OFF (HIGH)
  Serial.println(F("Relay: OFF"));
  digitalWrite(relayPin, HIGH);
  delay(2000);
}

Wiring diagram and example code generated by Codey.online — https://www.codey.online

Démo de contrôle de relais 5V ESP32

Cet exemple montre comment contrôler un module relais 5V active-low avec l’ESP32. La bobine du relais est alimentée depuis la broche VIN (5V via USB), tandis que GPIO 4 commande la broche de contrôle. Mettre la broche de contrôle à LOW active le relais, et la mettre à HIGH le désactive.

Schéma de câblage : Module relais 5 V bas sur un ESP32 DevKit V1
Schéma de câblage · Cliquez pour agrandir
Tableau de câblage : Module relais 5 V bas sur un ESP32 DevKit V1
Tableau de câblage · Cliquez pour agrandir
ESP32_5V_Relay_Control_Demo.ino · compilé et testé
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : ESP32 5V Relay Control Demo
 *  Board     : ESP32 DEVKIT V1 (esp32:esp32:esp32doit-devkit-v1)
 *  Parts     : Relais Module 5v Low
 *  Libraries : none (built-in)
 *
 *  Codey Online is an AI-powered browser IDE for Arduino and ESP32.
 *  Describe your project and Codey writes the code, draws the wiring
 *  diagram and uploads it to your board, straight from the browser.
 *  This code is free to use, modify and share, without warranty.
 * ==================================================================
 */

// Pin connected to relay IN
const int RELAY_PIN = 4;

void setup() {
  Serial.begin(115200);
  
  // Configure relay pin as output and start with relay OFF (HIGH = inactive for active-low module)
  pinMode(RELAY_PIN, OUTPUT);
  digitalWrite(RELAY_PIN, HIGH);
  
  Serial.println("ESP32 Relay Module Demo Initialized");
}

void loop() {
  // Turn relay ON (Active-low: LOW energizes coil)
  Serial.println("Relay: ON");
  digitalWrite(RELAY_PIN, LOW);
  delay(2000);

  // Turn relay OFF (Active-low: HIGH de-energizes coil)
  Serial.println("Relay: OFF");
  digitalWrite(RELAY_PIN, HIGH);
  delay(2000);
}

Wiring diagram and example code generated by Codey.online — https://www.codey.online