How to Scan Fingerprints with Arduino!

LeMaster Tech
182 followers
Apr 20, 2025
In this video I show you step by step how to wire up an optical fingerprint scanner compatible with Arduino and Raspberry Pi devices that communicates over UART.
We cover the wiring, sensing and programming all in less than 20 minutes!
The module I use in this video: https://www.dfrobot.com/product-1343.html?tracking=65bf320f5bda5
Or a similar option available from amazon: https://amzn.to/42X8NIb
The code is available here: https://github.com/plemaster01/ArduinoFingerprintLEDs
Don't forget to leave a like on the video, subscribe to the channel, let me know what you want to see next in the comments, and consider checking out my patreon to help me build bigger and better projects in the future!
https://www.patreon.com/LeMasterTech
welcome back to the channel in today's
video I'm going to show you how to use
fingerprint scanning with your Arduino
projects including what module to use
the physical wiring how to add
fingerprints to the database and then
how to use those fingerprints
programmatically to do interesting
[Music]
things okay so to keep this a quick
tutorial on how to use fingerprint
scanning in Arduino and not dive too
deeply into the various types of tech
analogy behind different fingerprint
scans just understand that the sensor
I'm using in this video is an optical
fingerprint sensor it communicates over
U protocol which is more commonly known
as art as some of my Panic viewers have
noted in past videos but um what an
optical fingerprint sensor is doing is
when you register a fingerprint it
basically takes a highresolution photo
of your fingerprint pressed up against
glass and then when you scan again in
the future it's comparing those two
photos using like a picture matching
algorithm and the higher the level of
confidence in it the more likely it is
to be a match I'm very impressed with
the Simplicity and ease of use of the
fingerprint scanner that I have so far
it's the optical fingerprint scanner
from DF robot this is the second time
I've used a DF robot sensor on the
channel the first was the voice sensor
module a couple videos back they've both
been incredibly easy to use super easy
to integrate with the Arduino board they
both use uart communication
and just like the first one the this
module has a super thorough really easy
to understand uh wiki page and online
documentation on the website on how to
use it and again one thing that makes
this kind of add to a project super easy
and streamlined is that there are
libraries and example codes that are
going to get us really close so whatever
your application is it's always a good
idea to piggyback off of a library or an
existing module that kind of gives you
some of the framework for for you let's
talk about the specific application that
I've built cuz it's pretty cool so the
uart fingerprint sensor module comes
with the six pin cable to connect it to
the back and although there's six wires
you actually only need four to make this
work the black wire is going to be your
ground the red wire is going to be your
5vt power from the Arduino and then the
white is going to be your read or data
input wire while the green is going to
be your transmit or data output wire the
yellow wire is called the induction
signal output and the blue wires called
The Touch induction power input and
we're not going to be using those for
this basic application okay so the
actual wiring of this module is super
duper clear I have this red wire jumping
from the 5vt power of my Arduino over to
the positive power Rail and then the
black wire from the ground to the
negative power Rail and that's tied to
the red and black wires going to my
fingerprint sensor that's all I need to
power it then I have a green and white
wire connected to the green and white
wires for transmit and receive
Communications and I have those going
into pins two and three which when we
take a look at the Arduino code you'll
see that those are the transmit and
receive for a soft serial connection if
you've been following along with the
Arduino videos on the channel you've
seen soft seral before for the Bluetooth
module for the voice recognition module
so that's not a New Concept to you but
if soft serial is a New Concept to you
you just need to understand that serial
Communications are basically just
transmitting and receiving data ones and
zeros at an incredibly High rate known
as the baod rate you can look into soft
cereal versus hard cereal if you want at
some point it's super fascinating stuff
but we're not going to dive into it too
much for this video we're going to try
to keep it moving and the only other
wiring I've done for this project is I
have a green LED and a yellow LED so
that when I register two different
fingerprints with this sensor I'll be
able to turn the green light on if I use
let's say my index finger and the yellow
light on if I use my thumb so for
example if I scan my index finger I want
the green light to turn on but then if I
scan my thumb I want the yellow light to
turn on and obviously you're probably
going to want to build an application
with a lot more interesting stuff than
just flipping between two LEDs but since
this isn't a tutorial on how to turn on
lights it's a tutorial on how to use
fingerprint sensors two LEDs is a great
example uh scenario for this video okay
and that's really it for the wiring if
you have questions feel free to drop
them in the comments below let's take a
look at the software piece of this
project okay so from the Arduino IDE go
ahead and plug in your board and uh set
up the communications to it I have an
Arduino Uno it's showing up on comport
19 which seems high but what do what do
I know uh then at the top of the window
uh go to sketch and then include library
and then manage libraries and in the
library manager you should just be able
to type in fingerprint and this will be
the first one that shows up um it's the
Ada fruit fingerprint sensor Library so
even though the module is by DF robot
they built a sensor that's compatible
with the existing Ada fruit sensor uh
Library that's straight from their
online
documentation so just make sure to
include that and then actually for
registering the fingerprints what we're
going to do is we're going to go to the
examples tab so still with the library
manager open if you hit the little three
dots there and then you go to examples
there's one called enroll and you want
to open that example right up because
that is going to give you the framework
for enrolling fingerprints with your
sensor okay so uh only thing you need to
double
check and you can get rid of some of the
boilerplate code if you want it is
useful to read those comments um but I
want to make it easier to see on my
screen so make sure that for the
software serial you have your transmit
and receive ports again the green wire
um should be on two or the the green
wire should come first so if you didn't
use pin two and pin three which is what
I used just make sure this goes in the
order of the green wire uh to the two
the sensor and then the white wire to
the sensor so for me that's pin two and
three I feel like I've talked about that
enough um and then the rest of this
example is doing everything else for you
all the way down to setting B rates and
checking like uh initial communication
detecting a fingerprint sensor uh in
there and then finger dot begins so
there's a lot of stuff in here where you
don't necessarily need to know what it's
doing because it's driver code created
by vendors who sell fingerprint modules
so the code is pretty well commented and
it's pretty easy to understand if you
really parse through it there's a lot of
built-in functions for checking if it
successfully received um or didn't
receive an image and you can kind of
tell how this technology works by
reading this code because basically it's
waiting to see a finger taking a picture
of of a finger and then if it's able to
successfully parse and store that data
it'll say fingerprint um okay it'll ask
you to scan it a second time if the two
fingerprints match it'll say great and
it'll ask you for a number to enroll
that fingerprint if not it'll say it'll
fail um which doesn't really harm
anything it just won't store that
fingerprint and you have to kind of try
it again so I really don't think we have
to change anything else let's just go
ahead and upload this to our board okay
and what you'll see real quick is when
you go to the serial monitor you'll get
this Adafruit fingerprint fingerprint
sensor enrollment and they'll say hey I
found the sensor that's great it'll set
up some basic parameters we didn't
change these this module can hold a
thousand fingerprints um and uh and so
let's just go down and take a look it
says ready to enroll a fingerprint
please type in the ID you want to save
this finger as let's go ahead and see
now let's scan my middle finger cuz I
have my thumb and my index and I want to
leave those in there already so let's
say uh I think I used one and 127
already um let's go ahead and make this
uh two I don't know why that was so hard
okay I want to make this two and what
you'll see once you've typed in the
number the module lights up because it's
scanning so the green LED on the face of
it turns on which is really cool now
let's go ahead and scan my middle finger
and it says image converted image taken
remove finger place the same finger
again okay and I printed I I put my
finger on there again and it said prints
match id2 stored that's great so let's
go ahead and do another finger I guess
let's say let's do the ring finger and
let's make that one three I don't know
why I made the one 127 I just was
feeling cheeky all right ring
finger image taken image converted
remove the finger all right place the
same finger again let's put it back down
and actually that time it couldn't find
the features I kind of put the finger uh
on the side of the glass kind of on
purpose kind of accidentally um but you
can see all it does is it resets and it
says hey I didn't have confidence in
that picture I'm not comfortable uh
storing that fingerprint but go ahead
and do it again so let's do three and
let's try to do the ring finger again
and if I fail we might just move on here
so okay image taken image converted ID3
place it again let's try get good one
there creating model fingerprints did
not last match um I've had this problem
before with that finger maybe I got like
burnt on the finger pad or something
let's try it one more time image
converted remove finger place the same
finger
again bang they matched okay there we go
so you can see if you have friends if
you have family if you're a teacher and
you have a whole class or whatever you
could go through this exercise and get a
scan from every person it'd be a fun way
to have your database make sure you
track somewhere which fingers do which
thing um but fortunately there's another
example that will let us see um our
scans and what they're stored as okay so
we're going to exit out of the serial
Monitor and we're also going to exit out
of this sketch so if you remember for
this sketch we were in the library
manager we were looking at
fingerprint by Ada fruit we were looking
at examples and all of that in Rolling
fingers was enroll now we're going to go
to fingerprint which all it does is it
scans our fingerprint and it's going to
tell us by default this is what the
built-in program does it's going to tell
us what fingerprint just got scanned in
this is how we can check and make sure
that our module is successfully picking
up what it just scanned I'm going to
delete out some comments in general you
should not delete comments of modules
you didn't make it's a good way for you
to forget what code is supposed to be
doing I'm just doing it so it's a little
bit easier to read you can see the same
software my serial lines at the top of
the program um and so just make sure if
you didn't do two and three to leave mes
2 and 3 we're still not doing anything
with the LED lights yet we're just
focusing on getting the fingerprint
scanning working
perfectly all right but we're going to
just kind of go down and I don't think
there's anything else right now that we
need to add or change to this code okay
so let's go ahead and just upload this
to that same board and then we're going
to go ahead and open up the the serial
Monitor and you'll see it's saying no
finger detected at a scan rate of uh 50
millisecond so it's checking 20 times a
second now let's go ahead and scan the
index finger image taken and it found
127 with a confidence of 108 that's
really good it's super confident that uh
the finger is accurate now let's do my
thumb okay that's number one with a
confidence of 108 that's really high
actually before I was getting like 60s
and stuff now I'm going to do my middle
finger which we just registered and that
says hey that's number two still really
confident now I'll do my ring hey that's
number three really confident let me try
to do a bad scan like the side of my
finger and it doesn't find a match so
now let me do a little bit better I'm
going to keep kind of rolling my index
until it just detects it but maybe with
less confidence yeah so there we go like
the Flat Pad of my finger um only got a
95 there with the with the fingerprint
detection it's a little bit hard to see
cuz it's scrolling by um pretty fast
since it's doing this 20 times a second
but hopefully what you can see so index
gives me 127 thumb gives me one middle
finger gives me two and then ring finger
gives me three so just like that I have
four fingers registered and it took a
couple of seconds and four wires so this
is where using smart sensors gets
incredibly cool because you don't have
to do a ton of complicated programming
most of the time the vendors are
providing examples for you and the
wiring is relatively simple because
there are is a little bit of brains in
your sensor so that's kind of cool I
think it's kind of cool now let's just
take a look at how to use these fingers
to do different things with our LEDs
okay so specifically I think it'd be
cool to have let's say the index turn on
the green light the thumb will turn on
the yellow light that's kind of the
functionality we talked about in the
intro and then I'll use my middle finger
to turn off both lights and then I'll
use the ring finger to turn on both
lights I'll probably forget how to do
that by the time I get the code pulled
up um but let's go ahead and take a look
at that okay
so and uh this is the first code that is
not just an example program um
everything else that we did today the
enrolling of the fingerprint the
checking um don't save the checking of
the fingerprint everything else we've
done so far has been been just straight
examples so I'm not going to leave links
to those the one we're about to do with
the LED control um is a little bit more
unique it's still piggybacking off of
the finger example that we were just
looking at um but I will leave a link to
it cuz I know um there's a chance you
guys might want to uh use this specific
code as a backbone for your project so
what I'm going to do is I'm going to
come down under get fingerprint ID which
is the function pre-built in running
over and over again in the loop to get
the fingerprint ID and all I did is I
dug into get fingerprint ID a little bit
and I saw that it was getting an image
if it was good then it was returning um
P which was like the code but then it
was converting that to a TZ which must
be their uh like Checker and if
fingerprint is okay they convert the
image and then eventually it comes down
into this thing finger f. finger
ID so basically all you really need to
know to use these fingerprints in your
custom Arduino code is that finger.
finger ID is the thing gets that gets
returned when there's a successful scan
from the
module okay so I come up just under
where get fingerprint ID is and I add in
some if statements and these could be
else if statements um but uh basically
what I'm saying first is okay if finger
ID is 127 and again I don't know why I
made my index finger 127 I just did I'm
a goofy little guy all right um so if
127 I'm going to turn the green LED on
and I'm going to turn the yellow LED off
so that'll be index finger if it's my
thumb which is one I'm going to turn
green off and then I'm going to turn uh
yellow on and now let's add in two more
right cuz we just added two more fingers
so I'll say if and then two and I'll say
say middle finger will turn them both
off so low low and then I'll do another
else
if and I'll say that will turn them both
on so hi hi whoops hi Hi how are
you good one all right hi high and
that's if the finger is three and it's
not generally advisable with stuff like
this that's doing uh like 20 scans a
second to use an else statement like a
blanket statement at the end unless you
want something something that only
lights up while it's actively
successfully scanning a finger because
if I were to put an else down here
anytime I didn't have a finger down at
all it would undo whatever I did before
so I'm not using an else I'm using a if
and a bunch of else ifs okay um but this
legitimately is the only code we have to
build on top of obviously like setting
up uh defining a green LED pin a yellow
LED pin and then setting them up as
outputs in the setup code which is very
basic stuff so if you are that level of
beginner with Arduino I have a full
Arduino tutorial series on the channel
you can check that out but without any
further Ado let's just upload this to
the board and let's take a look now and
see if we can successfully get all of
these scanning okay so now we can see
when we upload to our board the
fingerprint uh scanner starts blinking
green it's looking for a finger to scan
let's do the index that should be just
green let's do the thumb that should be
just yellow
got a bad scan just yellow let's do the
middle finger that should turn them both
off and let's do the ring that should
turn them both on okay and I think
that's pretty sweet I mean I know that
uh I geek out over this stuff which
probably is the reason I started a
YouTube channel on it in the first place
but I just think it's so cool how
technology that as a kid seemed like
science fiction to me I mean I knew
fingerprint scanning was a thing but it
was like a thing of buy movies in my
opinion building stuff like this is just
really rewarding and it's been really
rewarding as well to see how well um the
YouTube community's been responding to a
lot of the Arduino videos I've been
doing it means a lot of other people
find it pretty fun as well okay so that
is going to do it for this video a
massive thank you to DF robot for
sending me the sensor used in this video
be sure to check out their website
because in addition to this fingerprint
sensor and the voice recognition module
which I've done videos on they have tons
of great products that can be used for a
wide variety of projects their website
is super easy to use it's super well
documented and it has technical examples
and typically YouTube links for all of
their projects a huge thank you to the
patreon supporters as always thank you
to everyone who subscribes to the
channel leaves nice comments on videos
drops likes on the videos and be sure if
you have any questions to drop them in
the comments below and let me know down
there what we should do next on the
channel as well thank you so much to
everyone for watching as always good
luck with your projects and until next
time thanks for watching
bye
