Time synchronisation of a Node

I can recommend this approach, as I have been running a Virtual Real Time Clock (VRTC) in a SMR34 for about a year.

Set the time once with a downlink packet and after that the corrections are only a few seconds as it drifts less than a second per day and even then its not always in the same direction. it can go days without the need to make a correction and then the corrections are only a single byte signed integer.

Also use the VRTC to conserve energy by only sending sensor data between a start and end time each day.

1 Like

@TonySmith, may I ask you how you are retrieving the time from a downlink packet on SAMR34 using the MLS (Iā€™m using the WLR089u0 module)?
Iā€™m able to send a DeviceTimeReq and (apparently) get a DeviceTimeAns but when I try to get the ā€œDEVICE_GPS_EPOCH_TIMEā€ attribute from the stack it returns junk.
regards

Hi,
Iā€™m not retrieving time data from the downlink packet as you describe so I donā€™t think I can help with your question.
What I am doing is setting a Virtual Real Time Clock (VRTC) in the node which I use to conserve battery energy. I only need sensor readings for a few hours per day and to control this I run a VRTC. The node randomly sends data every 10 minutes within the time window controlled by the VRTC. Itā€™s a ā€œgood enoughā€ clock so it only needs adjusting if it drifts by more than a few minutes. To set the VRTC I send a downlink message and to (rarely) adjust the clock I can send a single byte signed integer as a downlink time correction message. On rare occasions when I need to read the VRTC I can also send a downlink message which the node responds with the time from the VRTC. Again, since its a ā€œgood enoughā€ clock, I compare time from the VRTC against the database time stamp for the message.

Thanks for your reply :slight_smile: .
May I ask how you get the timestamp from the downlink message?
Is it possible access to the row payload (for my understanding the MLS is handling the message and storing the information in the stack attributes retrievable using the LORAWAN_GetAttr() API function )?

Hi, I think you mean the Uplink message, the one from the node to the server and then onto the database.
Since I donā€™t need a highly accurate VRTC, I simply look at the time it was written to the database. Even if this varies itā€™s not significant in my system.

Hi @TonySmith, Thanks again for your reply.
I meant downlink (server-> gateway-> endNode).
Iā€™m trying to extract the DEVICE_GPS_EPOCH_TIME attribute from the MLS stack once Iā€™ve received the DeviceTimeAns being sent from the server-side (Iā€™m able to send a DeviceTimeReq and the server replies as expected).
Since Iā€™ve encountered difficulties in retrieving this information I was thinking (if it was possible) to get the downlink timestamp instead, thatā€™s why ā€œDownlinkā€ :slight_smile: but I must have misunderstood.
thanks