How To Connect a PS/2 Keyboard to the iPhone

 by awgh
step9-800x600.jpg
step1-800x600.jpg
step2-800x600.jpg
step3-800x600.jpg
step4-800x600.jpg
step5-800x600.jpg
step6-800x600.jpg
step7-800x600.jpg
step8-800x600.jpg

Although I’ve seen many pictures of PS/2 keyboards plugged into iPhones on the Internet, no one has yet published a detailed howto on how to get this working yourself.  Until now, that is.

In this Instructable I will show you how you can make a PS/2 keyboard to iPhone converter, including all hardware and software instructions.

Prerequisites

  • Jailbroken iPhone – The official SDK doesn’t allow access to the serial port due to the Elf Conspiracy, so the jailbreak is required.  All you need to know about jailbreaking is at the iPhone Dev Team Blog.
  • Arduino Diecimila or Dumilanove (or clone), available from many places.  This howto assumes that your Arduino is assembled.
  • An iPod Breakout board, like this one from Sparkfun.  Any similar product will work.
  • A Female PS/2 (Din 6) Keyboard connector.  Pull one off an old computer or buy one from Digikey or similar vendor.
  • Wire, preferably several colors and about 24 gauge.  I’m using a spool from RadioShack in the pics below.
  • One 500k Resistor.  I’m using an axial through-hole resistor from RadioShack, but you could add this to your Digikey order as well.
  • Soldering Iron and Solder.  If you don’t know how to solder, you can learn here and here.
  • (Optional) Pin Headers, like these.  I break these off and solder them to the ends of wires, so that they plug nicely into the Arduino.
  • (Optional) Sweet 9v Battery harness so your Arduino becomes portable available from the Maker Store.
  • (Optional) Stereo Headphone Jack from RadioShack or Digikey.

 
Remove these adsRemove these ads by Signing Up

Step 1: Solder the iPhone Breakout - Part 1

step1-800x600.jpg

Once all your ingredients arrive, fire up the soldering iron and have a quick look at the iPod Connector Pin-Out.

We’ll be making use of four of these pins for the keyboard: 11, 13, 16 and 21.  The definition of pin 21 says we need to place a 500k resistor between pin 21 and ground to enable serial communications to the iPhone, so we’re going to stick a resistor between pin 21 and pin 16, which is the serial ground.  We’re also going to be adding pin headers to pins 11 and 13, which will act as the TX and RX pins for serial communications.  Since we’ll ONLY be sending to the iPhone, we only make use of the iPhone’s RX pin, so we’ll also be adding a piece of wire to connect pin 11, the unused TX pin,  directly to the ground at pin 16.

You can also optionally add the stero headphone jack to pins 2, 3 and 4 right now and it will work whenever the breakout is plugged in.  This has nothing to do with the keyboard, but if you have a 1G iPhone with the lame non-standard headphone jack, this will fix it.

adruna says: Mar 16, 2011. 6:08 AM
Having issues with installing iPhone 2.0 Toolchain, Cydia keeps telling me it can't install because there is dependencies and conflicts that can't be identified xD
Anybody knows a way around?
E_MAN says: Mar 14, 2011. 6:13 PM
This is great! I modified the code am currently using through USB to transfer text to putty through the COM port. Nice Instructable!
MACKattacksnipe says: Jan 14, 2011. 2:47 PM
you should have a scematic and make a Arduino Shield
nickboy98 says: Jan 12, 2011. 2:53 AM
wow i could have bought a neat and tidy bluetooth keyboard and linked that to my iphone than waste that much time and money and ruin the aesthetic appeal of my iphone
alexand3rS says: Mar 24, 2010. 10:20 PM
omg win
Lance Mt. says: Feb 16, 2010. 1:43 AM
 lol, Im sorry but i really must insist. WOW, I've had some experience with jailbreaking but does that look complicated and a hlaf!
tompaige says: Jan 18, 2010. 7:34 PM
WILL IT WORK ON ANY TYPES OF IPODS
yonsje says: Dec 5, 2009. 11:08 AM
Hi,
When I type "gcc -static-libgcc -o TouchClient TouchClient.c -lvncclient"
I get:

ld: library not found for -lSystem
collect2: ld returned 1 exit status

What do I do?
guitarist24000 says: Dec 2, 2009. 9:31 PM
did any1 figure out backspace or how to hit send from the keyboard?
guitarist24000 says: Nov 26, 2009. 8:10 AM
I would like to make my own dock using this, the only information I cannot find is exactly what pins I have to put wires into to charge it and how much voltage and amps should be on those pins. by any chance would you know?
macattackct says: Oct 15, 2009. 4:17 PM
Is it possible to do this with a regular either graphic or basicLCD?  if so, where can I get the codes?
awgh (author) in reply to macattackctOct 15, 2009. 5:53 PM
Absolutely.  So you'll need a LCD with an existing Arduinolibrary.  Something like this , perhaps.  Follow the instructions as above, except don't botherwith the iPhone breakout or the iPhone code.  The library andinstructions for using it on the Arduino are here .

Simply modify the Arduino code I posted and replace the Serial.write()command with a command that prints the character to the LCD.

That's actually an awesome idea!  With a little storage, you couldmake an Arduino-powered word processor... 

Thanks for your comment!
awgh (author) in reply to awghOct 15, 2009. 6:03 PM
Or better yet, a serial-enabled LCD module like this.  Wouldn't have to change the code at all to print characters!

Would have to handle backspace and some kind of buffer yourself, butthat should be easy.
macattackct in reply to awghOct 21, 2009. 3:33 PM
ya. that is what I was planning on doing. Making a word processor.  Thanks for responding.  Is it harder to do it with a graphic LCD, or even a graphic touch screen LCD so that you can use the screen as a cursor?
jeeab says: Oct 16, 2009. 11:37 AM

Will this work with the ipod touch too? if so, do you know how much all of this costs? (besides the ipod)   thanks : )

awgh (author) in reply to jeeabOct 16, 2009. 12:20 PM
Should work with a jailbroken iPod Touch just fine.

As for the cost,  it's about $15 for the breakout board, $2 for the PS/2 connector, $20-$30 for the Arduino (a Seeduino clone would be enough).  The resistor and wire are cheap. 

Of course, you can always find another use for the Arduino when you're not using it to type ;)

- awgh
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!