In this tutorial we will show how to build real time clock display with time synchronization over WiFi network.

Material

 

-Arduino mega 2560

Arduino Mega 2560Arduino Mega 2560
$9.97
$6.99

 

-3.2" LCD TFT display

-3.2" TFT LCD adapter shield

3.2 TFT LCD + 3.2 TFT LCD Shield3.2 TFT LCD + 3.2 TFT LCD Shield
$22.99
$15.45

 

-DS1302RTC module

RTC DS1302 Real Time Clock Module RTC DS1302 Real Time Clock Module
$0.99
$0.82

 

-ESP8266 WiFi module

ESP8266 ESP-01 Serial WIFI Wireless Transceiver ModuleESP8266 ESP-01 Serial WIFI Wireless Transceiver Module
$2.11
$17.00
ESP8266 ESP-03 Serial WIFI Wireless Transceiver ModuleESP8266 ESP-03 Serial WIFI Wireless Transceiver Module
$2.07
$2.15
ESP8266 ESP-12 Serial WIFI Wireless Transceiver ModuleESP8266 ESP-12 Serial WIFI Wireless Transceiver Module
$2.06
$1.75
ESP8266 ESP-05 Serial WIFI Wireless Transceiver ModuleESP8266 ESP-05 Serial WIFI Wireless Transceiver Module
$1.88
ESP8266 ESP-07 Serial WIFI Wireless Transceiver ModuleESP8266 ESP-07 Serial WIFI Wireless Transceiver Module
$2.18
$1.88

 

See buying guide at the end for details and please shop in our store to support EasyIoT framework.

ESP8266 real time clock display

Connections

Connect ESP8266 on serial1 on Arduino Mega 2560 and reset pin to pin 12 on Arduino. Use Connect ESP8266 and 5V Arduino guide. You can use 3.3V power supply from 3.2" TFT LCD adapter shield to power ESP8266.

Arduino Mega 2560 pinout

Next conenct DS1302RTC module:

Arduino Mega 2560 DS1302
11 CE
10 IO
9 `CLK

Connecting Arduno LCD 3.2" should not be a problem, because we use shield.

Program

Program requests time from EasyIoT server to synchronize real time clock. After synchronization time is stored in RTC module which keep time if when Arduino is switched off. If Arduino is connected to EasyIoT server it keeps syncing time every hour. EasyIoT server is synchronized by time server if it's connected to internet. Time sent to Arduino is always UTC time. To display local time we use Timezone library. Time zone in example program is set to Central European Time (CET). Change time zone if you live in different time zone.

We need to add our Arduino to EasyIoT server. Our clock example does not use any sensors, but to be correctly added to EasyIoT server node list we present as digital input "esp.present(0, S_DIGITAL_INPUT);".

Program example is available on GitHub

See more tutorials at ​http://iot-playground.com/build​

 

Buying guide

 

To support this site and EasyIoT framework development please buy in our store.

Arduino Mega 2560

For bigger Arduino projects.

3.2 TFT LCD + 3.2 TFT LCD Shield

Mega 2560 ATmega2560-16AU Board for arduino + 3.2 TFT LCD + 3.2 TFT LCD Shield

Best price if you need Meaga 2560, TFT screen and shiels.

RTC DS1302 Real Time Clock Module

The DS1302 is a Real Time Clock (RTC) or TimeKeeping Chip with a build-in Trickle-Charger

5V 2A Charger Micro USB

For Raspberry Pi or sensor modules, cheap and easy power solution.

ESP8266 ESP-01 Serial WIFI Wireless Transceiver Module

ESP8266 Serial WIFI Wireless Transceiver Module

ESP8266 ESP-03 Serial WIFI Wireless Transceiver Module

ESP8266 serial WIFI model ESP-03

ESP8266 ESP-12 Serial WIFI Wireless Transceiver Module

ESP8266 serial Port WIFI wireless module ESP-12

ESP8266 ESP-05 Serial WIFI Wireless Transceiver Module

ESP8266 ESP-05 Serial WIFI Wireless Transceiver Module


Comments   

#2 profile 2018-11-02 12:11
Need cheap hosting? Try webhosting1st, just $10 for an year.

+1 #1 Muller 2015-02-15 01:03
Thanks for sharing this.
I already have build two projects featuring a 1.8" TFT and a RTC, one fuelled by a proMini, the other a Mega2560 like you.
I used to only use Local time. But now that I synchronize the Mega project node with EasyIoT, it displays UTC. I was surprised but I understand it's needed to record events with no gap or overlap during summer time transition.
With your code, it's a snap to upgrade and get automatic summer time correction with no headache. 8)

You have no rights to post comments

Forum latest

  • No posts to display.