Shop OBEX P1 Docs P2 Docs Learn Events
Sparkfun: Magnetic Stripe Reader (SEN-11096) — Parallax Forums

Sparkfun: Magnetic Stripe Reader (SEN-11096)

Hello All,

Has anyone tried this Reader with the BS2 family. How well did it work and how simple was the BS2 code? It seems simple enough once you get pass the wiring gyration.

Thanks for any feedback

https://www.sparkfun.com/products/11096

Comments

  • Hello All,

    Got the Mag. Readers in and the both work with the Terminal program that Sparkfun suggested. Read every card in the house here that I could find.
    BUT.....
    My connection through the BOE is correct 5v/gnd ( common) to the DB9 and the PS2 connection. Things started out real slow and got worse from their. May have killed two BS2 & e modules along the way. Once I had the 9600/8N1 set up in the 5 line program from the HELP file all seemed well. But I could only read some of the DATA, ALL the time. I bounced back and forth between the terminal program and all was find. This is dragging out way to long. Could never pull in ALL the data across the back of any card. Tried the Command to (SPSTR L) to put data up to 126 bytes in the SPRAM but could not get it to work also.

    Whats the secret of getting reliable RS232 data with the BS2 modules?
    1) program from the Help file (5 lines)
    2) 22k ohm in line from the Reader to the BS2
    3) ONLY two line from the BOE to the READER because its a known Baud rate (???)

    Thanks for any insight
  • Hello All,

    Need Help with RS232. Redid all connections to ensure they are correct, and they are. Went thru the 5/6 actual lines of code again, again, and again. Don't know if I need more code or more Hardware. Not reading the back of my Gift/credit/ Driver License cards.

    Magnetic reader:
    Baud :9600, Data: 8 Bit, Parity:none , Stop: 1, Flow Control: None
    ' {$STAMP BS2e}
    ' {$pbasic 2.5}
     DEBUG CLS, "Hello Scanner",CR
    
      sdata   VAR Byte
    
     Main:
     SERIN 1, 16468,Bad_Data,[SDATA]
     DEBUG  ? sdata
     GOTO main
    END
    
    Bad_data:
    DEBUG CR,CR, "NO-DATA",CR,CR
     GOTO Main
    STOP
    
  • Hello All,
    Here is a picture of the setup.
    PS2: Pin 4 5v from BOE
    PS2: Pin 3 GND from BOE

    DB9: Pin 3 Transmit from MAG. READER
    DB9: Pin 5 GND from BOE
    3405 x 2554 - 2M
  • It may just be me, but in the photo it appears that the wires that go into the DB-9 breakout are clipped somehow, as is the power cord. It's as if the photo got corrupted somehow. Why are there wires in both the DB-9 breakout and the PS/2 connector?
  • Hello Chris,
    Thanks for the reply.
    The PS2 is were the Reader gets the power (5v & gnd), the DB9 (Pin 3 is tx & Pin 5 gnd). I just got the breakout so I could check the signal coming from the Reader and it did not have Pin 3 connected, so i put a bridge from pin two(2) to fix that and still no luck. But the case of the breakout was not grounded so I added that and now (I think that fixed that erratic Data problem) I'm receiving consistent/repeatable data. But ONLY 26 bytes. I need to be able to read all the Data (74 Bytes). Nothing I've read will allow me to do that with a 'STRING'.
    I saw a Command for storing 126 bytes, but that's when I switch to the BS2 48 pin. I'm trying to learn with the BOE and then move up.

    1) How can I READ/SAVE past the current 26 byte limit?
    2) Pars along the way of reading or when all is read?


    I've tried saving the first 26 bytes to another "VAR", but the first "VAR" just resets and I end up with two(2) of the same 'STRING'.

    Thanks for any help

  • To get past the 26 byte limit, you need to use SPSTR formatter (meaning you need a BS-2p, at least)
    Cannot parse along the way (other than maybe WAIT or WAITSTR)
  • It still looks like power is going into the DB-9 as well, which doesn't seem right.
  • Now that I did a ZOOM on the picture, I see that it was (Split) when I had to do the compression to fit for the upload (1.9mgb now). Microsoft 3D paint program.
    But I am reading data now. I do have the BS2p 48 OEM working so I may be able to jumper into it for the Reader. I will try the (wait/waitstr) again now that I've got it running.

    Been out for the last 3 hours, will try now.

    Thanks Chris & tomcrawford

    just tested again, still working.......(26 bytes). so sad

    Thanks again
  • Hey Chris,
    I'm confused, how can any real work get done if it can only Read 26 Bytes of data. I know there has to be some other tricks of stashing Serial Data as it comes in.

    I printed out the Serin/Serout and will read through again.
    But that thought just came into my head.

    PS: Just learning of course and don't know how large packets are or length of streams of Serial data.
  • As Tom mentioned, this is one of those rare cases where you need a different model BASIC Stamp 2. It's not that the BASIC Stamp 2 is lacking, it's just that a few applications use long strings which aren't necessarily typical in older industrial control systems. 26 bytes may not seem like much, but I once saw several people post a reply to someone trying to log data from a GPS and they said it wasn't possible. I took that as, "Challenge Accepted!" Parallax even had a kit based on my design once:

    https://forums.parallax.com/discussion/115791/gps-datalogger-kit-from-chris-savage-s-elektor-article-available-for-purchase

    That said, in your case I would probably recommend the BS2p or BS2pe if you're planning on storing a bunch of data.
  • Per the input from the person who ask if I could do this, the Data will only be viewed for the moment, not stored. The piece of Data that I need starts at byte 59 of a 74 byte stream.
    Once I'm solid with these early steps, I will patch into my current PBASIC 48 pin and use the (SPSTR \L) to put the Data in EEPROM RAM and pars (GET) from their.
    I did download some gps code already for further review/studying to learn from. I just tried some things with (WAITSTR "=") and its just to far in the String (byte 59) to read.

    Thanks for speeding up my learning curve. If you think of anything else please please please let me know. THANKS.

    will try some more commands to make sure I understand how they work

    Thanks again
  • Hello All,
    update: Got the Reader detected on my BS2p 48 pin OEM.. That was to easy. Anyway, erratic Data again, so I'll have to make sure all connections are solid, but now I should be able to try the long String commands.

  • Note that the baud mode will be different between a BS-2 and a BS-2p.
  • Hello All,
    Well pump the brakes.
    Had to rebuild the patch work by taking out some connections and still not working. That was at 1 am, now trying again and still not working. Had some data before, now its just those (yyyyyy) with 2 dots over top. Went through all the baud rates. Will move back to the BOE to try and figure out were I went wrong.

  • done for the night....nothing but (yyyyy's w/2 dots on top)

  • That really sounds like a baud rate issue. Be sure you're using inverted if you're coming from an RS-232 port through a resistor.
  • Saturday worker, just got in.

    Thanks Chris.
    Stopped by Fry's to get a DB9-Male to solder wires onto an plug directly into the Reader. Just to ensure a solid connection.
    I'm currently trying to use my own OEM PCB, BS2-P smt that was working before with no problem. All I had to do was connect the Data into MainIO pin 12 at the connector that was going through a 10k smt resistor already.
    Chris, how touchy is RS-232 as far as noise/trace width/two (2) jumps from top side to bottom side of a 4 x 3 PCB. Is it very forgiving or does some minimum requirements (need/should) be maintained for best results. My next attempt will be to jumper straight off pin 12 to the resistor to avoid any possible noise problems.
    The short HELP File program is the only code running at this time but the lay already had a (DS1302/Battery, Piezo, SSR) close by. Can this have anything to do with it?
    Obviously this can save money if I can get this jump started with any of my current OEMs.
  • I haven't worked with Parallax products in over a year, but my recollection of connecting RS-232 to a TTL input was using a 22K resistor. Also, when coming from RS-232 you must use inverted baud mode. In the past I have simplified things by creating a test rig out of another dev board just to test communication under controlled conditions. In the past I have programmed a BoE to be any number of serial interface devices. But when it comes to the actual signal interface, it helps to know exactly what you're dealing with. In your case, dealing with a custom PCB to me is an unknown. You can't be sure there isn't something wrong on the board. I would test it on a know working board. I almost think you did that. I didn't go back to see. But without the proper test equipment that would be the easiest way to test your communication.
  • Hello Chris,
    Got it solved.
    Had to come home from work today and as soon as I had a chance to hook up my O'Scope and look at the Data Sheet/picture (ah again for the 10th time) from Sparkfun, then I realized that I had NO signal from the Reader at all and that the connector in the picture is Male and the connector on the unit is Female.
    So when trying to cleanup the initial working connection with a Null modem in-between I built my connection backwards going to my OEM board. It's working now and so is the (SPSTR L) Command for 83 charactors . I'm also able to read back the Data and print to the Debug Terminal Screen.
    The "Aerogps4" code has a "String to Value" routine that I will adapt once I Parse some Data out for calculation.

    Thanks for the feedback, was dead in the water for awhile there, now seems so simple.

    Now: looking for a 3D printer for this and future projects.
    Thanks again
  • Awesome! Glad to hear it. Just remember, in a complex system when something isn't working, break it into the simplest form for testing. Small blocks, so to speak. :nerd:
  • Will do.
    Parsing is working from the 'long string'. Now I'm working on the String-to-Value conversion for the calculation. Should be easy with GPS routines.

    Thanks again

  • Cool! Can't wait to see your finished project.
  • Hello All,
    I'm running into a slight problem. I've been testing my code and increasing the (SPSTR L) value. That's when I noticed, I had to do a double swipe to make a read of my card. I did the half split method until I got to the values of (94-good read with 1 swipe and =>95 and I had to do double swipe for a good read).
    I've tried this over and over again with the same results. Was not expecting this so I went back and removed lots of code and added PAUSE code before the (SERIN Read) thinking this could fix it and changed the baud rate, but no luck.
    Will try and repeat this again tomorrow.
    If anyone has any insight please let me know. Thanks
    '                                      '
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    DEBUG "waiting for data",CR,CR        ' To show we are in the routine
    MAINIO                                 ' Switch to Main I/O pins
      SERIN Readerpin, 16624, [SPSTR 95]  ' Readerpin = I/O pin 11
         GOSUB Audible_Alarm               ' Sound Audible Alarm Piezo
    '                                      '
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    '
    

    This is the code that read the Mag. reader.

    Thanks again
Sign In or Register to comment.