The M5-RTC-Mod is a real time clock specifically designed for the popular ESP32 based M5-Stack. It features the RV-3028-C7 RTC from Micro Crystal.
- high precision RTC with ±1ppm deviation per year (±32 seconds per year)
- extremely long battery runtime with a CR2032 lithium cell (at least 10 Years, considering the operating life of the battery)
- fully compatible to the M5Stack Core
- two external EEPROMs
- battery voltage monitoring through a 10-bit ADC.
- configurable interrupt pin
- 3D printable housing for an M5Stack
- all components are connected via a single I2C bus
- /examples – example sketches for the library
- /src – source files for the library (
.cpp
,.h
) - /extras/hardware – schematic, Gerber-files and bill of material
- /extras/3D-files –
.stl
-file for 3D printing
The library is based on the RTC RV-3028-C7 Arduino Library. It also includes the uEEPROMLib for communication with the external EEPROM via I2C. The battery voltage is monitored using the MCP3X21 library.
The following functions are included in this library:
begin()
– initializes the I2C-Interface and the RTC. Must be called in the setup functionsetLocalTimeToRTC()
– set the time on the ESP32 to the M5-RTC-ModgetBatteryStatus()
– returns true if the battery is ok, false if it's to lowgetBatteryVoltage()
– returns the battery Voltage in mV
This library works best in combination with functions from the included libraries:
- Additional functions to control the RTC are described here. You can use these by adding
.rtc
to the call of the function. - Additional functions to control the EEPROM are described here. You can use these by adding
.eeprom0
or.eeprom1
to the call of the function. - Additional functions to control the ADC are described here. You can use these by adding
.adc
to the call of the function.
Here is an example on how to use the library:
#include <M5_RTC_Module.h>
// create an instance of the class M5_RTC_Mod
M5_RTC_Mod rtc_mod;
void setup(){
// init RTC-Module
rtc_mod.begin()
}
void loop(){
// Updates the time variables from RTC
if (rtc_mod.rtc.updateTime()) {
currentTime = rtc_mod.rtc.stringTimeStamp();
} else {
// RTC failed to update
}
}
You can set up an interrupt event on the RTC. With the help of the solder jumper LJ1 on the M5-RTC-Mod board you can choose which IO of the ESP32 should act as an interrupt pin.
The following IOs can be chosen as an interrupt pin:
35 | 36 | 2 | 5 | 12 | 13 | 15 |
For example: In the following picture the IO 35 is used as an interrupt pin.
We look forward to contributions, reports or comments on the hardware or software.
If you have any question feel free to contact us: info@iotec-gmbh.de
See LICENSE file for more information.
Copyright (c) 2020 iotec GmbH