This is building on top of the previous post on the journey to how to get Spotify into my car, you can find the prototype here.
So after a few extremely fruitful evenings, this is the end result of the ZSUN Wifi card reader currently running my Spotify playlist in my car. There's still a bit of manual labour involved in getting my music into the car but this is quite a start. It saves me from remembering to take the music stick out of the car and I can add in music from wherever I've got the Inr'net.
First things first - WIFI
My router is running happily on the third floor. Eir(com)'s devices are not the greatest but they do the job pretty well in spreading the signal across the apartment. Thing is, a wifi signal looks kind of like a disc or a flattened egg.. which is not bad when you're on the same level, but not so great if you want to get a signal below the floor, say outside where your car would normally be parked.
This calls for drastic measures - meaning - a repeater in the window with the antenna pointed at the usual parking spot.
So how does this actually work?
The current solution is made up of two parts that don't really communicate with each other as of yet.
The first part is getting the Spotify playlist through the developer API to check out what's good in the list. It then does two things:
- Downloads the song into a folder on the laptop
- Removes extra songs from that folder that are not on the playlist any more. This helps when I'm fed up of listening to the first few songs which always get played before you'd normally press the shuffle button or continue on to the newer ones
The other side of the equation is where the fun is. The little USB device has been hacked and it now runs a version of OpenWRT tailored for the chip on the ZSUN reader. In short, it now thinks it's a fancy router with an extra piece of tech that mounts the SD card reader onto the filesystem. Here's another glitch to the installed chip. Its specification requires it to only be able to mount the SD card to the USB directly. Therefore, it takes a while before the songs start playing.
OpenWRT needs to mount the SD Card to the internal system so that it can put read and write files to it. Then it checks if there are new songs on the VM or if there are any it should delete. Only then after it downloads the songs it can eventually shoot out a GPIO signal to the SD Card and tell it that it's time to turn around and say hello to the USB. That's when the radio would normally pick it up. In my experience it hasn't been too long. It's normally about a minute or two before the ZSUN either gets something new or decides the wifi does not want to cooperate and just shoots the thumbs up signal to make itself into a USB memory stick again and play the music. There has been times where the wifi was there but wasn't too great and a single song was trying to download for 15 min without success. In general though, it's been behaving nicely.
What's next then?
So the next step would be to remove a few of the hoops in-between. It would be great if the device could get the songs directly from Spotify. Unfortunately as of today that cannot be done since Spotify is getting strict on it's encoding. The next logical thing therefore would be to remove the laptop from the equation. The USB stick being a tiny sort of IoT device, is fairly limited. There's 16MB of internal storage that needs to be shared with the system which takes about half of that, and extra packages to play with. I learnt to get only the very essential packages and even then, some of the good stuff is not actually available for this device so you have to hack your way through with what you have. Keeping that in mind, some kind of server is necessary for this plan to work. It will continue be the powerhouse that holds and downloads the music and lists out the two lists of songs to the ZSUN to download or delete. Fun times are coming.