top of page

Getting Started with RFID and Arduino: Reading Values and Controlling an LED

Here’s a step-by-step guide for getting started with RFID and Arduino to read values on the Serial Monitor and control an LED

Description:

Introduction

RFID (Radio Frequency Identification) technology allows you to read data from RFID tags using an RFID reader. In this guide, we will show you how to set up an RFID reader with an Arduino to display tag information on the Serial Monitor and control an LED based on the tag read.


Materials Needed

- Arduino Uno

- RFID Reader (RC522)

- RFID Tags

- LED

- Resistor (220 ohms)

- Breadboard and jumper wires


Step 1: Wiring the RFID Reader to the Arduino


1. Connect the RFID Reader (RC522) to the Arduino as follows:

- SDA to Arduino pin 10

- SCK to Arduino pin 13

- MOSI to Arduino pin 11

- MISO to Arduino pin 12

- IRQ to Arduino pin 9 (not used in this example)

- GND to GND

- RST to Arduino pin 8

- 3.3V to 3.3V


2. Connect the LED to the Arduino:

- Connect the longer leg (anode) of the LED to a 220-ohm resistor, then to Arduino pin 7.

- Connect the shorter leg (cathode) to GND.


Step 2: Install the Required Libraries

Install the MFRC522 library:

- Open the Arduino IDE.

- Go to Sketch > Include Library > Manage Libraries.

- Search for "MFRC522" and install the library by GithubCommunity.


Step 3: Upload the Code to the Arduino

1. Open the Arduino IDE and create a new sketch.

2. Copy and paste the following code:

3. Replace `"XX XX XX XX"` in the code with the UID of your RFID tag. To find your tag's UID, upload the code first, open the Serial Monitor, and place your RFID tag near the reader. The UID will be displayed on the Serial Monitor.

4. Upload the modified code to your Arduino.


Step 4: Test the Setup

1. Open the Serial Monitor:

- Make sure the baud rate is set to 9600.

2. Place your RFID tag near the reader:

- Observe the UID printed on the Serial Monitor.

- If the UID matches the specified UID in the code, the LED should turn on for 3 seconds.

- If the UID does not match, the Serial Monitor will display "Unauthorized access."

Project Gallery

All Documents :

Download the below code and explore with RFID Sensor.

Click Here to Download

Video Tutorial :

Conclusion :

You have now successfully set up an RFID reader with an Arduino to read tag values and control an LED. This basic project can be extended to various applications, such as access control systems, inventory management, and more. Explore additional projects and expand your skills with Skill-Hub by EmbeddedBrew.

Comments

Share Your ThoughtsBe the first to write a comment.
bottom of page