A compact physical Now Playing display powered by an ESP32 and a 1.8" ST7735 SPI TFT screen. Designed in the style of the iOS Lock Screen music player, it displays song title (with smooth marquee scrolling), artist, album artwork, a live progress bar, and connection status.
The device operates in two distinct modes:
- Standalone Bag Charm Mode: Connects directly to your phone's mobile hotspot or home Wi-Fi via ESP32 Wi-Fi, calling the Spotify Web API directly with zero computer connection required.
- USB Desktop Companion Mode: Connects via USB to a Mac, Windows, or Linux machine running a Python background service that streams track info from Spotify, YouTube, or Apple Music.
| Component | Specification | Notes |
|---|---|---|
| Microcontroller | ESP32 Dev Module (ESP32-WROOM-32) | Standard 30-pin or 38-pin board |
| Display | 1.8" ST7735 SPI TFT (128x160) | 8-pin SPI interface (black tab / red tab) |
| Connecting Wires | Female-to-Female Dupont jumpers | 8 wires for display |
| Power Source | 5V Powerbank or 3.7V LiPo + TP4056 | Powers board via Micro-USB or 5V/GND pins |
| Buttons | Built-in BOOT button (GPIO 0) | Optional external tactile buttons for Next / Prev |
Connect the display directly to the ESP32 pins as defined in platformio.ini:
| Display Pin | ESP32 Pin | Function |
|---|---|---|
| VCC | 3.3V | Power (3.3V regulated) |
| GND | GND | Ground |
| CS | GPIO 5 | Chip Select |
| RESET / RST | GPIO 4 | Hardware Reset |
| A0 / DC | GPIO 2 | Data / Command select |
| SDA / MOSI | GPIO 23 | SPI Data out |
| SCK / SCLK | GPIO 18 | SPI Clock |
| LED / BLK | 3.3V | Backlight power |
Internal pull-ups are enabled in firmware. Connect tactile pushbuttons between the GPIO pin and GND:
| Pin | Function | Wiring |
|---|---|---|
| GPIO 0 (BOOT) | Play / Pause | Built-in on ESP32 board (no wiring needed) |
| GPIO 13 | Next Track | Pushbutton to GND (optional) |
| GPIO 14 | Previous Track | Pushbutton to GND (optional) |
This mode lets the ESP32 run independently using your phone's personal hotspot or home Wi-Fi.
- Go to the Spotify Developer Dashboard and log in.
- Click Create app:
- App name:
Spotify Deck - App description:
ESP32 Now Playing Charm - Redirect URI:
http://127.0.0.1:8888/callback - APIs used: Web API
- App name:
- Save the app, open Settings, and note down your Client ID and Client Secret.
Install the Python dependencies and run the token helper:
pip install -r requirements.txt
python3 get_token.pyEnter your Client ID and Client Secret when prompted. Your browser will open for a one-time Spotify authentication. Once authorized, the terminal prints pre-formatted configuration definitions.
Copy the configuration template:
cp src/config.example.h src/config.hEdit src/config.h and supply:
WIFI_SSID_1andWIFI_PASS_1: Your phone's hotspot name and password.WIFI_SSID_2andWIFI_PASS_2: (Optional) Home Wi-Fi credentials.- Paste the
SPOTIFY_CLIENT_ID,SPOTIFY_CLIENT_SECRET,SPOTIFY_REFRESH_TOKEN, andSPOTIFY_AUTH_BASICdefinitions produced byget_token.py.
src/config.h is excluded by .gitignore to prevent credentials from being committed.
Using VS Code with the PlatformIO extension:
- Open the project folder in VS Code.
- Connect the ESP32 using a data-capable USB cable.
- Click the PlatformIO Upload button in the bottom status bar.
Alternatively, using the PlatformIO command-line tool:
pio run --target uploadOnce flashed, turn on your phone's personal hotspot. The ESP32 will connect automatically, fetch playback data from Spotify, download album artwork, and update the screen.
If you prefer to keep the device connected to your computer via USB, use the Python companion script to capture media playback locally:
python3 spotify_deck.py| Flag | Description |
|---|---|
python3 spotify_deck.py |
Auto-detects playback from active apps |
--player spotify |
Force Spotify desktop app capture |
--player youtube |
Force YouTube browser capture (Chrome / Safari / Edge) |
--player apple |
Force Apple Music capture (macOS only) |
--demo |
Offline simulation mode |
--port <PORT> |
Explicitly define serial port (e.g., /dev/ttyUSB0 or COM3) |
While spotify_deck.py is running in terminal:
Space: Play / Pausen: Next trackp: Previous trackq: Quit
- macOS (YouTube timeline tracking):
- Chrome: View -> Developer -> Allow JavaScript from Apple Events.
- Safari: Develop -> Allow JavaScript from Apple Events.
- Windows: Install
pywin32andpyautoguifor media detection (pip install pywin32 pyautogui). - Linux: Requires
playerctlfor MPRIS support (sudo apt install playerctl).
- Current Spike and Flicker Mitigation:
The ESP32 Wi-Fi radio draws up to 450-500 mA during high-power 802.11b/g/n transmission bursts. On a shared 3.3V rail, this causes voltage drops that reset the ST7735 internal charge pump, resulting in white screens or flickering.
This firmware sets
WiFi.setTxPower(WIFI_POWER_8_5dBm)and disables modem sleep (WiFi.setSleep(false)), providing clean, continuous power to the display. - Optimized Viewing Angle:
The ST7735 panel has directional contrast. The display is initialized with
tft.setRotation(1)(180-degree flip) to provide high contrast when viewed from the left or head-on. - Direct JPEG Decoding:
Album art is streamed directly from Spotify CDN into memory and rendered on the 128x160 panel using
TJpg_Decoderwithout writing to flash.
| Issue | Cause | Solution |
|---|---|---|
| White screen / flickering | Insufficient power or voltage sag | Ensure TX power capping is present; verify display VCC is on 3.3V and GND is secure |
| Wi-Fi dot stays gray | Cannot connect to hotspot | Ensure hotspot is enabled and SSID/password in src/config.h are exact; on iPhone, toggle "Maximize Compatibility" |
| "Waiting" or "Not Playing" | No active Spotify session | Start playback on any device linked to your Spotify account (phone, web player, desktop) |
| Port not detected during flash | Missing USB-to-UART driver | Install CH340 or CP2102 driver for your operating system |
| Upload stuck on Connecting | ESP32 bootloader mode | Hold the BOOT button while PlatformIO displays Connecting..., then release |