This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

synchronized stop watch application

Hello,

I am rather new to BLE and the NRF5x.

I want to build the following application: a swim timing sytem. The system consists of master timer with a high precision RTC. Then there are 19 nodes which register external GPIO (basically a button push). one acts as a starter, the other 18 are act as stop buttons operated by humans.

The basic idea is that each node records the time when the button is pushed, and this can later be read out by a Android phone or tablet. One issue is to keep the clocks in each of the nodes synchronized down to < 5 ms.

Can this be done with 20x 51822 modules?

I assume the readout of the button time can be achieved with GATT, but what protocol would be appropriate for the clock synchonization? Can one of the nodes send out a broadcast every few seconds, and can the other nodes pick up this signal with a reasonably accurate timestamp to generate an offset to the internal RTC?

Any pointers will be appreciated.

Parents
  • Hi,

    Readout of results can certainly be done with GATT, but the challenge is the synchronization. Here are my two cents:

    • Your best option is probably to make your own proprietary radio protocol to get things synchronized at the begninning. The BLE specification will put several obstacles in your way introducing a lot of potential latencies in your system. With a proprietary system you can:
    1. Send as many packets as fast and as often as you want.
    2. Send the packets on whatever radio channel you want.
    3. This makes it easy for you to make all the nodes listen for start or synchronization beacons. Latencies less than 5ms shouldn't be a problem.
    4. After the system has started you can switch to BLE communication to receive data.
    5. It is also possible to run BLE and proprietary protocols concurrently opening for possibilities of sending synchronization beacons at regular intervals while in a BLE connection.
    • Use BLE advertising:
    1. Set up your starter as a peripheral.
    2. Configure it to advertise on a single advertising channel.
    3. Have all your other nodes scan continuously on the same channel.
    4. Start advertising with your starter the moment the button is pushed.
    5. Assuming there are no packet losses then all nodes should receive the packet in sync.
    6. In case any nodes miss the first advertising packet you will have trouble though, since you are only allowed to advertise every 20ms according to spec and there is a 10ms random time delay on top of that.
    • Using BLE and GATT: I suppose it is possible to
    1. Use your starter in central role and keep it connected to all 19 peripherals at all times.
    2. When your starter button is pushed, start the central's RTC.
    3. Use the lowest connection interval possible and service each peripheral in a Round Robin scheme.
    4. As the RTC keeps running, let the central send updated RTC values to the peripherals.
    5. Let the peripherals have their own RTC running, but update it on each connection interval when they receive an updated value from the central.
    6. The uncertainties here will be: The time it takes from the central reads the RTC value until the value is transmitted, possible packet loss, the time it takes from the peripheral receive the packet until it updates the RTC counter.
    7. The benefit is that your central and peripherals are synchronized multiple times making the system more robust against packet losses.
  • Thanks Martin, I was preferring the nRF51 due to larger variety of available form factors but I can switch to nRF52 if required. But, I thought that ANT is not available on the 51822, it requires a 51422 which is uncommon in off-the-shelf components.

    So as far as concurrent connections go, I guess I am looking at the following situation:

    1. The master node will be in broadcast mode all the time
    2. the start and stop nodes will advertise themselves until they have the GATT connection to the android device, then they can stop advertising
    3. the start and stop nodes need to be able to receive the broadcasts at the concurrently while communicating over GATT.

    So the real question is can I have an Observer concurrently with with the GATT communication on the nRF51 or does this require nRF52

Reply
  • Thanks Martin, I was preferring the nRF51 due to larger variety of available form factors but I can switch to nRF52 if required. But, I thought that ANT is not available on the 51822, it requires a 51422 which is uncommon in off-the-shelf components.

    So as far as concurrent connections go, I guess I am looking at the following situation:

    1. The master node will be in broadcast mode all the time
    2. the start and stop nodes will advertise themselves until they have the GATT connection to the android device, then they can stop advertising
    3. the start and stop nodes need to be able to receive the broadcasts at the concurrently while communicating over GATT.

    So the real question is can I have an Observer concurrently with with the GATT communication on the nRF51 or does this require nRF52

Children
No Data
Related