46 lines
2.5 KiB
Markdown
46 lines
2.5 KiB
Markdown
# 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](https://github.com/kmetz/BLEExposureNotificationBeeper) 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
|
|
+ [ESP32 with in-built SSD1306 Display](https://www.aliexpress.com/item/4000217873035.html?spm=a2g0o.productlist.0.0.3cbb3f174QDsKe&algo_pvid=19b9389d-6613-4aef-bc52-59f1a4f8dfcd&algo_expid=19b9389d-6613-4aef-bc52-59f1a4f8dfcd-1&btsid=0b0a01f815926828747758917ec2d0&ws_ab_test=searchweb0_0,searchweb201602_,searchweb201603_)
|
|
|
|
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](https://www.thingiverse.com/thing:3821633) case from Thingiverse. You can see it in the second image above.
|
|
|
|
In case you have an [Anycubic i3 Mega](https://www.anycubic.com/products/anycubic-i3-mega) printer at home you can use the sliced gcode file in the `case/` folder. The file contains the top and bottom part and was sliced with Cura with highest printing accuracy. It will take approx. 3h to print.
|
|
|
|
## Used Libraries
|
|
+ [ESP8266-oled-ssd1306 by ThingPulse](https://github.com/ThingPulse/esp8266-oled-ssd1306)
|
|
|
|
## To do
|
|
- [ ] [Sparklines](https://github.com/0xPIT/ESParklines)
|