bearing / dosenet

Code for the Berkeley RadWatch dosimeter network
https://radwatch.berkeley.edu/dosenet
4 stars 0 forks source link

[WiFi part 1] Update data packet format #12

Closed bplimley closed 7 years ago

bplimley commented 8 years ago

The message should include timestamps of the measurement interval, and the server should use these timestamps rather than the time of receiving the message.

This is one prerequisite for enabling WiFi, which may have intermittent connectivity.

navrit commented 8 years ago

The reason why we didn't use the send time is because

  1. The Raspberry Pi's internal clock's drift significantly over time, and so are inherently unreliable
  2. UDP packets don't have handshaking as part of the protocol like TCP do, so they just won't be sent and just be lost. I don't think they'll be any buffering of outbound packets.
bplimley commented 8 years ago

Hi Nav,

  1. Do you have an estimate of the rate of clock drift? They should sync to an NTP server... if they are offline for a long time then the drift could still be an issue.
  2. By buffering, I mean in the python code. So the Dosimeter object writes the info for a UDP packet into a list object after each time interval. If ping is successful, all objects in the list get sent to server, otherwise they collect until connectivity is restored.

The alternative is that anytime the WiFi is out, no data gets posted. Joey, Ali and I have discussed this and we think reliability is important.

navrit commented 8 years ago
  1. I can't precisely remember, others seem to get ~12s per day. I agree, it should be syncing to an NTP server - this has never actually been verified though. I imagine it wouldn't take much work to do so.
  2. Ok, that makes much more sense. That sounds like a feasible method for redundancy.
jccurtis commented 8 years ago

The pi's do use NTP. In the December firmware update, they connect to NTP servers in pool.ntp.org.

bplimley commented 8 years ago

This capability is merged into master but it is a non-default option right now. I want to load-test it more before making it the default behavior