How to ensure epoch time on phone and sensor are in sync?

I'm having a bit of trouble understanding how to accomplish what I'm looking for from the tutorials.

The setup we would have would be the setup described in 2.2.1 (1 sensor + 1 app).

I need to verify that we can do something like this:
1. User presses start button in app. Epoch time IN THE APP is recorded as 1547578388000.
2. Sensor detects acceleration starts, epoch time ON THE SENSOR is recorded as 1547578388150.
3. The difference is recorded as 150 milliseconds.

However, the concern is that what if the epoch time "IN THE APP" is different than the epoch time "ON THE SENSOR".

One solution would be for step 1 to be changed to: 1. User presses start button in app. Epoch time ON THE SENSOR is recorded as 1547578388000. But I don't know if that is possible, or if there is another way to ensure that we can accurately compare the two Epoch times (when button is pressed & when acceleration begins).

Comments

  • edited January 15

    Thanks for the thorough response Laura. Based on your feedback, I think perhaps I'm not being clear. I understand that it will take several milliseconds to initiate accelerometer logging and I believe we can get around that by starting the logging in advance. I think I confused things by using the example of pressing a 'start' button.

    The problem I am trying to solve is the fact that the epoch time on the phone app may be out of sync with the epoch time on the Mbient device.

    In our use case, we are trying to measure the time between two events A and B, where A is an action on the phone occurring (e.g. pressing a button or hearing a sound play) and B is when acceleration is detected on the accelerometer.

    With that in mind let me rephrase my question:
    I need to verify that we can do something like this:
    1. App turns on sensor to detect acceleration. The sensor is currently not moving.
    2. A few seconds later the app plays a sound out loud. Epoch time IN THE APP is recorded as 1547578388000.
    2. Upon hearing the sound, a human moves the sensor triggering an acceleration detection, epoch time ON THE SENSOR is recorded as 1547578388150.
    3. The difference is recorded as 150 milliseconds.

    The concern is that what if the epoch time "IN THE APP" is different than the epoch time "ON THE SENSOR". How can we accurately calculate the time between when the human hears the sound and when they start moving the sensor?

    The reason we are trying to measure this is because our app is focused on measuring reaction speeds.

    Does that make more sense?

  • edited January 15

    The boards do not have a real time clock; they only know how much time has elapsed. All epoch calculations are ultimately done by the host device.

    Rather than continuing the back and forth, gather some time data and see if the delay is what you expect.

  • Is it possible to read the current epoch time on a sensor device? This issue would likely be solved if we could read the current epoch time on the sensor device at the moment we play the sound on the app.

  • why not just use the button on the device? Then the epoch time would be tied to the metasensor already (same time reference).

  • Thanks for the suggestion Laura. Unfortunately I don't think that would work in our case because we are trying to test the reaction speed of a person to an external stimulus.

    Consider this example for sports with a coach and a player:

    • Player gets into position for the test
    • Coach waits a few seconds (random amount of time) and then yells "go" (or app plays whistle sound)
    • Player reacts as quickly as they can
    • The time between the stimulus and the reaction is measured.

    So the problem is, the player will be holding the sensor, and the coach couldn't press the button on the device.

    Thanks so much for all the help everyone, I know I'm asking for something very specific. If we're able to figure this out, I'm confident it will lead to many many many Mbient sensors being purchased, so I'm not trying to waste time.

  • @BFar said:
    Is it possible to read the current epoch time on a sensor device? This issue would likely be solved if we could read the current epoch time on the sensor device at the moment we play the sound on the app.

    As previously stated, the board does not have a real time clock; epoch is meaningless to it.

    And to quote myself:

    @Eric said:
    Rather than continuing the back and forth, gather some time data and see if the delay is what you expect

Sign In or Register to comment.