Replacing magnetic card reader by Arduino+NFC shield

Hi! (first post in the forum)

I have to replace an old magnetic card reader (MagTek MT-215 TTL, [http://www.magtek.com/documentation/public/99875113-12.03.pdf][/http://www.magtek.com/documentation/public/99875063-4.02.pdf]) which is not working really well because of lots of dust.
The card reader would return the card number (only digits) in an, at least for me weird, binary format to the actual controller.

I would like to add a NFC-reader beside the magnetic card reader, faking the MagTek-output so we could use both at the same time: NFC and magnetic cards.

What do you think? Something that can be done with Arduino, a nfc shield and some couple of well-thought pages of code? Too tricky?

Regards from Austria

Edi

MagTek_Reader.pdf (466 KB)

Should be easy enough.

I think the only 'hard' part will be figuring out how to get the two devices to share the wire. All the signals seem to be "active low" so AND gates on the signals should be enough:

1 Rear Sensor
2 Data TK2
3 Card Present
4 Strobe TK2

6 VCC (+5V)
7 Ground
8 Strobe TK1
9 Data TK1

You shouldn't have to implement both TK1 and TK2 since only one is ever used at a time (depending on which way up the card is inserted).

The output looks a bit like SPI: Pull down Card Present and shift out data with Strobe and Data lines. The 'Rear Sensor' might be used to tell the receiving equipment that the card is fully inserted and to look for data.

Hi John!

Thanks for the quick reply.

I understand what you write about the AND. But I guess this can be easily done within the Arduino board? Like having the Card-Reader signals 1,2,4 as analog input and implementing the ANDs; connecting the Arduino to the black box behind.
(I come more from the programmers site, this gonna be my first electronic experience since college…)

The component behind the card reader would not use the “Card Present” input btw. and you are right, only TK2 is used.

You mentioned the output and SPI. I am a little worried about the timing though. Actually about the frequency of the strobe.

The strobe is generated based on the signal on the card so the clock rate will depend on how fast you move the card and how dense the data bits are on the card. Might be good to locate an oscilloscope so you can get a feel for the data rate. You could connect the Strobe line to a speaker and listen to the pitch to get a feel for the data rate. A medium pitch would be roughly 500 hundred cycles per second. Low pitch would be about 125. High pitch would be about 2000. Very high pitch about 8000.

Well, all the parts connected.

Magtek card reader connected to the Arduino inputs, Arduino outputs connected to the component behind the card reader.
I receive the signal from the card reader very well (printed to serial would show the right content).

But...

Neither the forwarding nor the simulation would return any response on the black box (except for showing that there is a card in the slot).
The simpler task should be the streight forwarding. I thought the following code would copy the signal from input to output:

int signal[2] = {1,0};
int strobe[2] = {1,0};
int backend[2] = {1,0};

void loop() {
        signal[0] = digitalRead(CR_SIGNAL);
        strobe[0] = digitalRead(CR_STROBE);
        backend[0]= digitalRead(CR_BACKE);
        if(signal[0] != signal[1]) {
          digitalWrite(OUT_SIGNAL, signal[0]);
        }
        if(strobe[0] != strobe[1]) {
          digitalWrite(OUT_STROBE, strobe[0]);
        }
        if(backend[0] != backend[1]) {
  	  digitalWrite(OUT_BACKE, backend[0]);
        }
        
        signal[1] = signal[0];
        strobe[1] = strobe[0];
        backend[1] = backend[0];

Could this be something about the speed of reading and writing? The card reader says max. 3750 bits/sec. Would mean ~250µs/bit.

You can simplify the coding (and sped things up) for now by just copying the signals straight over:

void loop() {
  digitalWrite(OUT_SIGNAL, digitalRead(CR_SIGNAL));
  digitalWrite(OUT_STROBE, digitalRead(CR_STROBE));
  digitalWrite(OUT_BACKE, digitalRead(CR_BACKE));
}

If that doesn't work then something else is going wrong. Perhaps some of the signals are Open Collector and need a pull-up resistor. You could try changing pinMode() from INPUT to INPUT_PULLUP to see if that helps.