PDA

View Full Version : Mag Card Reader



Melanie
- 7th June 2004, 10:34
--- snip ---

Hi Melanie,

I did seen your magnetic card reader program on the WEB.
I just wondering if u can help me and tell me how can i store cards what was readed in to one external memory like I2C and after that to can read with one computer to RS232 interface

In fact i need to know what instruction is supouse to add in yur profram to do that.

That aplication is need for one Control Access Solution, and im new and very unfamiliarized with PIC programming and i request your help if u have time and if u can help with that.

--- snip ---

Firstly, let's try to keep requests on-list.

In case anyone is wondering what we're talking about here, it's this program...

http://www.melabs.com/resources/samples/submitted/MagCard.txt

What you also need to know is Microchip Datasheet AN727 which is found here...

http://ww1.microchip.com/downloads/en/AppNotes/00727a.pdf

Now here's one example of how to modify to output to PC/RS232 (there are many other ways of doing it with SEROUT or HSEROUT for example)... The result of the card read is stored in a buffer called MagData which is 40 bytes deep. The section I'm modifying is located at the end of my original program...

If MagError<>0 then
'
' Blink LED ten times rapidly to indicate Bad Read
' ------------------------------------------------
For CounterA=1 to 10
Low GreenLED:Pause 50
High GreenLED:Pause 50
Next CounterA
else
'
' Blink LED slowly to indicate Good Read
' --------------------------------------
Pause 500:Low GreenLED:Pause 500:High GreenLED
DEBUG REP $00\16,13,10
FOR COUNTERA=0 to 39
DEBUG HEX2 MAGDATA[COUNTERA]
NEXT COUNTERA
DEBUG 13,10
endif

I'll let you sort out the details of baud-rate etc to suit your own requirements and ponder why I've used HEX output and a For-Next loop rather than use the apparantly simpler STR expression.

As for writing to I2C, easy enough too... but rather than have me do all your homework, I think you should get familiar with PICBasic and do some programming yourself.

Melanie

aetosat
- 15th June 2005, 05:56
Dear Mrs. Melanie,

First of all I would like to give you congratulations for your wonderful style in
teaching people how to learn and how to solve different problems regarding programming of pic microcontrollers and for all those programming samples ,so useful ,for all the guys arround,experts or newbies.
I would like to ask an advice about a card reader build by a guy ,based on your project (magcard).He used a magtek reader and the problem he had ,was on reader's card detection.Seemed that you and Mr. Bruce R. gave him some advice at that time, to put a capacitor somewhere on the circuit.Can you tell me where I can find that post!?I'm working on something similar,only that I start with the very beggining:
I build the reader myself (the hardware and software),using a mag-tek chip decoder for tracks 1 & 2,decoder circuit + magnetic head ( I will try different types) ,actually will work for track 2 for the beggining,and I will like to perform different tests to bring that project to a portable magnetic
card reader!
There are some companies arround claiming that, they sale the smallest magnetic card readers in the world!Well,I doubt about it!
Just for the work of art I will try to see ,how far it can go,and how small can become the real "smallest portable magnetic card reader" !
I'm wondering how difficult it will be and how long time will take to write a program for all the three tracks of the magcard.
I'm using an ICD interface to debug my programs with MicroCode Studio Plus and perhaps it will be good to provide the pcb (which I designed myself) and the schematic + components, here on this forum for people which will be interested to use it!
Thank you for taking the time to read my message and for that wonderful piece of software (magcard.txt) ,the most interesting I found all over the net!
For the link to AN727 datasheet from Microchip as well!

My Best Regards!
Aetosat

Melanie
- 15th June 2005, 08:04
Dear Mrs. Melanie - Ohhhh... don't marry me off yet... I'm still a Miss Melanie! Thank you for the compliments.

