Shop OBEX P1 Docs P2 Docs Learn Events
Need help on RFID Card Reader Serial 28140 please. — Parallax Forums

Need help on RFID Card Reader Serial 28140 please.

TaiTai Posts: 5
edited 2009-02-05 17:04 in BASIC Stamp
Hi,

I am currently doing a project, it include a Microchip Explore 16 mcu board, a Parallax reader (28140) and interface with pc (VB6).·I have a few qustions:
1) Does this sound like doable?
2) If so, how can i connect the reader on the board? i did some research on the reader, it said i only need to connect 1 wire to the board. Most of the info i found is connected to a LCD so i have no idea where should i connect the wire on the board.
3) The main purpose is to keep track of the card that swiped, so basically after i swiped 3-4 cards, i check it on VB to see which card, name, time, can i do that?

Please help me out [noparse]:)[/noparse]

Comments

  • FranklinFranklin Posts: 4,747
    edited 2009-02-03 01:42
    You need to connect the ground to your board ground and the signal wire to a pin that can read serial. How you do that with the board you are using is beyond me. Good luck.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Craig EidCraig Eid Posts: 106
    edited 2009-02-03 02:56
    The serial version of the RFID card reader has 4 pins that require a connection. From the manual (http://www.parallax.com/Portals/0/Downloads/docs/prod/audiovis/28140-28340-RFID%20Reader-v2.1.pdf) - the connections are as follows:

    Pin 1 VCC +5V DC input.
    Pin 2 /ENABLE Bring this pin LOW to enable the RFID reader and activate the antenna.
    Pin 3 Serial Output,·TTL-level interface, 2400bps, 8 data bits, no parity, 1 stop bit.
    Pin 4 GND

    You will need to connect the ( +5V DC input and ground) on the card reader to the (+5V DC and ground) on your target board; Pin 2 must be taken LOW to enable the serial output on Pin 3. Since the serial output is TTL, you can connect it directly to an input pin on the microcontroller. The manual provides details on decoding the output stream.

    Craig
  • technoobtechnoob Posts: 21
    edited 2009-02-05 04:40
    hERE IS SOME CODE FOR RFID AND THE BOE ON A BS2.· I HAVE AN LCD IN THERE SO I CAN READ IDS.· You will have to insert your tag numbers in the data section for the numbers.· since your not Randy Or Stephanie you will need to change the Names associated with the tags too.···· I have the lcd data pin set to·0 in this.· (see LCD Constants last line)·· I have a buzzer thingy on pin 2.· the rest is cake.· If you have a BS2 and a Board of Education (boe).·· getting the data to windows is tougher.· You will need some hardware and alot more code.· ITs RS-232 time.· I just figured out how to get Hyper Terminal to see Synced data on RS-232 com port.· I have along way to go befor Im executing VB code on my PC.
    (' {$STAMP BS2}
    ' {$PBASIC 2.5}
     '  File....... RFID.BS2
    ' Purpose.... RFID Tag Reader / Simple Security System
    ' Author..... (c) Parallax, Inc. -- All Rights Reserved
    ' E-mail..... [url=mailto:support@parallax.com]support@parallax.com[/url]
    ' Started....
    ' Updated.... 07 FEB 2005
    '
    '
    ' =========================================================================
    ' -----[noparse][[/noparse] Program Description ]---------------------------------------------
    '
    ' Reads tags from a Parallax RFID reader and compares to known tags (stored
    ' in EEPROM table). If tag is found, the program will disable a lock.
    ' -----[noparse][[/noparse] Revision History ]------------------------------------------------
      ' NOTE:  Install LCD TxPin on pin 0
    ' -----[noparse][[/noparse] I/O Definitions ]-------------------------------------------------
    Enable  PIN 4              ' low = reader on
    RX      PIN 5              ' serial from reader
    Spkr    PIN 2              ' speaker output
    Latch   PIN 3              ' Lock or Latch control Green LED
    Alarm   PIN 6              ' Alarm control RED LED
    ' -----[noparse][[/noparse] Constants ]-------------------------------------------------------
    #SELECT $STAMP
      #CASE BS2, BS2E, BS2PE
        T1200 CON 813
        T2400 CON 396
        T4800 CON 188
        T9600 CON 84
        T19K2 CON 32
        TMidi CON 12
        T38K4 CON 6
      #CASE BS2SX, BS2P
        T1200 CON 2063
        T2400 CON 1021
        T4800 CON 500
        T9600 CON 240
        T19K2 CON 110
        TMidi CON 60
        T38K4 CON 45
      #CASE BS2PX
        T1200 CON 3313
        T2400 CON 1646
        T4800 CON 813
        T9600 CON 396
        T19K2 CON 188
        TMidi CON 108
        T38K4 CON 84
      #ENDSELECT
    '------------------------[noparse][[/noparse] LCD Constants ]---------------------------------
    LcdBaud         CON     T19K2
    LcdBkSpc        CON     $08             ' move cursor left
    LcdRt           CON     $09             ' move cursor right
    LcdLF           CON     $0A             ' move cursor down 1 line
    LcdCls          CON     $0C             ' clear LCD (use PAUSE 5 after)
    LcdCR           CON     $0D             ' move pos 0 of next line
    LcdBLon         CON     $11             ' backlight on
    LcdBLoff        CON     $12             ' backlight off
    LcdOff          CON     $15             ' LCD off
    LcdOn1          CON     $16             ' LCD on; cursor off, blink off
    LcdOn2          CON     $17             ' LCD on; cursor off, blink on
    LcdOn3          CON     $18             ' LCD on; cursor on, blink off
    LcdOn4          CON     $19             ' LCD on; cursor on, blink on
    LcdLine1        CON     $80             ' move to line 1, column 0
    LcdLine2        CON     $94             ' move to line 2, column 0
    LcdCC0          CON     $F8             ' define custom char 0
    LcdCC1          CON     $F9             ' define custom char 1
    LcdCC2          CON     $FA             ' define custom char 2
    LcdCC3          CON     $FB             ' define custom char 3
    LcdCC4          CON     $FC             ' define custom char 4
    LcdCC5          CON     $FD             ' define custom char 5
    LcdCC6          CON     $FE             ' define custom char 6
    LcdCC7          CON     $FF             ' define custom char 7
    TxPin           CON     0
      Baud19200 CON 32
    '-------------------[noparse][[/noparse] Stamp  Select ]--------------------------------------
    #SELECT $STAMP
      #CASE BS2, BS2E
        TmAdj    CON $100 ' x 1.0 (time adjust)
        FrAdj    CON $1500 ' x 1.0 (freq adjust)
      #CASE BS2SX
        TmAdj        CON      $280 ' x 2.5
        FrAdj        CON      $066 ' x 0.4
      #CASE BS2P
        mAdj         CON      $3C5 ' x 3.77
        FrAdj        CON      $044 ' x 0.265
      #CASE BS2PE
        TmAdj        CON      $100 ' x 1.0
        FrAdj        CON      $0AA ' x 0.665
      #CASE BS2PX
        TmAdj        CON      $607 ' x 6.03
        FrAdj        CON      $2A ' x 0.166
    #ENDSELECT
    ' ------------------------------[noparse][[/noparse] CONSTANTS  2 ]-------------------------------
    LastTag    CON                    3
    SevenBit   CON                    $2000
    Inverted   CON                    $4000
    Open       CON                    $8000
    Baud       CON                    T2400
    ' ---------------------------------------[noparse][[/noparse] ]--------------------------------
    #DEFINE __No_SPRAM = ($STAMP < BS2P) ' does module have SPRAM?
    ' ------------------------------[noparse][[/noparse] Variables ]-------------------------------
     buf             VAR              Byte(10)     ' RFID bytes buffer
     tagNum          VAR              Nib          ' from EEPROM table
     idx             VAR              Byte         ' tag byte index
     char            VAR              Byte         ' character from table
    
    ' ----------------------------[noparse][[/noparse] DATA DIRECTIVES ]--------------------------
    Tag1 DATA "0F03038AA2"            ' valid tags
    Tag2 DATA "0F030299A1"            ' valid tags
    Tag3 DATA "0415AFD883"            ' valid tags
    Name0 DATA "Unauthorized    stop immediatly", CR, 0
    Name1 DATA "Randy you may proceed", CR, 0
    Name2 DATA "Stephanie you may proceed", CR, 0
    Name3 DATA "WORLD TAG", CR, 0
     
    ' -----------------------------[noparse][[/noparse] Initialization ]---------------------------
    Reset:
    SEROUT TxPin, Baud19200, [noparse][[/noparse]12]
    PAUSE 50
    HIGH Enable                      ' turn of RFID reader
    LOW Latch
    LOW Alarm                       ' lock the door!
    ' -----------------------------[noparse][[/noparse] Program Code ]-----------------------------
    Main:
          GOSUB Write_tagnum
      SEROUT TxPin, Baud19200,  [noparse][[/noparse]Lcdbloff]
      SEROUT TxPin, Baud19200, [noparse][[/noparse]12]
      PAUSE 50
      SEROUT TxPin, Baud19200, [noparse][[/noparse] "Hello,  Please  scan your RFID"]
    LOW Enable                                              ' activate the reader
    SERIN RX, T2400, [noparse][[/noparse]WAIT($0A), STR buf\10]                ' wait for hdr + ID
    HIGH Enable
    ' --------------------------[noparse][[/noparse] Subroutines Check_List ]-----------------------
    Check_List:
    
    FOR tagNum = 1 TO LastTag                 ' scan through known tags
    FOR idx = 0 TO 9                          ' scan bytes in tag
    READ (tagNum - 1 * 10 + idx), char        ' get tag data from table
     
     IF (char <> buf(idx)) THEN Bad_Char       ' compare tag to table
    NEXT
    GOTO Tag_Found                            ' all bytes match!
    ' --------------------------[noparse][[/noparse] Subroutines Bad_Char ]------------------------
    Bad_Char:                                 ' try next tag
    NEXT
    ' --------------------------[noparse][[/noparse] Subroutines Bad_Tag ]------------------------
    Bad_Tag:
    tagNum = 0
    HIGH Alarm
    GOSUB Show_Name                                   ' print message
    FREQOUT Spkr, 1000 */ TmAdj, 115 */ FrAdj         ' groan
    PAUSE 1000
    LOW Alarm
    GOTO Main
    ' --------------------------[noparse][[/noparse] Subroutines Tag_Found ]------------------------
    
    Tag_Found:
    DEBUG CLS
    DEBUG HOME
    GOSUB Show_Name                                     ' print name
    DEBUG " " , tagNum                                        ' print tag number
    HIGH Latch                                          ' remove latch
    FREQOUT Spkr, 2000 */ TmAdj, 880 */ FrAdj           ' beep
    LOW Latch                                           ' restore latch
    GOTO Main
    END
    ' ----------------------[noparse][[/noparse] Subroutines Show_Name ]-----------------------
    Show_Name:                     ' Prints name associated with RFID tag
     
    LOOKUP tagNum, [noparse][[/noparse]Name0, Name1, Name2, Name3], idx    ' point to first character
       HIGH TxPin                                ' Set pin high to be a serial port'PAUSE 100
          SEROUT TxPin, Baud19200,   [noparse][[/noparse]12]
          PAUSE 50
          SEROUT TxPin, Baud19200,  [noparse][[/noparse]LcdBLon]
          PAUSE 50
          SEROUT TxPin, Baud19200, [noparse][[/noparse]"RFID Detected"]
          PAUSE 750
          SEROUT TxPin, Baud19200,   [noparse][[/noparse]12]
          PAUSE 50
          SEROUT TxPin, Baud19200, [noparse][[/noparse]"Scanning ...."]
          PAUSE 500
          SEROUT TxPin, Baud19200, [noparse][[/noparse]12]
    DO
       SEROUT TxPin, Baud19200,  [noparse][[/noparse]LcdBLon]
      READ idx, char                          ' read character from name
        IF (char = 0) THEN EXIT               ' if 0, we're done
      SEROUT TxPin, Baud19200, [noparse][[/noparse]char]
      SEROUT TxPin, Baud19200, [noparse][[/noparse]Lcdbloff]
      DEBUG char                              ' otherwise print it
      idx = idx + 1
    LOOP
                                          ' point to next character
    RETURN
    
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-02-05 17:04
    Complete/large programs should really be attached using the Attachment manager instead of pasted into the message. It's a lot easier to load code into the editor from the original file.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
Sign In or Register to comment.