microReticulumTbeam/exercises/301_microReticulum_ble_ping_pong
2026-05-19 15:38:06 -07:00
..
src All working 2026-05-19 15:38:06 -07:00
platformio.ini All working 2026-05-19 15:38:06 -07:00
README.md All working 2026-05-19 15:38:06 -07:00

Exercise 301: microReticulum BLE ping-pong

This exercise is the BLE analogue of Exercise 201. It proves that two T-Beam Supreme units can exchange microReticulum PLAIN destination packets over an ESP32 BLE GATT interface instead of LoRa.

The ESP32 BLE interface is new in this exercise. It uses the Reticulum BLE service and characteristic UUIDs from /usr/local/src/ble-reticulum/BLE_PROTOCOL_v2.2.md:

service  37145b00-442d-4a94-917f-8f42c5da28e3
TX notify 37145b00-442d-4a94-917f-8f42c5da28e4
RX write  37145b00-442d-4a94-917f-8f42c5da28e5
identity  37145b00-442d-4a94-917f-8f42c5da28e6

For this first BLE proof, roles are explicit:

AMY -> BLE central/client
BOB -> BLE peripheral/server

AMY scans for the Reticulum BLE service, connects to BOB, sends the 16-byte BLE identity handshake, subscribes to BOB's TX notifications, and writes Reticulum packet fragments to BOB's RX characteristic. BOB receives writes and sends its own Reticulum packet fragments back with TX notifications.

Build, upload, and monitor

In one console:

source /home/jlpoole/rnsenv/bin/activate
cd /usr/local/src/microreticulum/microReticulumTbeam
pio run -d exercises/301_microReticulum_ble_ping_pong -e bob -t upload --upload-port /dev/ttytBOB && \
pio device monitor -d exercises/301_microReticulum_ble_ping_pong -e bob

In another console:

source /home/jlpoole/rnsenv/bin/activate
cd /usr/local/src/microreticulum/microReticulumTbeam
pio run -d exercises/301_microReticulum_ble_ping_pong -e amy -t upload --upload-port /dev/ttytAMY && \
pio device monitor -d exercises/301_microReticulum_ble_ping_pong -e amy

Start BOB first so the peripheral is advertising before AMY starts scanning.

The platformio.ini maps each environment to its stable USB symlink:

amy -> /dev/ttytAMY
bob -> /dev/ttytBOB
cy  -> /dev/ttytCY
dan -> /dev/ttytDAN
ed  -> /dev/ttytED

The shorter form should also work once the symlinks exist:

pio run -d exercises/301_microReticulum_ble_ping_pong -e bob -t upload
pio device monitor -d exercises/301_microReticulum_ble_ping_pong -e bob

Expected output

BOB should advertise:

Exercise 301: microReticulum BLE ping-pong
Node=Bob
BLE role=peripheral service=37145b00-442d-4a94-917f-8f42c5da28e3

AMY should scan, connect, and send the BLE identity handshake:

BLE scanning for Reticulum service
BLE peer found: ...
BLE connected and identity handshake sent

After the BLE link is connected, both nodes should print Reticulum packet traffic:

TX RNS BLE: Amy says hi. iter=0
RX RNS BLE: Bob says hi. iter=0

Notes

  • This exercise still uses PLAIN destinations. It proves BLE can carry serialized Reticulum packets, not identity announces or negotiated links.
  • Exercise 302 should mirror Exercise 202 by adding announced SINGLE destinations over BLE.
  • Exercise 303 should mirror Exercise 203 by negotiating a Reticulum Link over BLE.
  • The BLE fragmentation header matches the Python/C++ BLE Reticulum protocol: [type:1][sequence:2][total:2][payload...].
  • This first ESP32 implementation is intentionally role-paired. A later pass can add dual central/peripheral operation and MAC-sorted connection direction.