Home     Contact     Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science     RSS     Terms of services     Privacy policy  
 Home      Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science   

PIC Smartcard Phonecard ReaderAuthor
Giorgos Lazaridis
May 31, 2012

The circuit assembled on a breadboard for prototyping

Special thanks to Panagiotis for this cool smart card reader slot
Some days ago i wrote a theory regarding phonecard smart-cards. I explained how the phonecard protocol works, how can someone read smart cards, and how can someone read and write data to the smart-card memory locations. In this circuit i will demonstrate how can someone use a PIC microcontroller and read telecards. Data will be shown on a 4 by 20 LCD. A separated inc file is also provided as a library for your own software with the appropriate routines to read and write on telecards.

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.

The Circuit
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 is the mechanical switch at the bottom of the slot The switch is normally-closed. The card is not 100% inserted, so the switch is not actuated yet The card is fully inserted into the slot and pushes mechanically the switch which eventually opens

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

R1Resistor 3.3 KOhm 1/4 Watt 5% Carbon Film
R2Resistor 220 Ohm 1/4 Watt 5% Carbon Film 
R3Resistor 220 Ohm 1/4 Watt 5% Carbon Film 
R4Resistor 150 Ohm 1/4 Watt 5% Carbon Film 
R5Resistor 10 KOhm 1/4 Watt 5% Carbon Film 
IC1PIC 16F1937 Microcontroller 

The Software
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.

Download file
Smartcard Reader - Assembly listing files - Ver 1.0

Download file
Smartcard Reader - HEX file - Ver 1.0

   Continue reading. Click here to view the presentation.



  Email (shall not be published)


Notify me of new posts via email

Write your comments below:
BEFORE you post a comment:You are welcome to comment for corrections and suggestions on this page. But if you have questions please use the forum instead to post it. Thank you.


  • At 4 June 2012, 7:47:55 user Giorgos Lazaridis wrote:   [reply @ Giorgos Lazaridis]
    • @Hercules Trapierakis I've got something in mind herc... Something cool. Do you remember when i asked you about ths PCB provider if he provides also 0.8mm PCBs? It is not totally irrelevant :D :D :D

  • At 4 June 2012, 7:07:54 user Hercules Trapierakis wrote:   [reply @ Hercules Trapierakis]
    • gia to gamoto

  • At 2 June 2012, 18:41:20 user Panagiotis Kalogeris wrote:   [reply @ Panagiotis Kalogeris]
    • Nice presentation and project!Thanks for the credits!!!!!!! :-) Herc and why to do that?For underground purpose projects?

  • At 2 June 2012, 16:37:51 user Giorgos Lazaridis wrote:   [reply @ Giorgos Lazaridis]
    • @Hercules Trapierakis And what about elegance???

  • At 2 June 2012, 15:27:34 user Hercules Trapierakis wrote:   [reply @ Hercules Trapierakis]
    • you dont even need the battery

      the phone box will provide you the power

      do it or i will

  • At 2 June 2012, 15:25:22 user Hercules Trapierakis wrote:   [reply @ Hercules Trapierakis]
    • Ok but this in not usefull

      make a PIC telephone card

      wou will make a telecard sised pcb ( a little bit bigger to put the pic on it )

      and it will have an PIC and CR2032 only

    reddit this Reddit this

     HOT in heaven!

    NEW in heaven!

    New Theory: AC electric motor working principle

     Contact     Forum     Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science     RSS   

    Site design: Giorgos Lazaridis
    © Copyright 2008
    Please read the Terms of services and the Privacy policy