Shop OBEX P1 Docs P2 Docs Learn Events
3.- Electric Lock Controlled by a Bs2 And a RFiD TAG — Parallax Forums

3.- Electric Lock Controlled by a Bs2 And a RFiD TAG

GotenGoten Posts: 70
edited 2006-02-19 19:40 in Robotics
Name: Cancerberus

Description: Just open a door, with an electric 12 V lock, with a Basic Stamp and the RFID Parallax Module, using just 2 tags. i know that isn't a awesome project for you, but maybe it could help someone, the electric system could be change it if you need·a different voltage

Files Attached:·Board Diagram, Sample Picture

The Algorithm is the same of the Parallax Official but i changed the speaker frequency and the tags Username.

'
[noparse][[/noparse] I/O Definitions ]
Enable········· PIN···· 0······················ ' low = reader on
RX············· PIN···· 1······················ ' serial from reader
Spkr··········· PIN···· 2······················ ' speaker output
Latch·········· PIN···· 15······················ ' lock/latch control

'
[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
SevenBit······· CON···· $2000
Inverted······· CON···· $4000
Open··········· CON···· $8000
Baud··········· CON···· T2400

#SELECT $STAMP
· #CASE BS2, BS2E
··· TmAdj······ CON···· $100··················· ' x 1.0 (time adjust)
··· FrAdj······ CON···· $100··················· ' x 1.0 (freq adjust)
· #CASE BS2SX
··· TmAdj······ CON···· $280··················· ' x 2.5
··· FrAdj······ CON···· $066··················· ' x 0.4
· #CASE BS2P
··· TmAdj······ 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

LastTag········ CON···· 3

#DEFINE __No_SPRAM = ($STAMP < BS2P)··········· ' does module have SPRAM?

'
[noparse][[/noparse] Variables ]
#IF __No_SPRAM #THEN
· buf·········· VAR···· Byte(10)··············· ' RFID bytes buffer
#ELSE
· chkChar······ VAR···· Byte··················· ' character to test
#ENDIF
tagNum········· VAR···· Nib···················· ' from EEPROM table
idx············ VAR···· Byte··················· ' tag byte index
char··········· VAR···· Byte··················· ' character from table
' x·············· VAR···· Word
'
[noparse][[/noparse] EEPROM Data ]
Tag1··········· DATA··· "0F027D7115"··········· ' valid tags
Tag2··········· DATA··· "0F01D9D263"
Tag3··········· DATA··· "04129C1B43"
Name0·········· DATA··· "Access Denied", CR, 0
Name1·········· DATA··· "Welcome Mr. Goten", CR, 0
Name2·········· DATA··· "Welcome", CR, 0
Name3·········· DATA··· "Mary Evans", CR, 0

'
[noparse][[/noparse] Initialization ]

Reset:
· HIGH Enable·································· ' turn of RFID reader
· LOW Latch···································· ' lock the door!
· '
[noparse][[/noparse] Program Code ]
Main:
· LOW Enable··································· ' activate the reader
· #IF __No_SPRAM #THEN
··· SERIN RX, T2400, [noparse][[/noparse]WAIT($0A), STR buf\10]··· ' wait for hdr + ID
· #ELSE
··· SERIN RX, T2400, [noparse][[/noparse]WAIT($0A), SPSTR 10]
· #ENDIF
· HIGH Enable·································· ' deactivate reader
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 __No_SPRAM #THEN
······· IF (char <> buf(idx)) THEN Bad_Char···· ' compare tag to table
····· #ELSE
······· GET idx, chkChar······················· ' read char from SPRAM
······· IF (char <> chkChar) THEN Bad_Char····· ' compare to table
····· #ENDIF
··· NEXT
··· GOTO Tag_Found····························· ' all bytes match!
Bad_Char:······································ ' try next tag
· NEXT
Bad_Tag:
· tagNum = 0
· GOSUB Show_Name······························ ' print message
· FREQOUT Spkr, 200 */ TmAdj, 5500 */ FrAdj···· ' groan
· PAUSE 1000
· GOTO Main
Tag_Found:
· GOSUB Show_Name······························ ' print name
· HIGH Latch··································· ' remove latch
· FREQOUT Spkr, 100 */ TmAdj, 7000 */ FrAdj···· ' beep
· LOW Latch···································· ' restore latch
· GOTO Main
· END

'
[noparse][[/noparse] Subroutines ]
' Prints name associated with RFID tag
Show_Name:
· DEBUG DEC tagNum, ": "
· LOOKUP tagNum,
········ [noparse][[/noparse]Name0, Name1, Name2, Name3], idx····· ' point to first character
· DO
··· READ idx, char····························· ' read character from name
··· IF (char = 0) THEN EXIT···················· ' if 0, we're done
··· DEBUG char································· ' otherwise print it
··· idx = idx + 1······························ ' point to next character
· LOOP
· RETURN



PS: THANX TO JOHN AND EVERYONE ON THIS FORUM THAT HELPS ME

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Best Regards from Chile

Goten

chilebot3.jpg

Envio editado por (Goten) : 2/20/2006 12:15:26 PM GMT
710 x 439 - 24K

Comments

  • GotenGoten Posts: 70
    edited 2006-02-18 04:59
    files

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Best Regards from Chile

    Goten

    chilebot3.jpg
    710 x 439 - 24K
    634 x 346 - 38K
    720 x 480 - 324K
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2006-02-19 19:40

    HI EveryOne

    Description

    I did a project like this·for my·Garage Door so i did not have to open the car door when i want to be
    out side·doing yard work or taking the bike out for a ride
    ·I put a round card on a BIG RING with all the keys on it

    Tag_Found:
    · GOSUB Show_Name······························ ' print name
    · HIGH Relay
    · PAUSE 500···································· 'Relay to activace door switch
    · LOW Relay
    · PAUSE 3000···································· ' This pause is so that the door switch is not
    · GOTO Main····································· ' activace or the door will go back up or down


    This is the rutine that i wrote so the door switch was not activace so the door would not go up then
    down while you had the card on the reader
    Last two pictures where for a project where i used a ping sensor to know if my··Garage Door· was open or
    closed from in side the house
    http://forums.parallax.com/showthread.php?p=539835

    I thought i would share these project so that if some one was think of doing something like this that
    could have some ·idea.gif·on how it could be done one thing on the card reader box i took the leds that where
    on it and used some very small leds that had the same milamp rating as the ones on the board and hot glued the leds in place the electrial boxs where from ether Home Depot or Lowe's but you have to use the
    the one that fits the BS2 OEM Board there two boxs that cary they look a like but one is about an inch longer in depth then the other box so take the BS2 OEM board with you try to get one

    ·On the BS2 OEM Board· boxs I have a power led and a led that i put on the same leads that the relay
    leads are with a·560 ohm·resistor for the led for 12 volts power supply

    Sam



    Post Edited (sam_sam_sam) : 2/19/2006 8:37:15 PM GMT
    480 x 640 - 57K
    640 x 480 - 54K
    640 x 480 - 63K
    640 x 480 - 60K
Sign In or Register to comment.