Introduction: IPhone RFID Reader

Picture of IPhone RFID Reader
The idea behind this project is to see what the iPhone's serial is capable of and to try and have a
little fun with RFID along the way. This reader works with the low frequency (125Khz) tags but I have
a half working version for MiFARE Hi-Frequency as well.

This was built as part of an up and coming project from The Centre for Advanced Spatial Analysis at University College London.



This instructable assume knowledge of compiling iPhone custom software (in C++) , basic soldering and electronics.

For this project you will need:
  1. An iPhone USB Cable (genuine one is best and probably at least 3!)
  2. A JAILBROKEN iPhone!
  3. An ID-12 RFID Reader
  4. An ID-12 Breakout Board
  5. A Logic Level Converter
  6. It's useful to have some IC Sockets for Soldering
  7. Glass Tags if you want extra fun or any
    125Khz Tags
  8. If you don't like the idea of taking iPhone Cables apart, use an iPhone Breakout Board
  9. A Battery Pack with a 5V step up
  10. Wire.
  11. Some kind of switch.
  12. A box to put it all in.
I should point out that I don't work for Sparkfun.



Step 1: Wire the ID-12

Picture of Wire the ID-12


The first stage is the wiring of the ID-12. You should attach it to the breakout board then attach a series of IC Sockets to the board so you can easily add and remove your wires later on. Wiring up the ID-12 is quite easy. This particular unit does need to be set to ASCII  output however. To do this you need to solder:
 
  • A Red wire from 5V (11) to /RST (2)
  • A Black wire from FS (7) to GND (1)

This sets up the ID-12 into ASCII mode. From here we need simply need to solder in the Ground, 5V power and TX Lines
  • VCC to 5V (Pin 11)
  • GND to GND (Pin 1)
  • RX-I to D0 (Pin 9)

If this is confusing, there is an excellent write-up Here

Step 2: Connect Logic Level Converter

Picture of Connect Logic Level Converter

The next step is to wire up the Logic Level Convertor. This is needed because the iPhone works at TTL3.3V whereas the ID12 runs at TTL5V. We need  to step up and down. This little board is quite easy to use. The Schematic and Instructions can be found in this PDF. The key is to Solder the ID12's 5V, GRND and signal lines to the first channel on the High Voltage Side of the Board.

At this point, you can wire in the switch and the battery box into the High Voltage side of the circuit. Wire the positive of the battery into the switch and out of the switch into the logic board and the ID12. Wire the battery's ground wire into the GND of the logic level board and the ID12.

Step 3: Repurpose the IPhone USB Cable

Picture of Repurpose the IPhone USB Cable
The next step is to work on the iPhone's connection. You should make yourself familiar with the connector. If you use a breakout board, this is quite easy. However, if you are using an iPhone cable, things are a little trickier. Firstly, you should look at Pinout.ru's iPod Guide that lists the ports we need. We are aiming to use the iPhone's built in serial connection. The pins we need are:


  • Pin 1 for GND

  • Pin 13 for RX

  • Pin 18 for 3.3V(+ve)



We could use pin 12 for TX as well but the ID-12 doesn't need data sent to it and I have had significant problems in sending data FROM the iPhone. If anyone knows why this is so, do let me know. Regardless, the iPhone only needs to receive and this is well because these two pins are very close together.

First, either solder your wires into the breakout board or open up the iPhone cable. To open a genuine iPhone cable, you need to run a thin blade around the inside of the plastic case. A small amount of force should release the clips on either side and then pulling on the metal plug with a pair of pliers should do the job. Be careful at this stage though as its VERY HANDY TO KEEP THE PLUG INTACT.

Taking apart the plug should reveal 4 cables. A genuine iPhone cable will have a sheath and small gold connectors. Cheaper cables will be glued in place and this can wreak the project. You dont want glue inside the unused sockets and the less force you need to remove the cables, the better.

Removing the small plugs requires a lot of force and yet, you MUST be as delicate as possible. The connectors are attached to the wires with a very small amount of solder. If the connectors snap they cannot be used and if the solder snaps, you will need to solder them again and if you use too much, the plugs will not fit back into their sockets. Also, you are limited on how many times you can place the plugs as the sockets will wear out. I personally went through 5 cables with this method; two of them were genuine. The geunine ones wear much less.

Place the black wire into the ground. You can decide which colour goes into which socket. I chose green for Pin12, white for Pin13 and Red for Pin18. Remember which is which!

Step 4: Connect IPhone Cable to Logic Level Board

The next step is to wire the cable into the LOW level side of the Logic level board. Again, you need only solder the Live, RX and GND but you may do the TX as well. The iPhone should be receiving from the TX-O pin on the board whereas the ID-12 is sending to the TX-I on the board. It can be useful to practice this on a breadboard first to make sure you get it right.

Once this is all soldered together, you can place it all in a box and begin testing. I used a custom built FTDI USB TTL adaptor and read the the values being sent with my laptop.

Step 5: Download and Compile Software

Picture of Download and Compile Software
The next step is to design the software. Jailbroken software is really another topic all together but there are some interesting choices. In the main, I followed the advice given on This Page which talks about OpenFrameworks and iPhone Serial. As I'm a big fan of OpenFrameworks, I chose this approach. However, I didn't use the serial class mentioned in this blog.

I had previously written some standard C++ to open serial ports for the ID-12 specifically and use it. As this worked, I decided simply to transplant it into a simple OF example.

Compiling OpenFrameworks for the iPhone requires signing in order to run on a jailbroken device. There is a small program called LDID by Saurik who is the definitive source for all iPhone development.

To generate a working program you need to:

  1. Download the code from GitHub
  2. Open the project in Xcode.
  3. Compile the code using your own signature fake signature or simnply don't sign at all
  4. Using SSH/SCP, copy the executable .app to /private/var/stash/applications
  5. Download LDID in Cydia
  6. Use ldid on a terminal app to sign your app.

In short, build with Xcode and use a fake signature as written on Saurik's site.

Serial Communication on the iPhone has been covered very well on DevDots page. The basic C/C++ code there works quite well for testing if you comment out the sending code.

So now you have the ability to read RFID Tags. But you need some tags to read. For me, I quite like the idea of home automation and similar. There was an odd trend of implanting glass RFID tags into the flesh near your thumb but why bother with that when you can simply make an RFID earring? That way, you can remove it if need be or swap out the actual tag.


Comments

jelimoore (author)2014-02-22

Firstly, good project, with a major flaw: there is the new ID-12LA, which operates at 3-5 volts. Very suitable for this application.

sghantous (author)2010-11-30

First, I'd like to thank you for sharing this project.
Second, may I ask what the putty is there for and exactly how everything is connected? Would you mind posting more photos? Like perhaps an one of the complete project.
Thanks again :-)

sghantous (author)2010-11-18

Hello,

I would like to know whether this would work with the iPad.

Cheers,
Stephen in Montréal

TheParadox (author)2010-09-06

Very cool! The iPhone is basically a unix device in your pocket.