RTC example for the M5Stack
-
Does anyone have a running RTC example for the M5Stack what about UiFlow?
This is mine what I use on my Wipy but don't want to run on the M5Stack.#rtc.ntp_sync("de.pool.ntp.org", update_period=3600) # Datum und Uhrzeit holen rtc.ntp_sync("de.pool.ntp.org") while not rtc.synced(): machine.idle() # save power while waiting utime.timezone(TimeDiff) time1 = utime.localtime() # Übergabe Datum und Uhrzeit in die Variable time1 #time1 = rtc.now() # Übergabe Datum und Uhrzeit in die Variable time1 startzeit = time.time() LogDateTime = "{}.{:}.{:};{:0>2d}:{:0>2d}:{:0>2d}".format(time1[2], time1[1], time1[0], time1[3], time1[4], time1[5]) LogDate = "{}.{:}.{:}".format(time1[2], time1[1], time1[0]) LogTime = "{:0>2d}:{:0>2d}:{:0>2d}".format(time1[3], time1[4], time1[5]) break
-
Hi @Wolli01 Only M5StickC has built in RTC. M5Stack only supports NTP, but RTC requires an external module
-
And how can I use NTP in MicroPython to get the time?
-
I have the same issue. Trying to work with a DS3231 RTC module but it seems to interfere on I2C level with M5. Any solution found ? KInd Regards, Tony
-
Hi I was just able to use the ds1307 rtc module with M5stack core in arduino, by using adafruits RTClib library https://github.com/adafruit/RTClib/
-
if you are using micropython and have a ds1307 you can use the excellent library created by mcauser https://github.com/mcauser/micropython-tinyrtc-i2c
-
@lukasmaximus Could you please help solving the problem by giving a micropython example , I need to sync time via ntp because after booting it is zero.
many thanks
-
@lukasmaximus Why cant we sync the RTC with Network time?
-
I created a guide on hackster.io using micropython check it out here https://www.hackster.io/lukasmaximus89/rtc-modules-with-m5stack-46636b you should be able to sync it with ntp by using the datetime function of ds1307 and ntp with settime() this forum post explains it https://forum.micropython.org/viewtopic.php?t=2440
-
@lukasmaximus RTC functionality is weak, ntp_syc does not work. Any M5 example?
many thanks