ESPDailyTaskNTP
ESPDailyTaskNTP copied to clipboard
Schedule one task every day at the same time. Deepsleep inbetween
ESPDailyTaskNTP
Library for ESP8266 to execute a task once per day at a specified time using NTP synchronization and deep sleep.
📦 Dependencies
Install these libraries first:
| Library | Description |
|---|---|
| SNTPtime | SNTP time synchronization |
📥 Installation
- Download this repository as ZIP
- Arduino IDE → Sketch → Include Library → Add .ZIP Library
- Install the SNTPtime dependency (link above)
⚙️ Configuration
📶 WiFi Credentials
Option 1: Define credentials directly in your sketch (recommended):
char my_SSID[] = "your-wifi-name";
char my_PASSWORD[] = "your-wifi-password";
Option 2: Create a credentials.h file in your Arduino libraries folder:
char my_SSID[] = "your-wifi-name";
char my_PASSWORD[] = "your-wifi-password";
Then include it with #include <credentials.h>.
🔌 Wiring
Connect a reset pin (e.g., D2) to RST for deep sleep wake-up:
| ESP8266 Pin | Connection |
|---|---|
| D2 (GPIO4) | RST |
💡 Usage
#include <ESP8266WiFi.h>
#include <ESPDailyTaskNTP.h>
#include <SNTPtime.h>
char my_SSID[] = "your-wifi";
char my_PASSWORD[] = "your-password";
#define RESET_PIN D2
// Wake up at 12:00, timezone +1.0 (CET)
ESPDailyTaskNTP dailyTask(12, 0, 1.0, my_SSID, my_PASSWORD, RESET_PIN);
void setup() {
Serial.begin(115200);
dailyTask.sleepOneDay();
// Your daily task code here
Serial.println("Doing daily task...");
dailyTask.backToSleep();
}
void loop() {
// Never reached - device is sleeping
}
📁 Examples
| Example | Description |
|---|---|
OncePerDayNTP |
Execute task once per day with NTP sync |