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.
@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 .
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ā but I must have misunderstood.
thanks