Ble Spotify Controller - Unleash The Beat!

Photo of vin-vout-io

Made by vin-vout-io / Music / IoT

About the project

Tired of reaching for your device every time you want to change a song or adjust the volume? Say hello to this ESP32-powered Spotify remote

Project info

Difficulty: Easy

Platforms: ArduinoEspressif

Estimated time: 1 hour

License: GNU General Public License, version 3 or later (GPL3+)

Items used in this project

Hardware components

keypad Matrix keypad Matrix x 1
Espressif ESP32 Espressif ESP32 x 1

Software apps and online services

Arduino IDE Arduino IDE

Story

I have an exciting project to share, a Spotify controller using an ESP32

With this Nifty device, you will be able to control your Spotify playlist from a distance wirelessly.

Let's have a quick overview of our project, we'll be using an esp32

which is a powerful microcontroller and will be using a matrix keypad

1 / 2

which we have built ourselves on a breadboard, so if you want to make one you can go check out my video on this.

Features

The esp32 uses its BLE (Bluetooth Low Energy) to act like a BLE keyboard here, which will send out the media controls like the play, pause, next track, previous track, volume controls, and on the desktop you can even go to the Spotify website just by a single press. You can go to some playlists like the liked songs by using your matrix keypad or this Nifty device.

Connections

Now let's connect the component --- we will wire up the Matrix keypad to the esp32 for user interaction if you want you can go check out this video to understand how to make one.

A 9V battery will power esp32 making it portable and wireless.

I know it will waste a lot of power but I could have used this 3.7 volt LiPo battery with the LDO like a mic 5205 but these were not available in my local store, so for now let's adjust with this

About the code

It is time to upload the code, We will be using the Arduino IDE and some libraries such as keypad and ble keyboard to make our esp32 into the Spotify controller.

okay, first we need to download this library from GitHub. Next, open the Arduino IDE and navigate to Include library, then click and add zip library. Now go to the desired folder, and select the esp32 ble keyboard.

1 / 3

Go to the examples, and scroll down to the examples from Custom Library there you can see it.

About the Library

You can find the code below, Go and upload it to your esp32. We use the BLE keyboard, This library is easy to use and it is similar to the keyboard library with more features. Thanks to its creators.

1 / 2

We also have something called the nimble mode. The nimble mode saves a lot of RAM and flash memory just add it using

#define USE_NIMBLE

To make it more presentable let's put all of this in a case

Alright, everything is ready Let's test our Spotify controller, now we'll pair our PC or phone and then we can start playing and controlling our Spotify playlist wirelessly. With the Press of a button, Spotify will open up in a new tab of our browser

You may need to change the code or the keyboard shortcut according to yours, it also has a feature to move to your favorite songs

Wait a minute.

Level it up!!

Put the volume on max.

Here you have a demo

Thanks for reading.

Code

code for esp32

maybe need to change the lines 84 - 93 according to your computer

Credits

Leave your feedback...