Professional Documents
Culture Documents
Magnetic Card Reader User Guide Handout Version 2.0 2023
Magnetic Card Reader User Guide Handout Version 2.0 2023
MICROCHIP
User Guide
Card Reader
Demo
gsmskimms@protonmail.com
1
Revision History
REV DATE ORIGINATOR DESCRIPTION OF CHANGE
Shilpa Ganganna
0.1 08.03.20 Initial Version
Venkatesh Bengeri
2
Contents
3
1. Introduction
With the common use of cards instead of cash, Credit Card Reader (MSR, mag
stripe/swipe readers) are an essential part of any POS system. MSRs can read any card
with magnetic stripes, including some driver's licenses, gift cards, and other IDs.
Magnetic Card Readers (also known as Magnetic Stripe Readers or MSRs) read data
from a 3-track magnetic stripe via a peak detection circuit and process that data for
downstream users. After extracting data from the magnetic stripe, it is converted to
binary data and formatted for encryption. They feed the swiped information to
applications management software and connect through USB, RS-232, or PS/2
connections.
This demonstration shows the Magnetic Stripe Reader using Microchip’s dsPIC and
PIC24F device and displays the card data on the serial terminal.
1. Clocking zeroes
2. A start sentinel character
3. Data characters
4. An end sentinel character
5. A longitudinal redundancy check character
6. Clocking zeroes
4
3. Hardware
It includes Op-amp circuitry, power supply and RS-232 connectivity.
In the case of PIC24F solution, external Op-amps are used to amplify and shift the
signals from Magnetic Read Head such that the signal is read by on chip ADC.
Track outputs from Magnetic Guide Head are connected to the Inverting terminal of
the Op-ampT1, T2 and T3 respectively. Output of Op-amp is connected to the analog
channels of the Microcontroller.
4. Software:
An exponential averaging technique is applied to filter the noise prior to the signal
detection algorithm. While the card is swiped, the software algorithm performs the F2F
decoding and stores the time between consecutive peaks into RAM. After a swipe has
finished, the read data is decoded and checked for the errors. Universal asynchronous
receiver/transmitter (UART) is used to transfer the decoded data from the controller to
the PC terminal application.
5
The basic flowchart which shows the working of the card reader is shown below:
main loop
Start
No
Is SLP Jumper
P1 connected?
Y
e
s
Sleep
Wait for
Swipe
Timeout
6
ADC_Interrupt routine ()
ADC_Interrupt
Swipe_Timeout _ISR ()
Timeout_ISR
Till Swipe
Sleep
7
Note: A low power feature has not been added. It can be added based on customer
interest/needs.
main loop
Start
Configure ADC, UART,
TIMERs
Configure 3 external OP-AMPs
and one external comparator
No
Wait for
Swipe
Timeout
8
Swipe_Timeout ()
Timeout
Decode the time captured between
peaks to get card data
Reinitialize the modules
main
5. Device specifications
2. Peripherals used:
• ADC: Sampling speed 400 KSPS.
• Timers: Two 16-bit timers.
• UART
• INT0: External Interrupt for wakeup from sleep.
9
6. Hardware Requirements
4
6
2. USB Connector
10
Card Reader Guide has magnetic sensor inside it which reads track data
during swipe. During the swipe, make sure the Card stripe is in-line with
the magnetic sensor.
4. Debug port
11
4
2
During the swipe, make sure the Card stripe is in-line with the magnetic
sensor.
4. Debug port
12
13
7. Hardware Connections
1. Connect the mini USB cable to Magnetic card reader board. Power LED turns
ON indicating board is powered-up.
If the jumper is connected to P1, the device will enter into sleep mode once
powered-up and it is indicated by the LED LD1. On swipe, the device will
wake-up from sleep and displays the card data on the terminal.
Power LED ON
LED ON to
indicate device
is in sleep
2. Power-up the board using 9V power supply as shown in figure below. Power
LED turns ON indicating board is powered-up.
14
Power LED ON
9V Power Supply
MCP2200 Serial to
USB Converter
8. Demo Instructions
1. Configure the serial terminal for 38400 baud rate. On asserting MCLR button, the
following message will appear on serial terminal.
15
2. Hold the card as shown below and then swipe. Make sure
• Card stripe is in-line with the magnetic head of the guide.
• Card is not tilted during the swipe.
• Do not stop or hold the card in-between during the swipe.
16
4. If error is detecting during the swipe, then following error messages will be
displayed..
ii) If the card is not swiped properly or if card is tilted while swiping, card data will
not be read correctly and the error message will be displayed as
“CARD_NOT_READ_PROPERLY” for each of the tracks which are not correctly
read.
17
1. AES-128 encryption is used to encrypt the card data. For more information on AES
2. Configuring the AES key: Configure the serial terminal for 38400 baud rate. On
asserting MCLR button, the following message will appear on the serial terminal.
Option “Y” for entering new key and option “N” for using default key.
3. On entering “N” option, the default key will be used for encryption and the key used
for encryption will be displayed on the terminal.
18
4. If ‘Y’ is pressed, the user is allowed to enter the 128-bit (16 bytes in hexa decimal
format) key to be used for encryption.
The key entered by the user will be displayed on the screen. After 128-bit key is
entered, the cursor will move to the next line displaying the demo message.
19
5. Demo software looks for complete 128 bit key (16 bytes). If the line feed option is
entered accidently then following message (“Enter remaining key”) is prompted on
serial terminal.
6. Once the full key is entered, the default message will be displayed as shown below.
20
7. Swipe the card. The AES key used for encryption, track data and encrypted data of
each track will be displayed as below.
21
I. APPENDIX A
22
23
II. APPENDIX
B
25
Browse the hex file to be loaded. Select the device and family of the
microcontroller. Also select the debugger/programmer to be used for
programming.
26
27
X2-Software.zip
EMV Writer Reader Software v8.6.zip
X2 certified software.zip
EMV Writer Reader Software v8.zip
EMV Reader Writer.rar
X1-ATR.zip
28