lukasmaximus89
Published © CC BY

RTC Modules with M5Stack

Out of the M5Stack family only the M5StickC has an inbuilt RTC. Here's how to add one to your other M5Stack devices

IntermediateFull instructions provided145
RTC Modules with M5Stack

Things used in this project

Hardware components

Grove - RTC
Seeed Grove - RTC
×1
DS1307 64 x 8, Serial, I²C Real-Time Clock
Maxim Integrated DS1307 64 x 8, Serial, I²C Real-Time Clock
×1
Adafruit ds1307 RTC
×1
ESP32 Basic Core IoT Development Kit
M5Stack ESP32 Basic Core IoT Development Kit
×1
M5Stack FIRE IoT Development Kit (PSRAM 2.0)
M5Stack FIRE IoT Development Kit (PSRAM 2.0)
×1
M5GO IoT Starter Kit
M5Stack M5GO IoT Starter Kit
×1

Software apps and online services

MicroPython
MicroPython

Story

Read more

Code

RTC Basic program

MicroPython
A python script to display the date on the screen
from machine import I2C
import ds1307

i2c = I2C(1, I2C.MASTER, sda = 21, scl = 22)
ds = ds1307.DS1307(i2c)

#enable the osscilator
ds.halt(False)
ds.datetime()

#enter the current time (year, month, date, weekday, hour, minute, second, microsecond)
now = (2019, 11, 18, 1, 16, 20, 22, 0)
ds.datetime(now)

while(True):
    time = ds.datetime()
    lcd.text(0,0,str(time[0:8]),lcd.WHITE)
    

Credits

lukasmaximus89

lukasmaximus89

39 projects • 6 followers
I'm Luke from Manchester, UK. I've been living in shenzhen for 6 years. I do 3D design, Basic Electronics, Casting and other cool stuff.

Comments

Add projectSign up / Login