This project uses an ESP32 TTGO-T1 board with touch sensors and LEDs to trigger audio playback on a laptop over UDP. When a touch sensor is pressed, the ESP32 sends a command to the laptop, and the laptop plays the matching local audio file from the audio/ folder. In addition, the LED light corresponding to the touch sensor also flashed in response. A demo can be found here.
- ESP32 TTGO-T1 board
- PlatformIO for building and uploading the firmware
- Python 3.9+ on the laptop
pydubandffmpegfor audio playback
-
Open the project in VS Code with the PlatformIO extension installed.
-
Install the Python dependency:
pip3 install pydub
-
Install
ffmpegif it is not already available on your system.
The firmware and laptop script are configured to work together with these defaults:
- ESP32 access point SSID:
ESP32 - ESP32 access point password:
ESP32_SoundOfNYC - UDP port:
4210 - Audio directory:
audio/
The audio files expected by the script are:
audio/statue.m4aaudio/building.m4aaudio/wsp.m4aaudio/columbia.m4a
-
Build and upload the firmware to the ESP32 using PlatformIO.
-
Connect the laptop to the ESP32 Wi-Fi network using the SSID and password above.
-
Start the laptop listener:
python3 serial_audio_player.py
-
Touch one of the sensors on the board to trigger playback and the matching LED animation.
| Touch target | UDP command | Audio file |
|---|---|---|
| Statue of Liberty | PLAY_STATUE |
audio/statue.m4a |
| Empire State Building | PLAY_BUILDING |
audio/building.m4a |
| Washington Square Park | PLAY_WSP |
audio/wsp.m4a |
| Columbia University | PLAY_COLUMBIA |
audio/columbia.m4a |
- The laptop script listens on
0.0.0.0:4210by default.