netzstaub

beatz & funkz

Sunday, March 20, 2005

RFSID – play C64 SIDs with an RFID reader

Dividuum, my flat-mate, has built a very cool RFID application. He stores SID-files (SID is the music format for the C64) on RFID tags. When you put such a tag near to the reader, the music is played on the stereo. He got a RFID reader (ID ISC.PR100) which you can connect to your PC through USB, and has written a library in C to control it. The C library has a very simple interface: it searches for the USB device using libusb, and the application using the library can then send vendor requests to the device (vendor requests are “USB ioctls on speed”). The whole functionality of the device can be called using these vendor requests. The C library is used by a Ruby wrapper which has methods for all the commands of the reader. You can read and write the configuration data of the reader, control the LED, write its EEPROM, and, of course, read and write RFID tags, all of this using the OO system of Ruby.

Some RFID tags can store up to 1 kB of data, which is enough to store gzipped SID-files, which are quite small most of the time. In dividuum’s big collection of 29.000+ SID files, about 400 are small enough to fit on the RFID tags. The code for the RFID playing application itself is quite small, and, because of the Ruby wrapper, very clean. The application itself is 113 lines long, and you can get the complete sourcecode from our public subversion repository at svn://bl0rg.net/rfid .

As long as the RFID tag is near the reader, the music is played back. As soon as you remove the RFID tag however, the music stops. A very nice feature is that you can put a stack of tags near the reader, and they will act as a playlist. Remove the playing tag, and the program will play the next SID-File in the stack. Here is a video of the SID player.

At the Entropia meeting, Blueloop quickly put together a RFID detector using a LED, a piezo-speaker and a wire antenna. Here are some movies of the detector. You can hear the RFID reader reading the tag :).

Alt Tag Added during WordPress Conversion

I won’t post a lot of technical details in this post, as the application is best explained by reading the sourcecode :) Believe me, it is very clear and straightforward. I’d like to point out the libusb, which allows you to do crossplatform, userland USB development without much hassle. I used the libusb USB communication code for a few devices, including crypto-communication hardware, a USB analyzer and mobile phones, and it is very nice to have the same code work on most current unix platforms. Check it out at libusb. In order to have a few lines of code in this post though, here is the ruby program dividuum used to test writing to RFID tags:

#!/usr/bin/env ruby
require 'rfid'

text  = ARGV.join(' ') + "\x00"
text += "\x00" * (4 - text.size % 4)

RFID::Device.new(0) do |rfid|
    loop do 
        rfid.readSerials.each do |label|
            if rfid.write(label.snr, text) 
                puts "Wrote to #{label.snrHex}"
            end
        end
    end
end
The first lines combine all the text given on the command line, and pad the data with ’0′ bytes to a 4 byte boundary. In the next line, a new object corresponding to a RFID reader is created using “RFID::Device.new”, and each tag in reach is written with the text given on the command line. “readSerials” returns an array of label objects, and these are written using the rfid method “write”. Very simple indeed. And here is the reading counterpart:
#!/usr/bin/env ruby
require 'rfid'

RFID::Device.new(0) do |rfid|
    loop do 
        rfid.readSerials.each do |label|
            data, blocksRead, blockSize = rfid.read(label.snr, 0, 10)
            puts "Read from #{label.snrHex}: #{data}" if data
        end
    end
end
posted by manuel at 9:22 pm  

