Arduino comunication to iPhone using PodBreakOut v1.5
A brief Introduction about iPhone/pod/pad connector and how to interface it with Arduino using a podBreakOut board (we are using the v1.5)
1 Arduino
1 PodBreakout 1.5
5 res 10 Kohm
1 res 68 Kohm
1 res 1 Kohm
4 pushbuttons
1 proto shield (optional)
Apple iPod, iPhone (2g, 3g), iPad Dock Device Pinning
(from: Pinouts.ru)

Here's the pinning of any pin of the socket. Some of them change the way the device interface with another device by the value of the resistor connected to the pin (This concept is quite important to understand the aim of the lesson).
| Pin | Signal | Description |
| 1 | GND | Ground (-), internally connected with Pin 2 on iPod motherboard |
| 2 | GND | Audio & Video ground (-), internally connected with Pin 1 on iPod motherboard |
| 3 | Right | Line Out - R (+) (Audio output, right channel) |
| 4 | Left | Line Out - L(+) (Audio output, left channel) |
| 5 | Right In | Line In - R (+) |
| 6 | Left In | Line In - L (+) |
| 8 | Video Out | Composite video output (only when slideshow active on iPod Photo) or Component Video Pb |
| 9 | S-Video Chrominance output | for iPod Color, Photo only or Component Video Y |
| 10 | S-Video Luminance output | for iPod Color, Photo only or Component Video Pr |
| 11 | AUDIO_SW | If connected to GND the iPhone sends audio signals through pin 3-4, otherwise it uses onboard speaker. |
| 12 | Tx | ipod sending line, Serial TxD |
| 13 | Rx | ipod receiving line, Serial RxD |
| 14 | RSVD | Reserved |
| 15 | GND | Ground (-), internally connected with pin 16 on iPod motherboard |
| 16 | GND | USB GND (-), internally connected with pin 15 on iPod motherboard |
| 17 | RSVD | Reserved |
| 18 | 3.3V | 3.3V Power (+) Stepped up to provide +5 VDC to USB on iPod Camera Connector. If iPod is put to sleep while Camera Connector is present, +5 VDC at this pin slowly drains back to 0 VDC. |
| 19,20 | +12V | Firewire Power 12 VDC (+) |
| 21 | Accessory Indicator/Serial enable | Different resistances indicate accessory type: 6.8 kΩ - Serial port mode. Pin 11-13 are TTL level. Requires MAX232 chip to convert to RS232 levels. |
| 22 | TPA (-) | FireWire Data TPA (-) |
| 23 | 5 VDC (+) | USB Power 5 VDC (+) |
| 24 | TPA (+) | FireWire Data TPA (+) |
| 25 | Data (-) | USB Data (-) |
| 26 | TPB (-) | FireWire Data TPB (-) |
| 27 | Data (+) | USB Data (+) iPod 5G can also be forced to charge by attaching the data + and the data - pins to the 5v via a 10k Ohm resistor ( BOTH PINS) and connecting pin 16 to the 5v (ground). (Confirmed working with iPod 5G 20GB). This provides 500mA of current for charging. For quicker charing, up to 1A, see below. To charge an iPhone, 3G, 3GS, 4 / iPod Touch, 2nd gen, 3rd, 4th or Ipod Classic (6th Gen), usb data- (25) should be at 2.8v, usb data+(27) should be at 2.0v. This can be done with a few simple resistors: 33k to +5v (23) and 22k to gnd(16) to obtain 2v and 33k to +5v and 47k to gnd to obtain 2.8v. This is a notification to the iphone that it is connected to the external charger and may drain amps from the usb. To charge iPod Nano pins 25 and 27 should be tied together and then connected to a 10K ohm resistor, and the other side of this resistors then needs to be connected to 5v power. It's also possible to charge the iPod's or iPhone's battery to make use the of internal +3.3v output (18) terminal to connect the USB Data + (27) thru a 47k ohms resistor and the USB Data- (25) thru a 47k resistor to the USB Power source +5v (23). This way the USB function is still useable for normal operations and makes it easier the fit in a plug. The resistors are not to critical 2x 150k's still work. |
| 28 | TPB (+) | FireWire Data TPB (+) |
| 29,30 | GND | FireWire Ground (-) |
How do the iPhone recognize a certain device?
In this lesson we want to make the iPhone sending audio through line-out without any messages. To accomplish this we'll have to solder several pin of the PodBreakOut v1.5 to the Arduino (we used a protoshield and we strongly advice it for your convenience). You can donwnload the Fritzing project (with the PodBreakOut v1.5 module) by clicking here.
Solder:
pin 11 from PodBreakOut to GND: This for sendig audio out (through pins 3 and 4)
pin 12 from PodBreakOut to Arduino RX
pin 13 from PodBreakOut toArduino TX, througha 1 Kohm (we found this instruction here)
pin 16 from PodBreakOut to GND
pin 21 from PodBreakOut to 5V through a 68 Kohm (in the attached pic we show you how we used a 100 Kohm trimmer to set the required resistance manually)
pin 23 from PodBreakOut to 5V
pin 25 e 27 from PodBreakOut to 5V through a 10 Khom resistor.

