Small PlatformIO project for identifying ESP32 GPIOs.
Four modes:
- PWM sensing (default): drives each GPIO with a 1 kHz square wave and detects which pin is connected to the sense input.
- Morse output: blinks each GPIO number in Morse code.
- Pin toggle (button-stepped): pulses each GPIO on button press and logs the pin/state.
- I2C probe: scans the I2C bus and logs detected device addresses.
- Pick the environment for your board in
platformio.ini:
esp32s3d1mini_esp32
- Build and upload (default PWM sensing):
pio run -e esp32s3 -t upload --upload-port /dev/cu.usbmodemXXXX- Monitor:
pio device monitorModes are toggled by uncommenting flags in the global [env] section of platformio.ini:
[env]
build_flags =
; -DMORSE
; -DTEST_BUTTON
; -DPINS_TOGGLE
; -DPINS_LEVEL=HIGH
; -DI2C_PROBE- Default (no flags): PWM sensing mode.
-DMORSE: Morse mode.-DTEST_BUTTON: enables the Morse test button behavior (Morse mode only).-DPINS_TOGGLE: enables button-stepped pin toggling.-DPINS_LEVEL=HIGHor-DPINS_LEVEL=LOW: idle level forPINS_TOGGLE.-DI2C_PROBE: enables I2C scan mode.
After changing flags, rebuild and upload.
Wiring:
- Connect the pin you want to identify to the sense input pin (
SENSE_IN_PIN). - The status LED (
STATUS_LED_PIN) blinks Morse status:E,Iduring confirm passesSon successOon disconnect
The serial log prints on successful detection:
Connected: GPIO35
Connected: GPIO35 (2)
The number in parentheses increments only on reconnects to the same pin.
Pin mapping is configured in platformio.ini only (no edits in src/main.cpp).
Set the pins in the env you are using:
build_flags =
-DBOARD_ESP32S3
-DSENSE_IN_PIN=44
-DSTATUS_LED_PIN=40Each GPIO blinks its numeric pin ID in Morse code, in parallel. Timing is based on kDashMs in src/main.cpp.
If -DTEST_BUTTON is enabled in Morse mode:
- A button press forces
TEST_LED_PINto blink at 5 Hz. - Releasing returns the pin to Morse output.
Pin configuration example:
build_flags =
-DBOARD_ESP32S3
-DMORSE
-DTEST_BUTTON
-DTEST_BUTTON_PIN=17
-DTEST_LED_PIN=40Each button press targets one pin and drives it to the opposite of PINS_LEVEL until the next press.
The next press first restores the previous pin back to PINS_LEVEL, then advances.
The serial log prints the pin and the driven level.
Pin configuration example:
build_flags =
-DBOARD_ESP32S3
-DPINS_TOGGLE
-DPINS_LEVEL=HIGH
-DTEST_BUTTON_PIN=17Press the test button to scan the I2C bus, list detected devices, then probe the first device as a BM8563 RTC. It prints a check line, the decoded time, and the CTRL1/CTRL2 register values.
Pin configuration example:
build_flags =
-DBOARD_ESP32S3
-DI2C_PROBE
-DI2C_SDA=41
-DI2C_SCL=42
-DTEST_BUTTON_PIN=17Configured in platformio.ini:
esp32s3d1mini_esp32
Each env defines the board and USB-CDC settings as needed.
- Avoid flash pins, strapping pins, and input-only pins unless you know the risks.