Once you've tested the sensor, you can now use it within a sketch to verify a fingerprint. We'll need to rewire the sensor. Disconnect the green and white wires and plug the green wire into digital 2 and the white wire to digital 3. (For ESP8266 use 4 & 5, for devices with Hardware UART use 0 & 1)

It is normal for the sensor to blink the LED quickly once powered, after that the LED may stay off until you've started to request data from it

If your fingerprint sensor has individual socket wires (its this one) then use the following wire setup:

  • Red Wire to 3.3V
  • Yellow wire is Serial TX
  • White wire is Serial RX
  • Black wire is ground

If your cable has a single slim connector on the end and has different color wires:

  • The first wire from the left should be the black wire ground
  • then the two data pins: Serial RX is the white wire
  • Serial TX is the green wire
  • Then the red power wire (3 or 5V)

You'll have to cut, strip and solder the wires.

If your sensor is an older one and has all the same-color wires, The first wire from the left is ground, then the two data pins, then power. You'll have to cut, strip and solder the wires.

 

RX is the same as the White wire
TX is the same as the Green wire

On the "rugged" fingerprint sensor:

  • Red wire is connected to 3.3V for power
  • Black wire is connected to ground
  • Yellow to Microcontroller RX (data in to microcontroller)
  • Green to Microcontroller TX (data out from microcontroller)

On the 'slim' fingerprint sensor

  • Black to GND
  • Yellow to Microcontroller TX (data out from microcontroller)
  • Green to Microcontroller RX (data in from microcontroller)
  • Red to 3.3V VIN

Arduino UNO & Compatible Wiring

This example sketch uses pins 2 and 3 for software serial (on ATmega328P type boards by default) - Not all boards support Software Serial on all pins so check board documentation! For example on ESP8266 we used 4 & 5

You can power the sensor from 3.3V or 5V - some sensors require 3.3V, see above!

In the diagrams below we show the wires plugged directly into the Arduino. However, this does not work well because the wires are so thin and they dont make contact. You should solder thicker solid core wires to each wire, to make good contact. NOTE: Both ends of the cable plug into the fingerprint sensor - verify that you're removing the correct end of it before cutting anything off. Your wiring order should match the image above with the fingerprint sensor upside down.

Hardware Serial Wiring

If you have a device with hardware serial, you should use that instead. Often this is pins #0 and #1

Next, you'll need to install the Adafruit Fingerprint sensor library (also available from github).

Open up the Arduino Library Manager:

Type in Fingerprint until you see the Adafruit Fingerprint library show up!

Click Install! That's it. Now you should be able to select the File→Examples→Adafruit_Fingerprint→fingerprint example sketch.

Soft & Hard Serial

By default the sketch uses software serial (Arduino UNO & compatibles). If you are using a device with Hardware Serial, e.g does not have a USB-Serial converter chip, use that instead! Usually those are on pins 0 & 1

// On Leonardo/Micro or others with hardware serial, use those! #0 is green wire, #1 is white
// uncomment this line:
#define mySerial Serial1

// For UNO and others without hardware serial, we must use software serial...
// pin #2 is IN from sensor (GREEN wire)
// pin #3 is OUT from arduino  (WHITE wire)
// comment these two lines if using hardware serial
//#include <SoftwareSerial.h>
//SoftwareSerial mySerial(2, 3);

If necessary, uncomment/comment lines for hardware serial support

Upload

Upload it to your Arduino as usual. Open up the serial monitor at 9600 baud and when prompted place your finger against the sensor that was already enrolled.

You should see the following:

If you can't get 'connected' to the sensor the library says "Did not find fingerprint sensor :(" Try swapping the RX and TX wires and resetting

The 'confidence' is a score number (from 0 to 255) that indicates how good of a match the print is, higher is better. Note that if it matches at all, that means the sensor is pretty confident so you don't have to pay attention to the confidence number unless it makes sense for high security applications.

Of course you have to have enrolled a fingerprint first! If you did this using the Windows program, that's good to go. If you have not yet, you should at least have gotten a Found fingerprint sensor! printout. You can go ahead to the next step to enroll fingerprints.

If you get Did not find fingerprint sensor :( check your wiring, maybe swap the RX and TX wire as that's a common issue

If you want to have a more detailed report, change the loop() to run getFingerprintID() instead of getFingerprintIDez() - that will give you a detailed report of exactly what the sensor is detecting at each point of the search process.

This guide was first published on Nov 05, 2012. It was last updated on Mar 17, 2024.

This page (Wiring for use with Arduino) was last updated on Mar 08, 2024.

Text editor powered by tinymce.