🌐
Arduino Forum
forum.arduino.cc › projects › programming
how to use esp8266 as a scheduled timer - Programming - Arduino Forum
April 7, 2019 - How to use esp8266 as a scheduled timer that trigger and output each day at specific time ?? Please help
🌐
Random Nerd Tutorials
randomnerdtutorials.com › home › home automation › esp8266 time-based events using node-red and big timer
ESP8266 Time-Based Events using Node-RED and Big Timer | Random Nerd Tutorials
March 17, 2023 - You can create any schedule conditions easily with the Big Timer node. We’ll send a 0 at the OFF time and a 1 at the ON time. The output of the Big Timer node will be published on a topic that contains the GPIO number we want to control.
🌐
GitHub
github.com › JohnHalfords › Timer-Clock-program-for-the-ESP8266
GitHub - JohnHalfords/Timer-Clock-program-for-the-ESP8266: Timer Clock program for the ESP8266. 4 timers with ON and OFF time or automatically switch ON and/or OFF by SunSet and/or SunRise with Offset · GitHub
Timer Clock program for the ESP8266. 4 timers with ON and OFF time or automatically switch ON and/or OFF by SunSet and/or SunRise with Offset - JohnHalfords/Timer-Clock-program-for-the-ESP8266
Starred by 4 users
Forked by 7 users
Languages   C++ 95.9% | C 4.0% | HTML 0.1%
🌐
Random Nerd Tutorials
randomnerdtutorials.com › home › project › micropython › micropython: timer interrupts with the esp32/esp8266
MicroPython: Timer Interrupts with the ESP32/ESP8266 | Random Nerd Tutorials
July 23, 2024 - In this guide, you’ll learn how to use timer interrupts (timers and event handling) with the ESP32 and ESP8266 programmed with MicroPython. Timer interrupts allow you to schedule and execute specific tasks at regular intervals or after a designated time delay.
🌐
GitHub
github.com › jhagberg › ESP8266TimeAlarms
GitHub - jhagberg/ESP8266TimeAlarms: Arduino ESP8266 version 2.4.0 TimeAlarm library, schedule alarms to occur at specific dates/times
The ESP8266TimeAlarm is no longer dependen on the Time library · Tasks scheduled at a particular time of day are called Alarms, tasks scheduled after an interval of time has elapsed are called Timers.
Starred by 18 users
Forked by 14 users
Languages   C++ 100.0% | C++ 100.0%
🌐
SwitchDoc Labs
switchdoc.com › home › iot esp8266 timer tutorial – arduino ide
IOT ESP8266 Timer Tutorial - Arduino IDE - SwitchDoc Labs Blog
January 4, 2018 - Timing your loops and adding delay ... of the ESP8266 coming out). The best way of doing this is to use a timer and a callback routine. That is what we are showing in the example below.
🌐
Arduino Forum
forum.arduino.cc › projects › general guidance
ESP8266 Schedule / Timer / RTC Wifi AP - General Guidance - Arduino Forum
June 4, 2019 - Hi Guys, I'm new here so please be gentle. Background: I'm wanting to use an ESP8266 or similar to schedule a relay with an RTC which is configurable from a web interface. I've found a great example here: But it has two issues, firstly it needs to be connected to an access point and secondary ...
Top answer
1 of 1
2

The Arduino package manager has a library called NTPClient, which provides, as you might guess, an NTP client. Using this with the system clock lets you keep reasonable time without a battery-backed RTC.

Once you know what time it is, scheduling events becomes trivial. This isn't a fully working example, but should give you the idea. The docs have more information. The NTPClient also works quite well with the AceTime library for time zone and other management.

#include <NTPClient.h>
#include <WiFiUdp.h>
#include <ESP8266WiFi.h>
#include <AceTime.h>
#include <ctime>

using namespace ace_time;
using namespace ace_time::clock;
using namespace std;

WiFiUDP ntpUDP;
const long utcOffsetInSeconds = 0;  
// Get UTC from NTP - let AceTime figure out the local time
NTPClient timeClient(ntpUDP, "pool.ntp.org", utcOffsetInSeconds, 3600);  
//3600s/h - sync time once per hour, this is sufficient.
// don't hammer pool.ntp.org!


