Hardware Needed :
4x Push Buttons
4x 10k ohm resistor
3x 1k ohm resistor
1x 500k equivalent ohm resistor
1x ipod breakout
References for this 'Ible
arduino forums big thanks to user EASTY, who's code I built off.
Step 1: Hardware
The divider is accomplished in two steps. First tie the Arduino TX (pin1) to a 1k ohm resistor. Second, on the other end of the resistor attach iPod pin 13 (RX) AND two 1k ohm resistors (in series).
The 500k Ohm resistor attached to pin 21 tells the ipod that you will be using a serial communication (see reference ).
Both iPod pins 1 and 11 should be grounded to the arduino. (To the nit pickers, I know the references state different things about pin 11, but grounding it seems to have no effect on this project.)
The rest of the hardware should be pretty straight forward, if you'd like more information on push buttons there is a tutorial on the arduino website .
Step 2: The Ipod Serial Protocol (mode 2)
The iPod can communicate in four different modes, this instructable uses Mode Two: iPod Remote. Other modes include Advance iPod Mode and Voice Recorder Mode. Messages are sent via the arduino's uart, with a baud rate of 19200 . Each message has the same format, and as a result, most Mode Two messages are 7 bytes long.
All messages start with a header that is 2 bytes long. This header is always 0xff, 0x55. Next comes the message length . This value tells the iPod how many more bytes to read. Next comes iPod mode . We always operate in mode 2 so this doesn't change in our code. The next two bytes are the command word. The reference above has a list of all the known command words in detail. The command word can actually be more than 2 bytes, but this software only supports 2 byte commands. Next comes the parameters , these are used in Mode Four only, so this project keeps this value set to 0x00. It is also omitted from the command. Finally, the checksum is calculated for error checking. The checksum is equal to the sum of the length , mode , command and parameters bitwise anded with 0xff (to mask off 8 bits) and subtracted from 0x100.
Step 3: Software
The project loops through each button, following a simple debouncing algorithm based off of this example from the Arduino website. If the button is pushed, the project calls a "sendToPod" command. This command puts together the appropriate message, calculates the checksum and then uses the arduino's Serial.print command to pass commands to the iPod.
Step 4: Expansion
It would also be awesome to add Mode 4 support. Mode 4 commands allow software to ask the iPod for data. This means if an added an LCD could display what was currently being played on the iPod, or an added ethernet sheild could broadcast it to twitter or last.fm.