Firmware for a custom ESP32-S3 wireless trackball using a PAW3395 optical sensor and BLE HID.
- BLE HID mouse
- PAW3395 motion sensor (SPI)
- SSD1306 OLED status/config UI (I2C)
- Battery monitoring and BLE battery level reporting
- Vertical and horizontal scrolling
- High-resolution scrolling mode
- DPI presets switchable from hardware button
- Deep sleep on inactivity with GPIO wakeup
- MCU: ESP32-S3
- Sensor: PAW3395
- Display: SSD1306 OLED (I2C address
0x3C) - Buttons: 6 total
BTN1,BTN2,BTN3(main mouse buttons)MODE(scroll mode toggle)SCROLL(hold/lock scroll and button lock behavior)CFG(DPI preset switch)
Pin mapping is defined in main/pins.h.
- ESP-IDF
v5.5.x - CMake
>= 3.16
- Open an ESP-IDF environment shell.
- Set target (first time only):
idf.py set-target esp32s3- Build:
idf.py build- Flash:
idf.py -p <PORT> flash- Optional monitor:
idf.py -p <PORT> monitor- Roll the trackball to move the pointer.
- Hold
SCROLLand roll the ball: temporary scroll mode. - Click
SCROLL: toggle locked scroll mode on/off.
- Press and hold a mouse button.
- Click
SCROLLto lock that button state. - Click
SCROLLagain to release all locked buttons.
- Click
CFGto cycle DPI presets.
- Click
MODEto cycle scroll axis modes:- vertical + horizontal
- vertical only
- horizontal only
- Hold
MODEto toggle high-resolution scrolling.
main/app.cpp: app state machine, input handling, power managementmain/paw3395/: PAW3395 sensor drivermain/nimble/: BLE HID implementationmain/oled/: SSD1306 driver and UI renderingmain/battery/: battery measurement and level updatesmain/button/: button handling (click/hold/state)
- Build-time settings are in
sdkconfigandsdkconfig.defaults. - Project-specific Kconfig entries are in
main/Kconfig.projbuild. - The default deep sleep timeout is 3 minutes (
180000 ms) in app config.
- Build fails with missing IDF tools:
- verify ESP-IDF is exported correctly in your shell
- No serial port found:
- check cable/data support and device permissions
- Device not discoverable over BLE:
- erase/reflash and reset the board
- confirm power and battery voltage are stable
This project is licensed under the MIT License. See LICENSE for details.