Having issues with Fingerprint Scanner, perhaps in my coding?

I am having issues with my fingerprint scanner. I am relatively new to Arduino and coding in general, and have been searching for an answer the past couple of days to see if anyone else had the issue and resolution. I am currently using a fingerprint scanner to move a stepper motor, and it seems to work to my liking. However, I have been trying to enroll multiple fingers and I have gotten that to work as well. The working fingers are thumb, pointer finger, and middle finger. Somehow, I am unable to get my ring finger or pinky to register to the FPS. It gives me the “Unable to capture first finger” during the enrollment process. While my code may seem iffy to you, I only combined the enrollment and verification process into one code, and used enrollment to be a one time thing on launch. Is there somewhere in my code that I did wrong to make me unable to use those two fingers? Or is it just a problem with the scanner that I overlooked? Again my code may seem whacky and I am up to make any changes to it as I am quite new to this, so please bare with me! :slight_smile:

The Fingerprint Scanner: https://www.sparkfun.com/products/11792

The Fingerprint Scanner Library: http://wordpress.hawleyhosting.com/ramblings/?p=375

#include <FPS_GT511C3.h>
#include <SoftwareSerial.h>
#include <Stepper.h>
uint8_t getFingerprintEnroll(uint8_t id);

FPS_GT511C3 fps(4, 5);
Stepper myStepper(255, 9, 10, 11, 12);
int inPin1 = 9;
int inPin2 = 10;
int inPin3 = 11;
int inPin4 = 12;



void setup()  
{
  Serial.begin(9600);
  myStepper.setSpeed(20);
  delay(100);
  fps.Open();
  fps.SetLED(true);
  Enroll();
}

void Enroll(){
	// Enroll test will repeat just once each time Reset button is pressed

	// find open enroll id, will repeat process each time Reset button is pressed
	int enrollid = 0;
	bool okid = true;
	while (okid == true)
	{
		okid = fps.CheckEnrolled(enrollid);
		if (okid==true) enrollid++;
	}
	fps.EnrollStart(enrollid);

	// enroll
	Serial.print("Please press finger to Enroll #");
	Serial.println(enrollid);
	while(fps.IsPressFinger() == false) delay(100);
	bool bret = fps.CaptureFinger(true);
	int iret = 0;
	if (bret != false)
	{
		Serial.println("Please remove finger");
		fps.Enroll1(); 
		while(fps.IsPressFinger() == true) delay(100);
		Serial.println("Please press same finger again");
		while(fps.IsPressFinger() == false) delay(100);
		bret = fps.CaptureFinger(true);
		if (bret != false)
		{
			Serial.println("Please remove finger");
			fps.Enroll2();
			while(fps.IsPressFinger() == true) delay(100);
			Serial.println("Please press same finger yet again");
			while(fps.IsPressFinger() == false) delay(100);
			bret = fps.CaptureFinger(true);
			if (bret != false)
			{
				Serial.println("Please remove finger");
				iret = fps.Enroll3();
				if (iret == 0)
				{
					Serial.println("Enrolling Successfull");
				}   
				else
				{
					Serial.print("Enrolling Failed with error code:");
					Serial.println(iret);
				}
			}
			else Serial.println("Sorry, unable to capture third finger");
		}
		else Serial.println("Sorry, unable to capture second finger");
	}
	else Serial.println("Sorry, unable to capture first finger");
}

void loop(){
 	// Identify fingerprint test, will continue to repeat while FPS is active
        // We will create a cap that covers the scanner, and opening the cap will
        // activate the scanner to run.
	if (fps.IsPressFinger())
	{
		fps.CaptureFinger(false);
		int id = fps.Identify1_N();
		if (id <200)
		{
			Serial.print("Hello! Fingerprint has been verified:");
			Serial.println(id);
                        myStepper.step(255);
                        delay(3000);
                        myStepper.step(-255);
		}
		else
		{
			Serial.println("Sorry, fingerprint was not found in database");
		}
	}
	else
	{
		Serial.println("Please press finger");
	}
	delay(1000);
 
}

