element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Design for a Cause - Design Challenge
  • Challenges & Projects
  • Design Challenges
  • Design for a Cause - Design Challenge
  • More
  • Cancel
Design for a Cause - Design Challenge
Blog Fingerprint Skeleton Key - Capacitive Fingerprint Module - Design for a Cause Challenge - Blog Post #4
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: milosrasic98
  • Date Created: 16 Aug 2018 12:40 PM Date Created
  • Views 4338 views
  • Likes 9 likes
  • Comments 10 comments
  • accessibility_projects
  • ardexpert
  • mkr_projects
Related
Recommended

Fingerprint Skeleton Key - Capacitive Fingerprint Module - Design for a Cause Challenge - Blog Post #4

milosrasic98
milosrasic98
16 Aug 2018

Introduction

Hi! In this update I will be taking a look at connecting a capactive fingerprint module to an Arduino MKR1000. I looked all over online, and could only find optical fingerprint sensors being connected to the Arduino, so I thought, why not give it a shot with a capacitive one, and if it works great! I want to integrate the fingerprint module to for now use it just a necessary switch, but will try using a solenoid in the device which would completely lock it. First, let's see what's a capacitive fingerprint sensor and how does it work!

 

  • Introduction
  • Fingerprint Sensors
    • Optical fingerprint sensors
    • Capacitive fingerprint sensors
  • GROW R302
    • Connecting the module to a PC
    • Connecting the module to an Arduino
    • First Test
  • Summary

 

 

Fingerprint Sensors

Fingerprint sensors, as the name suggests, are used for identifying fingerprints. Fingerprints are a unique thing for every person, so they are now used everywhere around us, specially on phones, since the technology allowed them to get so small. There are 2 main types of fingerprint sensors present today, optical fingerprint sensors, and capacitive fingerprint sensors, there is also a new type that is being developed currently, the ultrasonic fingerprint sensors. I will be covering the first 2, so let's start off with the optical fingerprint sensor.

 

Optical fingerprint sensors

Optical fingerprint sensors are the oldest off the bunch, and are still used everywhere. The optical sensors rely on pretty much a camera, that takes a detailed photo of the fingertip and using various algorithms scans the image. Of course the better the camera on the sensor the better the image and better the security. One of the main problems of the optical sensor is that most of them can be fooled easily. since they are capturing essentially a 2D image, which can sometimes be fooled with a good picture. Optical sensor modules can be found for the Arduino around the internet with libraries and everything.

 

Capacitive fingerprint sensors

Capacitive fingerprint sensors are the most widely spread fingerprint sensors in the phone industry currently. They use a lot of tightly pack capacitors, so when we put are fingertip on the sensor, the ridges on out fingerprint change the charge on some of the capacitors, effectively giving the information about our fingerprint to the device. After that, like with the optical fingerprint sensor, various algorithms are used to process the image. The good safety thing about these sensors is that 2D images can't fool them, since they are looking for actual ridges on the fingerprint.

 

 

GROW R302

The fingerprint module I went with is from a company called GROW and the model R302. These modules are the easiest to find around, and they are relatively low cost, with my module coming in around 16 euros, and a couple of weeks waiting time for the shipment to arrive. One more great thing about the modules from the GROW company is that they have the full documentation online free for anyone to use. Here is a picture of what I received in the package.

 

{gallery} R302

image

Module: In the package I got the module itself as well as a cable for connecting to it.

image

Table 1: General specification of the R302 module

image

Pin layout: Pin layout of the module board, the UART part has a connector that goes with the included cable, while for the USB part we need to solder the wires to the PCB.

image

Table 2: Pins for UART

 

The cool thing about these modules is that they store all of the data on themselves, and they do all of the processing of the images, so they don't use up any of processing power of the Arduino or any other boards. There are 2 ways to connect the module to other devices, UART or USB. First off I wanted to connect it to my PC to see if the module is functioning as it should be. The first attempt was using the USB communication, which required soldering some wires to the PCB. When I would plug in the module into the PC, I could see it in the devices but had problems with getting it to work.(I would see it as a CD ROM, then it would transfer itself to USB devices and then would just say it has a problem, so I opted to go with the second method). After that failed I tried using UART. This of course required a converter to go in between.

 

Connecting the module to a PC

image

 

