Serial Port
From wikiPodLinux
The 3rd generation iPod introduced a new headphone and remote connector, this connector seen below carries both the audio data and remote control data to the iPod. The remote control data is sent via a serial protocol (see Apple Accessory Protocol).
Table of contents |
3rd Generation iPod Pin-Out
Wire Color | Pin/Connector | Purpose |
---|---|---|
black | tip | Left Audio |
white | ring 1 | Right Audio |
red | ring 2 | Audio Ground |
sleeve | composite out (g4) | |
green | pin 1 | Serial RxD |
blue | pin 4 | 3.3V |
yellow | pin 3 | Serial GND |
pin 2 | Serial TxD |
Note, these serial lines run at TTL levels and not standard RS232 levels. Do NOT connect these lines directly to your PC!
Building a Connector
To create a serial connector you could simply use an existing remote cable (although note that the serial RxD line is not connected on the standard Apple cable). Alternatively you could use one of the following techniques.
Two row header pins
Snap off a 2-row-2-column 'square' from two-row header pins and bend in the pins slightly.
ISA board pins
Or you can cut two connectors from a ISA board. See [1] (http://www.minimanga.com/~vcarriere/ipod/)
(Note: The "header pins" on this connector is for connecting the RS232 to TTL converter, it is the other end that goes into the iPod. ;-) )
RS232 to TTL
Once you have the physical connector you need to convert the TTL levels to standard RS232 levels.
If you use the MAX3232E chip (http://pdfserv.maxim-ic.com/en/ds/MAX3222E-MAX3246E.pdf) there is a schematic on the top of page 17.
You need 5 0.1uF capacitors and the chip.
MAX232
Here is an alternative solution that takes its power from RS232 instead of the iPod:
Premade Cables
There are premade cables available, these should also work with the iPod.
- RS232 to TTL Interface Cable (http://www.avitresearch.co.uk/rs232_to_ttl.htm)
- USB to TTL Interface Cable (http://www.avitresearch.co.uk/usb_to_ttl.htm)
- RS232 to 5V TTL (http://www.superdroidrobots.com/rs232.htm)
- FTDI USB to TTL chip (http://www.ftdichip.com/Products/FT232BM.htm) has Mac/Win/Linux drivers ( and a nice retailer (http://www.hobbyengineering.com/SectionIN.html) )
- Spark Fun Electronics (http://www.sparkfun.com/) has a serial port adapter with a DB9 connector -- search for "PodConsole"
- Mitch's iPod to RS232 ( Picture shown) (http://www.rush2112.net/phpBB2/viewtopic.php?t=111)
Using the Serial Port under iPodLinux
See this forum post about connecting a serial keyboard to the iPod (http://ipodlinux.org/forums/viewtopic.php?t=187&highlight=serial%20port)
To connect it to a PC, you must use a null-modem cable (also known as cross-over). Even if the serial cable you have got seems to fit just fine between your PC and your PodConsole adapter, it still does not mean you have the send & receive lines right: They have to be crossed (that is: pins 2 & 3 on a DB-9 connector).
Testing the serial port
The following procedure was used by me (User:Tempel) to set up and verify the functionality of a PodConsole adapter on a 3rd generation iPod's remote control port.
These tests also assume the use of the Minix shell instead of the dumb sash shell.
The first test was a loop-back test. That means that we check if the data sent out over the serial port comes back in again. This requires no connection to a computer, ruling out problems on that behalf.
To make a loop-back connection, simply shortcut the Receive line with the Send line. In my case, that meant to plug the PodConsole into the iPod and then connect the DB9 port's pins 2 and 3.
Then instruct the iPod to send some data over the serial port and retrieve it at the same time. To do that, write the following lines into your /etc/rc file:
ln -s /dev/tts/0 /dev/ttyS0 cat /dev/ttyS0 > /serinput & echo "serial test" > /dev/ttyS0 reboot
If you start iPodLinux, it should run the above commands and then reboot again. Mount the disk back on your computer and check the file "serinput" that should now be created on the disk's root folder. If it contains one or more lines of "serial test", then the test worked, which proves that your iPod can send and receive data over the serial port.
Using a shell through the serial port
You could now use a Terminal program to access your iPod, e.g. to command a shell using your PC's keyboard. See Remote Shell.
External Links
- Forum discussion about serial keyboards and such [2] (http://www.ipodlinux.org/forums/viewtopic.php?t=187)
- 1N4148 at RadioShack [3] (http://www.radioshack.com/product.asp?catalog%5Fname=CTLG&product%5Fid=276-1122)
- 7805 at RadioShack [4] (http://www.radioshack.com/product.asp?catalog%5Fname=CTLG&product%5Fid=276-1770)