March 2, 2009 - 9:20pm

In my spare time I've been teaching myself some electronics.  Although I've written code all my life, I've always had a real fascination with making little eletronic gadgets that through simple automatic actions make your life better, or at least more interesting.  The state of microprocessors is now to the point where you can get whole little computers on cheap chips, and one such example of an open system built on such a microprocessor is the Arduino platform.  Basically the Arduino provides an easy to program base for litttle projects, all using open source hardware and software, and on a standard board that can be had for ~$25, cheaper if you are willing to solder a bit.

My big failings in school have always been that I can't learn something without a practical purpose, so I decided to try to build a way of controlling my Squeezebox using some kind of RFID tags.  My original goal was to have a tray of some sort, where you would plop tags representing artists, and a playlist would be built using that mix of artists.  Sadly, the current generation of hobbiest RFID readers don't support multiple tags, so I had to change things a bit and settle for a single tag representing a playlist, but it still turned out pretty neat.

I'm not the first to think of controlling music with RFID, somebody made a pretty neat player called PlayStand way back in 2002.  But its RFID reader was plugged directly into the PC.  I didn't want a PC in my living room, I wanted the player to be totally self contained, which seemed possible since the Squeezebox was already responsible for playing the MP3s.  All I needed to do was trigger a song to start playing once it saw the tag.  Problem was that my server is in another room and I don't have an ethernet drop in my living room.  There are ways of making Arduinos work with Wifi, but they are all really expensive, so after a bit of looking around I remembered that the Squeezebox itself could act as a bridge.  So the arduino actually connects via ethernet to the Squeezebox, sending commands to a little PHP script I have running on the same server as the SqueezeCenter.  That script provides a management interface to map RFID tags to particular URLs, so after configuring it, when it gets a message that new RFID is in place it triggers a playlist to start.  You could use this same system to perform other actions that can be performed via a script, such as having a coaster both stop the music and post a tweet that you are off to work or somesuch.  But I'm just using it for music.