The connections between them are:

  1. 5V on the Module (red wire) --- 5V on the converter
  2. GND on the Module (black wire) --- GND on the converter
  3. TXD on the Module (yellow wire) --- RXD on the converter
  4. RXD on the Module (white wire) --- TXD on the converter

 

Next thing we need to is plug the converter into a USB port and try the module out. Of course for that we need to download a program. The one most commonly used with which I went with is the SFG Demo V2.0. It can be easily found online to download. After downloading the program all that's left is trying out to see if the module works! Here is a step by step guide on using the program with the module.

 

 

{gallery} SFG Demo

image

Device Manager: First off all we need to see to what port the module is connected which can be done going to the device manager, as we can see my module is connected to COM1.

image

SYNO DEMO: This is the staring screen of the program, first we need to go and click Open Device.

image

Open Device: We will be greeted with a pop up screen asking us to select the port, for me that would be COM1.

image

Module Info: If the module is not broken is connected correctly, we should see a screen like this. On the left we can see all of the hardware information, and we can also adjust the BAUDRATE, security level, and other things within the program. Now let's try enrolling a fingerprint.

image

Enroll: We click the Enroll button and a pop up screen will come up asking us to which address on the module we want to save this fingerprint. Since this is the first time anyone has used this module, the memory is empty, so I just went with address zero. After clicking OK, the program will ask you to put your finger on the module and lift it off twice (a blue LED should be flashing when it is expecting a finger to be places).

image

Enroll success: If everything went smoothly we should get a message on the top saying success to enroll. And that would be how we add fingerprint to this module, now let's see how well the recognizing works. Also, if you want to see what kind of a picture the module creates of the fingerprint, you can click on the preview checkbox, but expect for the program to take a bit longer then.

image

Search initiation: When we click the Search button it will ask us to place the finger on the module, and the blue LED will start flashing on it.

image

Search success: This is me placing the finger i enrolled on the module, and as we can see the device took only 327 ms to recognize the fingerprint. But now let's see what happens when we put a finger that's not enrolled there.

image

Search Fail: As we can see it can't find the finger within its database, and it again took only around 300 ms which is great!

 

I tried playing around with the sensor a bit, and while it works great, there are some things that should be addressed, but are not a total deal breaker. The pad on the module is decent sized, but not large enough for a whole fingerprint really, specially with 2 scans. Most phones now when you need to enroll a fingerprint require you to scan your finger tip from all angles, so the pad could more easily recognize your finger regardless of the finger position. Again, even like this, I am impressed with how smooth and fast it works, but will try fixing this issue by enrolling the same finger to a few different addresses from all sorts of angles. Now we have to connect this to the Arduino MKR1000.

Connecting the module to an Arduino

Since we have already connected the module to the computer, we have a fingerprint recorded on the device, so to make this a bit shorter, I will for now only focus on recognizing the fingerprint. As I've said before, the module comes with full documentation but there are no convenient libraries specifically for it. But while doing some research around, I saw that there are a couple of libraries for other manufacturers modules. The one I took a look at was the Adafruit fingerprint module. Their fingerprint module is an optical one but I found a library for it, so I thought to go and look into that library as well as the documentation for the module itself. Having the documentation of both the Adafruit module and the GROW module side by side, I saw something that made me extremely happy, all of the commands are the same, which should mean that the library should straight on work with my module, and it did! The library in question can be found here (https://github.com/adafruit/Adafruit-Fingerprint-Sensor-Library). Now let's connect the module to the Arduino.

 

Connections are:

  1. Red wire on the module --- 5V on the Arduino
  2. Black wire on the module --- GND on the Arduino
  3. Yellow wire on the module --- RX Pin on the Arduino (13 on the MKR1000)
  4. Green wire on the module --- TX Pin on the Arduino (14 on the MKR1000)

 

image

 

To test out the module I will be using one of the example programs from the library ("fingerprint" example) with a few added lines to switch from a red to a green LED. As for the wiring all I did was add 2 LED-s with 220 Ohm resistors to pins 4 and 5. Here is the example code that comes with the library with addition of the couple of lines needed to turn on the LED-s.

 

/*************************************************** 
  This is an example sketch for our optical Fingerprint sensor


  Designed specifically to work with the Adafruit BMP085 Breakout 
  ----> http://www.adafruit.com/products/751


  These displays use TTL Serial to communicate, 2 pins are required to 
  interface
  Adafruit invests time and resources providing this open source code, 
  please support Adafruit and open-source hardware by purchasing 
  products from Adafruit!


  Written by Limor Fried/Ladyada for Adafruit Industries.  
  BSD license, all text above must be included in any redistribution
 ****************************************************/




