mirror of https://github.com/CovidBraceletPrj/CovidBracelet.git synced 2024-07-25 11:42:18 +02:00
Go to file
2023-02-20 18:35:39 +01:00
.github/workflows Run build and test actions on pull_requests too 2021-07-23 11:46:07 +02:00
img Add article to readme 2021-12-08 16:44:36 +01:00
include Add library files 2023-02-16 17:48:17 +01:00
lib Add library files 2023-02-16 17:48:17 +01:00
out Smaller tweaks for graphs 2023-02-16 17:48:17 +01:00
scripts Smaller tweaks for graphs 2023-02-16 17:48:17 +01:00
src Adding main tracing and sync calls again 2023-02-16 17:48:17 +01:00
test Correct test file extension 2023-02-16 17:48:17 +01:00
zephyr Remove deleted source files from Makelists 2023-02-20 18:35:39 +01:00
.clang-format Format ens files and add .clang-format file 2021-05-25 18:06:15 +02:00
.gitignore Refactor and Clean Project for essential functionality 2023-02-16 17:48:17 +01:00
basestation.py initial code release 2020-06-08 11:15:05 +02:00
LICENSE Initial commit 2020-06-07 21:45:48 +02:00
platformio.ini Update Zephyr version to fix consumption... 2023-02-16 17:48:17 +01:00
README.md Update README.md 2022-10-04 09:06:28 +02:00

TraceBand Actions Status: test Actions Status: build

This project aims to add support the Exposure Notification (EN) protocol for tracing contacts from Apple and Google on low-power wristbands. It maintains full compatibility with smartphone Apps based on the EN protocol.

Note: this is a proof of concept and not ready for production
Contributions Welcome!


  • Builds on Zephyr OS targetting the NRF52 BLE SOCs
  • Easy project setup using PlatformIO
  • Sends and receives exposure beacons as specified by Google and Apple for Covid Contact Tracing
    • Rolling, encrypted, anonymous beacons
    • Compatible with Apple iOS and Android phones
    • With rolling proximity identifiers and encrypted metadata
    • Proximity identifiers and BLE addresses change every 10 minutes
  • Stores own keys for 14 days
  • Stores contacts of more than 5 minute duration
  • Upon infection upload keys to a public database (WIP)
  • Retrieve keys of infections from database (WIP)
    • computes rolling proximity identifiers
    • compares to stored contacts to check for exposure
  • Android App (to be released)

Note: as we for now do not use the flash for key storage, this currently only works on nrf52480 or you can just store a very small number of keys. Moving the keys to flash is on the TODO list and will fix this.

Getting Started

This project is based on platformIO for an easy setup process, see: https://platformio.org/platformio-ide.


To run the tests for the desktop environment select the task test for desktop or run:

platformio test -e desktop

Demo Video

Video Demo


Flash Support

  • Store long-term contacts in flash

Device Initialization

The devices need to be initialized:

  • Fix entropy: keys are always the same on boot up
  • Synchronize time
  • Set device name, user id or so in Flash (-> persistend configuration)

Device Synchronization

  • Extend beyond the simple (existing) basestation
  • Synchronize time
  • Get infections from DB, Check their signatures
  • Secure GATT services and authentication of base statation in general
  • Read keys form national databases
    • Functions to extract keys from googles official exposure key export file format are already implemented
    • For full integration the keys have to be downloaded from the national servers (due to limited memory an intermediate server which provides small batches of keys is advised)
    • Also the keys have to checked against the stored contacts (for this the process_key-function in extract_keys.c has to be implemented)

Extract Keys from Device

In case of an infection, the keys need to be extracted from the device:

  • Secure extraction of keys (Base version existing)

Device Updates Over the Air (OTA)

Securely updating many running devices over the air with signed firmware will greatly improve maintainability. Related feature branch: feature/ota


  • extensive logging: crash, reboot, battery level, charging state, contacts, memory useage, flash usage
  • Energy efficiency

Protocol Specifications

  • set scanning interval to the correct value, for now we just use the default
  • set advertisement interval, correct value, for now we just use the default: should be 200-270 milliseconds
  • set transmit power and store this in the corona beacons
  • extensive compatibility testing with Apple iOS and Android devices
  • BLE advertisements sets


  • Contininous integration testing
  • More platforms: with display etc.

Possible Platforms

Possible platforms for real-world deployment many, as many of the cheap fitness trackers base on NRF52 or chips with similar capabilities. However, many would need the firmware to be shipped to manufactures.

  • Watch UI
  • Pine Time could be good for testing


A basic visual interface based on LVGL is included. It can be tested on POSIX-compliant platforms by building it with the zephyr/build_native.sh script. SDL must be installed to provide a virtual display.

No risk contacts Low risk High risk

Exposure Key Extraction

Exposure keys can be unpacked from their protocol buffer. The unpacking can be tested, by setting the TEST_UNPACK_KEYS=y and TEST_UNPACK_KEYS_N=n config variables. The test will run first thing at startup and output the time, it took unpacking and iterating over the keys.