-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 583d6b6
Showing
31 changed files
with
7,587 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# This file is for unifying the coding style for different editors and IDEs | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 2 | ||
max_line_length = 100 | ||
curly_bracket_next_line = false | ||
|
||
[*.{html,php}] | ||
max_line_length = 160 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# documentation at https://docs.platformio.org/en/latest/integration/ci/github-actions.html | ||
|
||
name: PlatformIO CI | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cache/pip | ||
~/.platformio/.cache | ||
key: ${{ runner.os }}-pio | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.9' | ||
- name: Install PlatformIO Core | ||
run: pip install --upgrade platformio | ||
|
||
- name: Build PlatformIO Project | ||
run: pio run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.pio | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 ThingPulse | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Color Kit Grande Spotify Controller | ||
|
||
[![Build Status](https://github.com/ThingPulse/esp32-spotify-remote/actions/workflows/main.yml/badge.svg)](https://github.com/ThingPulse/esp32-spotify-remote/actions) | ||
|
||
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/) | ||
|
||
## Purpose of this project | ||
|
||
Using the ThingPulse Spotify Controller you control a Spotify player (phone, browser, etc) from an Espressif ESP32 microcontroller. | ||
Album artwork as well as title and artist name are loaded from the Spotify Web API over WiFi and displayed on a color TFT touch-screen. | ||
The currently playing song can be paused, resumed and skipped to the next or previous song in the playlist. | ||
|
||
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 | ||
|
||
- Artwork download | ||
- Control player on touch screen: play, Pause, next, prev | ||
- Authentication and authorization (OAuth 2.0 flow) on device. | ||
|
||
## Service level promise | ||
|
||
<table><tr><td><img src="https://thingpulse.com/assets/ThingPulse-open-source-community.png" width="150"> | ||
</td><td>This is a ThingPulse <em>community</em> project. See our <a href="https://thingpulse.com/about/open-source-commitment/">open-source commitment declaration</a> for what this means.</td></tr></table> | ||
|
||
## Setup instructions | ||
|
||
### Precondition | ||
|
||
The below instructions assume a properly configured Visual Studio Code installation with PlatformIO. | ||
See our [instructions](https://docs.thingpulse.com/guides/esp32-color-kit-grande/#development-environment) if you need help with this. | ||
|
||
### Get access to the Spotify API | ||
|
||
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" | ||
|
||
<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. | ||
|
||
<img src="./images/SpotifyAppSignUp1.png" width="400"> | ||
|
||
4. At the end of the 3 steps click "Submit" | ||
|
||
<img src="./images/SpotifyppSignUp3.png" width="400"> | ||
|
||
5. Set the unique Client ID and Client Secret as values for the respective variables in `settings.h`. | ||
|
||
<img src="./images/SpotifyCredentials.png" width="400"> | ||
|
||
6. Click on "Edit Settings". Add "http://tp-spotify.local/callback/" to the Redirect URIs section. | ||
|
||
**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/SpotifyAppSettings.png" width="400"> | ||
|
||
7. Don't forget to save your settings. | ||
<img src="./images/SpotifyAppSettingsSave.png" width="400"> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
This directory is intended for project header files. | ||
|
||
A header file is a file containing C declarations and macro definitions | ||
to be shared between several project source files. You request the use of a | ||
header file in your project source file (C, C++, etc) located in `src` folder | ||
by including it, with the C preprocessing directive `#include'. | ||
|
||
```src/main.c | ||
|
||
#include "header.h" | ||
|
||
int main (void) | ||
{ | ||
... | ||
} | ||
``` | ||
|
||
Including a header file produces the same results as copying the header file | ||
into each source file that needs it. Such copying would be time-consuming | ||
and error-prone. With a header file, the related declarations appear | ||
in only one place. If they need to be changed, they can be changed in one | ||
place, and programs that include the header file will automatically use the | ||
new version when next recompiled. The header file eliminates the labor of | ||
finding and changing all the copies as well as the risk that a failure to | ||
find one copy will result in inconsistencies within a program. | ||
|
||
In C, the usual convention is to give header files names that end with `.h'. | ||
It is most portable to use only letters, digits, dashes, and underscores in | ||
header file names, and at most one dot. | ||
|
||
Read more about using header files in official GCC documentation: | ||
|
||
* Include Syntax | ||
* Include Operation | ||
* Once-Only Headers | ||
* Computed Includes | ||
|
||
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
|
||
This directory is intended for project specific (private) libraries. | ||
PlatformIO will compile them to static libraries and link into executable file. | ||
|
||
The source code of each library should be placed in a an own separate directory | ||
("lib/your_library_name/[here are source files]"). | ||
|
||
For example, see a structure of the following two libraries `Foo` and `Bar`: | ||
|
||
|--lib | ||
| | | ||
| |--Bar | ||
| | |--docs | ||
| | |--examples | ||
| | |--src | ||
| | |- Bar.c | ||
| | |- Bar.h | ||
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html | ||
| | | ||
| |--Foo | ||
| | |- Foo.c | ||
| | |- Foo.h | ||
| | | ||
| |- README --> THIS FILE | ||
| | ||
|- platformio.ini | ||
|--src | ||
|- main.c | ||
|
||
and a contents of `src/main.c`: | ||
``` | ||
#include <Foo.h> | ||
#include <Bar.h> | ||
|
||
int main (void) | ||
{ | ||
... | ||
} | ||
|
||
``` | ||
|
||
PlatformIO Library Dependency Finder will find automatically dependent | ||
libraries scanning project source files. | ||
|
||
More information about PlatformIO Library Dependency Finder | ||
- https://docs.platformio.org/page/librarymanager/ldf.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
; PlatformIO Project Configuration File for ThingPulse Color Kit Grande | ||
; | ||
; Documentation: https://docs.thingpulse.com/guides/esp32-color-kit-grande/ | ||
; | ||
; Additional PlatformIO options and examples: https://docs.platformio.org/page/projectconf.html | ||
|
||
[env:thingpulse-color-kit-grande] | ||
platform = espressif32@~6.4.0 | ||
board = esp-wrover-kit | ||
framework = arduino | ||
; Adjust port and speed to your system and its capabilities e.g. "upload_port = COM3" on Windows. | ||
; To list all availble ports you may also run 'pio device list' in the Visual Studio Code terminal window. | ||
; In most cases you should be able to leave this commented out and thus rely on the auto-detect mode. | ||
; upload_port = /dev/tty.wchusbserial54790238451 | ||
; monitor_port = /dev/tty.wchusbserial54790238451 | ||
monitor_speed = 115200 | ||
; For your OS & driver combination you might have to lower this to 921600 or even 460800. | ||
upload_speed = 1500000 | ||
monitor_filters = esp32_exception_decoder, time | ||
build_flags = | ||
; core flags | ||
-DCORE_DEBUG_LEVEL=5 | ||
-DBOARD_HAS_PSRAM | ||
-mfix-esp32-psram-cache-issue | ||
; TFT_eSPI flags | ||
; Below we replicate the flags from TFT_eSPI/User_Setups/Setup21_ILI9488.h. | ||
; You can't mix'n match from their .h and -D here. | ||
-D USER_SETUP_LOADED=1 # 1 => will not load User_Setup.h from TFT_eSPI but rely on the flags defined here | ||
-D ILI9488_DRIVER=1 | ||
-D TFT_MISO=19 | ||
-D TFT_MOSI=18 | ||
-D TFT_SCLK=05 | ||
-D TFT_CS=15 | ||
-D TFT_DC=2 | ||
-D TFT_RST=4 | ||
-D TFT_BL=32 | ||
; As we're using OpenFontRender we don't need any of the TFT_eSPI built-in fonts. | ||
; Font descriptions at TFT_eSPI/User_Setups/Setup21_ILI9488.h | ||
-D LOAD_GLCD=0 | ||
-D LOAD_FONT2=0 | ||
-D LOAD_FONT4=0 | ||
-D LOAD_FONT6=0 | ||
-D LOAD_FONT7=0 | ||
-D LOAD_FONT8=0 | ||
-D LOAD_GFXFF=0 | ||
-D SMOOTH_FONT=1 | ||
-D SPI_FREQUENCY=27000000 | ||
; required if you include OpenFontRender and build on macOS | ||
-I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/** | ||
board_build.partitions = no_ota.csv | ||
board_build.filesystem = littlefs | ||
lib_deps = | ||
arkhipenko/TaskScheduler@~3.7.0 | ||
bodmer/TFT_eSPI@~2.5.30 | ||
bodmer/TJpg_Decoder@~1.0.8 | ||
https://github.com/Bodmer/OpenFontRender#f163cc6 ; no tags or releases to reference :( -> pin to Git revision | ||
bblanchon/ArduinoJson@~6.21.3 | ||
https://github.com/witnessmenow/spotify-api-arduino#899502c ; https://github.com/witnessmenow/spotify-api-arduino/issues/61 |
Oops, something went wrong.