SqueezePi: Audio output and an enclosure to call my own

Audio Cannibalisation

For this first go at making a usable digital music player, I decided to forego custom analogue audio circuitry and use off-the-shelf stuff and/or cannibalise. In fact, I wound up doing both.

The speakers in my previous post are active (USB powered) so I decided to pull them apart and see if I could reuse anything – lo and behold, there was a neat little amplification circuit with volume control.


I just chopped off the USB plug and spliced the power connections into a 2.1mm socket alongside an adapter cable that connected to the Pi’s micro USB socket – and with a good quality 5v power supply, I was able to successfully power the Pi and the speakers.

The little USB audio dongle was also co-opted into my build, as it was small, cheap and worked well with the Pi – and better than the onboard audio!

So now I had all the main parts ready and working:

  • Raspberry Pi
  • Software: Squeezelite, Jive Lite, pikeyd.
  • Custom control panel.
  • Adafruit TFT touchscreen.
  • Analogue audio output, amplification and reproduction.

Act of Enclosing

I started out with the intention of finding a ready-made housing using something “retro” – an old radio or radio cassette player. Others have done this successfully; but after some initial research I realised I would either have to fork out for a refurbished item from an online seller (not cheap) or spend time grubbing around and hope to get lucky.

My next thought was – why not try 3D printing one? A chance to try out this cool new technology with a project… So I set to with a will, roughed out some ideas on paper based on the Squeezebox Radio (but with two speakers and fewer buttons), picked up the free version of Sketchup and created a box-like structure with suitable holes for speakers, controls, etc. The intention was to export the front and back faces as separately printable parts, and the main body as a hollow “sleeve” into which the electronics would fit.


This seemed like a good idea, until I got further into researching 3D printing – confirmed by feedback from a commercial “on-demand” 3D printing firm. The size of just the front face of my enclosure meant it would be expensive (£60) and risky (likely to distort) to print.

Then I came across laser cutting services – and this looked exactly the thing! At least one of my Raspberry Pi cases had been made with laser cut acrylic, and I also found more designs online for electronics enclosures made from both acrylicplywood and MDF. I found some great tutorials and a local cutting service with starting out advice and templates.

I went back to Sketchup and revised my design, producing a box whose faces fit together using interlocking “crenellation” and a bit of tab-and-slot. No screws or glue needed!


In the pictures above, I’ve also cut out holes for speakers, screen, control panel and speaker surround mounts (cannibalised from the original USB active speakers). The image on the right is a face-on view of the right side, with tabs for connecting the front face and a hole for the 2.1mm power jack in the bottom right.

I decided to follow the advice I’d read on various sites, and prototype the design with the cheapest material – cardboard! I first made a print out on paper of each face to the right size, stuck them onto cardboard and carefully cut them out with a craft knife and put it all together – and it worked! It was a bit fiddly trying to assemble, and I used a bit of selotape, glue and a few internal cardboard strips to help rigidity. That lack of rigidity wouldn’t be a problem for a final acrylic or plywood version.


So as a trial run, I exported the faces as DXF files from Sketchup, brought them into Inkscape and followed Razorlab’s instructions on how to set them up for cutting (using their template sizes and styles). I adjusted my crenellations and tabs to allow a little extra width to account for material lost by the cutting action of the laser (kerfing).

I sent these off and in a week got back the first cut – it went together like a dream! The cardboard was a lot more rigid than my first homemade version (no glue to dampen it), so assembly was easier.


The crenellation technique seemed to work well, and the general sizing and location of holes was accurate enough to facilitate a working mock-up assembly.

I tried several iterations of the front panel over the next few weeks via Razorlab, all still in cardboard – until settling on the design in the earlier Sketchup screenshot.

Then it was time to get real… I put in the order for a black acrylic version, uploaded the design and waited…


All this trial assembly of the components with various cases unfortunately took its toll on a weak point – the wires connecting the speakers to the amp. These were thin, and never designed to be manipulated – so broke very easily. I re-cut and soldered them a few times, then decided replaced them with thicker wires and stronger soldering. However at this point, some of the solder pads on the amp circuit board lifted away from the board and broke off – again, they were never designed for repeated re-soldering.

