Thursday, August 11, 2011

WiFi Wireless Speakers Set

Following the development of the wired speaker project of which I prepared only a demo prototype that included the boards connected externally to a set of computer speakers, I have now ported that project to a wireless version where I replaced the original Ethernet board (the official arduino Ethernet shield) with the Wifly shield from Sparkfun (see below for detailed hardware description). All code is open source and available on

With this setup you can stream files wirelessly from your PC (using the wifly shield from sparkfun) or with a cable (using the official Arduino Ethernet shield) to a set of speakers anywhere you can get a connection to your LAN.

Here's a video showing the operation (as requested, please see more videos and photos of the construction at the bottom of he page):

As a reminder, the original project included the following:

1. server software to stream files to a remote speaker set (originally connected to the network using cables, but now wireless) - this server software is available for download from the google code pages - made with DELPHI, requires VLC 0.8.6 as streaming engine - also available from my google code pages for convenience because it may or may not work with other versions of VLC - note that the software is for PC only - tested on windows 7 and winXP.
Main server Window
2. client software where I can stream files to another PC on the network (also needs VLC on the client computer)

3. Arduino code for both the wired and the wireless version - files are well identified on the google code pages.

4. Extra library for interaction with SD cards at low level but not actually used on the final versions of the project (see description here, download also from the google code pages).

5. The speakers will be auto-detected by the server. You just need to switch them on, start a stream on the server, and the IP of the new speakers will show up on the list automatically.

6. The server supports at least 20 different speakers sets on the network and the selection of which speakers are going to play the stream is done speaker by speaker or by groups of speakers (the server has a configuration area where groups of speakers can be defined).
The manage speakers and groups window on the server.
Hardware you will need: (links below  to not because I particularly endorse them - although I do like them ;-) but because info on their site is plentiful and I did get their mp3 decoder chip and wifly shields:

Arduino Controller Board - tested with the duemilanove, probably works with the UNO, but that needs to be confirmed.

The old version of the mp3 decoder shield from sparkfun. May work with the new one since it uses the same decoder chip, but that needs to be tested.

For the WIRED version, I used the Official Arduino Ethernet Shield.

For the WIRELESS version, I used the Sparkfun Wifly Shield.

As mentioned above, all the code required is available on the pages - including the required version of VLC and the Wifly library version that was used for the project.

Things still not quite right:

1. Improve sound quality. Currently the system allows playback of streams with 32kbps only. Above that the sound is chirping and not good at all. After a lot of tests, I think that perhaps we are limited to that value because of the very modest specs of the hardware used.
2. The server software currently only streams on file at a time, hardly useful if you would like to have the speakers streaming songs ALL DAY LONG!!! Should not require a lot of modifications to have it stream a playlist - code is available, maybe you can do it?

More videos and Photos:
Inside the prototype speakers - The boards are tightly held inside using some foam (also serves as electrical isolation from the speaker surface just below) and compressed slightly by the speaker back cover.

WiFi speakers, completely wireless!! The connections you see between the speakers are for sound signal between the amplifier on one of the speakers and the other one, the sound signal from the decoder board to the amplifier, the power connection between the main speaker and the controller boards I added.
 Thankfully the original speakers had plenty of room to add stuff inside!!

I had to add the filtering capacitor because the main power from the amplifier was extremely noisy and it affected the output too much. You can still hear the noise now, but you really need to be trying. Why that oversized capacitor value? Simple: the only one I had laying around!


Randy Glenn said...


This looks awesome! About the 32kbps thing though - looking over the code, it looks like you transfer a single byte from the Ethernet driver, then write that directly to the MP3 decoder. You might try doing multiple bytes at once - 32 or so, maybe - as switching between the devices is going to take some time.

I would also suggest using direct port manipulation rather than digitalWrite for working with the CS lines - digitalWrite is very, very slow, and that'll drastically reduce your potential throughput.

Very cool project - I think I'll have to build one too!

zodiak aka Rui said...

yeah, the 32 kbps also bothers me ;-)

I actually tried to transfer as many bytes at a time as I could, and actually managed to get to a bit more than 1024. However, it seemed that the decoder chip would play those bytes faster then it would take me to fetch the next set from the network.

I will look into the direct pin manipulation rather then using digitalWrite and eventually use the old code with the 1024 byte transfer at a time.

Thank you for the feedback.

zen said...

Short google search: seems mp3 shield can decode ogg vorbis.
And a vorbis stream at 32k is really ok these days. I mean especially at really low bitrates is where ogg is unbeatable.

zodiak aka Rui said...


Streaming mode is available on the VS1053 for mp3 (which is what I'm using) and WAV, no support for ogg vorbis streaming (although, as you said, the chip can decode ogg vorbis). I think I'm stuck to mp3 for the time being ... ;-)


ups said...

Awesome project. I wanted to do something like this for some time but never got to it.
The hardware seems to be the biggest limitation. A good processor and a fast wifi chip should do the trick but these seem to be hard to find. (Most of the WIFI chips I find use UART at very low rates to communicate with the CPU.)

Keep up the good work. I'm sure you will find a solution.

jack said...

Really great project!
I really don't know much about this topic, but concerning the 32kbps issue, maybe the SPI bus is limiting the bandwidth, as both the ethernet and the mp3 decoder have to share the SPI bus. isn't there an arduino with more than one SPI bus? maybe that would help! cheers!

-D said...


Are u willing to share your server source code?

Cheers -D

zodiak aka Rui said...

server code is open source and available here:

-D said...

Have u managed to make some performance upgrades?

I am currently rebuilding your project but the songs aren't even recognizable and your custom "WiFly Configure" function keeps on failing.


0845 numbers said...
This comment has been removed by a blog administrator.
camac said...

Fantastic project. Ever thought of streamming each channel to a separate speaker so that surround sound could be flexible. I have a family room which is used East-West for watchimg television but NS for parties and SN for normal day to day..

If the channels were separate, they could be switched to the appropriate speaker as required.

Unknown said...

Hi there,
Was just wondering if you could assist me, I have recently tried to develop this project with my son as a fun hobbyist and first coding project with him but have run into some trouble. I purchased a WiFly RN-131C similar to the one you used, but I cannot seem to connect to any networks when running the code.
More so I have tried troubleshooting with SpiUART Terminal, manually the WiFly connects however, when even running the most simplest auto connect code, the WiFly cannot seem to associate to the network specified, this stopping the remaining code from executing.

I have also tried a wired connection, more to the point the port 6000 does not get a connection, however example sketches seem to connect fine!

Any help would be great! I understand it's been a while but your project is of more interest now then ever.


zodiak aka Rui said...

Hi Aaron,

It's been a really long time since I have completed this project. I have not kept up with the technology and namely I do not know nor I have I ever used the wifi shield you mention. Maybe someone else reading these comments can be of assistance?

Good luck with your project and when you sort out your problems, do post some update comment here that may be of help for other users.