Check and see if it is enrolling ID number 1 twice. If it is, try setting enrolled as 1 instead of 0.

void Enroll(){
    // Enroll test will repeat just once each time Reset button is pressed

    // find open enroll id, will repeat process each time Reset button is pressed
    int enrollid = 1;

Nope :( it still comes back as "Unable to capture first finger" then a "Sorry, Finger was not found in the database". After that it continues onto the verification process and repeats "Please press finger." It is just strange that the pointer finger and thumb work so well, but the others give me problems. Any other ideas?

Can you please explain the process of enrolling a new ID ?

Does each of the 3 fingers have to be read twice as would seem to be the case from your "Please press same finger again" messages ? If so then the "unable to capture" messages don't make sense because they refer to the wrong fingers.

The enrolling a new ID process is for when people will want to add more fingerprints to this device, whether the same person and different finger or a different person. The finger is to be read three times to just get a better accuracy for detecting the same finger. The unable to capture message is just to say that the device didn't take an accurate picture I suppose. Enrollment is same finger detected three times, not three fingers taken once each. However, it will not even let me get past the first detection process for middle finger, ring finger, and pinky.

Steps for process: - If reset button is pressed, the code will restart and start with the enrollment - The user will press finger on the scanner they want to be added - The FPS will take a picture of that fingerprint and ask to remove the finger - The FPS will then ask for the finger again to take another picture, then ask to remove - The FPS will then ask for the finger one last time to take final picture, after picture is taken, the FPS will ask to remove it then print "Fingerprint has been verified:EnrollID"

The finger is to be read three times to just get a better accuracy for detecting the same finger. The unable to capture message is just to say that the device didn't take an accurate picture I suppose. Enrollment is same finger detected three times, not three fingers taken once each. However, it will not even let me get past the first detection process for middle finger, ring finger, and pinky.

That explanation puts a different complexion on the problem because if it works with reading certain fingers 3 time but not others even once it sounds like it is not a programming issue at all.

How about writing a simpler program that reads a finger just once and reports on success or failure ? That way most of the complications of the program will be removed and if the simple program works you will be able to add code to it extend the functionality.

Alright, I will try this and get back to you on the what happens. The reason for using this program with three finger scans is that is what the library came with. I just combined the separate files of enrollment and verification into one file with both of them running, just at different times.

Hmm this is strange, I tried doing just the one picture but it was not saving correctly, then I unhooked the FPS from Arduino Uno and tightened the wires ( I still need to solder for better connection ) and hooked up the FPS again and tried the original code, and was able to get my left hand pinky and ring finger working on it. However, I still cannot seem to get my right hand pinky and ring finger to register to the enrollment. It may be because of me being left hand dominant and so when I try to place my right hand on where the scanner is, it may be unusual placement for the finger or even move the wires it is connected to. So now I am for certain it is not the programming but the setup I have right now just needs to be wired and soldered completely. Thank you guys for responding and your input on the situation! It is very much appreciated!

You can try using the SDK_Demo program to clear the fingerprints you already have, then re-connect it back to your Arduino. Also check the resistors you are using for the serial data. I had issues with my reader when I first started and had to use the demo program to constantly clear the reader and it would work again. After fiddling with the resisters I got it to work smooth finally. I then used the Arduino to power it and the resisters in the documentation work fine. I also had to change the enrollID to 1 to get it to accept more than three fingers. Have you tried just the default code that was included with the library?

Yeah I originally used the default code before changing it a little bit. I also just found out that I am using the older version of the FPS that only stores up to 20 different fingerprints instead of 200. This wasn't brought to my attention until just now from my buddy who gave me the FPS. Now it all seems clear to why I am having the issue of enrollID #20 not saving, because I use the array of 0-19. Silly me :'(.