How to Scan RFID Tags with Arduino!

LeMaster Tech
182 followers
3 Video Views·Apr 20, 2025
In this video I show you how to scan RFID components using an arduino using an MFCR522 RFID chip!
Thank you to PCBWay for sponsoring this video, check them out here: https://pcbway.com/g/2Zlh7L
The RFID Scanning kit I used in this video can be found here: https://amzn.to/3CoW2xd
And the code can be found here: https://github.com/plemaster01/ArduinoRFIDScan
Love the channel? Considering become a supporter on Patreon! https://pcbway.com/g/2Zlh7L
Thank you for watching and don't forget to leave a like on the video and subscribe the channel!
welcome back to the Master Tech and in
today's video I'm going to show you how
to read RFID scans from components like
key cards and key fobs using a
microcontroller like an Arduino or a
Raspberry
[Music]
Pi so the core functionality in this
project is obviously RFID which stands
for radio frequency identification and
there are so many little sub
technologies that we deep dive around
the world of RFID Communications this
will be a practical video on how to use
RFID scanning for an Arduino or a
comparable microcontroller project but
for today's video all you really need to
know about how an RFID Loop works is
that there is a master or a powered
active component that is sort of going
out and emitting a radio frequency and
looking for nearby devices to scan and
for this application that'll be this
standard mfrc 522 RFID scanning
component it uses a very simple 8 Pin
pinout which is very standard for RFID
scanners and then passive components
things that don't require power because
they have an RF signature an RF id but
they're not powered because all they
need to be is near an active component
that's able to scan them like this key
fob or this key card so if you
understand the difference between active
and passive you know enough about RFID
that you can use it for this project the
eight pins I previously mentioned are
built around around serial peripheral
Communications usually abbreviated SPI
and in our application it's 3.3 volts
and ground for the power Loop and then
SDA which is serial data sck which is
serial clock miso which is Master in
slave out and M oi which is Master out
slave in then irq which means interrupt
request and rst which means reset you
can find little variations on these pins
some use uh slave select or chip select
as well um but we're not going to worry
about that today it is worth mentioning
and calling out now that the majority of
the kits and scanners that I saw that
are Arduino compatible don't come with
the pins soldered on so I know some
folks uh have found my videos before and
they mentioned that I never said
anything about you having to solder if
you use the exact kits that I use in
this video you will need to solder your
components so if you don't want to do
that just make sure you look for a
similar kit that comes with the pins
already attached now let's take a look
at the physical wiring for our project
the piece that you actually need to know
about our physical connections here is
we want to take 3.3 volts and ground
from the scanner to the same pins on the
Arduino then I'm going to use pins 9 10
11 12 and 13 for the rest of the
connections N9 for reset 10 for SDA 11
for MOSI 12 for miso and 13 forck in
this application we don't need the irq
pin so don't worry about that one and
those physical hookups to an Arduino is
all we need to get the RFID scanner
working I'm going to add a breadboard
with six LEDs just hooked up to six open
Digital pins so that I can make an
interesting example in the next step but
all we need for the RFID scanner to work
is those first seven wires we talked
about now let's go quickly look at some
of the code here in the Arduino IDE go
to tools then manage libraries and
search for mfrc522 I'm using this one
from GitHub community
that comes with several great examples
so install this library then hit the
little three dots in the top right
corner of that library in the library
tools and go to examples then open the
one that's called read nuid this is
going to have some simple code to get us
going really fast with just reading the
rfids and then I'll show you my custom
code for checking and validating rfids
against a bank of stored and trusted
codes now if you're a code efficient
Auto or you're really trying to
understand a layer deeper of how RFID
works I welcome you to pause here a
little bit go through this example code
and really understand what each line is
doing but I'm going to summarize it for
you it's basically importing the
libraries that you need to get going and
then the sensor is actively listening
for a new RFID chipped device when one
comes close enough that it can read it
it just prints it to the serial window
that's basically the whole point of this
read nuid example code and so let's put
it onto our Arduino real real quick
Let's scan a few devices and let's see
what happens and what you can see is I'm
scanning these unique IDs and they're
being displayed in four bytes stored in
heximal format that's really important
because when you save these codes in an
array or some Bank of trusted codes that
you want to use going forward you have
to make sure to get both the data type
which is bytes in this case and the
format which is heximal you have to get
both of those correct or it won't copy
over appropriately and then your
comparison logic won't work right so I'm
going to write down all six of the codes
that I have uh here on the devices in
front of me and I'm going to use these
in the next example and just before we
dive into the next example I want to
take a moment to thank the sponsor of
today's video PCB way PCB way has
everything makers and hobbyists need to
take their hobby designs and turn them
into highquality production level Parts
while they specialize in printed circuit
boards and printed circuit board
assembly they also have everything you
need to turn highquality 3D printed
parts and metal CNC prototypes around in
no time at all every time I've worked
with PCB way the service has been
extremely high quality pricing is super
reasonable and the turnaround time is
great so be sure to check them out and
thank you to PCB way for sponsoring
today's video now I want to use the six
LEDs to indicate if the RFID I just
scanned was one of the trusted codes and
if it is then I want to light up the
spot in that LED bank for that code so I
have 1 through six I'm going to store
them in an array so they'll have indexes
0 through 5 and I want these lights to
light up if I scan a certain one so
light five should light up if I scan the
fifth RFID tag light 1 2 3 4 Etc and the
code component of this is very simple
you just have to sort of modify that
read nuid to then take the scanned code
and check against an array uh kind of
iterate through a for Loop and of course
I'm going to leave it linked in a get
Hub below so if you want to grab that
start from that code start poking around
and making it your own feel free to take
that and let me know as always with any
questions you have around the code in
the comments below I'll get back to you
as soon as I can so let's go ahead and
scan a few devices see how the circuit
reacts and talk about what's happening
and what you can see when I scan RFID
tag one the first light lights up the
rest of them blink indicating it's a bad
match RFID 2 the second light lights up
and etc etc so you can think of a system
where you might want students to scan
badges or tags when they check in some
sort of system where you provide an
employee perk and you want to track
who's using it so you set up a badge
scanner and in a pretty minimal way this
is sort of how employee access systems
at work your credit card when it's being
chip scanned at checkouts and all sorts
of other local scanning RFID type
Technologies are working so having a
basic understanding of this is super
cool not just for hobbyists and makers
but as you go go about the world seeing
this in regular use and knowing hey I
know what's going on in there all right
so I hope yall found this video to be a
useful introduction to the world of RFID
scanning with Arduino and
microcontrollers let me know if you have
any questions in the comments below and
drop a comment telling me what we should
do next please consider leaving a like
on the video subscribing to the channel
it helps me out a ton and if you love
the content we're doing on the channel
go ahead and check out my patreon link
it's in the description of the video as
well thank you so much to my patreon
support orders and thank you to everyone
for watching we'll see you next time
good luck with your projects bye
