How To Install Using Arduino Library Manager
Why do we need this NTPClient_Generic Library
The NTPClient_Generic Library is designed to work in conjunction with the Arduino Time Library, which must also be installed on your system. This documentation assumes some familiarity with the Time library.
The primary goal of the NTPClient_Generic Library is to enable the creation of an NTPClient to connect to NTP time-servers to get time and keep local time in sync. For ESP8266/ESP32, nRF52, SAMD21/SAMD51, STM32F/L/H/G/WB/MP1, Teensy, etc. besides AVR, using ESP WiFi, WiFiNINA, Ethernet W5x00, ENC28J60, LAN8742A, ESP8266/ESP32 AT-command WiFi. But whether hardware RTC or another time-keeping source is present is not mandatory, since the Time Library can function as a software RTC without additional hardware (although its accuracy is dependent on the accuracy of the microcontroller's system clock.)
The examples will demonstrate how to get the UTC time from NTP server, then update the DS3231, STM32 built-in RTC or local clock to make sure the time is perfectly correct.
In the examples, the interval to get perfect time from the NTP server to update RTC and/or local clock is configurable to ensure the RTC and/or local clock accuracy.
This NTPClient_Generic Library is based on and modified from Fabrice Weinberg's NTPClient Library to add functions, features and as well as support to many boards and shields.
Releases v3.2.2
- Add examples to use STM32 Built-In RTC.
Releases v3.2.1
- Initial porting to many Generic boards using WiFi/Ethernet modules/shields.
- Add support to SAMD21/SAMD51, nRF52, STM32F/L/H/G/WB/MP1 with WiFiNINA, W5x00, ENC28J60, LAN8742A Ethernet modules/shields.
- Add functions.
- Completely new examples using NTP time to update DS3231 RTC and/or local clock.
Currently Supported Boards
- ESP8266.
- ESP32.
- SAM DUE
- AdaFruit Feather nRF52832, nRF52840 Express, BlueFruit Sense, Itsy-Bitsy nRF52840 Express, Metro nRF52840 Express, NINA_B302_ublox, NINA_B112_ublox etc..
- Arduino SAMD21 (ZERO, MKR, NANO_33_IOT, etc.).
- Adafruit SAMD21 (Itsy-Bitsy M0, Metro M0, Feather M0, Gemma M0, etc.).
- Adafruit SAMD51 (Itsy-Bitsy M4, Metro M4, Grand Central M4, Feather M4 Express, etc.).
- Seeeduino SAMD21/SAMD51 boards (SEEED_WIO_TERMINAL, SEEED_FEMTO_M0, SEEED_XIAO_M0, Wio_Lite_MG126, WIO_GPS_BOARD, SEEEDUINO_ZERO, SEEEDUINO_LORAWAN, SEEED_GROVE_UI_WIRELESS, etc.)
- STM32 (Nucleo-144, Nucleo-64, Nucleo-32, Discovery, STM32F1, STM32F3, STM32F4, STM32H7, STM32L0, etc.).
- STM32F/L/H/G/WB/MP1 (Nucleo-64 L053R8,Nucleo-144, Nucleo-64, Nucleo-32, Discovery, STM32Fx, STM32H7, STM32Lx, STM32Gx, STM32WB, STM32MP1, etc.) having 32K+ Flash program memory.
- AVR Mega, UNO, Nano
Currently Supported WiFi Modules/Shields
- ESP8266 built-in WiFi.
- ESP32 built-in WiFi.
- WiFiNINA using WiFiNINA or WiFiNINA_Generic library.
- ESP8266-AT, ESP32-AT WiFi shields using WiFiEspAT or ESP8266_AT_WebServer library. To be done soon.
Currently Supported Ethernet Modules/Shields
- W5x00's using Ethernet, EthernetLarge, Ethernet2 or Ethernet3 Library.
- ENC28J60 using EthernetENC or UIPEthernet library.
- LAN8742A using STM32Ethernet / STM32 LwIP libraries.