🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    RTC example for the M5Stack

    Scheduled Pinned Locked Moved Micropython
    10 Posts 5 Posters 24.3k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W Offline
      Wolli01
      last edited by

      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
      
      1 Reply Last reply Reply Quote 0
      • lukasmaximusL Offline
        lukasmaximus
        last edited by

        Hi @Wolli01 Only M5StickC has built in RTC. M5Stack only supports NTP, but RTC requires an external module

        E R 3 Replies Last reply Reply Quote 0
        • W Offline
          Wolli01
          last edited by

          And how can I use NTP in MicroPython to get the time?

          1 Reply Last reply Reply Quote 0
          • T Offline
            Tokn59
            last edited by

            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

            1 Reply Last reply Reply Quote 0
            • lukasmaximusL Offline
              lukasmaximus
              last edited by

              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/

              1 Reply Last reply Reply Quote 0
              • lukasmaximusL Offline
                lukasmaximus
                last edited by

                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

                1 Reply Last reply Reply Quote 0
                • E Offline
                  Efried @lukasmaximus
                  last edited by

                  @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

                  1 Reply Last reply Reply Quote 0
                  • R Offline
                    rupin.chheda @lukasmaximus
                    last edited by

                    @lukasmaximus Why cant we sync the RTC with Network time?

                    1 Reply Last reply Reply Quote 0
                    • lukasmaximusL Offline
                      lukasmaximus
                      last edited by

                      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

                      1 Reply Last reply Reply Quote 0
                      • E Offline
                        Efried @lukasmaximus
                        last edited by

                        @lukasmaximus RTC functionality is weak, ntp_syc does not work. Any M5 example?
                        many thanks

                        1 Reply Last reply Reply Quote 1

                        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                        With your input, this post could be even better 💗

                        Register Login
                        • First post
                          Last post