Musicbox

I love the idea of SONOS, but they're a bit too expensive for the sound they provide, and all we wanted was airplay and Spotify music casting. I figured, "that's probably something I could figure out!" and lo and behold I stumbled upon something called Shairport Sync. It's a reverse-engineered version of Apple's Airplay. That only fulfilled one of my needs, however. I still needed Spotify support, which came in the form of Raspotify, a Spotify Connect service for Raspberry Pi. Neat! Now I just install them, right? Not quite.


The Hardware:

I opted to use a Raspberry Pi Zero W and a Hifiberry Dac+ Zero. The Dac+ is an improved audio solution for the Pi, which has terrible audio quality alone. This became an issue alter, however, and necessitated a different program.


Installation:


Edit 12/9/2020: Shaireport-Sync & Raspotify working! will provide update and instructions soon.


I successfully got Shairport Sync working, and Raspotify. Both are installed through the Linux command line on the headless version of Raspberry Pi OS (formerly Raspbian). This means I have to hunt around for documentation and change the contents of specific files on the Pi using only a keyboard, there's no GUI.


Though both programs ran fine and I could connect to them easily, there wasn't any audio output. (12/9/2020 fixed, will update) This is where the trouble started. I needed to modify a file to point the Pi towards the correct external device (the DAC+ Zero) I tried everything I could, and eventually got it working. There were things that should have worked that didn't for no apparent reason, as is common with projects like this. I finally got a version that worked. Unfortunately, the SD card that stores the Pi's data got corrupted when I pulled the plug without noticing it was powered on. I might try again to get that working, but for now, it's running Pi Musicbox, which theoretically takes both Shairport Sync and Raspotify and merges them into one, with a bunch of extra features. It, unfortunately, suffers from occasional crashes that require me to unplug the device, which risks the SD card getting corrupted. I think this is because it's a bit too much for the weaker Pi Zero W to run smoothly, though when music is streaming it works 99% of the time.


The Build:

Once I had gotten everything put together, I needed a way to house it all. I found a design I thought would work on Thingiverse. It technically did, but it had a huge amount of empty

screenshot of online design software called tinekrcad, with design in various stages of completion

space that I wasn't satisfied with. I went on to design a new case, making use of geometry from the previous model I mentioned and this one, which I used to design proper placement of all the ports and screw holes. I basically used each as a reference to design a case from the ground up, using Tinkercad of all things. I mean hey, if it works! It came out well, with very tight tolerances.


The next thing to tackle was the mixing of two inputs into one output. I was connecting this to a stereo that lacked two inputs. The stereo has a CD carousel connected to it, and I essentially needed to put the Musicbox in between the two. The issue was that if both outputs got enabled at the same time, there was a chance of damage to the stereo amplifier. It would be providing too much power to the stereo, which could potentially cause issues. I needed to build a small circuit to mix the two inputs and split their power, called a mixer. This can be achieved with this design: (source)

It calls for two 10kOhm resistors per channel that reduce the ~2v from each channel to ~1v, allowing the two of them to mix together and return to a ~2v total. This circuit needed to be quite small but also at a weird angle, as the DAC+ Zero pins are located in the middle near one side.


I eventually wound up at design #3, after the first two failed due to incorrect wiring. The small space made shorts and mistakes easy, especially with the unfortunate placement of the DAC+'s audio pins. Notice how I changed the outputs so they'd be opposite from each other-this made wiring quite a bit easier. This managed to fit very well within the case I had already designed, with a couple of holes cut on either side. I figured it was better to not waste the plastic and use what I had already printed. The soldering is not my best work by any means, but it works and I didn't want to mess with it. If it ain't broke, don't fix it!

Here it is in the final form. It's not as pretty as the one I designed to forego the mixer circuit, but it works and it's behind a stereo system anyway. If this was in view I would probably redesign with an extra millimeter or so of clearance and pre-made holes for the second audio jacks.

Note the holes for the audio jacks carved with a hot knife. The CD carouel pplugs into the "input" side and the stereo/amplifier connects to the "outputs" side. only the 3.5mm jack is mixed, the RCA jacks are purely audio from the DAC+ Zero.


Here's a gallery of one that only has RCA outputs (black) and one that has an additional 3.5mm jack for easier connectivity. Neither have mixer circuits.

Take a look on Thingiverse!


38 views0 comments

Related Posts

See All