Introduction: Simple Ipod Controller

Picture of Simple Ipod Controller

This instructable will help you understand the iPod serial protocol, and how to send commands to an iPod using an Arduino.  This instructable is only meant to show the basics of the protocol and is by no means complete.  I only had enough hardware space for 4 buttons, and the software reflects that.

Hardware Needed :
1x Arduino
4x Push Buttons 
4x 10k ohm resistor
3x 1k ohm resistor
1x 500k equivalent ohm resistor
1x ipod breakout

References for this 'Ible
pinouts.ru
arduino forums    big thanks to user EASTY, who's code I built off.
cornell students
adrian game

Step 1: Hardware

Picture of Hardware

The most important part of this setup is the voltage divider .  The iPod Rx only expects 3.3v, so anything more than that (like the Arduino's 5v TX) could hurt your iPod.  The voltage divider is a safe way to ensure that when the Arduino sends a 5v HIGH, your iPod only gets hit with a 3.3v HIGH.

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)

Picture of The Ipod Serial Protocol (mode 2)

For a more detailed description, see this reference .  For a quick and dirty version, keep reading.  

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

Picture of Software

The software follows a simple flow.  This layout works because we are in operating in Mode 2.  In this case, the Arduino only needs to check for user input (push buttons) and send commands to the iPod.  It is not necessary to receive data from the iPod.  This makes the project much easier.  

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

This project could easily be expanded to support all Mode 2 commands.  One could use more buttons to mimic those found on the iPod.  I think the addition of an infrared remote would be a great 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.

Step 5: Results!

Here's a video showing off the pause/play, then the volume +/-, then skip!


 

Comments

pwalker15 (author)2014-07-20

I know it's been a while since this was discussed, but I'm really having trouble getting this to work (or the version I've created). I must be missing something

I am trying to get my arduino to send vol + and vol - signals to my iphone. I can run the code in debug and it shows in the serial monitor. I can then run it is non-debug and the TX light shows transmission, but nothing happens on the iphone. I've double checked the wiring and am using the ipod breakout mini v3.

How do I move past this problem?

Montiduino (author)2014-01-05

This thing works, Excellent results. The code is fantastic. There are some glitches though and while I am not able to fix this just want your inputs on this.
The code does not work for Skip back or any other serial command where the value is two digit. e.g. 10 for skip back
0x00 0x10 Skip<
0x00 0x20 Next Album
0x00 0x40 Previous Album
0x00 0x80 Stop

Need help on this. Have a project planned around this. Everything else works like a dream.
Also would like to emphasize that the value of the 500K resistor is super critical. Did not realize this until I read somewhere

0928885086 (author)2011-12-25

After I saw your project and I use itouch to test, I have something problem. When itouch connect to podbreak, itouch no sound. But after taking off , itouch have sound normally. Do you know how to use podbreakout charging iPad? not charging all the time. I want use button to turn on/off charging iPad. can you teach me?

astroboy907 (author)2011-12-04

My plan for this (still have not gotten around to building it)
Compact, arduino controlled, ipod awesome SKI GLOVES! :)
We live near mountains so every year we ski a few days and sometimes go on trip. When skiing with friends its fun to listen to music but I have to change the volume a lot (like low for talking to friends and really high to get the adrenaline going) so I plan to make this. Ill use probably just plain wire to get to gloves with a connecter, and somehow work out the switched, but it would be awesome. If or when I build it, Ill post an ible. Still love the simplicity of this. Needs to be featured :)

dan95 (author)2011-11-13

Hey men, nice project, i tried it and voila, i have my own ipod player.
One question, whats the program you used to draw the schematic with the arduino and the protoboard?

allmondjoy87 (author)dan952011-11-14

http://fritzing.org/

iang1 (author)2011-09-25

Thanks for the project! Is it possible to control 2 ipods with this? I tried adding a NewSoftSerial port but it didn't seem to work.

allmondjoy87 (author)iang12011-09-25

Never tried it with the NewSoftSerial... I know the old one had a baud rate limit of 9600... Could it be a baud rate issue with the new one? Some research online shows NewSoftSerial should be able to handle bauds up to 115.2k reliably.

Build_it_Bob (author)2011-03-26

Awesome project! Code is way above my level, but it sure is neat to try and follow. Great work ! Thanks for the share!
Build_it_Bob

astroboy907 (author)2011-02-14

Dang it I knew I shoulda got a podbreakout when I placed my order. Ah well, I have an iHome connector that should have all the pins I need. This is actually just what I was looking for!

allmondjoy87 (author)astroboy9072011-02-17

just uploaded much cleaner, more understandable code (imo). Instead of using buttons for input, it uses your serial port on the computer. Keep the circuit the same, just send chars a->u at baud rate 19200 to your arduino from your comp and you can now use every single command.

About This Instructable

17,753views

28favorites

License:

More by allmondjoy87:Arduino Projects on a breadboard (no serial com)Simple Ipod Controller
Add instructable to: