This instructable is now slightly old and a better machine has been made with lower cost parts and much better software that automatically allows you to "pair" new cards with new tracks as they are added to the iPod playlist.
iPod playback track selection simply by putting RFID "bricks" on a table.
- An iPod Touch controlled by Arduino via the serial protocol intended for use by docking stations and other peripherals.
- RFID (Radio Frequency Identification) cards are embedded in small plastic blocks with album cover art on the face of each block.
- Advanced serial mode is used, giving 2-way communication between Arduino and iPod and ability to select individual tracks by number.
- All built into a small wooden table.
- Place an RFID "block" in the centre of the table and the selected album plays automatically, no conventional controls or menus at all.
I was trying to make a music player for a disabled child who is unable to load and operate a CD player or negotiate the small buttons and menus of mp3 players. Original plan was to make a basic big-button mp3 player with just forward/back buttons and maybe 100 songs on it. I then found this website by David Findlay which documents his experiments in acquiring control of an iPod via its serial connection: http://davidfindlay.org/weblog/files/tag-ipod.php
Before going further I must say David has helped me a lot with this, completely rewriting the code after seeing my clumsy attempts at merging RFID reader code with his Advanced Remote serial code.
There are several serial protocols which the iPod can understand. The big advantage of the "Advanced" mode is that instead of just giving you virtual forward/back, volume buttons and so on, it allows you to select tracks from a playlist by their number.
- Therefore the Arduino can select the first track on an album and the playlist will start playing from that point onwards.
- Therefore I can use an RFID card, one for each album in the iPod playlist, to "tell" the iPod the track number to start playing from.
- Therefore it should work, so I had a go at building it.
Who might use it?
The child I made it for has it playing all day long, so it has been a big success. It might also benefit anyone with impaired vision, hand tremor, poor dexterity, the old and also the very young. The RFID blocks could even have Braille titles on them potentially. Also good for total technophobes I suppose.
1) Arduino Mega (the multiple serial ports are quite handy). Good news is you can use the cheaper one if you like - the 1280
http://arduino.cc/en/Main/ArduinoBoardMega Approx $40 for a Mega 1280 clone
2) Parallax Serial RFID reader. http://www.parallax.com/tabid/768/ProductID/114/Default.aspx $39.99
3) A serial 4 x 20 LCD display (optional), shows you which album is playing. Example: http://www.sparkfun.com/products/9568 $29.95
4) A PodGizmo Breakout board. This is a 30 pin plug for the iPod with solder pads brought out on a board for each pin. http://www.sparkfun.com/products/8295 $14.95
5) Sparkfun logic level converter; Arduino uses 5V for everything, iPod uses 3.3V so this does the conversion for serial communication lines. http://www.sparkfun.com/products/8745 $1.95
6) RFID cards. One for each of your albums (or even one per song if you prefer). Can get them on well known auction site in bulk. Make sure you have correct type - the EM4100 family. About $1 - $1.50 each.
7) I used cheap plastic business card holders to contain each RFID card, album cover label and filler cardboard to convert the RFID cards into small tough "blocks" suitable for small hands. Again available in bulk on well known auction website. Approx $1 for two.
8) A 500kOhm resistor
9) A push to make button (used as Arduino reset button).
10) Power supply for Arduino (Wall-wart). Approx $10.
NOTE: Since above video was made, software has been improved. You can leave the iPod connected all the time, just turn iPod on, turn on the Arduino and it will work.
Step 1: How It Works
How it works
The blue RFID reader has a range of about 4 inches so it has been fixed by 4 small bolts and spacers (cut from plastic tube) to the underside of a sheet of polycarbonate cut into an artistic oval using a jigsaw.
I used a project box which has a lid on the top held by screws which screw down into main box. The polycarbonate oval now forms the new "lid" for this box and 6 screws that came with the project box now hold it to underside of the polycarbonate.
The whole assembly is then self contained and fits into your table / box / cabinet / Star-Trek control panel of choice by simply dropping it down over a hole cut into the top surface. The project box sits in the hole while the polycarbonate is held down with self-tapping screws that go into the wood around the edges.
This makes it easy to take apart to fix any problems.
Step 2: How It Works
Here is an image of the main part of the device with RFID reader located just below surface of the polycarbonate.
Step 3: Introduction
This shows the general idea.
A project box holds the Arduino Mega. A multicore cable comes out and connects to the iPod Touch I am using.
You can see the strange connector at the base of the iPod. This is the PodGizmo breakout board which has a plug one side for the iPod and 30 solder holes on a circuit board the other side. This means you can solder up the wires without needing a microscope.
The Parallax RFID reader is the blue flat object seen fixed to the underside of the open polycarbonate "lid" and the red button is an Arduino reset button which you need to get it talking to the iPod at initial startup.
The table is actually a small cabinet bought as a flat pack item from a really low cost furniture store (since the first thing I did on getting home was cut a hole in the top).
Step 4: Introduction (2)
I have a little tray made from the lid of a small project box which the RFID "bricks" are placed into. This keeps them located exactly above the RFID reader.
A few of the spare "bricks" can also be seen. The RFID reader simply detects the nearest one with the strongest signal. In this application the short range of the reader is actually an advantage.
There is also an LCD display top left which tells you which album is playing and so on.
This is not essential for the device to work however, it just looks nice.
Step 5: About RFID Cards
About RFID cards
RFID cards have a coil of wire in them and a radio transmitter. The reader induces a current in the wire coil which then momentarily powers the radio transmitter. This sends a 10 digit code to the RFID reader (and so to the Arduino). Each card has a unique number.
Therefore the software in the Arduino can work as follows:
"If I see number XXXXXYYYYY on the RFID reader, I must instruct the iPod to start playing track number X in the playlist."
It will do this every time it sees that particular card.
Later on I will show how the numbers are discovered for each card, it is best to just write the number on the back of each one.
Each card represents the first track of each album in the playlist, and the cover art from each CD is put on the front as a label.
Here are a few spare "bricks" on the floor waiting to be chosen next!
Step 6: Creating a Link to the IPod (1)
Creating a link to the iPod (1)
Here is the PodGizmo breakout board.
On the left is a picture of it and on the right I have altered it slightly to make the pin solder holes more obvious.
This plugs into the base of the iPod.
We do not use all 30 wires (phew!) but we do need some for:
a) Serial communication between Arduino and iPod.
b) To carry audio output to our line-out sockets and headphone socket.
c) Pin 21 has to be connected to GND (ground) via a 500kOhm resistor to "tell" the iPod it has been connected to an external device.
The secret is to take each aspect in turn, breaking the task into small chunks.
Step 7: Create a Link to the IPod (2)
Get Sparkfun voltage converter board
The serial data from the Arduino is at 5V, however the iPod does not like this, it operates at 3.3V.
This board from Sparkfun does the job for you, allowing the data to flow but changing the voltages along the way to keep both sides happy.
You can see one side is labelled HV (high voltage, i.e. 5V) and the other LV (low voltage, i.e. 3.3V).
More on this later.
Step 8: Connection to IPod
Connection to iPod
This shows the PodGizmo breakout board with wires soldered to it and plugged into the iPod.
This is designed for experimentation but is not very elegant. They do a smaller one where all the wires will fit into the plug itself, but I cannot get it here in the UK.
Step 9: Create Link to the IPod (3)
How to connect these to the Arduino Mega
OK it had to happen, some circuit diagrams.
This part deals with how the Arduino talks to the iPod via serial connection. Notice how the voltage converter has been used to keep the Arduino side at 5V and the iPod side at 3.3V
Solder it up exactly as shown here. Make sure the voltage converter is not back to front and so on.
Soldering has to be neat here else whole thing will be totally unreliable. I rub the solder holes very slightly with fine emery paper wrapped around a tiny screwdriver first, to make sure the solder takes and flows easily, but that is just my own preference.
*******I SUGGEST USING AN OLDER iPOD for this project as if you make a soldering mistake you could damage your expensive new iPhone for example. I used an ex-demo iPod Touch 2nd generation********
Step 10: How to Connect the RFID Receiver (1)
How to connect the RFID receiver
This has 4 pins on it.
VCC is the one you supply +5V to from the 5V pin on the Mega.
GND is connected to any of the GND pins on the Mega.
/ENABLE is connected to digital pin 2 on the Mega so the Arduino can "enable" the reader to look for new RFID cards at set time intervals.
SOUT is the data output
For wiring diagram see next page
Step 11: How to Connect the RFID Receiver (2)
How to connect the RFID receiver (2):
(Wires for +5V power and GND between Arduino and the RFID reader are not shown in the diagram).
Also shows the LCD and also the Reset button
Reset button brings the "reset" pin to GND when pressed.
SOUT on the RFID reader connects to RX2 on the Mega (one of its serial ports).
The optional LCD display is also shown. This has a +5V supply, a wire to GND, and 2 remaining wires for serial communication to TX1 and RX1 on the Mega.
NOTE: If on first startup nothing happens, switch the RX1 and TX1 wires around as it is incredibly easy to get them mixed up!
Step 12: Box of Electronics
Box of electronics
Here it all is looking rather untidy.
Mega visible on right.
Lower middle is the small voltage converter module.
Top left are two 10K Ohm potentiometers. These adjust the volume to the headphones (one for each channel).
Step 13: Serial LCD Display
Serial LCD display.
Displays album title, then reads name of track currently playing from the iPod and displays it along with name of the artist.
Step 14: How to Get Sound Out of IPod (1)
How to get sound out of the iPod (1)
Photo of the phono sockets for the cable to HiFi amplifier.
OK, we need some sound out of this thing somehow.
The iPod thinks it is connected to an external device via a docking station. Therefore it sends its audio out the "line-out" pins NOT the iPod headphone socket.
The line-out audio is wired up to two phono sockets shown here. A suitable cable with two phono plugs on each end is then used to connect it to a HiFi amplifier if that is what you want to do.
You can connect the line out wires to a headphone socket, and indeed I have run them from these line-out phono sockets to a headphone socket, but it is very loud, hence the presence of the two 10K Ohm potentiometers to adjust each side of the headphone volume.
Step 15: How to Get Sound Out of the IPod (2)
How to get sound out of the iPod (2)
We have a right +ve audio signal (Pin 3 on the PodGizmo) and a left equivalent (Pin 4 on the PodGizmo).
There is also an "Audio Ground" Pin on the PodGizmo which is Pin 2.
The Audio Ground (Pin2) has to be connected to the OUTER ring of each of the phono line-out sockets and also to the outer tab of the headphone socket.
The audio signal R (Pin 3) and L (Pin 4) then connect to the CENTRAL PIN of the R and L Line-out sockets respectively, and then these wires are extended to the inner 2 tabs of the headphone socket.
HOWEVER as they run to the headphone socket we have added a 10K Potentiometer into each one to allow the volume of the R and L sides of the headphones to be adjusted so it is not too loud.
Step 16: How to Get Sound Out of the IPod (3)
How to get sound out of the iPod (3)
Pin 21 !
The legendary Pin 21 of the iPod plug.
This pin is connected to ground via a resistor. The value of this resistor determines what the iPod thinks it is connected to.
If you put a 500kOhm resistor here, it thinks it is connected to a "Dension Ice Link Plus" car interface.
For more info on what all the pinouts do, which vary slighly from model to model of iPod and iPhone, check out the table here:
This is essential as it is what is telling the iPod to connect to the Arduino.
Step 17: Volume Control for Headphones
Volume control for headphones
Poor quality photo of the two 10kOhm potentiometers (variable resistors) seen in previous diagram. They adjust volume to R and L side of the headphones.
Step 18: Assembly (1)
Main box of electronics assembled underneath the polycarbonate oval.
RFID reader can be seen underneath the polycarbonate and the little tray can be seen attached to its upper surface to locate the RFID "bricks."
This could be a dish, a wooden salad bowl or anything you like really so long as the base is narrow so the RFID brick always falls down so it comes to rest directly over the RFID reader.
Red Arduino reset button also can be seen bottom right.
Step 19: Assembly (2)
Whole unit is then dropped carefully into the hole cut into the top of your best living room table or whatever else you have sacrificed to make this.
Step 20: Assembly (3)
Simply screw the polycarbonate oval down to the wood of the table around its edges.
If you used a thin foam gasket it could even be made waterproof against spilt drinks.
Step 21: Make the RFID "Bricks"
Make the RFID "Bricks"
I will cover how you discover the RFID number of each of your cards later, but here I cover how to make each "brick".
The brick is a business card holder designed to hold about 5 business cards. They are rugged and low cost.
Glass blocks would be nice (thinking of the film 2001 now) but pretty expensive.
The number of the RFID card can be seen written on a little attached label, top right.
A photo of the album cover has been pasted into Word using the label formatting option (google it) and printed out as part of a sheet of similar labels.
On the front is the label, then a slab of thick card, then the RFID card on the underside.
The card holder is then closed with a dab of superglue for good measure and you have your "brick."
You may just be able to see on the bottom right of the label, it says Start 396.
This is a reminder when you modify the Arduino code that the first track of this album is actually song number 396 in the enormous single playlist set up on the iPod.
I used iTunes to paste each album into a playlist on the iPod. The end result is that the albums just follow each other in sequence down the playlist. You then just have to make a note of the track number of the first song of each album (I write it on the front of the labels on each brick as shown here).
Step 22: Startup Routine (1)
1) Turn on iPod
2) Connect to Arduino using the PodGizmo plug.
3) Put an RFID "brick" over the RFID reader.
4) Power up the Arduino.
5) It should connect and music should play.
6) Change the RFID "brick" and make sure the track being played changes. Usually the red light on the RFID reader will flash twice (take 2 readings), 10 seconds apart and then the music will change. If that works OK then it is working fine!
1) Turn off the Arduino.
2) Turn off the iPod by pressing the button on top left edge (you can leave it connected at the PodGizmo plug so as not to stress socket by repeated unplugging). NOTE, if you just put it to "sleep" it will continue playing until battery goes flat as it still thinks it is connected to an external device, you need to turn it off properly (hold top left button for about 4 seconds)
At next startup, turn on iPod (takes a moment to get itself going), then turn on Arduino, and iPod should sync with the Arduino automatically as you power the Arduino up.
Step 23: Synchronise With IPod
iPod now thinks it is connected to external device due to the effect of the 500kOhm resistor on pin 21 of PodGizmo breakout board.
Step 24: Setting Up the IPod Playlist (1)
If you put CD's into your computer while iPlayer is running, it will automatically rip them and turn them into mp3 files.
You can highlight a whole album as here and then paste it into the iPod playlist.
You have one single playlist on the iPod, nothing else.
Step 25: Setting Up the IPod Playlist (2)
Here is the section of the playlist that is relevant.
So here, the first track of the album "Singles of the 90's" is "C'est La Vie Always 21" and is track number 2 in the overall playlist.
The first track of the next album (Floorfillers Club Classics) that has been pasted into the playlist is "Lady (hear me tonight)" and this is track number 18 in the overall iPod playlist.
Therefore when the "Floorfillers Club Classics" RFID "brick" is placed in the RFID reader, the Arduino must always tell the iPod to start playing at track 18.
Step 26: Code (1)
There is a section in the Arduino sketch where you have to enter
i) The RFID card code (10 digits/letters)...........(on left)
ii) The album title we want to be linked to that RFID card, two pieces of text allowed for, each up to 20 characters...................(middle)
and also, crucially,
iii) The track number in the overall iPod playlist that represents the first track on that album..............(right)
For "Floorfillers Club Classics" example I used on previous page, this would be track 18.
You can see in the extract from the main sketch below that indeed, the start track for this album has been entered as 18.
Step 27: Code (2)
At the end of the sequence you can see we have several hundred tracks in the playlist and 21 albums (so far).
The comments in the sketch itself show you how to enter your own albums and playlist info into the Arduino sketch using a very simple format.
You need to replace my list completely with your own.
Note that there is no comma after the last item in the list.
Note also that you have to enter the RFID code number for the RFID card you want to be associated for evermore with that particular album.
To get the RFID code for each of your RFID cards you need to do the following (buy 20 at a time online and number them all in one session):
- Power up the Arduino with RFID reader attached.
- Have your computer connected via its USB cable, with the Arduino sketch open.
- Load my example sketch onto the Arduino (It does not matter at this point that my example album list is different to yours).
- Open the Serial view window on your PC/laptop
- Place each RFID tag on the reader and wait, every few seconds the number of the tag will come up on the PC/laptop screen in the serial window, scrolling upwards.
- Write down the number of each RFID tag (easiest is to use a permanent marker or CD labelling pen and write it directly onto the RFID card)
You need to have done this before working on the playlist.
You can then go into the sketch later on and enter the RFID number of the card you want to be associated with an album in your playlist AND you can enter the track number in the playlist of the first song on that album, as in the picture.
There are comments in the Arduino sketch itself to guide you.
Do this for every album.
Don't worry it sounds hard but is very fast when you get the hang of it.
Step 28: Code Attached Here
The Arduino sketch is attached here. Copy it and paste it into a new empty Arduino sketch.
Then compile for your Arduino type and save it.
Written for an Arduino Mega 1280 but should also work on the newer (more expensive) Mega.
Also you need the AdvancedRemote library adding to your Arduino libraries folder, see next page.
Step 29: Arduino Libraries
This project does assume some Arduino experience.
David Findlay has written some libraries which need to be downloaded, unzipped and added to your Arduino libraries folder.
This is a screenshot of part of my Arduino libraries folder, you can see the new folders added, all of which come bundled in the download.
The libraries are available via Github here:
Half way down the page on the right is a "Download" button. Click on it and download the .zip file.
Extract it, select and arrange the "AdvancedRemote" folder in your library as in my picture below.
Also look here for the same download:
Step 30: Reliability
There is a neater version of the PodGizmo plug available in the US, but for now I needed to stop the wires bending around, snapping and the whole connection becoming unreliable.
I used a digital camcorder tape box and a glue gun to glue the back of the white plug into a recess cut into the box with a Dremel + cutting disc. The multicore cable is glued in at the other end so all the solder joints stay fixed rather than mobile.
Not that pretty but it works and will I am sure improve long term reliability.
Step 31: Power Supply
The RFID allegedly uses "a lot of power" when it is actually in "read" mode. Not sure how much this is but since I am supplying the backlight of my LCD display as well as my RFID reader with 5V power from the on-board voltage regulator on the Mega, I thought it would be best to turn the RFID off most of the time, having it "look" for a new RFID reading every 10 seconds instead.
The Arduino runs at 5V and has an on board voltage regulator to keep everything at 5V. It will run with a DC supply of 7-12V. However at 12V it is converting a lot of that to heat, and if I am also consuming a lot of current with my peripherals, that might not be a great idea.
I therefore have used a stabilised (i.e. not a really cheap thrift shop unit) 7V power supply with claimed output of up to 1.5Amps. By using a 7V supply I have enough to keep the Arduino regulator happy without generating masses of unwanted heat.
Step 32: Additional Information / Links.
From time to time I will update this page with additional reading.
For now here is David Findlay's website which inspired me to do this:
Here is the big table of what each pin does in the Apple 30 pin connector, and the variations for each type of iPod and iPhone.
Here is some more information on the Apple Accessory communication protocol
My iPod Touch generation 2 has a quirk that means it will not automatically charge when in an accessory docking port. I think this was fixed in later versions. You can trick it into doing so by using a series of resistors soldered between various pins in the PodGizmo breakout board and all the details are given in the pinouts.ru link above. This is very fiddly however with plenty of scope to make Pod-damaging errors so for now I have left it out of this instructable. Leave well alone unless you are feeling confident.