Skip to content

V2.0.0 Initial Release: Complete Spotify Controller for ESP32 with UI and Album Art Support #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jul 26, 2025
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.pio
.vscode
src/compile_time.h
84 changes: 66 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,23 @@

Spotify controller application for the [ThingPulse Color Kit Grande](https://thingpulse.com/product/esp32-wifi-color-display-kit-grande/).

[![Color Kit Grande with sample application: weather station](https://thingpulse.com/wp-content/uploads/2022/10/ThingPulse-Color-Kit-Grand-with-sample-application.jpg)](https://thingpulse.com/product/esp32-wifi-color-display-kit-grande/)
<!-- Main image -->
<a href="./images/HomeView.jpg">
<img src="./images/HomeView.jpg" alt="HomeView UI Example" width="600"/>
</a>

<!-- Thumbnails -->
<p>
<a href="./images/CoverArtView.jpg">
<img src="./images/CoverArtView.jpg" alt="Cover View" width="200"/>
</a>
<a href="./images/ClockView.jpg">
<img src="./images/ClockView.jpg" alt="Clock View" width="200"/>
</a>
<a href="./images/DiagnosticView.jpg">
<img src="./images/DiagnosticView.jpg" alt="Diagnostic View" width="200"/>
</a>
</p>

## Purpose of this project

Expand All @@ -15,11 +31,49 @@ The currently playing song can be paused, resumed and skipped to the next or pre
A full OAuth 2.0 web flow is used to acquire the necessary access and refresh tokens to permit the user to control the player.
In order to run this project on your device, you will need to setup an application on your Spotify dashboard (instructions below).

## Features
## Features

- Artwork download
- Control player on touch screen: play, Pause, next, prev
- Authentication and authorization (OAuth 2.0 flow) on device.
- **Spotify Playback Control**
- Play, pause, skip to next/previous track from the touch screen
- Control playback on any active Spotify Connect device linked to your account (e.g., phone, browser, smart speaker)

- **Album Art Display**
- Downloads and displays album artwork via Spotify Web API
- Caches artwork locally for performance

- **Multiple UI Modes**
- Home view with track metadata and album art
- Cover Art only view
- Clock view with time and playback progress
- Diagnostics view with system stats and Spotify state

- **OAuth 2.0 Authorization Flow**
- Authentication and authorization (OAuth 2.0 flow) on device

- **Designed for ESP32 + TFT Touch**
- Built using PlatformIO and Arduino
- Touch event handling for UI buttons and screen navigation
- Takes advantage of ESP32 dual-core architecture: UI logic runs on one core, while background tasks (e.g., album art refresh) run on the other

- **Extensible Design**
- Modular architecture allows easy addition of new Views (UI screens)
- Built-in monitoring tools for measuring system performance and UI responsiveness
- Structured and tag-based logging system for easier debugging and analysis


<!--Design Context Diagram -->
<a href="./documentation/SCDesign.jpg">
<img src="./documentation/SCDesign.jpg" alt="Design" width="600"/>
</a>

## Using the Spotify Controller

- Tap the **Prev**, **Pause/Play**, and **Next** buttons to control music playback.
- Tap the **album art** on the Home view to switch to the **Cover Art view**.
- Tap the **clock** to switch to the **Clock view**.
- Tap the **network status box** in the lower-right corner to open the **Diagnostics view**.

> For detailed display logic and diagnostics layout, see `DiagnosticsView.cpp`.

## Service level promise

Expand All @@ -37,28 +91,22 @@ See our [instructions](https://docs.thingpulse.com/guides/esp32-color-kit-grande

1. Go to [https://developer.spotify.com/dashboard/login](https://developer.spotify.com/dashboard/login) and login to or sign up for the Spotify Developer Dashboard

2. Select "My New App"
2. Select "Create app"

<img src="./images/SpotifyDashboard.png" width="400">

3. Fill out the form. Give your new app a name you can attribute to this project.
It's safe to select "I don't know" for the type of application.
Add "http://tp-spotify.local/callback/" to the Redirect URIs section.

<img src="./images/SpotifyAppSignUp1.png" width="400">

4. At the end of the 3 steps click "Submit"

<img src="./images/SpotifyppSignUp3.png" width="400">
**NOTE** If you are running more than ThingPulse Spotify Remote in the same WiFi network, you should choose a unique name rather than "tp-spotify". Regardless of what you choose it has to reflect what you set for `SPOTIFY_ESPOTIFIER_NODE_NAME` in `spotify.h` in the project.

5. Set the unique Client ID and Client Secret as values for the respective variables in `settings.h`.
<img src="./images/SpotifyCreateApp.png" width="400">

<img src="./images/SpotifyCredentials.png" width="400">
**Don't forget to save your settings.**

6. Click on "Edit Settings". Add "http://tp-spotify.local/callback/" to the Redirect URIs section.
4. Set the unique Client ID and Client Secret as values for the respective variables in `spotify.h`.

**NOTE** If you are running more than ThingPulse Spotify Remote in the same WiFi network, you should choose a unique name rather than "tp-spotify". Regardless of what you choose it has to reflect what you set for `SPOTIFY_ESPOTIFIER_NODE_NAME` in `settings.h` in the project.
<img src="./images/SpotifyClientId.png" width="400">

<img src="./images/SpotifyAppSettings.png" width="400">

7. Don't forget to save your settings.
<img src="./images/SpotifyAppSettingsSave.png" width="400">
54 changes: 54 additions & 0 deletions boards/custom_esp-wrover-kit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"_comment": "This is a custom board configuration for an ESP32 with 8MB Flash. - Jan 8, 2025.",
"build": {
"arduino":{
"ldscript": "esp32_out.ld"
},
"core": "esp32",
"extra_flags": "-DARDUINO_ESP32_DEV",
"f_cpu": "240000000L",
"f_flash": "40000000L",
"flash_mode": "dio",
"hwids": [
[
"0x0403",
"0x6010"
]
],
"mcu": "esp32",
"variant": "esp32"
},
"connectivity": [
"wifi",
"bluetooth",
"ethernet",
"can"
],
"debug": {
"default_tool": "ftdi",
"onboard_tools": [
"ftdi"
],
"openocd_board": "esp32-wrover.cfg"
},
"frameworks": [
"arduino",
"espidf"
],
"name": "Espressif ESP-WROVER-KIT",
"upload": {
"flash_size": "8MB",
"maximum_ram_size": 327680,
"maximum_size": 8388608,
"protocols": [
"esptool",
"espota",
"ftdi"
],
"require_upload_port": true,
"speed": 460800
},
"url": "https://espressif.com/en/products/hardware/esp-wrover-kit/overview",
"vendor": "Espressif"
}

Binary file added data/DefaultCoverArt.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading