Test time with TimeAwareSensor sketch



  • Hi,

    Actually I test utilisation of time. I can see into the sketch :

    When time has been received, request update every hour

    Why requesting every hour the datetime to the controller ? Desynchronization ?

    Thanks


  • Mod

    @Fl0rian most Arduinos lack a real time clock, and rely on the signal generated by the oscillator. The frequency of the oscillator varies between different chips, supply voltage and temperature, so the Arduino's sense of time will not be exact.

    Due to this inexactness, the TimeAwareSensor example re-synchronizes with the controller once per hour.

    See http://jorisvr.nl/article/arduino-frequency if you want to dig deeper.



  • OK thanks for your fast response :)

    Do you know acceptable duration between 2 request ? 1 hour is the max ?

    And when I put in sleep mode the Arduino with 600000ms (sleep(600000)), the real duration is 10m30s and not 10min exactly. It's for the same reason ?


  • Mod

    @Fl0rian The maximum depends on how much traffic there is on your network and how fast your controller can reply. You could probably ask at least a few times per second, which is much faster than would be useful anyway.

    Yes, the difference you see in sleep time is due to the same reason.



  • OK, so it's not easy to use datetime with node using sleep mode during much hours.
    For example, if I want the node sleeping from 22:00PM to 08:00AM, it doesn't work, or very approximately.


  • Mod

    @Fl0rian exactly.

    To do that you would need a rtc, or use smartsleep, depending on your use case.


Log in to reply
 

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