#include <Adafruit_Fingerprint.h>


// 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);


Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);


void setup()  
{
  Serial.begin(9600);
  pinMode(4,OUTPUT);
  pinMode(5,OUTPUT);
  digitalWrite(4,LOW);
  digitalWrite(5,HIGH);
  while (!Serial);  // For Yun/Leo/Micro/Zero/...
  delay(100);
  Serial.println("\n\nAdafruit finger detect test");
  
  // set the data rate for the sensor serial port
  finger.begin(57600);
  
  
  if (finger.verifyPassword()) {
    Serial.println("Found fingerprint sensor!");
  } else {
    Serial.println("Did not find fingerprint sensor :(");
    while (1) { delay(1); }
  }


  finger.getTemplateCount();
  Serial.print("Sensor contains "); Serial.print(finger.templateCount); Serial.println(" templates");
  Serial.println("Waiting for valid finger...");
}


void loop()                     // run over and over again
{
  getFingerprintIDez();
  delay(50);            //don't ned to run this at full speed.
}


uint8_t getFingerprintID() {
  uint8_t p = finger.getImage();
  switch (p) {
    case FINGERPRINT_OK:
      Serial.println("Image taken");
      break;
    case FINGERPRINT_NOFINGER:
      Serial.println("No finger detected");
      return p;
    case FINGERPRINT_PACKETRECIEVEERR:
      Serial.println("Communication error");
      return p;
    case FINGERPRINT_IMAGEFAIL:
      Serial.println("Imaging error");
      return p;
    default:
      Serial.println("Unknown error");
      return p;
  }


  // OK success!


  p = finger.image2Tz();
  switch (p) {
    case FINGERPRINT_OK:
      Serial.println("Image converted");
      break;
    case FINGERPRINT_IMAGEMESS:
      Serial.println("Image too messy");
      return p;
    case FINGERPRINT_PACKETRECIEVEERR:
      Serial.println("Communication error");
      return p;
    case FINGERPRINT_FEATUREFAIL:
      Serial.println("Could not find fingerprint features");
      return p;
    case FINGERPRINT_INVALIDIMAGE:
      Serial.println("Could not find fingerprint features");
      return p;
    default:
      Serial.println("Unknown error");
      return p;
  }
  
  // OK converted!
  p = finger.fingerFastSearch();
  if (p == FINGERPRINT_OK) {
    Serial.println("Found a print match!");
  } else if (p == FINGERPRINT_PACKETRECIEVEERR) {
    Serial.println("Communication error");
    return p;
  } else if (p == FINGERPRINT_NOTFOUND) {
    Serial.println("Did not find a match");
    return p;
  } else {
    Serial.println("Unknown error");
    return p;
  }   
  
  // found a match!
  Serial.print("Found ID #"); Serial.print(finger.fingerID); 
  Serial.print(" with confidence of "); Serial.println(finger.confidence); 
  return finger.fingerID;
}


// returns -1 if failed, otherwise returns ID #
int getFingerprintIDez() {
  uint8_t p = finger.getImage();
  if (p != FINGERPRINT_OK)  return -1;


  p = finger.image2Tz();
  if (p != FINGERPRINT_OK)  return -1;


  p = finger.fingerFastSearch();
  if (p != FINGERPRINT_OK)  return -1;
  
  // found a match!
  Serial.print("Found ID #"); Serial.print(finger.fingerID); 
  Serial.print(" with confidence of "); Serial.println(finger.confidence);
  digitalWrite(4,HIGH);
  digitalWrite(5,LOW);
  delay(700);
  digitalWrite(4,LOW);
  digitalWrite(5,HIGH);
  return finger.fingerID; 
}

 

When we upload the program we have to open the serial monitor to get the whole thing going and we should be firstly greeted with this screen:

 

image

 

The one valid template is from when we enrolled the fingerprint using the PC, if there is time left I will be sure to incorporate enrolling fingerprints using Arduino as well!. After placing the correct finger on the sensor we should see a message like this:

 

image

 