Made with Friting.org
Testing Comunication between Arduino and iPhone
This explanation is based on some of the wonderful material David Finlay is sharing on its blog, and expecially here. iPodSerial Library is hosted on David's github. We have put a copy of the libraries we are using as attachment to this lesson: iPodSerial and Bounce.
Install both libraries and upload the code to the Arduino-
Important: Arduino won't upload if pin 0 and 1 are still connected to the breakout board. We advice you to find a way to plug and unplug those two pins (we used two female jumpers).
// Simple example of using iPodSerial library to send
// Simple Remote Play command on the press of a button.
// This will alternate between Play and Pause on the iPod.
//
// Uses the Arduino Bounce library for debouncing.
// You can get this from
//http://arduino.cc/playground/code/Bounce
//
#include <SimpleRemote.h>
#include <Bounce.h>
const byte PLAYPAUSE_PIN = 2;
const byte NEXT_PIN = 3;
const byte PREV_PIN = 4;
const byte TSHUFFLE_PIN = 5;
const unsigned long DEBOUNCE_MS = 20;
Bounce play(PLAYPAUSE_PIN, DEBOUNCE_MS);
Bounce next(NEXT_PIN, DEBOUNCE_MS);
Bounce prev(PREV_PIN, DEBOUNCE_MS);
Bounce tshuf(TSHUFFLE_PIN, DEBOUNCE_MS);
SimpleRemote simpleRemote;
void setup()
{
pinMode(PLAYPAUSE_PIN, INPUT);
pinMode(NEXT_PIN, INPUT);
pinMode(PREV_PIN, INPUT);
// enable pull-up
digitalWrite(PLAYPAUSE_PIN, HIGH);
digitalWrite(NEXT_PIN, HIGH);
digitalWrite(PREV_PIN, HIGH);
digitalWrite(TSHUFFLE_PIN, HIGH);
simpleRemote.setup();
}
void loop()
{
simpleRemote.loop();
if (play.update())
{
if (play.read() == LOW)
{
// prod the iPod in case it went to sleep since we last talked to it
// (after which older iPods will stop responding to us otherwise)
simpleRemote.sendiPodOn();
delay(50);
simpleRemote.sendButtonReleased();
simpleRemote.sendPlay();
}
else
{
simpleRemote.sendButtonReleased();
}
}
if (next.update())
{
if (next.read() == LOW)
{
// prod the iPod in case it went to sleep since we last talked to it
// (after which older iPods will stop responding to us otherwise)
simpleRemote.sendiPodOn();
delay(50);
simpleRemote.sendButtonReleased();
simpleRemote.sendSkipForward();
}
else
{
simpleRemote.sendButtonReleased();
}
}
if (prev.update())
{
if (prev.read() == LOW)
{
// prod the iPod in case it went to sleep since we last talked to it
// (after which older iPods will stop responding to us otherwise)
simpleRemote.sendiPodOn();
delay(50);
simpleRemote.sendButtonReleased();
simpleRemote.sendSkipBackward();
}
else
{
simpleRemote.sendButtonReleased();
}
}
if (tshuf.update())
{
if (tshuf.read() == LOW)
{
// prod the iPod in case it went to sleep since we last talked to it
// (after which older iPods will stop responding to us otherwise)
simpleRemote.sendiPodOn();
delay(50);
simpleRemote.sendButtonReleased();
simpleRemote.sendToggleShuffle();
}
else
{
simpleRemote.sendButtonReleased();
}
}
}
by pressing buttons 2, 3, 4, 5we should be able to control a playlist of our iPhone / iPod / iPad.

Comments