Wireless music player with TL-WR703N

In my previous post I wrote about using TL-WR703N and testing it as a wireless music player. Now I will try to provide some observations on what was working and what not in both cases.
Honestly I spent disproportionate ammount of time trying to make work the "PulseAudio" approach. That is because it leaves many options open and provides for clean separation between the "sound generator" and the "sound player".
The setup - I was using the TL-WR703N with OpenWrt (trunk)*. Connection was over WiFi, N mode, 40MHz channel. On the other side of the connection is a TL-WDR3600. The server is directly connected to the WDR3600 over gigabit ethernet.

PulseAudio approach:

audio_output { type "pulse" name "PulseAudio remote player" server "pulseaudio" #server name format "44100:16:2" }

I was running mpd on a home server with all the music files on a disk attached to this server. Alternatively I was streaming some internet radios. When listening to radios there was a small ammount of incomming traffic - compressed audio comming from the Internet, while there was a huge ammount of outgoing traffic towards the PA server running on the router. Could not conclusevely establish if it was a wifi overload issue, but the whole system was too unstable for me.

Additionally I tried rtp with pulseaudio. That was a failure. The streams never syncronized correctly.

MPD (mpd-full) with radio

Finally I settled on a simpler design. mpd running on the router being controlled by a computer or a phone (there are good clients for Android and iOS). As the router has some storage (8GB) it can easily be shared via SAMBA in the local network for local files. I even mounted my SAMBA share from the server with a lot of files. The indexing of all files was bringing down the router and the kernel was killing mpd, as a sacrifice :).
At some point I noticed that the router was instable and often restarting. I thought it was power issue, but after changing 3 different power adapters each less no-name that the previous there was inconclusive evidence.
I looked in the logs. When audio was played the kernel was spitting some strange errors. I added a parameter for the usb-audio module - nrpacks=1 which led to no more reboots, for now.
In the code repository I tried to share all the files that are relevant to the project.


As I had already 8GB attached to the router for extroot I decided to share it for uploading music to it as a form of local storage. It is relatively easy to enable Samba and have the unit visible in a local network.

Additionally I decided I want to add some sort of display. So I went the easiest route - grabbed an Arduino Pro Micro clone (Atmega 32u4) and Nokia 5110 display clone (PCD8544 controller) and "quickly" slapped a sketch. Additionallty I spent quite some time writing a bash script that monitors the state of mpd and sends it to the Arduino over the serial interface.

What I learned:

  • After programming the Atmega board will be in some intermediate state where the serial connection will not be available (indicated by blinking RX led). This lasts 5-10 seconds.
  • The library I used - U8glib uses some sort of double buffering that caused me quite a bit of trouble to figure out that it messes up with the timings in my script. Using ready Arduino libraries without understanding how they work can lead to a lot of headscratching.

Most of the important code created for this project is available here:


* Using OpenWrt trunk is a no-no :). You'll have trouble updating or even installing few days later when a new default kernel appears in the trunk and all the packages depend on it. Go for the last stable version instead.

TP-Link TL-WR703N

This router - the 703n is useful for building various DIY gadgets based on OpenWRT with WIFI (or wired) connectivity.

The 703n

I have already used several of those. One was used as a wireless bridge in order to share a network printer. Others were used to test and try wireless music transmission and different scenarios of running Linux, PulseAudio, MPD, RTP.

I have built two audio boxes with this router.

  • (openwrt-pulseaudio) First was OpenWrt (head), PulseAudio server. Sound was sent from my home server via wifi. Player was mpd with pulse configured as output.
  • (openwrt-mpd) Second one was OpenWrt (head), mpd-mini, samba share mounted on the router. Additionally I've added external antenna in order to improve reception.

I am going to test the stability of both systems. So far I have spent some time using the openwrt-pulseaudio system. From time to time, when I start playing music, there is audible crackle noise. After I stop and resume play several times the noise disappears. I still have to investigate where the problem comes from - the USB stack, pulseaudio caching, wifi transmission problems, or the audio output from the USB audio card (C-Media chip)