Syncing MetaBase Data From Multiple Boards

Intro.-Pic

One MetaBase use-case is to record sensor data using multiple MetaWear boards (and possibly multiple sensors on each board). For example, collecting temperature data from different areas of a room, then analyzing and comparing the data from each sensor.

Because you can only configure and download data from one board at a time using MetaBase, each boards’ data set will have a different start time and sample size. While inconvenient, we can work around these issues by:

  1. Interpreting the timestamps as a relative offset from the first data point.
  2. Discarding the extra data points to align start and end times as close as possible.

To demonstrate these ideas, I have recorded temperature data from two MetaWears using the MetaBase app (Android, iOS), one by an open window and one sitting on my laptop. The MetaBase App is set to record temperature only for a few seconds and then a CSV file of the temperature log is produced.

metabase

I will show you how to compare the sensor data in Excel using the aforementioned techniques. The CSV files for each board is provided as a GitHub Gist repository, and as you can see from the files, I started recording data from the MetaWear positioned on my laptop 21 seconds prior to starting the MetaWear by the window. Additionally, the window MetaWear stopped logging sensor data a few seconds later and thus contains 59 more data points.

NOTE: Please note that when using the iOS version of MetaBase, we recommend that you have multiple instances of the App running on different devices because ONLY 1 MetaWear can connect at a time. In this case, the window MetaWear is connected to an iPod running MetaBase and the laptop MetaWear is connected to an iPhone 6 running MetaBase.

Time Offset

The first trick we mention is to interpret the timestamps as relative offsets from the first data point rather than as absolute points in time. This simple change lets us easily visualize all the data on the same graph regardless of start time as we are now looking at how the data changes at each increment of time i.e. every X seconds rather than at each absolute point in time.

The Android MetaBase app already outputs relative offset times so we can simply use that column as the x-axis in a graph.

time_offset_select_fix

time_offset

Discarding Extra Data

Alternatively, you can instead discard extra data points to get the start and end times to align as close as possible. This is done by only considering data that lies between the latest start time and the earliest end time. The advantage that this method has over the former is that timestamps are preserved, which may be necessary depending on your use case.

time_absolute_sync

Plotting the graph again using synchronized times yields a slightly different graph that has an equal number of points for both lines.

Please note the first data point corresponds to time 03:17:10, the latest start time, and the last point represents time 03:20:28, the earliest end time.
time_absolute_fix

iOS Note:

On iOS, the time stamp is provided as an epoch. You can still sync data using epochs such as this example below.

In this example, two MetaWears were recorded by two different devices, an iPod and a iPhone6. Each device ran a different instance of the iOS MetaBase and as such the start and end times of the log differ slightly (by a few seconds). I emailed the CSV sensor data to myself and used excel to do a quick sync:

Screen Shot 2016-06-29 at 6.16.58 PM

Screen Shot 2016-06-30 at 10.07.42 AM

Conclusion

Hopefully these tips have provided you with what you need to make sense of data from multiple boards. You can also apply these techniques to sensors that are sampled at different frequencies, such as collecting temperature data every 30 seconds and humidity data every minute. If you have any further questions about syncing your data, feel free to post it on our community forum.