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

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

Project Source on GitHub Return to the LEAP Catalog
About LEAP

LEAP is my personal collection of electronics 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.

Projects are often inspired by things found wild on the net, or ideas from the many great electronics podcasts and YouTube channels. Feel free to borrow liberally, and if you spot any issues do let me know or send a pull-request.

NOTE: For a while I included various scale modelling projects here too, but I've now split them off into a new repository: check out LittleModelArt if you are looking for these projects.

Project Gallery view the projects as an image gallery Notebook reference materials and other notes Follow the Blog follow projects and notes as they are published in your favourite feed reader