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. Two main themes have emerged in recent years, sometimes combined:

  • electronics - 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
  • scale modelling - I caught the bug after deciding to build a Harrier during covid to demonstrate an electronic jet engine simulation. Let the fun begin..
To be honest, I haven't quite figured out if these two interests belong in the same GitHub repo or not. But for now - they are all here!

Projects are often inspired by things found wild on the net, or ideas from the many great electronics and scale modelling 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.