|
phyphox BLE
Plot your Arduino's data in the phyphox app and control the board from the phone
|
The canonical specification of the phyphox BLE contract is the "Bluetooth Low Energy" page of the phyphox documentation ("Phyphox service" section). This page says how this library uses it.
Fixed by the phyphox app (contract):
UUID (…-30f7-4671-8b43-5e40ba53514a) | role |
|---|---|
cddf0001 | experiment service — advertised, so the app lists the device as compatible |
cddf0002 | experiment characteristic (notify): the document transfer |
cddf0003 | experiment control (write): the app writes 1 to request the transfer, 0 before disconnecting |
cddf0004 | event characteristic (write): 17-byte start/pause/clear/sync events |
Conventions of this library (named in the generated document, so the app needs no knowledge of them):
| UUID | role |
|---|---|
cddf1001 | data service |
cddf1002 | data characteristic (notify): five float32 little-endian, channels 1…5 at offsets 0, 4, 8, 12, 16; with setRepeating(n), n samples per notification |
cddf20kk | input channel k (write): one float32 little-endian, written by the phone when the channel changes |
cddf30ss | phone sensor s (write): its mapped components as consecutive float32 little-endian |
cddf1003 | hand-written documents only (start(name, xml, len)): the config characteristic, five float32 little-endian at offsets 0…16, read with PhyphoxBLE::read(...) |
cddf0002 or writes 1 to cddf0003; whichever comes first starts the transfer, and a second trigger during a transfer is ignored.phyphox (7 ASCII bytes), the document size as a big-endian uint32, its CRC-32 as a big-endian uint32.The BLE link layer acknowledges and retransmits every packet, so a weak link makes the transfer slower, not incomplete.
The board asks for a connection interval of 15–30 ms with no latency and a 5 s supervision timeout, values both Android and iOS accept. PhyphoxBLE::minConInterval, maxConInterval, slaveLatency and timeout change them before start(), in BLE units (1.25 ms for the intervals, 10 ms for the timeout); iOS ignores a request below 15 ms.
See the phyphox documentation for the 17-byte layout: type byte, experiment time (int64 ms, big-endian), Unix time (int64 ms, big-endian). The library decodes it into PhyphoxBLE::eventType, experimentTime, systemTime.