The RFID reader is the Parralax Serial Reader, which is both expensive and slow. (don't know why I said cheap in the video, it is far from it for $40)  It works reasonably well but has some annoying shortcomings.  As I said, one is that it can only read one tag a time, another is that it tends to queue up the tags in the serial bus, always outputting the current tag in its field at 2400 baud.  Thankfully it also sports an enable pin, so you can just shut the thing down and back up to clear things out reasonably well.  It also seems to sometimes return a garbled tag id, which can cause a bit of havoc because the Arduino will want to treat this as a new tag and post the change to the server.  I currently have it verifying the tag once before going off to the server and that is pretty reliable, but I might up it to three times to be fool proof.

The tags are also from Parallax, 50mm round tags.  This was my original choice as I figured they would have a good range, and they did, but then disaster struck and they just barely didn't fit into the coasters.  I tried switching to the smaller adhesive tags Parallax sells, but they didn't have quite have the range.  I did notice that having the tag butted up against the metal plate in the coasters really cut down on their range, as I did test the 35mm tags first and had them working, but once I stuck them on the coasters they couldn't reach through the wood in the cabinet.  In a fit of desperation I ended up ever so slightly trimming the casing of the original 50mm tags and that did the trick.  RFID tags aren't as cheap as I thought.. I know Parallax tends to charge a ton for their items, but over $2 each was pretty shocking.. oh well, all in the name of science.

When I first started I wasn't sure how the tags and reader were all going to look.  I was originally thinking of building some kind of wooden case for the reader, I wanted it to be something I would use and be attractive.  But after reflecting on how awful looking every little thing I make like that is, I decide maybe it would be cooler to hide it entirely.  I thought that photo coasters would be neat because you could have them printed up custom from any number of sites and have real solid artwork.  But once I looked at the prices for the custom coasters I quickly decided that was a flawed plan, plus I wanted it to be pretty easy to change up the coasters and add new ones so I could keep them up to date with what I was listening to.  So a little bit of browsing later I came across these glass photo coasters from Amazon.  They were cheap, about $2 each, and looked decent, plus I could just print out photos and insert them myself, changing them easily as I wished.  They turned out perfect, although they are a bit delicate when inserting the pictures and the tags needed some trimming. They really do look sharp once the artwork is in. (shout out to my bro Marc for throwing together the art for me)

The project would have been done in an evening if not for being a bit on the bleeding edge with ethernet support on the Arduino.  I first went with the official Arduino ethernet shield.  Shields are just an awesome idea on the Arduino, they are a way of literally plugging in functionality, all while still maintaining the standard digital inputs and outputs.  When I first started playing with the shield I was ecastatic, it worked on the first try and everything was chugging along nicely.  But joy soon turned to frustration when I found that when powered off a wall wart the ethernet shield wouldn't get a link without a hard reset.  Turns out this is a hardware bug in the current revision of the ethernet shield, and I couldn't get any of the workarounds working.  Arr!

Thankfully, the Arduino being the open platform it is, someone else had designed an ethernet shield.  LadyAda at AdaFruit industries, had designed her own ethernet shield which used the same chipset as the official one, so the same libraries would work for it.  Plus it had the added bonus that you got to solder it together.   That let me add my own headers for the RFID reader and pull out the reset pin on the WizNet module so I could restart it from the Arduino.  After putting it together I had a pretty reliable system and put it aside waiting to have the coasters made.

Sadly, when I picked up the project a few weeks later, I found that I couldn't make multiple requests to the server.  The first one would work fine, but on the second request the call to connect to the server wold just hang, never to return.  I went a bit nuts trying different things, building simple example and having the same thing happen.. this worked a couple weeks ago, why was it broken now?  Turns out I had upgraded my version of the Arduino libraries in those two weeks, and a new bug had been introduced making multiple connections hang.  Double arr!  Once I patched up the library and put in a few fail safes and incantations I got a completely reliable system.

The last piece of the puzzle is the server side script itself.  I opted to just throw something together using the web hacking language de riguer, PHP.  The script basically just has three commands:  1) I see a tag, do something   2) Stop the music  and  3) Here's what to do when you see this tag.  The script just writes out the URLs you map to the tags to simple text files, and keeps track of the last tag it has seen in order to make it a bit easier to set up.  All in all it is ugly, but gets the job done, and since you have a server running PHP if you have a squeezebox, it sure seemed like the logical choice.

So if you want to do something like this yourself, it is all pretty easy.  Get yourself an Arduino, the RFID reader and ethernet shield.  You'll need to do a tiny bit of wiring from the ethernet shield to the RFID reader, but apart from that, you are set.  The server side script can be found here and the arduino script right here.  You can contact me at nicpottier at the gmail if you have any questions.

 

Comments