I don't recall giving advice about putting a Capacitor anywhere... perhaps it was Bruce. The Card-Detect is usually accomplished by either a photocell or a microswitch. Some cheap readers have the sensor positioned in front of the Read-Head so a card is detected as soon as it is inserted into the slot, but as it is swiped it is still travelling past the Read-Head as it clears the sensor therefore giving too early a warning that the card has been removed, so spoiling the read. A Capacitor could then be inserted to delay the card-detect signal... perhaps that was the reason, otherwise I just can't remember what it was for.

Anyhow, if you're only at the start of your project, I wouldn't worry about it until you meet any problem.

If you are going to read more than one track at the same time, then you will need either more PICs - one for each track, or a different PIC, as I recall (remember this was THREE YEARS AGO in 2002) the 16F84 pretty much maxed out on that RAM Buffer, and the 16F628 was only a bit better. You should be able to do it in one PIC, but will need to chose one with a lot more RAM and depending on how many tracks, you might need a speed increase beyond 4MHz.

Best wishes on your project in trying to make the world's smallest reader - Have fun.

DynamoBen
- 15th June 2005, 14:16
I too am using the MagCard code. I'm almost to the end of my project. I'm using a standard card reader (not serial), I2C memory to store account numbers, and RS-485 interface.

The only difference in my project is I'm stripping out only the account data and storing it. For security reasons I'm not collecting the balance of the information. (expiration date, pin hash)

I'm with Melanie in that you should start writing some code and experiment a little. I have modified her code very little and her code worked right away.

Melanie
- 28th August 2005, 11:38
There's a link to the Magcard program at the start of this thread.

The net result of that program is a buffer (byte array) full of data. It's now up to you to do what you want with it. Storing it in EEPROM is a simple matter (give it a go), but ultimately it depends on your application.

I will add that if you are using ATMEL parts, you're in the wrong forum.

Melanie
- 29th August 2005, 10:12
> I do not know anything with the programming, and to learn I need source code Of a program which manages the external eeprom

You are on a PICBasic forum, and posting in the PicBasicPro section. By that we all assume you have that compiler. If you have the program then you will have the manual (the manual is also freely downloadable from the manufacturers website). In the manual you will find commands I2CREAD and I2CWRITE, once you find those, then the rest is self explanitory.

> but I cannot make the modification.

Then you have a problem, because people here, though willing to help, are unlikely to write your application for you. That requires some effort on your part...

aetosat
- 30th August 2005, 09:30
Dear paulPIC

I'm wondering how those schematics get into your hands and why are you rushing to get that "device" running ,before you even know how a microcontroller work !
Here's a friendly advice :
Start with PIC MICROCONTROLLERS --- AN INTRODUCTION TO MICROELECTRONICS by MARTIN BATES .
It's a book for people without any ideea about programming ! Exactly as you are . If you read that book ,you will get a basic understanding of what you need to know ,to become ,with a lot of work , a programming guru !
Good Luck!
aetosat


P.S. what you got there is a portable magnetic reader,with a key pad to issue specific commands to the controller and serial communication to retrieve the stored data in the external eeprom!nice work

Melanie
- 30th August 2005, 12:02
A word of caution, developing Mag-Card Readers with Memory, Keypad and PC interfaces can have consequences - like jail time, for participating in Credit Card fraud. Unless it's being developed for a bona-fide company with a contract written in blood, this is something I would steer well away from.

Melanie
- 29th September 2005, 11:24
Little did I know this would end-up 'de rigueur' in one New York University... either everyone's cracking the door-access around the campus or they've discovered a new way of financing their way though college! Hey folks - where's my royalties?

Anyway, back to reality... looks like the program now comes with French subtitles.... links to the original (English version) program can be found at the start of this thread. It's down to you to add EEPROM and Keypads etc. The limit of my original involvement is to write the core (for reasons I've already stated earlier) after which what you do with it is down to you.

DynamoBen
- 4th February 2006, 17:29
http://www.melabs.com/resources/pbpmanual/5_61-5_64.htm