static BasicZoneProcessor estProcessor;
static SystemClockLoop systemClock(nullptr /*reference*/, nullptr /*backup*/);

const char* ssid = // your SSID;
const char* password = // your wifi password;
 
void setup() {
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  Serial.println("Connecting to wifi...");
  while (WiFi.status() != WL_CONNECTED) {
    Serial.println('.');
    delay(500);
  }
  systemClock.setup();
  timeClient.begin();
}

int clockUpdateCounter = 50000;  
void loop(){
  // Update the system clock from the NTP client periodically
  if (++clockUpdateCounter > 50000){  // can be more elegant than this... depends on your loop speed, can actually use the real time for this too, I'm just making this simple because I don't have a lot of time...
    clockUpdateCounter = 0;
    timeClient.update();
    // doesn't matter how often you call timeClient.update().
    // you can put this in the main loop() if you want.  
    // We supplied 3600s as the refresh interval in the constructor
    // and internally .update() checks whether enough time has passed 
    // before making a request to the NTP server itself
    auto estTz = TimeZone::forZoneInfo(&zonedb::kZoneAmerica_Toronto, &estProcessor);
    auto estTime = ZonedDateTime::forUnixSeconds(timeClient.getEpochTime(), estTz);
    // using the system clock is optional, but has a few 
    // conveniences.  Here we just make sure that the systemClock remains 
    // sync'd with the NTP server.  Doesn't matter how often you do this
    // but usually around once an hour is plenty
    systemClock.setNow(estTime.toEpochSeconds());
  }
  systemClock.loop();
  delay(30);
}

The above keeps the system clock in sync with the NTP server. You can then use the system clock to fetch the time and use it for all types of timing purposes. eg :

 // get Time
  acetime_t nowT = systemClock.getNow();
  auto estTz = TimeZone::forZoneInfo(&zonedb::kZoneAmerica_Toronto, &estProcessor);
  auto nowTime = ZonedDateTime::forEpochSeconds(nowT, estTz);

Checking the time is fast, so you can do it inside loop() and only trigger the action when whatever time has elapsed.

This is a particularly nice solution for database integration since you can record a real timestamp of the actual date and time when logging your data to the database.