Very cool job! I loved the self-printed coasters, it would be very magical for your guests to use it. I would start building the same only if I could make the whole system automated with RFID: once I enter my room, I place a toaster and my stereo turns on, switches to the correct input, squeezebox starts playing.. Anyways, great job! very impressive.
I'm totally impressed! security
So innovative and so cool. Email Marketing Singapore
Very industrious indeed! hosting
I am impressed as well! Pepper Spray
why not have 3 RFID readers side by side and you can mix and match coasters for a custom playlist.
I expected to see an attack. I was surprised when nothing substantive took place. investment in kent
Another possible idea is that each tag represents an Artist/Album/Song/Playlist/whatever, and when it is detected the corresponding songs are simply added to the playlist. Another tag clears the playlist.
Nice. Hopefully we can manage more with the controllers. Thye help you not to go beyond the limit. So we can keep the capacity optimized too. classifieds |ads|memory foam mattress
read this kind of stuff. The quality of content is fine and the description is good. Thanks for the post as I can study about some electronics from here. Custom Remodelers Minnesota..Insurance
Hello, I've bought these components and built the arduino reader with the ethernet shield from LadyAda. Which pins I need for the RFID module? I cant see it on your picture. I want to put the reader into a turntable and glue the tags under the records.
Nice idea of invention, I really like to use it. online pharmacy no prescription online pharmacy no prescription needed
Thanx very good. very nice post, perfect. http://www.seo-kursu.com
Thank you for sharing a great site you have admin
Thank you for sharing a great site you have admin http://www.baskentsohbet.com http://www.webmizah.com film izle
Great, thanks for providing the script link, I've been looking for it -Montreal Web Design
(play audio CAPTCHA)
Thanx very good. very nice post, perfect. http://www.gevezeler.net mIRC
great! you're so talented I admire your work! ferienwohnungen in rom
Which pins We need for the RFID module? I cant see it on your picture. I want to place the reader into a turntable and epoxy the tag words under the records. brandon from..Life Insurance Quotes..Las Vegas Domestic Violence Lawyer
asdsadasdasd
thanks a lot.. it's very good article. Okey Oyna | Okey | Rottweiler | Tavla
Web page addresses and e-mail addresses turn into links automatically.Thank you
Web page addresses and e-mail addresses turn into links automatically.Thank you porno izletürk porno izle
thanks brother.nice sharing.thanks for admin. Torna Makine Makina Makina Muhendisi
Something has been squeezed out.... Günstige Kredite
türkiyenin resim upload ve resim yükleme adresi tşk. resim upload
Really impressed! Everything is very open and very clear explanation of issues. It contains truly information. Your website is very useful. Thanks for sharing. Looking forward to more! smuckers natural peanut butter
yes everything is well laid out for sure, good job play daily sudoku daily sudoku
the ethernet shield from LadyAda. Which pins We need for the RFID module? I cant see it on your picture. I want to place the reader into a turntable and epoxy the tag words under the records. brandon from..Life Insurance Quotes
You could use this same system to perform other actions that can be performed via a script, such as having a coaster both stop the music and post a tweet that you are off to work or somesuch. But I'm just using it for music.tinggi badan
Nice post! I am thinking about having a try. classified |advertising|select comfort beds
Th4t be an epic da shizzi4 post, th4nkie 4it & in da futures we'll be seeing more of it travel agency We7ll I8be dat9 ogr6e speekie da speekie, gratz & than4x discount cruises heb7e sh8at be th34nkie 4it on da posting left & righ8ty flight center
prada walletscases available[url=http://www.guccibagsale.org/]Gucci handbags[/url]selection of walletsselection of wallets prada walletsall seasons[url=http://www.louisvuittonhandbagsale.com/]louis vuitton handbags[/url]cases availableprada bags accessories discover some our prada wallets[url=http://www.guccibagsale.org/gucci-replica-handbags.html]gucci replica handbags[/url]selection of walletsdiscover some our
gucci bags andcases availableGucci handbags prada wallets messenger bags prada wallets messenger bagslouis vuitton handbagsonline todaydiscover some our prada wallets prada walletsgucci replica handbags messenger bagsonline today
I don't remember how we happened to meet each other. I don't remember who got along with whom first. All I can remember is all of us together...always.Unakite Beads Pandora Beads Wholesale Pandora Beads Crystal Pandora Beads
I have alternative idea that each tag represents an Artist/Album/Song/Playlist/whatever, and when it is detected the corresponding songs are simply added to the playlist. Another tag clears the playlist in car cd player and tape mobil.
bebek maması thanks amn :)
I think this technology is so good to use. I think they are doing an amazing job with this. Keep up the good work. buy tadalafil
I had got a desire to begin my own business, however I did not have enough of money to do that. Thank goodness my fellow proposed to use the home loans. Therefore I took the commercial loan and made real my old dream.
Work banishes those three great evils : boredom , vice, and poverty.Other crazy lace agate Dragon Veins Agate Beads Fire Crackle Agate Beads
I prefer to read this kind of stuff. The quality of content is fine and the description is good. Thanks for the post as I can study about some electronics from here. Custom Remodelers Minnesota

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <p> <br>

More information about formatting options