What if there was some way to simplify the process of getting into our dorms? Wouldn't it be easier if you could swipe into your building with something attached to your keys? What if you could replace all magstripe style cards in your wallet with a single keyfob? Our CardFree project was inspired by our interest in Samsung's MST technology and our desire to build something that might improve the convenience of an action taken by students multiple times a day.
What it does
CardFree replicates the magnetic signature of a magnetic stripe card. It works with any type of magstripe card, such as a student ID or a credit card.
Using a magnetic card reader, we obtain the raw binary data from the user's card and program it to the key-chain device (ATTiny85), so that it can replay the binary signals through a temporarily generated electromagnetic field. The pulse of data within this field "tricks" any magnetic card reader, be it a point of sales or a door lock, into thinking a card was swiped through it.
How we built it
MagWorks Software - Our magnetic stripe reader is an HID USB device. It doesn't have a serial interface and therefore requires direct control through binary data transfers across the USB protocol. As little documentation exists for such devices, we researched the types of data transfers for USB and learned how to construct these binary instructions bit by bit. We used this knowledge to write a Python-based CLI driver (MagWorks) for our magnetic stripe reader, customized for everything we need. It can read, write, clone, and erase any magnetic stripe card.
Circuitry - Based on SamyK's MagSpoof design, we created a circuit that produces an electromagnetic field that projects magnetic stripe data wirelessly into any magnetic card reader.
ATTiny85 - Microcontroller controlling the entire device, stores relevant card data and replays it.
L293D Motor Driver - Motor driver to provide necessary current from LiPo battery for a sufficient magnetic field to generated by the magnetic coils.
Magnetic Coils - ~50 coils of 24 gauge magnetic wire with ~ 3-inch circumference
LiPo - 100 mAh 3.7 V battery for inducing the magnetic field and powering ATTiny85.
Case - To create more of a "production" model of our circuit, we 3D-printed an enclosure for our most successful prototype device. This enclosure isn't perfect, but acts as a perfect model for what the key-chain could look like.
Challenges we ran into
We tried to miniaturize our circuit further but it had a short that we were unable to locate. We had to use our V2 prototype for the final product, despite it being larger than we initially desired for the final product.
We struggled to accurately reproduce all three tracks of a magstripe card with our circuit. We had to spend a lot of time running through small, tedius changes to the ATTiny85's programming in order to produce a consistent, correct magnetic field with the correct card data.
It was very difficult to decode the data on our student IDs. Our card reader does not read and return the raw binary digits directly off of the magnetic stripe. It actually has it's own specs for reading raw card data, and we had to do a lot of binary conversions to figure out exactly how to translate the raw data we received into something we could use.
Accomplishments that we're proud of
Writing a Python-based driver for a USB device that would otherwise be unresponsive.
Successfully decoding the data off of the UMD student ID cards.
Successfully simulating magnetic strip cards with a keychain-sized device.
What we learned
How to write drivers for and directly control USB devices.
How financial cards follow a standard ISO encoding format, and how to parse it.
How to decode raw data encoded on any non-standard magnetic stripe card.
How to effectively organize components on a circuit with limited space.
How magnetic stripe data can be produced via an electromagnetic field to "trick" card readers into thinking a card was swiped.
What's next for CardFree
Make it much smaller.
Use a custom printed PCB instead of complex soldering.
Add functionality for multiple cards on a single CardFree.
Add a larger battery.
Improve reliability and range.
Better activation button.