How to Make an RFID Door Lock With a PN532 and D1 Mini

2022-10-09 04:51:21 By : Mr. Michael Ma

Most off-the-shelf RFID smart locks are easy to bypass. Here's how you can build one with security you can trust.

RFID-based door access control is not new. There are several RFID-based systems available in the market that you can install for secure access. However, you can unlock most of the RFID door lock systems using a paper clip since the trigger switch is located within the module installed outside the door.

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

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

We will use the ESP-RFID project on GitHub to build our DIY RFID door access control system. Follow these steps to download and flash the ESP-RFID firmware on your D1 Mini or NodeMCU.

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

Disconnect the USB cable from D1 Mini or NodeMCU. Refer to the following table and diagram to connect the PN532 RFID/NFC sensor and the relay module to the D1 Mini or NodeMCU board.

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

Make sure to enable SPI protocol on PN532 by moving the DIP switch to 0 and 1 positions 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.

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

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

Here’s a connection diagram you can refer to for connecting the electronic door lock trigger switch wires.

Unlike RFID door access control systems available in the market that can be easily unlocked and have no UI, this DIY RFID door lock system is Wi-Fi enabled, smart, and offers an intuitive UI to manage users and revoke their access anytime.

If you connect the DIY RFID module to your Wi-Fi network, you can access it on your network through IP address assigned by your router. You can assign static IP to this device and unlock the door by login into the web interface and clicking on the Test button under the Hardware Settings. You can use a LAN cable or any cable with 6-wires to separate the PN532 and the D1 Mini or NodeMCU relay module to prevent unauthorized access and secure your door lock.

Ravi is an expert tech explainer, an IoT enthusiast and Linux lover with a background in big data and app development. He spends most of his weekends working with IoT devices and playing games on the Xbox. He is also a solo traveler who loves hiking and exploring new trails.

Join our newsletter for tech tips, reviews, free ebooks, and exclusive deals!