Before we go on... Hacking smartcards is illegal. You are not allowed to modify any telecard in any way. This circuit is for educational purposes only!!! After being educated, you can have fun by yourselves alone...
Oh... i almost forgot. The internal uC of smartcards does not allow illegal or unintended changes to any memory location, but i really hope that you will inform me if you find any glitches whatsoever...
Special thanks to Panagiotis (you will also find him posting some goodies in the site with the ID _pike) for providing me the smart card slot, for firing up this project, for providing me enough info - references - files and links related to smartcards and for providing me the first code that he wrote some time ago.
Here is the schematic circuit of the Smart Card reader:
There are no many things to tell about this schematic. The numbers on the smartcard slot connector correspond to the smartcard pinout (as shown in the theory). Pins 9 and 10 are connected to the hardware switch of the slot. This switch is a normal closed contact which opens when a card is inserted into the slo:
This switch is connected to the RB0/INT pin of the microcontroller. The PIC uses the RB0 interrupt to effectively detect if a card is inserted or removed.
Notice the pull-up resistor on the I/O pin of the smart card, connected at the RC4 pin of the microcontroller. I could have used a pin with internal weak pull-up resistor (as i did for the RB0 pin), but i preferred to use an external resistor for one and only reason: For demonstration purposes. When i began designing this circuit, i searched around the net for similar circuits. Unluckily, all the circuits that i found had used the internal pull-up resistor of the uC pin. It took me a long time to discover by chance that i have to use a pull-up resistor. I took a wild guess and used one after some 2 hours of checking and re-cheeking the circuit trying to discover what went wrong...
Bill Of Materials
As always, i wrote this software in assembly. Many people do not notice the inc files that i use, or they get confused. I rarely or never write single assembly sheets and i use a lot of inc files, because i can simply copy/paste them to another project and use them as libraries. I use for example the mSecDelayGenerator16MHz.inc file to create time delays and the LCD_16X20_4bit.inc to drive the LCD. Similarly, i made one inc file which i named smartcard.inc and has all the subroutines needed to read and write on a smartcard. I strongly suggest you use my inc files -at least for start up- before you make your owns, simply because you will save a lot of time coding and debugging.
Here are the zip files with the PIC firmware.
Continue reading. Click here to view the presentation.