make your own secure diy rfid door lock system

How RFID Door Lock Works With PN532 And D1 Mini

It is easy to bypass most ready-made smart RFID locks. Here’s how you can safely build one you can trust.


RFID-based door access control is nothing new. There are many RFID based systems available in the market that you can install for secure access. However, you can unlock most RFID door lock systems with a paperclip because the ignition key is located inside the unit installed outside the door.


So let’s instead build a completely secure RFID-based door access control system using the ESP8266 and a PN532 RFID/NFC module that can be combined with your existing electronic lock. Once installed, you can unlock your door with a registered RFID card/card or a smartphone.


Things you will need

To build an RFID-based secure door access control system, you will need the following:

  • WeMos D1 Mini. You can also use NodeMCU.
  • Single channel relay unit.
  • Micro USB cable.
  • DuPont or Female to Female Jumper Wires.
  • Female berg strip.
  • PN532 RFID/NFC Module. You can also use MFRC522. Wiegand or RDM6300 RFID sensor. We are using the PN532 because it is smaller in size and offers a good scanning range.
  • Soldering iron and tin.

Flash Firmware to D1 Mini

We will use a file ESP-RFID Project On GitHub to build a DIY RFID Door Access Control System. Follow these steps to download and flash the ESP-RFID firmware to your D1 Mini or NodeMCU.

  1. Download esp-rfid-1.0.2.zip File and extract folder on your desktop. Contains some program files, including general Firmware file. Optionally, you can also download the latest Version 1.3.3 Unstable build.
  2. Download and run a file ESPHomeFlasher a tool.
  3. Using a Micro USB cable, connect the D1 Mini or NodeMCU to your computer.
  4. In the ESPHome Flasher tool, click on the update icon and choose the COM port where the D1 Mini is connected.
  5. tap on browse button and choose general The file we extracted in step 1.

  6. click ESP . flash.

  7. This will take a few seconds to complete. Configure RFID Settings

Configure RFID Settings

Once the firmware is flashed, reconnect the USB cable to the D1 Mini and follow these steps to configure the RFID settings:

  1. In the Wi-Fi settings of your smartphone, find a file ESP-RFID-xxxx entry point. It is an open access point, so it does not require a password to connect.
  2. Once connected, turn off mobile data on your Android and iOS smartphone, then open a web browser.
  3. Visit the IP 192.168.4.1and enter the password supervisor to log in.
  4. click food menu > hardware Settings And choose the following options from the relevant drop-down lists:
    1. Choose PN532 From reader type.
    2. Choose GPIO-2 From SPI SS.
    3. Keep everything default and click Memorizes
  5. go to the Menu > Settings > General Settings
  6. change the admin password from default supervisor for something complicated. This is a critical step and you should use a long and complex password to protect devices from unauthorized access.
  7. You can also edit a file hostname And choose if you want the device restart the car Every 24 hours, 7 days or 30 days.
  8. go to the food menu > wireless network Then enter a complex password to secure the access point. Again, use a strong password to prevent unauthorized access.

  9. You can also choose a file client option and connect the device to a wireless network.
  10. click Memorizes Then click Highlighted text in yellow Color at the bottom of the screen.
  11. click Save and restart.

  12. The device will restart.

Connect the RFID Sensor to the D1 Mini

Disconnect the USB cable from the D1 Mini or NodeMCU. Refer to the following table and diagram to connect the PN532 RFID/NFC Sensor and Relay Module to a D1 Mini or NodeMCU board.

NodeMcu / WeMos D1 mini pins PN532 . pins paging unit
D8 (GPIO-15) SS
D7 (GPIO-13) MOSI
D6 (GPIO-12) miso
D5 (GPIO-14) SCK
D4 (GPIO-2) Input
Vin/5V VCC VCC
J GND a land

Use DuPont wires or Berg Strips to connect or solder the D1 Mini or NodeMCU pins to the PN532 and the relay module. If you’ve never soldered a connection before, learn how to solder wires and electronics.

Ensure that SPI is enabled on the PN532 by moving the DIP switch to positions 0 and 1 as shown below.

Once the RFID module is connected to your NodeMCU or WeMos D1 Mini, you can start scanning the RFID card to register and add users to allow/disallow access.

Add RFID Cards / Users

After connecting the PN532 module to your D1 Mini or NodeMCU, follow these steps to add and register users’ RFID cards or tags.

  1. Connect a USB power supply to Wemos D1 Mini or NodeMUC.
  2. Go to your……. Wi-Fi settings And contact esp-rfid entry point Using the password you set up under wireless network Settings.
  3. visit 192.168.4.1 IP address.
  4. click food menu > Users.
  5. Take an RFID tag or tag and place it in front of or near the PN532 RFID/NFC sensor. you will see new Add a new user Model with scanned RFID tag ID.
  6. Write the name of the person to whom the card or tag belongs.
  7. Choose Access type. You can choose between always, disabled, or boss. You must add one admin card (yourself).

  8. Choose valid until History even when you want to allow or disable user access.
  9. click Saving changes To save user details.

Open the door using the web interface

Once you have added and saved your users’ RFID cards, you can scan them against the PN532 sensor. Scan cards with Access type: Always or boss It will trigger the connected relay unit. You can connect the wires of the electronic door lock power supply switch to this relay unit to operate the lock and unlock the door.

Below is a wiring diagram you can refer to for wiring the electronic door lock actuator switch.

RFID door access control lock

Unlike RFID door access control systems on the market that can be opened easily and have no user interface, DIY RFID door lock system is Wi-Fi, smart and provides an intuitive user interface to manage users and revoke their access at any time.

If you connect the DIY RFID module to your Wi-Fi, you can access it on your network through the IP address assigned by your router. You can set a static IP for this device and open the door by logging into the web interface and clicking a test button under Device Settings. You can use a LAN cable or any 6-wire cable to disconnect the PN532 and D1 Mini or NodeMCU to prevent unauthorized access and secure the door lock.

#RFID #Door #Lock #Works #PN532 #Mini

Leave a Comment

Your email address will not be published. Required fields are marked *