#737 NTP Client Demo
Simple demonstration of NTP client requests using an Arduino Ethernet Shield.
Notes
If an Arduino needs accurate time details, the most basic technique is to use an NTP server, as most computers will do. NTP: Network Time Protocol.
The sketch demonstrates requesting and parsing an NTP request from time.nist.gov
using an Ethernet Shield on an Arduino Uno.
The Simple Network Time Protocol is better described with practical examples in NTP with Ruby
Circuit Design
Nothing to it - just add the ethernet shield to an Arduino Uno board and plug it in..
Testing
The script NtpClientDemo.ino is based on the example Arduino tutorial. I’ve refactored it a bit to be clearer.
The script can be compiled and uploaded from the IDE, with the output examined using the built-in serial monitor set for 115200 baud:
Typical transcript…
Ethernet started...
Seconds since Jan 1 1900 = 3914801468
Unix time = 1705812668
The UTC time is 4:51:08
Seconds since Jan 1 1900 = 3914801480
Unix time = 1705812680
The UTC time is 4:51:20
Seconds since Jan 1 1900 = 3914801491
Unix time = 1705812691
The UTC time is 4:51:31
Seconds since Jan 1 1900 = 3914801502
Unix time = 1705812702
The UTC time is 4:51:42
Another way getting connected on macOS is to use screen:
screen /dev/cu.usbmodem24201 115200