Home > Industry Application >Security Aviation Circuits > How to use MFRC522 to create an RFID card reader security system

How to use MFRC522 to create an RFID card reader security system

Source: InternetPublisher:supremeOne Keywords: RFID MFRC522 Updated: 2024/08/23

    Have you ever thought about adding an RFID tag security system or surveillance system to your home or office? Well, if you've made it this far, you've probably checked before, and they range in price from $200 to $2,000. That's a bit too expensive!

    So I decided to build a system with a friend for less than $100 that can do more than just open a door. This is the project we came up with. An internet-enabled Arduino rfid tag reader. Just spend $20 more on the basics to open the door automatically.

    prototype:

    You might think this might take a long time, however this only took me about 6 hours (because I had power issues), but this might take you about 30 minutes to set up, just like the example above. It's all there below, so if you get confused in the next steps, keep checking it out.

    Here are all the steps:

    Before we begin (essential)

    Before we start scanning cards and sending them to our Telnet/TCP server we need some libraries get UIPEthernet here https://github.com/ntruchsess/arduino_uip

    Get the MFRC522 here: https://github.com/miguelbalboa/rfid

    Put these two libraries into Program Files (x86)/Arduino/Libraries/ Restart arduino

hardware

    Arduino Nano (you can always modify the code to fit your device)

    MFRC522 with MAIFARE card

    Jumper wires (male to male) (male to female)

    enc28j60 Ethernet module/shield

    RGB LED

    3V or 5V AC-DC converter with >700 mil amperes

    set up

    Connect the arduino to the breadboard (if it is a nano or micro)

    Look up your board's pinout online to find the SPI settings (change the values ​​below)

    Connect arduino pin 10 (SS) to ethernet module ss or CS

    Connect arduino pin 12 (MISO) to rfid MISO and ethernet SO

    Connect arduino pin 11 (MOSI) to rfid MOSI and ethernet SI

    Connect arduino pin 13 (SCK) to rfid SCK and ethernet SCK

    Connect arduino pin 9 to rfid RST pin

    Connect arduino pin 8 to rfid SSN

    Connect arduino pin 5 to green led, 4 to blue and 3 to red

    Connect AC to DC to the + and - on the breadboard

    Connect your arduino ground to AC to DC

    Connect VCC and GND on the rfid and ethernet to ac-dc (remember these devices are only 3v! do not supply 5v) if you have problems use a resistor to raise the voltage to 3v

    Connect the VCC pin on the LED to the arduino 3v or ac-dc 3v

    Connect an Ethernet cable to the module and make sure it is on the same network as your computer

    Plug the USB cable from your computer to the arduino

    Connect your computers to the same network

    Modify the code to suit your needs

    The code is well commented so you can go in and modify certain parts, but the ehternet module is definitely the best choice.

    The Mac address can remain the same (unless you plan to build more than one)

    If you are using 192.168. Basic ip network you can keep ip

    Again you can keep the dns, the only change is to 8.8.4.4

    Run ipconfig to find your gateway, the default is 192.168.1.1 if you don't know it (currently it's 192.168.1.5)

    Run command prompt and type ipconfig to find out your computer's IP address

    Scroll down to find Send to Server and enter your computer's ip, or if you have port forwarding your router to your public ip address

    Make sure you have Python and a server running (remember this is just sample code we use for demonstrations to schools, so the python server is pre-made and requires little modification, you can use any Telnet/TCP server)

    Other code you may need to modify:

    Run the code

    Plug the AC-DC power supply into the wall

    Make sure your arduino is currently connected to your computer

    Make sure both devices are on the same network

    Flash your modified arduino code or if the one I worked for you is fine (there is almost no chance that you have to modify it)

    Launch your Python, C++ script or any Telnet/TCP server on the network

    Reboot your arduino to be safe

    Wait until the light turns blue and try to scan the card, if your server gets the ID of the card then you are good to go

    Remember the meaning of the indicator light Purple/light red means it is starting

    Red indicates any errors, such as the card being at a weird angle and/or the server not responding in a timely manner

    Green means passed, so the server responded with a pass and you can read the next card

    Blue means waiting/loading waiting for a card or response

    If your arduino starts to lag and takes more than 30 seconds to show the red light, it means that the arduino ethernet module is simply not able to connect to the server. This could be caused by a number of reasons, firstly your arduino does not have enough power and the arduino ethernet module is struggling to send packets, or your computer server is not running, or your arduino and computer are not on the same network.

    If your Arduino keeps lagging, try these tips to fix them

    Turn off Windows Firewall

    Go into Advanced Firewall settings and allow inbound/outbound port 23

    Use port 23 to forward your router to your computer

    If you are connecting arduino wirelessly connect it directly to the router and your computer to the same

    Purchase a more durable AC-DC power adapter. Otherwise, you may have entered the wrong IP address or connection address.

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号