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 Return to the LEAP Catalog

LEAP is just 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 PR!). See the individual projects for credits where due.

For a while I have also included various scale modelling projects here too, but I've now split those off into a new repository. Check out LittleModelArt if you are looking for the modelling projects!

Project Gallery Notebook LittleCodingKata LittleModelArt More on my blog