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 2560 | |
$9.97 | |
$6.99 |
-3.2" LCD TFT display
-3.2" TFT LCD adapter shield
3.2 TFT LCD + 3.2 TFT LCD Shield | |
$22.99 | |
$15.45 |
-DS1302RTC module
RTC DS1302 Real Time Clock Module | |
$0.99 | |
$0.82 |
-ESP8266 WiFi module
ESP8266 ESP-01 Serial WIFI Wireless Transceiver Module | |
$2.11 | |
$17.00 |
ESP8266 ESP-03 Serial WIFI Wireless Transceiver Module | |
$2.07 | |
$2.15 |
ESP8266 ESP-12 Serial WIFI Wireless Transceiver Module | |
$2.06 | |
$1.75 |
ESP8266 ESP-05 Serial WIFI Wireless Transceiver Module | |
$1.88 |
ESP8266 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.
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.
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.
Comments
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.
RSS feed for comments to this post