SKU: OT951-C101 Numero articolo: XG648 EAN: 4502076751917
vedi qui lo Schema di collegamento e il codice di esempio >>>
Termini di ricerca: relais 5v, 5v relais, relay 5v, 5v relay, relais laag, relais low, relay low, blauwe relais, relais blauw, relais 250v, relais 220v, relais 1 kanaal, relais 1-kanaals, relay 1 channel
Ecco come collegare il Modulo relè 5v Low a un Arduino UNO o ESP32, con uno sketch di esempio che puoi caricare subito.
Questo progetto mostra come controllare un modulo relè active-low 5V con un Arduino Uno. Lo sketch commuta il relè ON e OFF ogni due secondi, stampando lo stato corrente nel Serial Monitor. Poiché si tratta di un modulo active-low, impostare il pin di controllo su LOW attiva il relè, mentre impostarlo su HIGH lo disattiva.
/*
* ==================================================================
* 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
Questo esempio mostra come controllare un modulo relè 5V active-low con l’ESP32. La bobina del relè è alimentata dal pin VIN (5V da USB), mentre GPIO 4 commuta il pin di controllo. Portare il pin di controllo a LOW attiva il relè, mentre portarlo a HIGH lo spegne.
/*
* ==================================================================
* 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