RSS
 

Speaky: The DIY Airplay Speaker

27 Aug

hero_wp

I’ve had a Raspberry Pi 2 sitting around my workshop for months now. I knew I had to have one as soon as they were announced (because, reasons), after it was delivered I quickly realized that I didn’t have any immediate need for it. I’m not sure I completely remember why I thought of it, but the other day I googled “Raspberry Pi Airplay” and found this handy article from Make Magazine. Now most of the time finding a well written article on something that I thought I had invented would discourage me from trying a new project (I’m a big fan of trying things I haven’t seen done before). But instead, reading this article inspired me to move away from the nitty-gritty details and think about something else. Design.

The article on Make does a great job of explaining how to setup the hardware and get your Raspberry Pi playing music. But it kind of just ends after that, and much as I love the “rustic” look of a naked Raspberry Pi and speaker wire lying around the house I thought I’d try to class this project up a bit with, (what else?) my 3D printer.

speakers

I started by looking for some USB powered speakers. I figured that the less power cables snaking out of this thing the better in the long run. I wasn’t looking for something too terribly high-end, just something to listen to podcasts on while I get ready for work in the morning. After a little searching, I came across these AmazonBasics USB Powered speakers (which have a pretty favorable review for small computer speakers). I really liked that they’re pretty compact overall and would allow me to print a case for them without having to join multiple parts from my printer. This makes for a cleaner overall look with a lot less post-processing of my printed parts.

Of course I couldn’t just take exactly what Make did and add a case. The article has instructions for installing Raspbian and a lot of other software from scratch. I generally have no problem with this, but for this particular project I was looking for the most turnkey solution I could find, which brought me to a piece of software called Volumio. Volumio lets you play music from external media, web streams, etc all from a nice web based app. Most importantly for me, it also will play music from an iOS device via Airplay and  comes as a nicely packaged, ready to install image for the Raspberry Pi. With the exception of setting up my wifi password, there was almost zero configuration needed.

applepi

I used ApplePi Baker to install the image I downloaded form Volumio and popped the card into my Raspberry Pi. I also hooked the Pi up to my network via Ethernet connection for the first boot. While I did have a wifi dongle attached to the Pi, it needed some configuration and a wifi password added before I could ditch the hardwired network connection. After hooking up USB power to the Pi and waiting about 5 minutes I was able to connect to, and configure my Volumino installation from a web browser. The device will show up on your local network as http://volumio.local by default (although this can be changed later).

wifisettings

Above you can see the wireless network connection dialog. I used this to connect my wifi dongle to my wireless network and was able to reboot and disconnect the wired cable without any issues. After another 5 minute boot up sequence the Volumino server was online and after hooking up my Amazon USB speakers to the Pi I was streaming from my phone over wifi without any issues. Now my only issue was making this little setup not look like a wild bundle of cables.

Screen Shot 2015-08-24 at 10.42.12 PM

I started by modeling all the important hardware I was using in my project. This included the Raspberry Pi, my Amazon Speakers, and all associated plugs. As I set out to make a final model I found it was really handy to have models of the audio and USB cables sticking out of the Pi to really get a good idea of the size enclosure I was going to need.

After I had the hardware blocked out, I started poking around google image search for inspiration. A few searches for vintage radios gave me enough to get started. I worked with the shape of the speakers for the start of the main body of the case, flaring out towards the front also gave the case a bit of a tilt backwards when it’s sat on a table (which I imagine is better for the speakers, angling the sound up into the room and not straight across a table seems like it would work better. But then I’m no audio engineer). It looks cool, so it stays. I also added some fluting to the sides, inspired by some of the 60’s radios I saw in my Google Image research. I made holes in the front of the case just bigger than the grills of the speakers (but not larger than the speaker body), which created a bit of a natural step for the speakers to lean on while inside the case. After that I made a back panel for the case with some slight rounding on the edges and a hole cutout to run the USB cable throughout the back. Finally, I added some standoffs to the back plate to help hold the speakers in place when it is installed.

hero_back

As I rounded the end of the design process, I knew I wanted to use some kind of 3D printed fasteners to hold this thing together, so I also poked around Thingiverse to see what I could remix from there. I like using tbuser’s pin library whenever possible because I find it tends to simplify installations and they’re a very quick print. However, for this project I wanted something that would give me a little more control over the connectors tension, I ended up using nuts and bolts generated with aubenc’s “Poor man’s openscad screw library“. The bolts I chose gave me a fun kind of chunky addition to the back of my otherwise sleek case.