Adafruit and ModMyPi came to the rescue in the form of the Adafruit TS2012 class D mini amplifier. This was just the ticket – easy to assemble, the right kind of power output and input – and worked like a charm. I just had to solder on the connectors, wire up a new cable to take the output from the USB audio dongle, and splice a connection to the power jack.


The Coming of Acrylic

Shortly after resolving the amplification woes, the acrylic case parts arrived from Razorlab. With nervous excitement, I unpacked it, checked the component fit and tried assembling it…


It wasn’t without some worrying moments:

  • The fit tolerance of the crenellations and slots/tabs was much tighter – because acrylic is obviously less flexible than cardboard. I also think that the laser cutting may have burned away less material, so I probably didn’t need to compensate in my kerfing quite as much. Some careful filing eased the fitting.
  • I’d left screwholes out of my design, assuming I could drill them ok. This turned out to be scary, again because of the rigidity and brittle nature of acrylic. I managed in the end, but did cause some cracking (thankfully covered by one of the speaker surrounds).
  • My lower “springy” tabs on the sides proved too fragile in real use and broke off – fortunately, they also turned out not to be vital.
  • One corner crenellation was also a little too small on the front panel, and also broke off – again not a vital part. To be robust, the minimum dimension for a part probably needs to be 4 mm or higher (this was 3 mm x 6 mm).

If I were to make this again, I would:

  • Allow less for kerfing, or disregard adjusting it altogether. My adjustment was 0.1 mm each side of a tab, so I think I would probably try again with no adjustment.
  • Let the laser cut screw holes where possible – or if they’re too small, get it to etch a mark on the right position.
  • Ensure no feature is smaller than 4 mm.

I then proceeded with final assembly, which was a bit fiddly (small screws, nuts, washers, etc) but pretty much went according to plan.

IMG_20140823_174912 IMG_20140830_121028 IMG_20140830_121041 IMG_20140829_192321

Testing and Bumps in the Road

Next up, some testing in the real world. It worked fine “in the lab”, so I tried it out around the house over a weekend – and it stood up rather well. Sound quality occasionally got a bit boomy and distorted – but adjusting the amp settings resolved this (I’d confused the onboard DIP switch settings as their action turned out to be the reverse of what I expected).

The only way to properly power off the device was to unplug it – this isn’t a good idea with the stock Pi operating system, as it can cause corruption to the SD card. So I did some research and reconfigured it to boot up in read-only mode, writing log and temporary files to a RAM disc.

Somewhere along the line when fiddling around in the internals during testing, I managed to kill the left audio channel. This turned out to be on the amp, so I ordered a replacement from ModMyPi. That arrived promptly, but also turned out to be faulty (DIP switches missing). ModMyPi were brilliant about that and sent me a replacement the very next day.

When the Pi boots up, and when it shuts down, strange noise comes through the analogue audio circuit. This happens when the USB audio dongle is in an uninitialised state (i.e. before the drivers are started, and after they’re shut down). It’s not the end of the world, just a little unpleasant.

Occasionally, the touch screen either doesn’t work after boot up or stops working after a while. I suspect my soldering might be the cause here…

And also occasionally the Pi doesn’t boot up. I haven’t pinned down the exact cause, but experiments suggest it may be related to my custom control board.

What’s Next?

I plan to tackle the following over time:

  • Sort out the bootup/shutdown noise.
  • Improve boot speed and experience – get some sort of boot image on the screen.
  • Sort out the intermittent boot up and touchscreen failures.
  • Improve the custom control board – use better components and a custom PCB.

(c) 2014 Nicholas Tuckett


3 thoughts on “SqueezePi: Audio output and an enclosure to call my own

  1. HI , thanks for posting your project been a big help as i am doing the same. I am having the similar problem as you mentioned “crash when navigating music collections” when you navigate up and down in playlist for no reason it locks up. Comparing your code to the original , i can only see you added a new skin “lcd skin” aswell as start scripts which has been changed , just wondering what you found the problem to be ?
    as i had the original version installed and copied your lcd skin and i still have it locking up although it looks alot better on lcd by the way good work !


Comments are closed.