33 Comments »

  1. Some more pictures of the RFID device:

    http://bl0rg.net/~dividuum/rfid/

    Comment by dividuum — March 21, 2005 @ 11:32 am

  2. How/where can you get an RFID reader?

    Comment by Jesse Andrews — March 22, 2005 @ 10:33 pm

  3. I’m doing document management at the university this term. The hardware we were given is from Schreiner (it is the usb version rather than the serial version you see in the picture): http://tinyurl.com/4zsyk

    Comment by dividuum — March 22, 2005 @ 11:32 pm

  4. Your site is about to get slashdotted as it appears on http://www.slashdot.com :-).

    Comment by Slashdot — March 23, 2005 @ 1:14 am

  5. and Hackaday :-O

    Comment by Scott Dodson — March 23, 2005 @ 4:56 am

  6. I don’t suppose the collection of 29,000 SID songs has a song called “Skirun” in it? I’ve been looking to find it again for about ten years now…

    Comment by J.G. — March 23, 2005 @ 5:17 am

  7. I think what people want to know is how much these devices sell for.

    We understand you didn’t have to pay for it. But were you able to learn roughly what the price would be? Please say more about that.

    Comment by J D — March 23, 2005 @ 6:24 am

  8. check out digikey for prices. its a TI unit but theres an idea for an eval kit ($700)

    http://www.secureorderprocess.com/ti/products.asp

    Comment by Kyle Fiducia — March 23, 2005 @ 7:28 am

  9. The StarterKit costs 750Eur.

    Comment by dividuum — March 23, 2005 @ 9:07 am

  10. Touchstream Stealth is fabulous.

    Comment by Josh — March 23, 2005 @ 9:19 am

  11. sorry, no skirun :}

    Comment by dividuum — March 23, 2005 @ 9:24 am

  12. Nice… someone else using a dvorak touchstream. Just got mine back from getting it swapped to silver.

    And does noone else use their RFID in their PCs, or is it just me. My IBMs have had RFID in them for aes to track them in and out but also very useful for locating then they need serviced. Now I can crank Moon Patrol tunes through it…

    Comment by Kancept — March 23, 2005 @ 3:01 pm

  13. I think a better question besides how much for a kit is: who knows how to put together an antenna and serial/usb interface?

    Comment by R_S — March 23, 2005 @ 5:42 pm

  14. Hey, this is really great! I’m supposedly a grad student doing work in tangible UI, and so we’ve been doing some stuff with RFID… but this is very nice work. I really liked the playlist interaction idea! How does this work in practice? What’s it like using it?

    And as of course you know, there really isn’t any reason to restrict this application to SID files (although that definitely adds to the coolness factor). All you need is to connect it up to some kind of disambiguator on the back end, and you can have a link into a giant database of mp3s, for example!

    Comment by Michael Saji — March 23, 2005 @ 6:12 pm

  15. Is there a primer for dummies for this hack ?? I would like soem backgrounder info and also a complete tech document if possible.

    This is an amzing hack for RFID’s !!

    Comment by /pd — March 25, 2005 @ 1:14 am

  16. Might make an interesting ap for the visualy impared. Put tags on objects or obstacles in the home and have clothing with sensors built in to let them know where they are or where the objects are.

    Comment by Dave E — April 26, 2005 @ 9:42 am

  17. Really fantastc!
    Not only the bright idea to use the old but still useful sound format of C64, but also the coding and the integration with RFID technolgy.
    By the way I’m plannig to realize a new line of RFID based products, if you are interested we can discuss the project.
    Best Regards

    Marco
    http://www.marcodesalvo.it
    http://www.marcodesalvo.com
    http://templeoftechnology.wordpress.com/

    Comment by MARCO DE SALVO — August 21, 2007 @ 1:48 pm

  18. “My mother said to me, “If you are a soldier, you will become a general. If you are a monk, you will become the Pope.” Instead, I was a painter, and became Picasso.”
    Pablo Picasso.

    Comment by Kirt T. — February 16, 2008 @ 2:29 pm

  19. This is an amzing hack for RFID’s !!

    Comment by sohbet — April 30, 2008 @ 1:34 pm

  20. good!

    Comment by Amway — June 2, 2008 @ 1:10 pm

  21. good!THANKS

    Comment by Moving services — June 2, 2008 @ 1:11 pm

  22. We sell cheap rechargeable laptop battery for most every notebook computer on the market. Since 1996, we have worked with leading laptop battery manufacturers around the world to design, specify, and build high quality laptop batteries. All our laptop batteries must pass stringent quality control tests that ensure they will work with your laptop computer.

    Comment by laptop batteries — September 10, 2008 @ 6:40 am

  23. it really irritating when in between typing on a important mail suddenly the laptop battery starts beeping indicating low battery and unfortunately u dont have a power cord
    Now has not been able to determine that this is really, but hoped that can have this technology. Our battery

    Comment by sony battery — November 8, 2008 @ 8:49 am

  24. Very useful information for me to read. Thanks a lot.

    Comment by estetik — November 14, 2008 @ 12:08 pm

  25. This is really cool. I’m looking into applications for providing auditory experiences for vision-impaired and blind people using RFID tags. My brother, who’s blind, could use something like this for clothes colors, books, etc. The potential is great. Nice work!

    Comment by Peter M — January 6, 2009 @ 8:52 pm

  26. モバイルの出会い!
    http://www.littlediablo.net/
    http://www.ccc-p.com/
    http://www.sit-n-shop.com/
    http://www.loveblue.net/

    Comment by 出会い — January 17, 2009 @ 1:56 pm

  27. Touchstream Stealth is fabulous.

    Comment by gıda — February 17, 2009 @ 4:26 pm

  28. Very useful information for me to read. Thanks a lot.
    Estetik
    Burun Estetiği
    Estetik

    Comment by Estetik — February 25, 2009 @ 11:55 am

  29. Hermarka klima ve kombilerinizin bakımı ve montajı yapılır Klima Tamiri
    Kombi Servisi
    web tasarımı

    Comment by Klima Servisi — February 25, 2009 @ 12:00 pm

  30. karın germe estetiği ve karın germe ameliyatlarında estetik olarak bir takım izlerin kalması çok normal çünkü bilimsel olarak neşter değen her bölgede bir takım izler kalır Karın Germe

    Comment by karın germe — February 25, 2009 @ 12:03 pm

  31. モバイルからのスタート!

    Comment by 出会い — February 27, 2009 @ 5:47 am

  32. Great post. very nice article. Estetik
    Estetik

    Comment by estetik — March 6, 2009 @ 8:03 pm

  33. Hola, soy de México, me encanta el nuevo proyecto, soy súper fan de XTC. Me gustaría saber como puedo conseguir algunos albumes. Lo amo Sr. Partridge!!

    Comment by Estetik — March 17, 2009 @ 4:06 pm

RSS feed for comments on this post.

Leave a comment

Powered by WordPress