Ordered before 2 pm on working days = shipped the same day 30-day reflection period 1-year warranty
← Back to overview

Wiring diagram and code example

How to connect the 12V adjustable time delay relay module to an Arduino UNO or ESP32, with an example sketch you can upload straight away.

Adjustable Timer Delay Relay Trigger

This project demonstrates how to trigger an adjustable timer delay relay module using an Arduino Uno. The Arduino sends a short pulse from digital pin 4 to the IN trigger pin, activating the onboard timer delay cycle. Adjust the potentiometer on the relay module to change the duration of the relay activation.

Wiring diagram: 12V adjustable time delay relay module on an Arduino UNO
Wiring diagram · Click to enlarge
Connection table: 12V adjustable time delay relay module on an Arduino UNO
Connection table · Click to enlarge
Adjustable_Timer_Delay_Relay_Trigger.ino · compiled and verified
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : Adjustable Timer Delay Relay Trigger
 *  Board     : Arduino UNO (arduino:avr:uno)
 *  Parts     : DC 12V adjustable timer delay, time delay relay turn off switch module time relay time switch 0~25sec for smart home, automatic control
 *  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.
 * ==================================================================
 */

// Timer Delay Relay Module Demo
// Sends a trigger pulse to start the module's countdown delay.

const int triggerPin = 4;

void setup() {
  pinMode(triggerPin, OUTPUT);
  digitalWrite(triggerPin, LOW);

  Serial.begin(115200);
  Serial.println(F("Timer Delay Relay Demo Initialized."));
}

void loop() {
  Serial.println(F("Triggering relay delay cycle..."));
  
  // Send a 200 ms HIGH pulse to trigger the module
  digitalWrite(triggerPin, HIGH);
  delay(200);
  digitalWrite(triggerPin, LOW);
  
  Serial.println(F("Trigger sent. Waiting for delay cycle to complete..."));
  
  // Wait 10 seconds before triggering the next cycle
  delay(10000);
}

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

Trigger 12V Adjustable Timer Delay Relay

This project demonstrates triggering an adjustable 12V time delay relay module using an ESP32. The ESP32 sends a short trigger pulse to start the countdown, and the relay stays energized for the duration set by the onboard potentiometer (0 to 25 seconds).

Wiring diagram: 12V adjustable time delay relay module on an ESP32 DevKit V1
Wiring diagram · Click to enlarge
Connection table: 12V adjustable time delay relay module on an ESP32 DevKit V1
Connection table · Click to enlarge
Trigger_12V_Adjustable_Timer_Delay_Relay.ino · compiled and verified
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : Trigger 12V Adjustable Timer Delay Relay
 *  Board     : ESP32 DEVKIT V1 (esp32:esp32:esp32doit-devkit-v1)
 *  Parts     : DC 12V adjustable timer delay, time delay relay turn off switch module time relay time switch 0~25sec for smart home, automatic control
 *  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 the IN trigger pin of the timer relay module
const int TRIGGER_PIN = 4;

void setup() {
  Serial.begin(115200);
  pinMode(TRIGGER_PIN, OUTPUT);
  digitalWrite(TRIGGER_PIN, LOW);
  
  Serial.println("ESP32 12V Timer Delay Relay Module Initialized");
  delay(1000);
}

void loop() {
  Serial.println("Sending trigger pulse...");
  
  // Send a 200 ms pulse to activate the timer
  digitalWrite(TRIGGER_PIN, HIGH);
  delay(200);
  digitalWrite(TRIGGER_PIN, LOW);
  
  Serial.println("Triggered! The relay will remain active for the duration set by the potentiometer.");
  
  // Wait 15 seconds before triggering the next cycle
  delay(15000);
}

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