-
3-6-22 - Linked the NFC scanner to Spotify
03/07/2022 at 03:30 • 0 commentsI had been running into an issue where I was unable to connect to the Spotify Connect device using the Web API. I assumed that it was just a limitation of the spotifyd library, but today I was able to work out that my configuration file was being ignored and as such spotifyd was not authenticating. Manually pointing the service to my config file fixed the authentication and made the player available to the Spotify Web API. This enabled me to rewrite my scripts so that if the SubWOOFer speaker is connected via bluetooth to the Raspberry Pi, then it will play the Spotify output locally. If not, it will default to the currently connected device. And now the Raspberry Pi correctly scans for NFC tags and plays music via the speaker if a known tag is scanned!
Now that the software is almost finished, I need to start thinking about the hardware. First I'll need to hookup the arm of the record player to a makeshift GPIO switch so that I can play/pause the record when the arm is put into place. Then I'll need to make some holes in the plastic shell so that the power cable can go through. Lastly I'll need to put it all together and make some mini record art to put on the tiny plastic records that came with the kit. Should be fun!
-
2-4-22 - Connecting to the SubWOOFer
02/05/2022 at 00:02 • 0 commentsSo I've finally got my hands on a working SubWOOFer which is another Rolling Press Mini Kit that is basically just a dog-shaped Bluetooth speaker and a small book. Can't say I'd recommend anyone else purchasing one for themselves, the quality of the two that I purchased was terrible. The first one came with the plastic volume buttons broken and its replacement (from a different storefront) had a completely broken on/off switch that I had to resolder! But it is adorable and that's what matters.
Using Spotifyd and following this tutorial, I was able to turn the Raspberry Pi Zero W 2 into a Spotify Connect player. Then I followed this tutorial to get the SubWOOFer paired and usable as a Bluetooth audio device. Everything worked like a charm, though I did run into some problems when I accidentally set up the Spotifyd service as a system service rather than a user service.
With that all sorted, the Raspberry Pi is now a functional Spotify player. Now I need to update my program to detect if the speaker is available for connection via Bluetooth and play using the local device if so, or otherwise play through a device specified in the config. That way I can easily control whether the audio is played through the dog or another device (in this case my house's speakers) by turning the dog off or on.
One last feature I was considering was using the tiny plastic tonearm as a playback controller. So placing the tonearm on the record would start the music and removing it would pause it. This might be possible if I wire in some switch to the internal base of the tonearm, but I'd have to design my own contact switch and figure out how to wire that up to the GPIO pins. This feels like it'd be a nice touch, but I'm not holding myself to it just yet.
-
1-17-22 - Spotify API
01/18/2022 at 05:04 • 0 commentsWas able to start messing with the Spotify API today by following this tutorial on grabbing the refresh token. The API seems pretty simple, though it took me some time figuring out how to work node's https library now that request is deprecated. Didn't get a chance yet to mess with the set playback endpoints, but it was super cool being able to see what music I was listening to on my personal account through the API. Fun fact: if you try and use the "/v1/me/player/currently-playing" endpoint while the user is in a private listening session, you'll receive a 204 status response which is pretty neat.
-
1-15-22 - Got the NFC reader hooked up
01/16/2022 at 00:24 • 0 commentsSo far, I've been able to open up the turntable kit and use wire clippers to strip out all of the internal components and excess plastic. Now the Raspberry Pi Zero W fits snuggly within the enclosure along with the PN532 NFC reader.
Finally got around to messing with the NFC reader and trying to interface it with the Raspberry Pi. Thanks to this fantastic blog post I was able to get it working in only a few minutes! Looks like the range of this chip (which is most likely a knockoff) is about 1.5 inches which is more than enough, since the "records" will be laying on top of the enclosure. Speaking of, the plastic enclosure doesn't seem to stifle the connection at all which is great. You can see a video of it in action here.