synchronizationmaster-slaveadafruitios-bluetoothnrf52

synchronized bluetooth devices to play a pattern of vibrations simultaneously


Facts: Bluetooth 5.2 introduced Isochronous Channels (ISOC) capability. In the context of BLE, it means supporting (1) data transmissions that are time-sensitive and (2) synchronized rendering of these data streams across multiple receivers.

I have purchased two ItsyBitsy Adafruit that each comes with a nRF52840 microprocessor. nRF52840 supports Bluetooth 5 but not 5.2. In addition it does not support Piconet and Scatternet support .

Goal: My goal is to connect each nRF52840 to a tactor and then the two tactors simultaneously play a pattern of vibrations.

User experience: The activation of the pattern could be done through an iPhone app or through a button on each of the ItsyBitsy boards. There are four scenarios to play a pattern: 1) iPhone is present and plays a master role for the two slave ItsyBitsy boards. 2) iPhone is absent and so one device plays the role of master and the other, the slave role. 3) iPhone is present as well as one of the ItsyBitsy boards. 4) iPhone is absent while an ItsyBitsy board is present.

Scenarios 3 and 4 are easy to implement. The difficulty is to ensure synchrony for scenario 1 and 2. In scenario 1, the activation of the device can be done through a phone or through a button on one of the boards. In scenario 2, the activation can be done only by pressing a button on one of the boards.

Potential Solution Sending a periodic time status packet between the Masters and slaves. The slaves will always conform to the master's time. When a button is pressed, either on the phone app or on the boards, it send a command to play a pattern in sometime in the future. If all the devices are in synch, then they will all play at the same time. That is the premis.

How viable this solution is? Tradeoffs I should be concerned about pursuing this option? Are there any alternatives?


Solution

  • There might be a simple Bluetooth Low Energy (4) solution to this. One board can connect to another and that connection can be used to synchronise the code or time (offset) on the boards. That can be made more accurate with easy round-trip time calculations.

    Adafruit Learn: Quick Draw Duo uses this technique to synchronise the Circuit Playground Bluefruit boards which are also nRF52840 based. There's a diagram on the design page showing how it works.

    There's potential for higher accuracy if you factor in the intervals in BLE communication. I'd guess you can get this within a few milliseconds if you do that even with an interpreted language like CircuitPython.

    Another BLE option is to use Advertisement broadcasts from one node. This approach appears attractive but I would be cautious on packet loss which can be substantial. There's also a small, random delay introduced as per the spec.

    I've found high speed video cameras very useful for verifying synchronisation if you have something visual like a simple LED to indicate a mark point. Many smartphones and cheap action cameras have 240fps modes nowadays.

    Nordic have an interesting example in Wireless timer synchronization among nRF5 devices for high accuracy which I think is squeezing in non-Bluetooth into the radio traffic to achieve: "These results shows that one can stay within one or two 16 MHz clock cycles of synchronization under ideal conditions".