Component: Real Time Clock (ESP32) (Real Time Clock)
Author | Matrix TSL |
Version | 1.0 |
Category | Real Time Clock |
Contents
Real Time Clock (ESP32) component
Allows an ESP32 device to act as a RTC with NTP type server synchronisation. Requires a WIFI network connection with internet access to synchronise. Provides simulation using local PC system time.
Component Source Code
Please click here to download the component source project: FC_Comp_Source_temp/RTC_ESP32.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_temp/RTC_ESP32.fcfx
Detailed description
No detailed description exists yet for this component
Examples
A simple example that shows how to connect the ESP device to a network and synchronise the internal clock with an internet based NTP time server every hour.
The internal clock can drift over time and so it is important to sync regularily with the NTP time server.
For low power operations or when internet connectivity may be intermittent a 32.768KHz crystal can be used with the ESP32 device to improve the internal clock accuracy over time.
The crystal is fitted between pins IO32 and IO33 and must have 12pF capacitors to ground. The crystal must also be enabled by editing the sdkconfig file in the project compilation directory.
Macro reference
GetDate
![]() |
GetDate |
Collects the day of the month as a numeric value in the range of 1 - 31. | |
![]() |
Return |
GetDateString
![]() |
GetDateString |
Collects the current date and returns it as a string. e.g. "DD/MM/YY" or "MM/DD/YY" | |
![]() |
USFormat |
Select date format: 0=DD/MM/YY, 1=MM/DD/YY | |
![]() |
Return |
GetHours
![]() |
GetHours |
Collects the current hour as a numeric value in the range of 0 - 23. | |
![]() |
Return |
GetMins
![]() |
GetMins |
Collects the current minute as a numeric value in the range of 0 - 59. | |
![]() |
Return |
GetMonth
![]() |
GetMonth |
Collects the month as a numeric value in the range of 1 - 12. | |
![]() |
Return |
GetSecs
![]() |
GetSecs |
Collects the current second as a numeric value in the range of 0 - 59. | |
![]() |
Return |
GetTimeString
![]() |
GetTimeString |
Collects the current time and returns it as a string. e.g. "HH:MM" or "HH:MM:SS" | |
![]() |
IncludeSeconds |
0=Dont Include Seconds, 1=Include Seconds in the String | |
![]() |
Return |
GetYear
![]() |
GetYear |
Collects the year as a numeric value in the range of 0 - 99. | |
![]() |
Return |
Initialise
![]() |
Initialise |
Configures the timeserver variable as well as sets the timezone offset in seconds. | |
![]() |
Return |
QueryTimeServer
ReadDate
![]() |
ReadDate |
![]() |
Unit |
![]() |
Return |
ReadTime
![]() |
ReadTime |
![]() |
Unit |
![]() |
Return |
SetDate
SetTime
SetTimeServer
![]() |
SetTimeServer |
Overwrites the default time server setting allowing for multiple time servers to be queried. | |
![]() |
TimeServer |
e.g. "pool.ntp.org" | |
![]() |
Return |
SetUTCOffset
![]() |
SetUTCOffset |
Allows the UTC Offset to be defined in seconds. e.g. for BST use 3600 or for UTC+2 use 7200 or for UTC-2 use -7200 | |
![]() |
UTCOffset |
Time offset in seconds | |
![]() |
Return |