We are open! Orders will be shipped as usual on Monday the 23rd.

How to use NTP with the Aduino Leonardo

Placed on

DS3231 library

The DS3231 library is useful for setting and reading the RTC module.
There are 3 functions we will use in the program to initialise, set and read the RTC-module.

When we initialise the module we want to set the module to not use the special features like interrupts or Alarms. So we initialise it with 0x00.

So to read or write to the module we have to use a struct, the struct consists of the time and the date.

But there is a problem, we get UNIX time back from the NTP request so we have to convert it with the TimeLib library.


The TimeLib library has functions that returns the date and time from the UNIX time, so we pass them into the struct.

The DS3231 module The DS3231 module
Current Page 4. DS3231 module 1. Introduction 2. The Schematic 3. How does NTP work? 4. DS3231 module 5. The LCD 6. The ESP8266 7. Full program Posted by

Comments

Webwinkelkeur Kiyoh Trustpilot Opencircuit