RFID Security System

Tips, Tricks and methods for programming, learn ways of making your programming life easier, and share your knowledge with others.

Moderators: Benj, Mods

Post Reply
User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

RFID Security System

Post by JohnCrow »

RFID Card Entry Security System

Introduction.
This is a card entry security system using I-Code RFID Cards.

I have a selection of 4 different card, each with different UIDs. Three of these have been programmed to be accepted by the system and the 4th is unrecognised and so will trigger the alarm
I have given the cards a number 1 to 4.
(Not actually programmed into them, just written on the card).

Part 1 Card Test System.

This is a simple program to read the first 8 UID bytes and display them on and LCD display.
This will allow the main system to be programmed with the correct values to match the cards in use.

However, only the first 4 bytes are used on the system.
The flowchart has been modified from an example flowchart on the Matrix website.

Equipment.

EB006V9 Programmer Fitted With 16F1937 PIC.
(Also been tested with a 16F877A PIC)

EB-004 LED E-Block.
EB-005 LCD E-Block
EB-052 RFID E-Block.
HP459 I –Code Cards.

Connections.

Port A Custom LCD Display.
Port B LED E-Block.
Port C RFID E-Block.
CTS = C4
TX = C6
RX = C7

Flowchart Description.

When the I-Code Card is presented to the coil on the RFID reader

The Get_RFID_UID macro reads the 8 byte UID of the card is read to memory.

Each separate byte can then be read by the Read_RFID_UID macro.
The required value is selected by use of an array i.e. Value = UID[3].

The LED E-block shows the following status lights.

Bit 7 = Reader Present
Bit 2 = Transponder Communication OK
Bit 1 = Transponder UID Accepted.
CardTest.JPG
CardTest.JPG (62.05 KiB) Viewed 6940 times
I_Code Reader Small_Display.fcfx
(9.34 KiB) Downloaded 555 times

Part 2 Security System

Equipment.

EB006V9 Programmer. Fitted with 16F1937 PIC
EB-004 LED E-Block.
EB-014 Keypad E-Block.
EB-052 RFID E-Block.
HP459 I –Code Cards.

Custom 4 x 20 LCD Display
Custom DS3132 RTC Board With Alarm Buzzer

Connections.

Port A Custom LCD Display.
Port B LED E-Block.
Port C RFID E-Block.
CTS = C4
TX = C6
RX = C7

Port D Keypad E-Block.
Port E Real Time Clock & Buzzer.
SDA = E0
SCL = E1
Buzzer = E2


I-Code Card UIDs

The I-code cards used have the following UID when reading the first 4 bytes.

Card 1 = 185 206 161 31 Valid
Card2 = 54 176 161 31 Valid
Card3 = 206 177 161 31 Valid
Card 4 = 208 186 161 31 Not-Valid

Flowchart Description.

Before main loop setup hardware.

Initialise LCD Display
Initialise RFID Board
Initialise RTC Board

The flowchart then drops into the main loop.

Read and display the date and time on line 3 of the display.

Display Door Locked – Insert Card.
Program will then wait until a card has been placed on the RFID reader.

When a card is placed on the reader, the GetRFIDUID function, will return the status value(134)

Using the ReadRFIDUID function The 4 bytes will then be read as UID[0], UID[1], UID[2] & UID[3].

These are the compared with the data for the 3 valid cards stored in memory.

If the card is unrecognised an “Unauthorised Card” message will be shown and an alarm will sound.

The system will then ask for a reset code (222).
If the wrong code is entered it loops until the correct code is entered.

If the card is recognised, it will show “Card Accepted” and ask for a password (123).

If the password is accepted the card UIDs are checked again.

A welcome message will then show the card owners name.

The door is unlocked. LED Port B 0 turns on to show this.
(This would normally be a relay or solenoid)
There is then a 5 second delay to open the door.
The display will show a countdown timer.

Then after 5 seconds the display will show a “Door Locking” message.

The door will relock. LED Port B 0 turns off to show this.
The timer is only approximate, and does not take system overheads into account.

If the password is incorrect an alarm will sound, and the system will ask for a reset code. (147)
If the wrong code is entered it loops until the correct code is entered.

All 3 password/reset code entries use the same entry subroutine stored as a separate macro “Code Entry” (Described below).

With all the alarm signals, once the correct reset code has been entered, the alarm will reset and the system go back to the initial standby display of “Door Locked – Insert card”.
Main Board
Main Board
MainBoard.JPG (91.13 KiB) Viewed 6940 times
]
RTC Board
RTC Board
RTC_Board.JPG (156.96 KiB) Viewed 6940 times
Main Display
Main Display
Display.JPG (62.75 KiB) Viewed 6940 times
I-Code Door Entry Alarm_V1.fcfx
Door Entry ProgramV1
(34.54 KiB) Downloaded 580 times
1 in 10 people understand binary, the other one doesn't !

User avatar
Steve001
Valued Contributor
Valued Contributor
Posts: 1189
Joined: Wed Dec 31, 2008 3:37 pm
Has thanked: 460 times
Been thanked: 523 times
Contact:

Re: RFID Security System

Post by Steve001 »

another fantastic project john

I was working on something similar but haven't got round to finishing it :( not enough hours in a day or days in the week :lol:

Steve
Success always occurs in private and failure in full view.

Post Reply