Synchronization of local time between two LoPy's



  • 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



  • @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")
    


  • 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



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

    but this still is not nanosecond ;-)



  • @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?



  • @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).
    

Log in to reply
 

Looks like your connection to Pycom Forum was lost, please wait while we try to reconnect.