Network Audio Player / RFID Reader

Marc Boon, May 2008

Abstract

Network Audio Player

The Network Audio Player is a MP3 audio player with ethernet interface, an embedded RFID reader, and a RS-232 serial port. It was designed for a sound installation at Museum De Paviljoens in Almere, The Netherlands, for the exhibition Localisms, which runs from April 12 to October 19, 2008.

The installation is based on the award-winning website soundtransit.nl, which was conceived and developed by Derek Holzer, Sara Kolster and Marc Boon in 2005. This website contains a database of field recordings made by sound artists from all over the world. All content is uploaded by users. For the general audience, the site features an interface which looks like a online flight planner such as used by airlines, to book a sonic journey across the world, generating a MP3 mix of sounds from all locations in the itinerary.

The installation at Museum De Paviljoens is a physical embodiment of the website. It features 8 individual audio stations, each equipped with a Network Audio Player, speakers, and a Kodak Ektapro slide projector. Each station plays a separate playlist of 80 sounds from the soundtransit database, and for each sound, the slide projector displays a slide containing info about the sound, the recording artist, and the location of the recording.
Each station also contains a RFID reader where visitors of the exhibition can swipe a RFID tag which is given to them on entrance to the exhibition. This action adds the currently playing sound to a personal sonic journey, which can later be retrieved from the website as a MP3 mix by entering the unique id number printed on the tag.

How it works

The Network Audio Player is based on a off-the-shelf single board computer (SBC65EC) with ethernet interface from Modtronix, Australia. This SBC is a small (54 x 58.5 mm), but fully functional ethernet device with build-in webserver, a serial interface, and several digital and analog I/O ports, based on the PIC18F6627 microcontroller. It implements DHCP, NetBIOS, and various other internet protocols and can thus be easily accessed from a browser (plug and play). All software delivered with the board is open-source and fully documented (except for the bootloader).

To implement the MP3 audio player and RFID reader functions, I designed a equally sized daughterboard containing extra circuitry which is piggy-backed on the SBC using its expansion headers. The daughterboard contains 2 independent subsystems: a MP3 audio player and a RFID reader. It also contains an extra output, able to switch external circuitry such as a relay, a potentiometer, which could be used as a volume control, and a bicolor LED.
The electronic design and the pcb layout was made using the Eagle layout editor.

To control the added hardware, I wrote extra software modules for the SBC, and modified some of the software provided by Modtronix to suit my needs. All code is written in C and compiled with the free edition of the Microchip C compiler for the PIC18 family of microcontrollers.

For the server side, I wrote a Java application, which acts a a graphical user interface (GUI) for the audio player. This Java application (which can also run as an applet embedded in a HTML page) is stored in the memory of the SBC, and can thus be served by the build-in webserver and run in a browser, or can be downloaded from the SBC to run as a local Java application. The webpages stored on the SBC also contain a HTML interface to change settings such as network parameters, passwords etc.

MP3 player

The MP3 player is based on the VS1011E from VLSI Solution, Finland. This chip is a pre-programmed digital signal processor (DSP) which contains all the circuitry and firmware to decode digital audio files in WAV or MP3 format and can drive stereo headphones or active speakers directly. The DSP is connected to the SBC by 2 serial buses, one for control and one for (audio) data. It can decode MP3 streams with bitrates between 8 and 320 kbit/s.

The bit stream is received from a server over the network by UDP. This is a simple Internet protocol which provides low-overhead transport without verification. It is therefore suited for local networks where speed is more important than reliability, such as in the case of audio streaming. In our case, there is strictly speaking no audio streaming (where the timing is set by the sender), but synchronized file transfer (the timing is set by the receiver).

The MP3 decoder has a bit stream input FIFO, which the SBC has to fill up quickly enough to keep the stream going, but not too fast to overflow it. To synchronize the bit stream, the DREQ pin of the DSP, which signals that there is enough room in the FIFO to receive 32 bytes of audio data, is monitored by the code running on the SBC. When DREQ is high it sends a burst of up to 32 bytes of audio data (depending on availability) to the DSP.
The serial port of the DSP can accept data at a high rate (up to 6 Mbit/s). In my design, I use the second EUSART port of the PIC microcontroller in synchronous mode, since the other serial ports are either in use for other functions or not available on the daughter board connectors. Using a dedicated hardware serial port lowers the software overhead and provides the highest throughput.

