Biometric Fingerprint Scanner with Arduino Pro Micro | Capacitive Fingerprint Sensor R557
Table of Contents
Biometric Fingerprint Scanner:
Biometric Fingerprint Scanner with Arduino Pro Micro | Capacitive Fingerprint Sensor R557– In today’s article, you will learn how to use a Capacitive Biometric Fingerprint Scanner module R557 with the Arduino Pro Micro. Don’t worry if you hear the name Arduino Pro Micro. You can also use Arduino Uno or Arduino Nano. In fact, I have already used this fingerprint module with the Arduino Nano to control an Electronic Door Lock.
I have also used this fingerprint module with the Nodemcu ESP8266 WiFi module to create an IoT based attendance system for students or employees.
I have also used the same capacitive fingerprint module with the Raspberry Pi Pico to control an Electronic Door Lock.
Even I have used the same Capacitive Biometric Sensor with the ESP32 WiFi + Bluetooth module for controlling home appliances.
Now you might be wondering, if I have already used this fingerprint module with Arduino, Raspberry Pi Pico, ESP8266, and ESP32 WiFi + Bluetooth module, then why am I using the same fingerprint module with the Arduino Pro Micro? Well there are three reasons behind it.
- There are no videos on YouTube about Arduino Pro Micro and Fingerprint sensor, so I thought that making a video about it might help someone. Arduino Pro Micro is much cheaper than the other Arduino boards, so by using Arduino Pro Micro you can reduce the cost and size of your project.
- For the past 3 months, I have been using my designed Arduino Pro Micro and 5V 3A power supply in various projects to test their performance. My ongoing series about Arduino Pro Micro is going well, and I have already used my designed Arduino Pro Micro and the 5V 3A power supply with the MLX90614 Non-contact infrared temperature sensor and the PN532 NFC RFID module. So far, the performance of my designed Arduino Pro Micro has been amazing. Today, I will also find out how well my designed Arduino Pro Micro is going to perform with the R557 Biometric Fingerprint Scanner module.
- There are many boys and girls who want to design their own products and don’t want to use readymade Arduino boards. For example, if you want to make a fingerprint-based door lock product, you cannot just sell everything separately. You have to properly solder everything on a single PCB.
I have designed these two boards that I can sell separately as products. It’s a fully functional 5V 3A power supply and a fully working Arduino Pro micro. If I solder the components of these two boards onto one PCB and add a fingerprint module, I can make a complete product. I designed these boards in Altium Designer software. So, without any further delay let’s get started!!!
Amazon Links:
R557 Biometric Fingerprint Scanner Module
*Disclosure: These are affiliate links. As an Amazon Associate I earn from qualifying purchases.
R557 Biometric Fingerprint Scanner:
The R557 Fingerprint Sensor module is a compact and reliable biometric Sensor that can be used to secure doors or other access points. It can also be used in students and employees attendance systems. It’s a low-cost and low-power Fingerprint sensor. It operates on a low voltage of 3.3V, making it ideal for battery-powered systems. It can be used with 5v and 3.3V compatible controller boards like Arduino, ESP32, STM32, ESP8266, Raspberry Pi Pico, and so on. With this Capacitive Fingerprint sensor, you can easily integrate biometric authentication into your projects.
Technical specifications:
Technical parameter:
Supply voltage: DC 3.3V
Supply current:
Working current: 30mA (typ.)
Peak current: 40mA
Fingerprint image entry time: <0.3 seconds
Collection window area: 12.8mm in diameter
Image pixel: 160*160 pixel
Image Resolution: 508dpi
Match method:
Comparison method (1:1)
Search method (1:N)
Storage capacity: 120 pieces
Security level: five (from low to high: 1, 2, 3, 4, 5)
False Recognition Rate (FAR): <0.0001%
Authentic rejection rate (FRR): <1.0%
Search time: <0.3 seconds (1:1000, average)
Host computer interface: RS232 (TTL logic level, 3.3V)
Communication baud rate: (9600?N)bps where N=1~12 (default value N=6, ie 57600bps)
Working environment:
Temperature: -20 to +45?
Relative humidity: 10%RH-85%RH (non-condensing)
There is an RGB Led inside this module. So, when the fingerprint sensor is ON it shows Blue light. When the Fingerprint scanning operation is successful it shows Green Light, and when the operation is failed, it shows Red light.
It includes a storage capacity of up to 120 fingerprints, a fast recognition speed of under 1 second, and a high resolution image sensor that captures clear and accurate fingerprints. For more technical specifications read my article available on www.electroniclinic.com.
R557 Capacitive Fingerprint Sensor Pinout:
Wiring
1 VT Finger detection
2 Out IRQ
3 VCC 3.3
4 TX 3.3 Logic level
5 RX 3.3 Logic level
6 GND
1st wire is the VT. This is the Finger Detection power and this wire is connected with the 3.3V.
2nd wire is the IRQ. This is the Finger detection signal wire. When there is a finger, it outputs a high signal.
3rd wire is the VCC and it should be connected with 3.3V.
4th and 5th wires are TXD and RXD, both are 3.3V TTL logical level. And
6th wire is the GND and it should be connected with the ground.
Now, let’s go ahead and take a look at the circuit diagram.
Fingerprint Sensor with Arduino Pro Micro:
The Red and Yellow wires of the Fingerprint sensor are connected to the 3.3V pin on the Arduino Pro Micro. The Black wire which is the IRQ wire is left unconnected. The Green and Blue wires are the Txd and Rxd wires and these wires are connected to the Arduino Pro Micro RX and TX Pins. The white wire is the GND wire and it’s connected to the Arduino Pro Micro GND Pin.
The Anode legs of the two LEDs are connected to the Arduino Pro Micro digital pins 3 and 4 through these 330 ohm resistors and the Cathode legs of the LEDs are connected to the GND.
So, that’s all about the connections. Now, let’s go ahead and install the required libraries for the R557 Fingerprint module.
Required Libraries for the R557 Fingerprint Sensor:
Now, the next step is to install the Arduino Library for the R557 Capacitive Fingerprint Sensor. For this, open the Arduino IDE. Click on the sketch Menu, go to Include Library, and then click on manage libraries.
Search for the Adafruit Fingerprint.
Click on the install button.
You can see my Adafruit Fingerprint Sensor Library is now installed.
Next, for the Fingerprint enrollment connect your Arduino Pro Micro board with the Laptop/PC and Upload this sketch.
Fingerprint Enrollment:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
#include <Adafruit_Fingerprint.h> #include <HardwareSerial.h> Adafruit_Fingerprint finger = Adafruit_Fingerprint(&Serial1); uint8_t id; void setup() { Serial.begin(9600); while (!Serial); // For Yun/Leo/Micro/Zero/... delay(100); Serial.println("\n\nAdafruit Fingerprint sensor enrollment"); // 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); } } Serial.println(F("Reading sensor parameters")); finger.getParameters(); Serial.print(F("Status: 0x")); Serial.println(finger.status_reg, HEX); Serial.print(F("Sys ID: 0x")); Serial.println(finger.system_id, HEX); Serial.print(F("Capacity: ")); Serial.println(finger.capacity); Serial.print(F("Security level: ")); Serial.println(finger.security_level); Serial.print(F("Device address: ")); Serial.println(finger.device_addr, HEX); Serial.print(F("Packet len: ")); Serial.println(finger.packet_len); Serial.print(F("Baud rate: ")); Serial.println(finger.baud_rate); } uint8_t readnumber(void) { uint8_t num = 0; while (num == 0) { while (! Serial.available()); num = Serial.parseInt(); } return num; } void loop() // run over and over again { Serial.println("Ready to enroll a fingerprint!"); Serial.println("Please type in the ID # (from 1 to 127) you want to save this finger as..."); id = readnumber(); if (id == 0) {// ID #0 not allowed, try again! return; } Serial.print("Enrolling ID #"); Serial.println(id); while (! getFingerprintEnroll() ); } uint8_t getFingerprintEnroll() { int p = -1; Serial.print("Waiting for valid finger to enroll as #"); Serial.println(id); while (p != FINGERPRINT_OK) { p = finger.getImage(); switch (p) { case FINGERPRINT_OK: Serial.println("Image taken"); break; case FINGERPRINT_NOFINGER: Serial.println("."); break; case FINGERPRINT_PACKETRECIEVEERR: Serial.println("Communication error"); break; case FINGERPRINT_IMAGEFAIL: Serial.println("Imaging error"); break; default: Serial.println("Unknown error"); break; } } // OK success! p = finger.image2Tz(1); 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; } Serial.println("Remove finger"); delay(2000); p = 0; while (p != FINGERPRINT_NOFINGER) { p = finger.getImage(); } Serial.print("ID "); Serial.println(id); p = -1; Serial.println("Place same finger again"); while (p != FINGERPRINT_OK) { p = finger.getImage(); switch (p) { case FINGERPRINT_OK: Serial.println("Image taken"); break; case FINGERPRINT_NOFINGER: Serial.print("."); break; case FINGERPRINT_PACKETRECIEVEERR: Serial.println("Communication error"); break; case FINGERPRINT_IMAGEFAIL: Serial.println("Imaging error"); break; default: Serial.println("Unknown error"); break; } } // OK success! p = finger.image2Tz(2); 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! Serial.print("Creating model for #"); Serial.println(id); p = finger.createModel(); if (p == FINGERPRINT_OK) { Serial.println("Prints matched!"); } else if (p == FINGERPRINT_PACKETRECIEVEERR) { Serial.println("Communication error"); return p; } else if (p == FINGERPRINT_ENROLLMISMATCH) { Serial.println("Fingerprints did not match"); return p; } else { Serial.println("Unknown error"); return p; } Serial.print("ID "); Serial.println(id); p = finger.storeModel(id); if (p == FINGERPRINT_OK) { Serial.println("Stored!"); } else if (p == FINGERPRINT_PACKETRECIEVEERR) { Serial.println("Communication error"); return p; } else if (p == FINGERPRINT_BADLOCATION) { Serial.println("Could not store in that location"); return p; } else if (p == FINGERPRINT_FLASHERR) { Serial.println("Error writing to flash"); return p; } else { Serial.println("Unknown error"); return p; } return true; } |
After uploading this code; next open the serial monitor and follow the instructions. If you find it difficult to enroll your fingers then you can follow my video tutorial given at the end of this article. Anyway, I enrolled two fingers “the forefinger and the middle finger” I assigned 3 as an ID to the forefinger and 4 as an ID to my Middle finger.
Altium Designer, Altium 365, & Octopart:
Altium Designer is the world’s most trusted PCB design system. Altium Designer enables engineers to effortlessly connect with every facet of the electronics design process. Over 35 years of innovation and development focused on a truly unified design environment makes it the most widely used PCB design solution. With Altium Designer you can create PCB designs with an intuitive and powerful interface that connects you to every aspect of the electronics design process. Route it your way through any angle, tune for the delay, Push, Slide, and Walkaround faster than ever.
Easily work together with your mechanical team and forget about the days of swapping design files. Every design change stays in sync between Altium Designer and SOLIDWORKS, PTC Creo, Autodesk Inventor, Autodesk Fusion 360, or Siemens NX*.
Interact and collaborate with mechanical designers like never before in a photo-realistic, 3D design environment.
One of the best things about Altium Designer is that you can share your designs with your team members using Altium 365. They can check your design, leave comments, and if there are any issues, they can fix them from anywhere in the world. Altium Designer also uses the world’s fastest components search engine, Octopart, so you won’t have any difficulty in searching for components.
Altium Designer, Altium 365, and Octopart—unleashes the full potential of electronics design by seamlessly integrating design tools, collaboration platforms, and component databases. Together, they offer engineers a comprehensive and synchronized experience, leading to improved productivity, reduced errors, and accelerated innovation in the world of electronics design.
After, enrolling all the fingers. Next, download the following code, and replace my finger ids with yours.
Biometric Fingerprint Scanner Arduino Programming:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
#include <Adafruit_Fingerprint.h> #include <HardwareSerial.h> int relay1=4; int relay2=5; Adafruit_Fingerprint finger = Adafruit_Fingerprint(&Serial1); void setup() { pinMode(relay1,OUTPUT); pinMode(relay2,OUTPUT); digitalWrite(relay1, LOW); digitalWrite(relay2, LOW); Serial.begin(9600); //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); delay(5); if (finger.verifyPassword()) { Serial.println("Found fingerprint sensor!"); } else { Serial.println("Did not find fingerprint sensor :("); while (1) { delay(1); } } Serial.println(F("Reading sensor parameters")); finger.getParameters(); Serial.print(F("Status: 0x")); Serial.println(finger.status_reg, HEX); Serial.print(F("Sys ID: 0x")); Serial.println(finger.system_id, HEX); Serial.print(F("Capacity: ")); Serial.println(finger.capacity); Serial.print(F("Security level: ")); Serial.println(finger.security_level); Serial.print(F("Device address: ")); Serial.println(finger.device_addr, HEX); Serial.print(F("Packet len: ")); Serial.println(finger.packet_len); Serial.print(F("Baud rate: ")); Serial.println(finger.baud_rate); finger.getTemplateCount(); if (finger.templateCount == 0) { Serial.print("Sensor doesn't contain any fingerprint data. Please run the 'enroll' example."); } else { Serial.println("Waiting for valid finger..."); Serial.print("Sensor contains "); Serial.print(finger.templateCount); Serial.println(" templates"); } } void loop() // run over and over again { getFingerprintID(); 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"); finger.LEDcontrol(FINGERPRINT_LED_OFF, 0, FINGERPRINT_LED_BLUE); finger.LEDcontrol(FINGERPRINT_LED_OFF, 0, FINGERPRINT_LED_RED); 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.fingerSearch(); if (p == FINGERPRINT_OK) { Serial.println("Found a print match!"); finger.LEDcontrol(FINGERPRINT_LED_FLASHING, 25, FINGERPRINT_LED_PURPLE, 10); delay(1000); if(finger.fingerID==3) { digitalWrite(relay1,!digitalRead(relay1)); delay(1000); } if(finger.fingerID==4) { digitalWrite(relay2,!digitalRead(relay2)); delay(1000); } } else if (p == FINGERPRINT_PACKETRECIEVEERR) { Serial.println("Communication error"); return p; } else if (p == FINGERPRINT_NOTFOUND) { finger.LEDcontrol(FINGERPRINT_LED_FLASHING, 25, FINGERPRINT_LED_RED, 10); delay(1000); 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); return finger.fingerID; } |
This is the Final Code that I use to control the two LEDs. You can see I have named the two LEDs as Relay1 and Relay2. This is the same exact code from my previous R557 Fingerprint module based projects. The only difference is that this time I am using the Arduino Pro Micro and instead of controlling the Door lock I am simply controlling the two LEDs.
You can see, I am using the finger ids 3 and 4. 3 is the ID of my fore finger and 4 is the id of my middle finger. You can download this code from my website www.electroniclinic.com. I will add a link in the description. I have already uploaded this program and now let’s watch this Capacitive Fingerprint sensor and Arduino Pro Micro in action.
Practical demonstration:
Right now, you can see I am using my Laptop as the voltage source. And you can see I am able to control the two LEDs.
Now, I am going to use my regulated 5V and 3A powers supply to power up all the electronics. I connected the 5V and GND wires from the 5V power supply to the Arduino Pro Micro RAW and GND pins.
I am going to use my 12V DC adaptor. This 5V and 3A power supply accepts a wide range of input voltages from 7 volts to 28 volts DC. So you can use any voltage source, just make sure it doesn’t exceed 28 volts.
So, my designed Arduino Pro Micro and 5V 3A power supply works amazingly with the R557 Capacitive Fingerprint module. So, that’s all for now. For the practical demonstration watch the video tutorial given below.