🌐
Arduino
docs.arduino.cc › libraries › esp8266timerinterrupt
ESP8266TimerInterrupt
December 21, 2022 - The Arduino environment can be extended through the use of libraries. Libraries provide extra functionality for use in sketches. To use a library in a sketch, select it from Sketch > Import Library.
Find elsewhere
🌐
Tiago Tech
edgemicrotech.com › home › esp › wemos d1 mini › exploring the esp8266 hardware timer – led
Exploring the ESP8266 Hardware Timer – LED
December 29, 2024 - This code introduces 16 Interrupt Service Routine (ISR)-based timers that significantly extend the maximum interval, limited only by an unsigned long representing milliseconds. These timers are highly accurate and can be used for mission-critical ...
🌐
Circuits4You
circuits4you.com › 2018 › 01 › 02 › esp8266-timer-ticker-example
ESP8266 Timer and Ticker Example | Circuits4you.com
July 22, 2018 - Use of timer instead of Ticker gives advantage of precision timing and You can get timer interrupt in micro seconds. /* ESP8266 Timer Example Hardware: NodeMCU Circuits4you.com 2018 LED Blinking using Timer */ #include <ESP8266WiFi.h> #include <Ticker.h> Ticker blinker; #define LED 2 //On board LED //======================================================================= void ICACHE_RAM_ATTR onTimerISR(){ digitalWrite(LED,!(digitalRead(LED))); //Toggle LED Pin timer1_write(600000);//12us } //======================================================================= // Setup //====================
🌐
YouTube
youtube.com › ηλίας λάμπρου
Virtuino MQTT, SE How to create a programmable timer (ESP8266 or ESP32) - YouTube
How to create a programmable timer for ESP8266 or ESP32 How to create a schedule using the Virtuino app and send it to the board Supported apps: Virtuino MQT...
Published   June 13, 2019
Views   2K
🌐
Hackster.io
hackster.io › eltoberino › tobers-timeswitch-for-esp8266-ab3e06
Tobers Timeswitch for ESP8266 - Hackster.io
April 18, 2021 - Tobers Timeswitch is a multifunctional time switch software for ESP8266 including twilight modes, a countdown timer and a Master/Client mode By elToberino.
🌐
OpenEnergyMonitor Community
community.openenergymonitor.org › hardware
Esp8266 power energy monitor & time scheduler - Hardware - OpenEnergyMonitor Community
April 30, 2021 - BACKGROUND I have always been conscious of our energy usage at home and the Geyser Timer was a project that I had been contemplating for several years but never had the time to get seriously involved, and when the Covid Lockdown started I thought this was the ideal opportunity to start developing ...
🌐
GitHub
github.com › philbowles › H4
GitHub - philbowles/H4: Universal functional scheduler / timer with rich API for asynchronous one-off, periodic and random events with event chaining
H4 is a simple way of doing multiple things / "tasks" / "processes" at the same time on ESP8266 and ESP32. It is the base of any IOT app you want to build if the app needs to to do more than one thing at a time - which most do! Technically-speaking, it is a "Functional scheduler" in the form of an ArduinoIDE library providing timers for ESP8266 / ESP32 which can call:
Starred by 39 users
Forked by 10 users
Languages   C++ 100.0% | C++ 100.0%
🌐
Random Nerd Tutorials
randomnerdtutorials.com › home › esp8266 › esp8266 projects › esp8266 interrupts and timers using arduino ide (nodemcu)
ESP8266 Interrupts and Timers using Arduino IDE (NodeMCU) | Random Nerd Tutorials
August 6, 2019 - Hello Laurent, Yes, you need to create two different timers (one for 2 seconds and the other for 10 seconds)… Reply ... You are great! I learnt almost everything about esp8266 from you, and now i created already several industrial data logging or controlling solutions to my company!
🌐
Random Nerd Tutorials
randomnerdtutorials.com › home › project › esp32 › esp32/esp8266 web server: control outputs with timer
ESP32/ESP8266 Web Server: Control Outputs with Timer | Random Nerd Tutorials
March 17, 2025 - The ESP32/ESP8266 hosts a web server that allows you to control an output with a pulse; The web server contains a slider that allows you to define the pulse width (how many seconds the output should be HIGH); There’s an ON/OFF button. Set it to ON to send the pulse. After that, you’ll see a timer decreasing for the duration of the pulse width;
🌐
Everything ESP8266
esp8266.com › viewtopic.php
Scheduling a Timer For a Specific Time every day Question - Everything ESP8266
July 31, 2015 - Everyday at 8am is a little to simplistic. I wanted the timer to go off at various times like 8am, 12pm, 10pm and there isn't a guarantee that the ESP modules hasn't been reset. ... - Fri Jul 31, 2015 3:03 am #24674 Have a look at ESP8266 Easy WebConfig in this forum.
🌐
GitHub
github.com › rafaelbds04 › esp-rtc-timer
GitHub - rafaelbds04/esp-rtc-timer: Digital timer build with ESP8266 Microcontroller and friendly web interface. · GitHub
*Is only needed to configure schedules · You'll need: ESP8266 Microcontroller · Board driver CP210x (NodeMCU V2 and ESP32) or CH340G (NodeMCU V3) PlatformIO Core (Command line tool) or PlatformIO IDE for VSCode · Advanced usage - custom settings, uploading to SPIFFS, Over-the-Air (OTA), staging version · # Clone this repository $ git clone https://github.com/rafaelbds04/esp-rtc-timer.git # Go into the repository $ cd esp-rtc-timer ·
Author   rafaelbds04
🌐
Arduino
arduino.cc › reference › en › libraries › esp8266timerinterrupt
ESP8266TimerInterrupt - Arduino Reference
October 1, 2021 - This library enables you to use Interrupt from Hardware Timers on an ESP8266-based board. These ESP8266 Hardware Timers, using Interrupt, still work even if other functions are blocking. Moreover, they are much more precise (certainly depending on clock frequency accuracy) than other software ...