That's a Spicy Meatball!
RFID Record Player

This is a side-project that I’ve been working on for a while.

Like most people, I have a large collection of digital music, which is awesome, but sometimes I miss the process of physically choosing an album. Also, when you have friends over, it’s a little weird to hand them a laptop and say “Pick an album!”. When you have thousands of artists to choose from, the paradox of choice kicks in and it’s a bit like asking them to pick a 401k plan.

This is an early prototype of it working in action:


The small vinyl records are Christmas ornaments that I embedded RFID tags into and then pasted their album art that I downloaded from discogs and had printed on quality photo paper at a print shop. The record player is simply a photo of a record player I found on Flickr with an RFID reader underneath.

Assembling a record

I start with a Christmas ornament of a vinyl record.


Then I peel off it’s label and clip the string and plastic loop.


This is a disc RFID tag.


I stick the disc RFID onto the album.


Then I place the album art on top of the RFID.


Hardware

The components are a RedBee RFID reader with XBee wireless modules, a wireless router running DD-WRT, and a Popcorn Hour A-100.


The RedBee RFID reader reads the RFID tag and wirelessly transmits it to the XBee module attached via USB to my wireless router, which then replays the RFID tag to my Popcorn Hour, which finally selects the corresponding album and plays it.

Software

Asus RT-N16

The XBee wireless module is attached to the router via USB. I’ve flashed the router with DD-WRT, which includes an implementation of the FTDI Virtual COM Port drivers.

Thus, we just need to read from the virtual COM Port and send the RFID tag to the Popcorn Hour via netcat:

cat /dev/usb/tts/0 | nc 192.168.1.135 3333

Popcorn Hour A-100

Starting from a stock Popcorn Hour, I modified it to allow telnet access and then used the NMT Community Software Installer to install mpd.1

I found mpd when researching mp3 player daemons that could be accessed via the command line. It’s an amazing project that’s worth checking out if you’re interested in running a music server. They have free clients available for almost every platform, including iPhone and Mac OS X.

The Popcorn Hour reads data from the router via netcat and then passes the RFID tag to our play.php script.2

nc -l -p 3333 | while read x ; do /mnt/syb8634/server/php /opt/sybhttpd/localhost.drives/HARD_DISK/RFID/play.php "$x" ; done

And play.php simply does an array lookup against the RFID -> Artist/Album hash and launches mpc, the command-line client for mpd. It also checks if the RFID tag it just read is the same as the one currently playing.

<?php

    $albums = array(
        '128 208 4 44 154'      =>  array('A Tribe Called Quest', 'The Anthology'),
        '128 208 248 94 105'    =>  array('Broken Bells', 'Broken Bells'),
        // etc...
    );

    $line = $argv[1];
    $line = preg_replace("/>?T:NACK /", "", $line);
    $line = trim($line);

    // Sometimes the RFID reader likes to send junk data
    if (!preg_match('/[0-9 ]*/is', $line)) {
        exit();
    }

    $currently_playing = '';
    
    if (file_exists('/tmp/currently_playing.txt')) {
        $fp = fopen('/tmp/currently_playing.txt', 'r');
        $currently_playing = fread($fp, filesize('/tmp/currently_playing.txt'));
        fclose($fp);
    }

    if ($line != '' && $line != $currently_playing) {

        if (array_key_exists($line, $albums)) {

            exec('mpc stop');
            exec('mpc clear');
            exec('mpc search artist "' . $albums[$line][0] . '" album "' . $albums[$line][1] . '" | mpc add -');
            exec('mpc play');
            
        }

        $fp = fopen('/tmp/currently_playing.txt', 'w');
        fwrite($fp, $line);
        fclose($fp);
        
    }

?>

That’s pretty much it! When I make new albums, I just transfer them to the Popcorn Hour via SMB, add the corresponding RFID tag to the array, and update the music database.

Cool, how do I make one?

The hardware choices I’ve made here were mostly based on stuff I already had. The Popcorn Hour could easily be replaced by any computer with a sound card that can run mpd and the ftdi drivers, but if you don’t have a spare netbook or PC lying around, the Popcorn Hour seems to be the right price point (especially the refurbished A-110 at $105) for a dedicated RFID mp3 player.

The RedBee RFID reader is slightly more expensive that most RFID readers, but that is because it can use XBee wireless modules. If you don’t need wireless, you can get away with cheaper USB RFID readers.

The only tricky thing to find is probably the Christmas ornaments that look like records. I bought these from Restoration Hardware’s online store a few years ago during an after Christmas sale, but I haven’t been able to find a cheap source for them. If you do, let me know. One alternative that I was thinking of would be to remove the disc inside of 3.5” floppy disks.

If you decide to try making one, please let me know (bertrand@fan.net) how it turns out!


  1. It’s worth noting that the ftdi_usb drivers are also available for the Popcorn Hour, thus you could theoretically bypass the wireless router altogether by attaching the XBee wireless module directly to the Popcorn Hour, but I found the drivers to be too unstable - perhaps due to the memory limitations of the unit.

  2. Why do we have a daemon running in a loop that calls php? PHP daemonizes poorly and leaks memory like a sieve. Why not use a language other than PHP? Well, for one, I work at Flickr and write PHP all day long, so it’s the language I’m most familiar with. When all you have is a hammer, everything looks like a nail. Also, it’s already on the Popcorn Hour, albeit an old CGI version of PHP 4.
  1. xcallmejudasx reblogged this from bertrandom
  2. roararr reblogged this from bertrandom
  3. geekologic reblogged this from bertrandom and added:
    A truly awesome project.
  4. tangyiding reblogged this from bertrandom
  5. thelifeandtimesofglen reblogged this from bertrandom
  6. blakeshall reblogged this from bertrandom and added:
    I want one of these soooo bad.
  7. 734g33k reblogged this from bertrandom
  8. australblackbird reblogged this from bertrandom
  9. amusicbox reblogged this from bertrandom and added:
    build interactive furniture...of you guys come across posts like this,
  10. joshuanguyen reblogged this from bertrandom
  11. hartsell reblogged this from bertrandom and added:
    My coworker Bert made an awesome RFID “record” player.
  12. bertrandom posted this
Blog comments powered by Disqus