jKNfdJZ-1

Printing these parts was pretty time-consuming, with the main part coming in at around 8×5.5×4 inches it filled most of my print bed, and the print came in at about 13 hours (whew!). In total you’ll need about 225g of filament, and (for me and my bot) this worked out to about 16.5 hours total of printing. I used PLA to avoid some curling issues on large flat prints that you can run into with ABS, but either should work fine.

BoomBox

After all that printing, I now had a big pile of printed parts and it was time to think about installation, despite taking careful measurements before starting this project I did run into a few issues.

unfitspeakers

The first was kind of a big one, I couldn’t fit my speakers into the case! While I had taken great measurements to make sure the openings would hold the speakers in place just so, I hadn’t considered the taper of the back of the case. Thankfully I happened to luck into some good design choices, the case itself has fairly thin walls, which means that they are slightly flexible. I was able to stretch the top and bottom sides of the case just enough to pop the speakers in one at a time. And GOOD NEWS EVERYONE, they won’t be falling out on their own (I totally meant to do that).

cablemess

The second issue I ran into is despite making a space for my Raspberry Pi to fit in between the two speakers I didn’t take into account all the extra cable that come with the speakers (I had made sure to model the connectors, but NOT the cords). These particular desktop speakers (conveniently?) have extra long USB and audio cables for easy installation. In this case, bigger was not better. I was able to bundle all the extra cable and cram it into my poor Raspberry Pi’s previous home, thankfully the Raspberry Pi fits right under the fastener bolt on right side of the speaker. Crisis averted (again, I totally meant to do that).

Now because I was trying to manage about 30 miles of spare cable in the speaker’s case I imagine each installation will be different if and when other people make this project on their own. If you do decide to make this, I recommend getting some foam tape to add to the back plate’s standoffs as needed. Depending on how your cram your spare cables into the void you may need to add some additional padding to keep the speakers nice and tight at the opening of the case. I also ended up adding a 90 degree micro USB cable for power and a 90 degree audio cable adapter to make the installation go slightly smoother. Could I have finished the project without them? Sure, but I had them and it made things easier, so why not?

BoomBox-Home

After cramming all the cables, I ran the USB power cable through the back plate of the case and screwed down the two chunky bolts on the back of the case and was ready for a test! I plugged the power cable into a USB power adapter and plugged it into the wall. After a terrifyingly long 5 minute boot time I heard the Volumio chime through the speakers and I was done. Somehow despite shoving cables into that case like a madman I hadn’t managed to mess up any connections (and I’m pretty happy about that).

Because no project is over really over I have a couple of thoughts for improvements:
While I haven’t had any issues yet, some venting may help with airflow (I would hate if my Pi melted through my pretty case). I also tried hooking up my iPhone/iPad 10,000 mAh battery pack to the Pi and it was able to run the Pi and speakers without any issue. I haven’t done the math yet to see how long it would last on that battery pack, but changing the back plate to accommodate a battery pack and making the whole unit portable could be a very cool addition.

But that is a project for another day, for now I’m going to leave my speaker hooked up in my kitchen so I can listen to Still Untitled: The Adam Savage Project while I get ready for work.

Below you’ll find a bill of materials for the project. Some parts I had lying around already (USB cable and audio adapter) so while the parts I’ve linked on Amazon are not the ones I used they should be close enough to work fine.

Bill of materials:

 
  • develpr

    This is really great. One of the first uses of a 3d printer that has “spoken to me”.

    I’d be really curious to know how well the raspberry pi works long term for playing music. I’ve used various software to have them “act” as airplay devices, but I’ve often found myself having to disconnect/restart the services, etc. I’d LOVE to know if this was something you were able to plug in and not worry about every again, a “it just works” type of device.

    Thanks for sharing 🙂

  • JB_Gator

    Looks great. Considering the startup time it seems like this would be best suited for a more permanent installation as an AC powered speaker set. I’m toying with the idea of making a portable battery operated speaker, but if it is a 5 minute startup time that probably makes this set a no-go. Unless you make sure the battery is always charged so you don’t accidentally turn the set off. Any thoughts of a way to remedy this, Or is boot- oup time faster for you now?

  • Doug Jefferies

    Very Nice, great look.

    How is the audio quality? (I’ve read elsewhere that the Pi’s audio out isn’t that good from the headphone jack).

    If you don’t mind a bit of soldering you could definitely shorten the USB lead (but soldering headphone cable is often tricky).

 


css.php