The SBC in turn signals the upstream source that more data has to be sent whenever it has room in its software buffers. The audio packets between the SBC and the audio server have a fixed size of 255 bytes, to enable efficient data handling on the 8-bit microcontroller. At the beginning of a file transfer, all software buffers (6 in the current implementation, for a total of 1530 bytes) are filled up before sending any data to the DSP. This pre-buffering prevents buffer underruns at the start of a track, while introducing a minimal latency (of 64 ms at a typical 192 kbit/s bit rate).

The maximum throughput is about 400 kbit/s, which is sufficient to feed the DSP with its maximum MP3 bit rate of 320 kbit/s, but limits the playback capability of uncompressed WAV files to 16-bit mono or 8-bit stereo at 22 kHz sample rate.

RFID reader

The RFID reader is based on the SM125-IC from SonMicro, Turkey. This chip is a pre-programmed CY8C27443 mixed-signal microcontroller (PSoC) from Cypress Semiconductor. The firmware is developed by SonMicro, and implements all functions nescessary to read and write 125 kHz RFID tags. It has independent I2C and UART serial ports and some digital I/O ports to indicate tag presence and reader status. It operates with an external loop antenna composed of a hundred or so (I didn't count them) windings of enameled copper wire (also available from SonMicro). Using this antenna, the reader has a range of about 10 cm.

The RFID reader chip is connected to the SBC by the I2C bus. It's DREADY pin, which switches high when a tag is detected, is connected to a digital I/O port of the SBC, to facilitate low-overhead status polling. When a tag is detected, the code running on the SBC retrieves the unique id of the tag over the I2C bus, which resets the DREADY pin automatically. The RFID reader is fully independent of the SBC and decodes the RFID signal before signalling the SBC. The RESET pin of the reader is also connected to the SBC, to enable sofware controlled power-down and reset of the RFID reader.

The UART port of the reader is not connected to the SBC, but brought out to a pin header to facilitate configuration changes and firmware upgrades of the reader. It is after all, a flash-based microcontroller in itself. SonMicro provides software to access the chip from a PC to perform these functions. Normally this is not needed though, since the part is pre-configured by SonMicro upon request at no extra charge. Options include the use of the serial ports, parity decoded or raw output, and different Manchester encoding formats to facilitate different types of RFID tags. In my application, I use EM4100 type tags embedded in ISO cards.

GUI

The Graphical User Interface is written in Java and can be run as an applet in a browser, or as a standalone application. It can also run as a command line application without a graphical user interface (using the -nogui command line option).

The GUI has a tabbed interface with Playlist, Info, Console, and Options panes. At the bottom of the GUI is a progress bar which displays the relative time and file name of the currently playing track.

The Playlist pane features a scrollable playlist with track number and file name and five buttons for Start/Stop, play mode (Single/Loop/Shuffle), adding files or directories to the playlist, and loading and saving a playlist. Playlist files are in M3U format.
Individual tracks can be removed from the playlist by selecting one or more tracks (using common Ctrl-click, Shift-click and Ctrl-A selection functions) and pressing the Del key.

The Info pane displays track info about the selected file (whether it is playing or not). File format, sample rate, bit rate and duration (inaccurate for variable bit rate files) are extracted from the file header. During playback, the actual bit rate as sent over the network to the audio player is displayed, as well as a buffer indicator displaying the amount of buffers filled at the receiving end.

The Console pane displays a timestamped event log, which is also optionally saved in a file. The log file name can be specified on the command line after the -l option. If omitted, the log file name is the host name (NetBIOS name or IP address) of the audio player, with .log appended, and saved in the user's home directory.

The Options pane has controls for setting the volume of the audioplayer, and several functions of the slide projector, such as brightness, standby mode, and so on.

The Java applet is embedded in the index.htm page which is retrieved from the Audio Player by pointing a browser to its IP address or NetBIOS name. To effectively run the applet in the browser, a Java policy file has to be installed on the local system. Without it, the applet, running in the browser's sandbox, will refuse access to the local file system, so sending audio files will not be possible. The policy file is included in the webpage image file, and can be downloaded and moved to the user's home directory.
Alternatively, the applet can be downloaded from the Audio Player as a jar file and started by invoking the Java interpreter from a command line: java -jar player.jar -h <audio player ip address or netbios name>. In this case, installing the policy file is not required.

Source files

Eagle schematic, layout, and libraries
MPLAB project for firmware
Eclipse Java project for GUI
Webpages to upload to the SBC