ESP32 Workshop

For developers

The source code, building from source, the board’s pins, and how firmware is published and verified. If you only want to use the tools, installing the firmware and connecting to the device is all you need.

Source code

The source code for all tools is in anoni-net/esp32, released under the MIT License:

Directory Contents
pocket-detector/ Pocket Detector, a PlatformIO project. The firmware is in pocket_detector/ and the phone panel’s web page is pocket_detector/panel.html
playground/ Demo firmware for trying out the ESP32-S3’s features
lib/ Shared components: firmware updates from a URL (netupdate) and a Bluetooth text channel with pairing (phonelink)
tools/ Publishing scripts
site/ Build script for this website

Full documentation for each tool (serial commands, research modes, every panel feature, log formats) is in the README in its directory, for example the Pocket Detector notes (in Chinese).

Building and flashing from source

After installing PlatformIO Core:

git clone https://github.com/anoni-net/esp32.git
cd esp32/pocket-detector
pio run -t upload       # build and flash
pio device monitor      # watch the serial output at 115200 baud

Platform and library versions are pinned in platformio.ini (espressif32 8.0.0, Arduino core 3.3.12, NimBLE-Arduino 2.5.2, U8g2 2.36.18). If the upload fails, hold BOOT, press RST once and release BOOT to put the board into download mode, then try again.

With the Arduino IDE, first copy the folders under lib/ into your Arduino libraries folder, choose the board ESP32S3 Dev Module, Flash Size 16MB, PSRAM set to OPI PSRAM and Partition Scheme set to 16M Flash (3MB APP/9.9MB FATFS). For details, see the Pocket Detector notes (in Chinese).

Board and pins

Only 44-pin DevKitC-compatible boards with the ESP32-S3 N16R8 (16 MB flash, 8 MB Octal PSRAM) are officially supported for now. For the chip’s specifications, see What is ESP32. Pins used by Pocket Detector:

Pin Use
GPIO0 BOOT button: hold to turn Wi-Fi on or off, press briefly to acknowledge an alert or add a marker, double-press to find
GPIO4 Buzzer (active, triggered on high)
GPIO8, GPIO9 OLED SDA and SCL (SSD1306, I2C address 0x3C or 0x3D)
GPIO48 On-board RGB LED (GPIO38 on some boards)

Avoid these pins when wiring:

Pin Reason
GPIO0, 3, 45, 46 Strapping pins for the boot mode
GPIO19, 20 USB
GPIO35 to 37 PSRAM on the N16R8
GPIO43, 44 Serial port of the COM port

Connect the OLED’s VCC to 3.3V. The ESP32-S3’s pins do not tolerate 5V. For full wiring instructions, see the Pocket Detector wiring (in Chinese).

The partition table is app3M_fat9M_16MB.csv:

Partition Address Size Use
nvs 0x9000 20 KB Settings (name, password, threshold, Wi-Fi for updates)
otadata 0xE000 8 KB Which app slot to boot from
app0, app1 0x10000, 0x310000 3 MB each Two app slots. An update is written to the other one and switched to only after it passes verification
ffat 0x610000 About 9.9 MB Flash log, alert history, places

Publishing and verifying firmware

Firmware is published on assets.anoni.net in two channels:

Channel URL Contents
Stable https://assets.anoni.net/esp32-tracker/ Versions that passed hardware testing. Web installation and auto update read from here
Test https://assets.anoni.net/esp32-tracker-test/ Published after every change, for boards used in development testing

Pocket Detector comes in Traditional Chinese, Simplified Chinese and English. Each is built separately and has its own two channels: Simplified Chinese uses esp32-tracker-zh-cn/ and esp32-tracker-zh-cn-test/, and English uses esp32-tracker-en/ and esp32-tracker-en-test/. The firmware for each language updates only from its own channels. For how the translations are done, see the Pocket Detector notes (in Chinese).

Each channel has a latest.json (read when updating over the internet) and a manifest.json (read by web installation), which state the build time, commit, SHA-256 and file name. Firmware file names include the first 12 characters of the SHA-256, so the content behind a file name never changes. While downloading, the board writes to the other app slot and computes the SHA-256 at the same time, and switches only if it matches latest.json. The URLs are hard-coded in the firmware, so even someone who knows the hotspot password can only install versions published by the community.

The install pages have two levels: /esp32/install/ to choose a tool and /esp32/install/<tool>/ to choose a language and install. Each tool lists the firmware for each language under [[firmware]] in site.toml (language, button label, publishing channel). To add a language, build it separately, publish it to its own channels and add another [[firmware]] entry, and the install page gets another button.

New versions are first published to the test channel with tools/publish_firmware.sh. Boards used in development testing update from the test channel, and only after hardware testing (tests/hil/run_hil.py --update) passes is the same file copied unchanged to the stable channel with tools/promote_firmware.sh.

Current version on the stable channel:

Pocket Detector

Build time
Nov 28 2026 01:35:25
commit
3813ec9
SHA-256
e3cc470c92decd1b9b789688ee1ec46be921fd02e9f761c0d8bb74ee46077488
File
tracker-e3cc470c92de.bin

The firmware contains its build time, so a file you build yourself from the same commit will not have the same SHA-256 as the published one. To verify a published version, compare it with the source at that commit, or inspect the downloaded file with esptool image-info.

Tests

cd pocket-detector
./tools/run_tests.sh                    # unit, panel and color contrast tests
./tools/run_tests.sh --hil /dev/cu.xxx  # add hardware-in-the-loop tests with a board connected to the computer

On every PR, GitHub Actions compiles all tools, runs the tests that don’t need a board, builds this website and checks its layout at three widths: 320, 390 and 1280.

Development tools

  • For development

    Demo firmware

    Connect a phone to the board’s hotspot and try the ESP32-S3’s features from a web page to see what it can do.

    Needs: ESP32-S3 N16R8 board. Build and install from source

    How to build from source

Contributing

Please report problems and suggestions in GitHub issues. Code conventions and privacy rules are in the repo’s AGENTS.md (in Chinese): field test records stay out of version control, and addresses of passers-by’s devices are only stored as salted hashes.