Shop OBEX P1 Docs P2 Docs Learn Events
Fob RFID tag reading problem — Parallax Forums

Fob RFID tag reading problem

Luis_PLuis_P Posts: 246
edited 2012-05-06 09:59 in BASIC Stamp
I'm new to RFID. I'm trying to simple read the "Blue Eye Key Fob Tag" with the "Read/Write Module, Serial Item code 28440". I thought was going to be a simple task. well not! I want just read any tag close to the module. I used the code provided for BS2 but nothing happens. I need help do not know what's wrong. connections are very simple (GND, 5V and TX, RX) I need a simple testing code to start that do not include writing, only read the blue tags.

(SOLVED!)The code below is working now:


'
[ Program Code ]

#SELECT $STAMP
#CASE BS2, BS2E, BS2PE
T9600 CON 84
#CASE BS2SX, BS2P
T9600 CON 240
#ENDSELECT

RFID_TX PIN 0 ' Connects to RFID R/W Module SIN
RFID_RX PIN 1 ' Connects to RFID R/W Module SOUT
Baud CON T9600
RFID_ReadLegacy CON $0F ' Read unique ID from EM4102 read-only tag (for backwards compatibility with Parallax RFID Card Reader, #28140 and #28340) (12)
buf VAR Byte(12) ' data buffer
idx VAR Byte ' index

Initialize:
PAUSE 250 ' let DEBUG open
DEBUG CLS ' clear the screen

Main:
DEBUG "Reading ID tag unique serial number..." ' Read unique ID from EM4102 read-only tag
Read_Legacy:
SEROUT RFID_TX, Baud, ["!RW", RFID_ReadLegacy]
SERIN RFID_RX, Baud, [STR buf\12] ' Get header and data
IF buf(0) <> $0A THEN Read_Legacy ' If we don't receive the correct header, keep trying until we do
FOR idx = 1 TO 10 ' Display the data (ignore final \r byte sent by the reader)
DEBUG buf(idx)
NEXT
DEBUG CR

PAUSE 2000
GOTO Main ' Do it all over again!
END

Comments

  • FranklinFranklin Posts: 4,747
    edited 2012-05-05 21:56
    How do you have the reader connected to the stamp? Also what output do you get from the program? Try posting your code between [code] tags in the advanced editor ( Go Advanced)
  • Luis_PLuis_P Posts: 246
    edited 2012-05-05 22:25
    Franklin wrote: »
    How do you have the reader connected to the stamp? Also what output do you get from the program? Try posting your code between [code] tags in the advanced editor ( Go Advanced)


    Thanks. the module reader is connected VCC to the Vdd (5V stamp), GND to Vss( - stamp) then SIN to PIN0, SOUT to PIN1.
    I get DEBUG "Reading...." but nothing else happens.
  • Mike GreenMike Green Posts: 23,101
    edited 2012-05-06 09:08
    The key fob tag you're trying to read is a "legacy tag". I'm not sure what the reader will do when you try to read it as a read/write tag, but it may treat it as an error, so the first loop in your program will never exit. You might try commenting out the first loop so the program falls through to the second section where it tries to read a "legacy tag". That should work. None of the rest of the program will work unless you switch to a read/write tag.
  • Luis_PLuis_P Posts: 246
    edited 2012-05-06 09:59
    Works! Great. Thanks Mike.
Sign In or Register to comment.