ESP32-ExposureAPI-Scanner
This repository contains code to scan the official COVID19 Exposure API with an ESP32 using Bluetooth LE and shows a counter on an SSD1306 OLED display.
Code is based on BLE Exposure Notification Beeper which uses an LED and a piezo buzzer to notify about new detected devices but would not show the device count so I added the display part to it. You can still use the LED/Buzzer because this part is not touched in the code. In case you want to do so use this wiring:
| ESP32 pin | goes to |
|---|---|
| GPIO 0 | LED (+) |
| GPIO 2 | Buzzer (+) |
| GND | LED (-), Buzzer (-) |
How it works
The official Exposure API used by Apple and Google generates new device keys approx. every 15 Minutes. The scanner remembers these codes and won't notify you again if they're detected multiple times. After 20 minutes these devices will be removed from the counter because the keys are no longer valid.
You can adjust this timespan in the code by changing FORGET_AFTER_MINUTES.
Required Hardware
This ESP32 model uses these internal I²C and pins for the SSD1306 display:
| SSD1306 | goes to |
|---|---|
| I²C ADDRESS | 0x3c |
| SDA | 5 |
| SDC | 4 |
You can also use a separate SSD1306 but keep in mind to adjust the I²C adress and the pins in the code.
3D printed case
I recommend this case from Thingiverse.
