Maker.io main logo

Build Arduino RFID Door Lock With Visual Programming (Visuino + MFRC522)

2025-10-08 | By Ron Cutts

License: General Public License Magnetic Magnetic / Reed RFID / NFC Arduino

 

This tutorial shows how to connect the MFRC522 RFID module, check RFID card IDs, and control a magnetic solenoid lock. When a valid RFID card is detected, the door unlocks and a green LED lights up as a visual confirmation. Swipe the same card again to lock the door. Unauthorized cards are denied access.

🔹 What you’ll learn:

  1. Wiring and configuring MFRC522 with Arduino

  2. Using Visual Programming in Visuino to detect RFID card UIDs

  3. Checking IDs against an authorized list (access control)

  4. Controlling a solenoid lock with Arduino + Visuino

  5. Adding a green LED indicator for successful unlock

  6. Implementing re-swipe toggle logic (lock again)

🔹 Hardware Required:

  1. Arduino board (Uno, Nano, Mega, or compatible)

  2. MFRC522 RFID module + RFID tags/cards

  3. Magnetic solenoid lock (or electric strike) with driver (relay/MOSFET)

  4. Green LED + resistor (for unlock indication)

  5. External power supply for solenoid

  6. Breadboard, jumper wires, optional buzzer

🔹 Why this project is great:

  1. No coding — 100% Visual Programming with Visuino

  2. Beginner-friendly but practical for smart home security

  3. Includes both lock control and LED feedback for a clear status

Watch the Video!

Step 1: What You Will Need

What You Will Need

What You Will Need

What You Will Need

What You Will Need

What You Will Need

What You Will Need

What You Will Need

What You Will Need

What You Will Need

  1. RFID module MFRC522

  2. Electromagnetic solenoid lock DC 12V

  3. Power Supply

  4. Relay module

  5. Some RFID cards for the test

  6. LED

  7. 1K ohm resistor

  8. Arduino UNO

  9. Jumper wires

  10. Breadboard

  11. Visuino program: Download here

Step 2: The Circuit

The Circuit

  1. Connect RFID module pin[SDA] to Arduino digital pin[10]

  2. Connect RFID module pin[SCK] to Arduino digital pin[13]

  3. Connect RFID module pin[MOSI] to Arduino digital pin[11]

  4. Connect RFID module pin[MISO] to Arduino digital pin[12]

  5. Connect RFID module pin[GND] to Arduino pin[GND]

  6. Connect RFID module pin[RST] to Arduino digital pin[9]

  7. Connect RFID module pin[3.3v] to Arduino pin[3.3v]

  1. Connect Arduino digital pin [3] to the 1K ohm resistor

  2. Connect the 1K ohm resistor to the LED positive pin (+)

  3. Connect the LED negative pin (-) to the Arduino Pin GND

  1. Connect Relay VCC pin(+) to Arduino 5V pin

  2. Connect Relay GND pin(-) to Arduino GND pin

  3. Connect Relay signal pin(S) to Arduino Digital pin 2

  4. Connect power supply 12V (+) to Electromagnetic lock red wire(+)

  5. Connect power supply 12V (-) to relay pin(com)

  6. Connect Electromagnetic lock black wire (-) to relay pin(NO)

Step 3: Start Visuino, and Select the Arduino UNO Board Type

Start Visuino, and Select the Arduino UNO Board Type

Start Visuino, and Select the Arduino UNO Board Type

Start Visuino as shown in the first picture. Click on the "Tools" button on the Arduino component (Picture 1) in Visuino. When the dialog appears, select "Arduino UNO" as shown in Picture 2

Step 4: In Visuino, Add Components

In Visuino Add Components

In Visuino Add Components

In Visuino Add Components

In Visuino Add Components

In Visuino Add Components

In Visuino Add Components

In Visuino Add Components

  1. Add "RFID MFRC522/WS1850S (SPI)" component

  2. Add "Binary To Text" component

  3. Add "Text Multi Source" component

  4. Add "Text Value" component

  5. Add "Find Text Position" component

  6. Add "Delay" component

  7. Add "Toggle(T) Flip-Flop" component

Step 5: In Visuino Set Components

In Visuino Set Components

In Visuino Set Components

In Visuino Set Components

In Visuino Set Components

Select "BinaryToText1" and in the properties window set "Begin Text", "End Text", and "Separator Text" to empty

Select "TextValue1" and in the properties select "Value", click on the 3 dots button, and in the Value window set your card IDs

Select "FindPosition1" and in the properties window select "Text", click on the pin icon and select "String SinkPin"

Select "Delay1" and in the properties window set "Interval" to 500000 (0.5s). You can adjust this value according to your needs. In this project, it is used to add a small delay in reading the RFID tag to prevent double reading when you swipe the tag.

Step 6: In Visuino Connect Components

imageimage

  1. Connect (Byte) from RFID1.Card.ID OutputPin to BinaryToText1.InputPin

  2. Connect (Digital Output Pin) from RFID1.ChipSelect OutputPin to Arduino.Digital.Digital[ 10 ].DigitalInputPin

  3. Connect (SPI Communication) from RFID1.Interface OutputPin to Arduino.SPIChannels.SPI.InputPin

  4. Connect (Digital Output Pin) from RFID1. Reset OutputPin to Arduino.Digital.Digital[ 9 ].DigitalInputPin

  1. Connect (Sting) from BinaryToText1.OutputPin to MultiSource1.InputPin

  2. Connect (Sting) from MultiSource1.OutputPins.Pin [0] to FindPosition1.Text

  3. Connect (Clock) from MultiSource1.OutputPins.Pin [1] to TextValue1.Clock InputPin

  4. Connect (Sting) from TextValue1.OutputPin to FindPosition1.InputPin

  1. Connect (Clock) from FindPosition1.OutputPin to Delay1.Start InputPin

  2. Connect (Clock) from FindPosition1.Missing OutputPin to TFlipFlop1.Reset InputPin

  3. Connect (Clock) from Delay1.OutputPin to TFlipFlop1 ClockInputPin

  4. Connect TFlipFlop1.OutputPin to MultiSource2.InputPin

  5. Connect MultiSource2.OutputPins.Pin [0] to Arduino.Digital.Digital[ 2 ].DigitalInputPin

  6. Connect MultiSource2.OutputPins.Pin [1] to Arduino.Digital.Digital[ 3 ].DigitalInputPin

Step 7: Generate, Compile, and Upload the Arduino Code

Generate, Compile, and Upload the Arduino Code

In Visuino, at the bottom, click on the "Build" Tab, make sure the correct port is selected, then click on the "Compile/Build and Upload" button.

Step 8: Play

Congratulations! You have completed your project with Visuino. Also attached is the Visuino project that I created for this. You can download it and open it in Visuino: https://www.visuino.eu

Download Visuino File: RFID-Lock.visuino

Mfr Part # 5065
SMALL LOCK-STYLE SOLENOID - 12VD
Adafruit Industries LLC
Mfr Part # A000066
ARDUINO UNO R3 ATMEGA328P BOARD
Arduino
$226.62
View More Details
Add all DigiKey Parts to Cart
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.