Skip to content

A lightweight NTP server for ESP32 that syncs time with an external source. Supports both IPV4/IPV6 and Wi-Fi/Ethernet connectivity.

License

Notifications You must be signed in to change notification settings

suricate-dev-lab/nesp-ntp-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Supported Targets ESP32 ESP32-C2 ESP32-C3 ESP32-C6 ESP32-H2 ESP32-S2 ESP32-S3

NTP Server

The application creates an NTP Server using UDP socket with the specified port number (default = 123) and waits for the data to be received. For now the ESP32 development board syncs up with an external NTP Server - WWVB support will be integrated.

How to use example

In order to interact with the NTP Server, you can choose one of many existing host-side tools. One command line tool on MacOS is sntp which can give you the status health of the NTP Server.

Note: please replace 192.168.8.194 with desired IPV4/IPV6 address (displayed in monitor console) in the following commands.

Send NTP packet via sntp (MacOS)

sntp -d 192.168.8.194

Send NTP packet via ntpdate (Linux)

ntpdate -q 192.168.8.194

Send NTP packet via w32tm (Windows)

w32tm /stripchart /computer:192.168.8.194

Hardware Required

The NTP Server can be run on any commonly available ESP32 development board.

Configure the project

idf.py menuconfig

Set following parameters under NTP Server Configuration Options:

  • Set IP version of the NTP Server to be IPV4 or IPV6.

  • Set Port number for the NTP Server for any specific use case, otherwise keep the default port (= 123).

Configure Wi-Fi or Ethernet under "Example Connection Configuration" menu. See "Establishing Wi-Fi or Ethernet Connection" section in examples/protocols/README.md for more details.

Build and Flash

Build the project and flash it to the board, then run monitor tool to view serial output:

idf.py -p PORT flash monitor

(To exit the serial monitor, type Ctrl-].)

See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects.

Troubleshooting

Start server first, to receive data sent from the client (application).

About

A lightweight NTP server for ESP32 that syncs time with an external source. Supports both IPV4/IPV6 and Wi-Fi/Ethernet connectivity.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published