We get the ID of the fingerprint, and as we can see it returned 0, just like we enrolled it in the first place, and besides that returns a number which represents how confident the module is. This is a great little feature which can be used to make the sensor a bit more secure by adding a threshold, but for now all we care about is if the finger is recognized or not. The library comes with a few more great examples, but I will be sticking to this one for now. Here is a video of switching between LED-s. One more LED we can see reacting is the module integrated LED, which usually flashes blue, but changes to red if it doesn't recognize the fingerprint.

 

First Test

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

Summary

That would be it for this update, I was pretty frustrated in the beginning when it didn't want to work over the USB pins, but after setting up the converter correctly and going over UART everything clicked into place pretty fast, specially considering that the Adafruit library works with the module as well. I will take a look at it a bit better also to see what other functions are available. The primary goal of the fingerprint is to use it like an electronic switch, so that the device is useless for the most part without the owner, but would like to further increase its use by adding something like a solenoid lock to it, but that will have to come later on. Now it's time to finish up the mechanical part as well as take a look at the ESP8266. Thanks for reading the blog, hope you liked it!

 

Milos

  • Sign in to reply

Top Comments

  • DAB
    DAB over 7 years ago +4
    Nice post. Was there any comparison data between the various sensors that led you to the decision on your selection? DAB
  • milosrasic98
    milosrasic98 over 7 years ago in reply to DAB +4
    Hi DAB, There were a few things I looked at, first off all, I really wanted to go with a capacitive sensor. While searching for those the sensors from the GROW company popped up a lot, and saw that a few…
  • aspork42
    aspork42 over 7 years ago +3
    Nice progress. Are you looking at power consumption on the device?
  • milosrasic98
    milosrasic98 over 4 years ago in reply to dkylewillis

    Thanks! Glad you like it!

     

    I didn't have any issues like that, looking at the link that you sent you are using an Arduino Nano? It might be, as you've suspected, a problem regarding the voltage levels, In my project I used the MKR1000 board which has a 3.3V logic level. As the guys at electrical stack exchange have said, try maybe some different type of shifter circuit since that one is for I2C. Also, I would recommend to try using the PC software, you'll just need the small converter, that's one sure way to check if the sensors are working fine, also, an easy way to record the fingerprints. Another thing you can do of course is try another Arduino, the MKR family is 3.3V and I think the Pro Mini is as well, and it's a similar in size to the Nano, though, lacking some pins.

     

    Milos

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • dkylewillis
    dkylewillis over 4 years ago in reply to milosrasic98

    Hey Milos, nice post!  I've ordered a couple of the r502a variants, but I'm having trouble with each. The issues is when the module's TX pin is connected to the Arduino's Rx pin, no data is being sent by the sensor (I'm monitor using oscilloscope).  However, when the Tx line is not connected to the Arduino, i can see data. I've tried using a level converter also, but the data is 2.6 volts in the high state and 1.2 volts in the low state.  It's really bizarre.

     

    I'm not a newbie to using UART and Arduinos, and I'm positive it's connected correctly.  Have you had similar experiences or have any idea what could be the issue?  I have posted a question on electrical stack exchange at the following link https://electronics.stackexchange.com/questions/529162/data-logic-levels-sent-from-sensor-are-not-going-all-the-way-low

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • milosrasic98
    milosrasic98 over 5 years ago in reply to nbod

    Hi,

     

    I would suggest you check out the lineup of GROW fingerprint sensors, because I think they are all similar when it comes to the electronics but just have different shapes, meaning, they should probably work with the Adafruit library. I've ordered mine from Aliexpress, so you can check there. I suspect they use a same controller as the Adafruit one, since the demo software is the same, https://learn.adafruit.com/adafruit-optical-fingerprint-sensor?view=all . This was my only experience with using a fingerprint sensor so I can't really recommend what works and what doesn't, this one worked for me. Another thing, GROW sensors come with a really well written datasheet if you decide to go without using a library. Hope some of this helps!

     

    Milos

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • nbod
    nbod over 5 years ago

    im looking to get a capacitive fingerprint sensor similar to the one you have but i cnt seem to find one that works with the adafruit fingerprint  library any help?

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • milosrasic98
    milosrasic98 over 7 years ago in reply to aspork42

    Hi James,

     

    Wasn't measuring for this module in particular, I just went with the table values of "Typical: 40mA" and "Peak: 50mA", but nevertheless since this is a battery powered device, I will code it to keep everything as power efficient as possible. I will probably end up mounting something like a small button underneath the module, so it gets power when the button is pressed or something along those lines!

     

    Milos

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube