Skip to content

Latest commit

 

History

44 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

esp32-pinout-tester

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.

Quick start

  1. Pick the environment for your board in platformio.ini:
  • esp32s3
  • d1mini_esp32
  1. Build and upload (default PWM sensing):
pio run -e esp32s3 -t upload --upload-port /dev/cu.usbmodemXXXX
  1. Monitor:
pio device monitor

Mode selection

Modes 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=HIGH or -DPINS_LEVEL=LOW: idle level for PINS_TOGGLE.
  • -DI2C_PROBE: enables I2C scan mode.

After changing flags, rebuild and upload.

PWM sensing mode

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, I during confirm passes
    • S on success
    • O on 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=40

Morse mode

Each GPIO blinks its numeric pin ID in Morse code, in parallel. Timing is based on kDashMs in src/main.cpp.

Morse test button (optional)

If -DTEST_BUTTON is enabled in Morse mode:

  • A button press forces TEST_LED_PIN to 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=40

Pin toggle mode

Each 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=17

I2C probe mode

Press 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=17

Board environments

Configured in platformio.ini:

  • esp32s3
  • d1mini_esp32

Each env defines the board and USB-CDC settings as needed.

Notes

  • Avoid flash pins, strapping pins, and input-only pins unless you know the risks.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages