Fork me on GitHub

Project Notes

#737 NTP Client Demo

Simple demonstration of NTP client requests using an Arduino Ethernet Shield.

Build

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..

bb

schematic

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:

ide

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

screen

Credits and References

About LEAP#737 EthernetArduino
Project Source on GitHub Project Gallery Return to the LEAP Catalog

This page is a web-friendly rendering of my project notes shared in the LEAP GitHub repository.

LEAP is just my personal collection of projects, usually involving an Arduino or other microprocessor in one way or another. Some are full-blown projects, while many are trivial breadboard experiments, intended to learn and explore something interesting (IMHO!).

The projects are usually inspired by things found wild on the net, or ideas from the sources such as:

Feel free to borrow liberally, and if you spot any issues do let me know. See the individual projects for credits where due. There are even now a few projects contributed by others - send your own over in a pull request if you would also like to add to this collection.