Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Synchronization of local time between two LoPy's

    Scheduled Pinned Locked Moved LoPy
    lopy
    7 Posts 3 Posters 1.9k Views 3 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.
    • A Offline
      assia
      last edited by

      Hello

      I want to have the same local time in nanoseconds for both lopys, I use at the moment time.time () * math.pow (10,9) but this returns the nanoseconds since the power up of lopys so i try to put them power up at the same time but there is a time lag.

      Do you have any solution to synchronize the local time of two lopys using RTC for example?

      @LoPy-2016-Kickstarter-Backers @LoPy-Beta-Summer-2016

      L 1 Reply Last reply Reply Quote 0
      • L Offline
        livius @assia
        last edited by livius

        @assia said in Synchronization of local time between two LoPy's:

        Do you have any solution to synchronize the local time of two lopys using RTC for example

        rtc.ntp_sync("pool.ntp.org")
        

        but do you really mean nanoseconds ?
        What do you try to accomplish that you should have nanosecond precision - especially synchronized between two devices

        • i suppose that also RTC is here not accurate.

        you can use

        utime.ticks_cpu()
         resolution (25 ns).
        

        think about people first, then computers

        A 1 Reply Last reply Reply Quote 0
        • A Offline
          assia
          last edited by

          @livius thanks for your response

          if i use rtc.ntp_sync("pool.ntp.org") should the lopy's be connoted to the internet all the time or just at the time of synchronization?

          L 1 Reply Last reply Reply Quote 0
          • L Offline
            livius @assia
            last edited by livius

            @assia
            if you do not use deepsleep (reset)
            then you can do this only once

            but this still is not nanosecond ;-)

            think about people first, then computers

            1 Reply Last reply Reply Quote 0
            • A Offline
              assia @livius
              last edited by

              Hi @livius when i try to synchronize with the ntp server and i try to get the actual time using:

              rtc.now()
              

              i get :

              (1970, 1, 1, 0, 9, 11, 833500, None)
              

              but I want to have the current time like the year 2017 for example.
              What is the problem knowing that my computer is connected to the Internet when i do it ?

              thanks

              L 1 Reply Last reply Reply Quote 0
              • L Offline
                livius @assia
                last edited by

                @assia said in Synchronization of local time between two LoPy's:

                What is the problem knowing that my computer is connected to the Internet when i do it ?

                Do you mean Lopy not computer right?
                If your Lopy is connected to the router (STA or AP_STA mode)
                then you can synchronise time by calling:

                rtc.ntp_sync("pool.ntp.org")
                

                think about people first, then computers

                1 Reply Last reply Reply Quote 0
                • M Offline
                  Majdoulina makbal
                  last edited by

                  Hi assia, did you solve the problem ?

                  1 Reply Last reply Reply Quote 0

                  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
                  • 1 / 1
                  • First post
                    Last post

                  Pycom on Twitter

                  Pycom