Introduction: IPhone RFID Reader
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:
- An iPhone USB Cable (genuine one is best and probably at least 3!)
- A JAILBROKEN iPhone!
- An ID-12 RFID Reader
- An ID-12 Breakout Board
- A Logic Level Converter
- It's useful to have some IC Sockets for Soldering
- Glass Tags if you want extra fun or any
- If you don't like the idea of taking iPhone Cables apart, use an iPhone Breakout Board
- A Battery Pack with a 5V step up
- Some kind of switch.
- A box to put it all in.
Step 1: 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)
Step 2: 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
- 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
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:
- Download the code from GitHub
- Open the project in Xcode.
- Compile the code using your own signature fake signature or simnply don't sign at all
- Using SSH/SCP, copy the executable .app to /private/var/stash/applications
- Download LDID in Cydia
- 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.
We have a be nice policy.
Please be positive and constructive.