tritest Svelte Themes

Tritest

Trilateration test using ESP32 Static Beacons and a Svelte web app listening to UDP broadcasts via an SSE server

Beacon positioning experiment

Building the ESP32 image

Install ESP-IDF v5.1.4, then for each static scanner you want to place:

  1. Source your ESP-IDF installation, e.g. . ~/esp-idf/export.sh
  2. Open esp32/, e.g. cd esp32/
  3. Set the ESP-IDF target to your board type, e.g. `idf.py set-target esp32c3
  4. Set a scanner ID (e.g. 1 or subsequent integers), WiFi SSID, WiFi PSK, UDP Broadcast IP and UDP port in idf.py menuconfig (Component config -> App Configuration -> ...)
  5. Build the firmware: idf.py build
  6. Upload the firmware: idf.py flash
  7. (optional) check it's working: idf.py monitor, you should see it connect to WiFi and then continuously scan for devices

The scanners will then broadcast a UTF-8 encoded packet for every device they pick up in the form:

ble,scanner_id=...,manufacturer_data=0x...,rssi=...

Building the server

Make sure you have nodejs installed, then in the project directory:

  1. Copy app/example.env to app/.env and fill in the MAPKIT_TOKEN with an Apple MapKit JS JWT
  2. Run ./bin/package.sh
  3. Copy tritest_build.zip to wherever you're hosting the server

On the server:

  1. Install python3 and python3-flask, e.g. sudo apt install python3 python3-flask
  2. Extract tritest_build.zip, e.g. unzip tritest_build.zip
  3. Edit serve.py to bind to the desired port, then run python3 serve.py in the extracted directory (e.g. in a screen session or a systemctl service)

Top categories

Loading Svelte Themes