Raspberry Pi Pico 2 Spotify Desk Player
Introduction
Raise your hands: how many of you listen to music? Probably quite a few of you just raised your hands. I listen to music too, but have you ever struggled to change the song? It’s a monumental task that requires intense concentration.
…
I might be being a little facetious there. Many of us have a second monitor, pop the player out in picture-in-picture mode, use our phones, or simply use whatever touch controls our headphones provide. I’m sure there are dozens of options.
However, the option I wanted was a touchscreen desk device that displays the current song and lets me choose which song is playing, as well as play, pause, and skip tracks.
So I completely and arbitrarily chose a Raspberry Pi Pico 2 and a ST7796S TFT resistive touchscreen.
Go over how the project started and what it was built with
The Build
Overall Design
I went onto Amazon and picked out a microcontroller and a screen and didn’t do very much research into whether they would work together.
I dove into learning about the board and, with a little help from AI, figured out how to design the program and make it work. The screen I purchased had an ST7796S chip on board, which is a well-documented chip with plenty of tutorials. It has an SPI interface, which makes communication with the Raspberry Pi easy. It also has C++, Arduino, and Python libraries. I settled on Python because I hadn’t done very much with MicroPython and wanted to experiment with it.
I took quite a bit of inspiration from the Pimoroni Presto, which also coincidentally has an RP2350 chip in it. Maybe that’s why my subconscious went straight to the Pico 2 as my microcontroller of choice. I knew that my enclosure would be a bit bulkier and not as… refined as the Presto, but I really wanted to make it myself, so here we are. For some reason, the Pico 2 still uses a micro USB port for data and power, so I also knew I would have to pick up a cheap converter.
The hardware is pretty simple: a cheap Amazon screen, a cheap microcontroller, and a cheap USB-C breakout board. Nice.
Now, onto the hardware issues…
Touchscreen Difficulties and Switch to a Capacitive Touchscreen
Remember how I said I didn’t look into the screen very much? Well, this bad boy comes with a resistive touchscreen. Resistive touchscreens are not good for precise input, and that is definitely not what I needed for this project.
- Resistive touchscreen
- A resistive touchscreen works by sending a voltage across two invisible layers of conductive material. When those layers are pressed together by your finger, they create a voltage divider that allows the screen to determine where it is being pressed.
- Capacitive touchscreen
- This is what most touchscreens use. The screen creates an electrostatic field, and when a finger touches the screen, it acts as a conductor, disrupting the field and allowing the screen to pinpoint where it is being pressed.
Resistive touchscreens are useful in industrial environments. They can be made more robust, making them suitable for demanding applications. They can also be used with gloved or styluses as they do not rely on the human bodies natural capacitance for functionality. The downside? The touch accuracy and responsiveness SUCKS, and because the top layer must bend, they are often plastic screens. For obvious reasons, a resistive touch screen was not the optimal solution for this project.
So I did some actual research and settled on literally the exact same thing except for a capacitive screen and a different touch IC. This did make using it as a drop in replacement very easy. I had to shuffle some of the touch screen pins around as the capacitive chip also communicated with SPI, and I just decided to use a different spi bus as the pico has 2.
Lets talk about the program now.
The Program
The programming wasn’t too bad, I did need some help from AI, but overall, it got working pretty well. It uses the spotify API to get the currently playing song’s details and status. A companion program runs on the users computer to process the thumbnail using pillow. I dont like this.
Go over the structure of the program and how everything communicates
Chassis Design
Conclusion and links