BiosensorArray - Timestamp

From Pumping Station One
Revision as of 14:16, 17 March 2014 by Hef (talk | contribs) (Robot: Cosmetic changes)
This page is part of the Biosensor Array Project

Methods

Smartphone / Computer

  • Shawn mentioned that one simple method would be to set the time on the Arduino based on the serial link (bluetooth or USB) to computing device (smartphone or PC)

RTC

  • Pro's:
    • Cheaper than GPS
    • Always works indoors since it doesn't need satellite signal
  • Con's:
    • Requires initial time set
    • Not as accurate as GPS
    • Lacks GPS's inherit benefit of geolocation data

GPS

  • Pro's:
    • Automatic time set
    • Adds geolocation data to biosignal data
  • Con's:
    • More expensive than RTC
    • Requires satellite signal (potential poor indoor performance)

Integration options

It would be good to write the Data Aggregator Board software (current target board is Arduino MEGA) so that it can use RTC, GPS or both. This would provide maximum flexibility to end user depending on their resources and environment.

Logic:

  • POWER UP: If GPS module installed and good signal, then set time from GPS
    • If RTC installed too, then set time from GPS in case GPS signal degrades during operation
  • POWER UP: If no GPS module installed or GPS bad signal, then
    • If RTC install & set, then get time from RTC
      • If no RTC installed, then:
        • Obtain timestamp from connected (USB or bluetooth) computing device (smartphone or PC)
        • If no computing device connected, then prompt for manual input (how?)

Note on time keeping

Quote Shawn:

"It depends on how accurate you mean. A while ago, I had to do a study at work regarding the timing accuracy of commercial laptops for possible use, by field engineers/technicians, as NIST trace-able stopwatches/clocks with and without access to the internet for NTP (Network Time Protocol). What I found was that laptops are pretty stable for the kind of timing Bill is talking about (keeping track of the milliseconds, seconds, minutes, and even hours between measurements). However, they tend to have significant drift over days and weeks due to things like temperature fluctuations over time. Also, in the case of a laptop, because the clock is being handled by the OS (many layers abstracted from the actual hardware) running other software at the same time can cause massive time drift (seconds lost at a time) on OSs like Windows.

On full PCs, NTP over an internet connection mitigates most of these problems and provides a time/date that is generally accurate to within half a second or better by using statistical methods to compensate for latency on the internet. Unfortunately, in the case of my work, we had serious questions about the traceability of that statistical method even though the time servers at the other end of the connection are connected to atomic clocks run by NIST themselves. That shouldn't be an issue for us though. Most personal PCs aren't connected to NTP but smart phones on most cell phone networks should update directly from the cell network which, I believe, uses GPS.

As for the Arduinos, they should be immune to many of the issues laptops have due to the fact that they don't get as hot and run in real-time. Without a reliable source to update the time/date, it will probably drift some with time anyway. However, as Bill pointed out, the kinds of tests we're looking to do don't really need accurate timestamps. They only really need to know the time since the last measurement and the time since the start of the test."

Related