RFID based electronic lock using pic microcontroller

This project is about RFID based electronic lock using pic microcontroller. RFID tags are used to open and close electronic lock.  Only those users who have authentic RFID tag will be able to open lock by using their assigned RFID tags or cards. In this RFID based electronic lock, RFID module is interfaced with pic microcontroller. RFID receiver used to receive tag number through radio frequency communication and RFID receiver sends this received number through serial communication to microcontroller. Radio Frequency Identification Lock is an electronic locking system that uses automatic locking mechanism using a mobile specific Radio wave of fixed frequency to unlock a locking mechanism. It serves both as a locking and identification system.

 RFID based electronic lock project objectives

  1. Locking/ Unlocking mechanism for electronic lock through microcontroller
  2. Radio Frequency Identification utilizing programmed microcontroller
  3. Locking/ Unlocking of electronic lock using RF

Components of RFID based electronic lock

  • Isolated Circuit to Power the lock:  Isolated 5 volt power supply is used to power microcontroller and RFID module.
  • Pic Microcontroller & support devices: PIC microcontroller is used in this project to receive data from RFID receiver and relay is interfaced with pic microcontroller to drive high power electronic lock. LCD interfacing is also done to display status of of card.
  • RF ID module (transmitter & receiver)
  • Electronic lock

Block diagram of RFID based electronic lock

Block diagram of RFID module is shown below. All components of this block diagram have explained very clearly above.

Block diagram of RFID based electronic lock

 RFID based electronic lock using pic microcontroller

Circuit diagram of RFID based electronic lock is shown below. As you can see, we have interface a relay with microcontoller through a transistor. Relay interfacing can also done using relay driver IC instead of transistor. Relay is used because microcontroller can not provide enough current to drive relay and electronic lock.

RFID based Electronic Lock using pic microcontroller

The module receives the Radio Frequency from the RFID chip and sends out the data character by character to the PIC18 uC which compares the RFID with the pre-set value burnt in the microcontroller. The subsequent module consists of an electronically controlled locking system that is configured to the output port of the microcontroller. If the scanned RF ID matches the preset RFID code, it triggers the output Port and unlocks the locking mechanism. In case the RFID does not match, no output is generated at the output port and the system stays locked.

We used a transistor and relay to amplify the signal output from our micro-controller to ensure we had enough volts and current to power our lock.Some of the technical and mechanical issues faced included the sending of junk value from the tag to the rdm module if the scanning time of the radio frequency tag was elongated. This caused the string to mismatch and as a result access was blocked by the system. One mechanical issue involved the fabrication of the lock which was out of the scope for this project and we had to buy it off the shelf which was not specifically designed for this project.The future course of work includes the use of wireless communication “to” and “fro” from this system which cannot only help communicate and send information wirelessly to android app using the web server but can also be used to raise alarm in the nearest police station in case of severe breach of security.

Code of RFID based electronic lock

After initialization of the LCD and UART, we create an rfid array that can store 3 elements in it. We assign PORTD as output, where our electronic lock is physically attached. Through an If condition, we check if UART1_Data_Ready() is high i.e. if UART is ready to send data. When it is high, we read the data and store the elements into the rfid array. Through a subsequent if condition, we check if our stored ID is in the rfid array. PORTD is momentarily set high to enable the lock and access is granted. But to ensure that it closes soon after and an intruder cannot enter, it is set to low after a short delay. For the other cards that are not stored in the array, the lock does not open and access is denied. Array is cleared at the end.

This is all about RFID based electronic lock using pic microcontroller. I have explained all the thing you need to make this project. But if you are interested in purchasing code of this project , you can contact us.

3 thoughts on “RFID based electronic lock using pic microcontroller”

Leave a Comment