Connecting a Fingerprint Scanner with Arduino Uno as a Counter?

Good Evening,

I have a project that I am working on for school that involves the Adafruit fingerprint scanner and an Arduino Uno. I also have and LCD that I purchased from them as well.

Fingerprint Scanner: Fingerprint sensor : ID 751 : $49.95 : Adafruit Industries, Unique & fun DIY electronics and kits
LCD Display: Standard LCD 20x4 + extras [white on blue] : ID 198 : $17.95 : Adafruit Industries, Unique & fun DIY electronics and kits

My question is, How can I make the fingerprint scanner count upwards and then back down to zero. For example:

1st person scans counter starts = 1
2nd person scans finger display = 2
3rd person scans finger display = 3 etc, etc, etc, Now the tricky part.

When any person scans finger again it subtracts a number. The numbers do not have to match the fingerprint of each person, just count up and back down when same finger scanned a second time.

Thanks in advance for the help as I have no Idea where to begin. I have tested the display and fingerprint scanner, uploaded their codes onto Arduino, and messed around with blinking L.E.D's.

RogerM1259:
I have no Idea where to begin

Divide the problem up into the smallest possible steps, and tackle them separately.

Detect when a fingerprint is scanned.
Associate a unique identity with each fingerprint.
Keep a list of fingerprint identities which are currently 'in'.
Find whether a given identity is already in the list.
Add an identity to the list.
Remove an identity from the list.
Count the number of identities in the list.
Display a number.

Presumably the fingerprint scanner comes with examples showing how to detect a fingerprint and recognise it. That would give you a good starting point for the first few tasks.

Thanks for the response.

I actually have the LCD and the fingerprint scanner working. My LCD lights up and i have the words I need to display on the LCD being displayed. I have also used the example that Adafruit offers and their code to see if the scanner works. I am able to capture a print and store it on the device. My problem now is, How do I get them to work together. The finger print loading and verifying can stay on the serial. I just need it to start to count up on the display once a finger is scanned. Then when that finger is scanned again it starts to count down. I have been reading about Boolean Variables. I assume they are just certain ways of using an If statement.

I have experience with Matlab so I kinda understand the Arduino language a little. Just not enough to integrate all my components together.

Presumably, the device identifies which of the stored fingerprints it's seeing when a known finger is applied to it.

Given that, you need to keep a record of which ones have been seen so you know when a finger is presented whether you're seeing it for the first time (count++) or a second (count--).

An array would be a simple way of keeping that data. An array of whatever type the sensor returns to identify a print - likely byte or int.

This is what I was told to do.

"You can start by creating an array of booleans large enough to hold one flag for each fingerprint and initialize all of them to 'false'. As each fingerprint is scanned, you can check its ID in the array. If it is 'false' set it to 'true' and increment the counter. If it is 'true' then set it to 'false' and decrement the counter."

So what thread did you get that from? Because if it's a thread on this forum then you're cross-posting.

On Arduino a boolean is an 8 bit variable than can be 0 or 1 for false or true.
An array is a chain of variables that are accessed by index.

byte myArray[ 8 ] = { 10, 20, 30, 40, 50, 60, 70, 80 }; // each can be any value from 0 to 255

myArray[ 0 ] contains 10
myArray[ 7 ] contains 80

As booleans they would all be 0 or 1.
byte myBools[ 8 ]; // by default they all start as 0

And the same 8 true/false flags could be the 8 bits of a single byte which can be checked in a single compare.

I dunno why it's doi it this way but once you understand arrays it might make sense to you.

As each fingerprint is scanned, you can check its ID in the array. If it is 'false' set it to 'true' and increment the counter. If it is 'true' then set it to 'false' and decrement the counter."

I got it from what a moderator in the Adafruit forum. Since the fingerprint scanner is from Adafruit I was hoping to get help from them.

I am a beginner with Arduino, the way he responded to me I did not understand him very well. Thank you for your response and help with this.

This really shouldn't be a separate thread - hopefully one of the mods will merge it for you.

The reply you got from Adafruit pretty much gives you your answer. If you want to increment your count when you first see a fingerprint and then decrement when you see it again, you have to have some way to know which ones you have seen.

The boolean array is the mechanism to do that. You'll need one that has the same number of elements as you have fingerprints stored in your scanner. That could be the number you've scanned in, but better to make it the maximum number the scanner can hold.
e.g.

boolean FingerprintsSeen[160];

The scanner returns you a number identifying the fingerprint. You can use than as an index into the array. When you look up the indexed element of the array the boolean value is used to tell you whether you've seen the element before or not. That in turn tells you whether to increment or decrement.

Alternatively, especially for a few fingerprints, you can have a bunch of individual booleans such as SeenFingerprint1, SeenFingerprint2 etc. This would need a lot of repeated code though and would hopefully push you towards reading about how to use arrays.

RogerM1259:
I got it from what a moderator in the Adafruit forum. Since the fingerprint scanner is from Adafruit I was hoping to get help from them.

I am a beginner with Arduino, the way he responded to me I did not understand him very well. Thank you for your response and help with this.

You're doing fine. You're still trying. :slight_smile:
It's easy to get caught out over terms you've never seen.
Identify the parts that hold you up and work through those as a start to getting a sketch together.
At least that way you can ask questions that will get you farther, quicker.

Thanks wildbill and goforsmoke,

I just feel stupid when it comes to Arduino language. It became less frustrating when I realized this is just like learning a different language. So the frustration has gone down a little. I just dove into the deep end of the pool head first with this project I am doing. Should have just used some on and off Technics and be done with it.

Your IDE has Example sketches loadable through File->Examples.
You want to go through sections 1,2,3 and 5.
Skip 4 as it teaches using resource eating C++ Strings instead of C strings that have no overhead.
Don't miss 5, even if you see a capital-S String. 5 is Control, arrays, loops and branches.

The explanations for those are here:

Your IDE will have the versions and libraries suited to that revision IDE.

Ok so I got the fingerprint sensor and lcd to work the way I want them to work! XD

Now I have another question. I need a digital pin to read a voltage coming in. When that voltage is disconnected, another pin is activated. Activating a force sensor that is connected to it.

Example:
Pin 6 has 5 volts coming in to it.
Pin 6 ceases to recieve 5 volts, pin 5 activates as a analog read. (Pin 5 is set to analog read with constraints.)

For demonstration this will be done by arduino it self. So for pin 6, a jumper wire will be connect from one of the 5v outputs on the arduino back into pin 6 with a manual switch in between. No external powersource other then the 9 volt battery to power the arduino board. I am testing and writing code with the project plugged into my usb on my computer.

Second reason for asking is I don't want to burn my board. Will I need a resistor before going back into pin 6 with 5v straight from the arduino?

Thanks again! for all your help!

Pin 6 ceases to recieve 5 volts, pin 5 activates as a analog read. (Pin 5 is set to analog read with constraints.)

Which pin 5? Digital pin 5 or analog pin 5?

There is nothing really to do to "activate" an analog pin. What you want to do is read, or not read, that pin, depending on whether digital pin 6 is HIGH or LOW.

Will I need a resistor before going back into pin 6 with 5v straight from the arduino?

No.

Pin 5 is digital. I just need pin 5 to turn LOW when pin 6 reads 5v. When pin 6 does not read 5v, turn pin 5 HIGH which would send 5v out and turn on the force pressure sensor. Right now I have the force sensor reading analog when it is open (115), when it is closed (5). I was able to blink an LED when the sensor is pressed down on. I am good with that. I just need the sensor to recieve power when the other votlage source is turned off. (Pin 6) I kept it at 5 v so that I can use HIGH and LOW andbe done with this project. Lol

Pin 5 is digital.

You can't read an FSR on a digital pin.

I just need the sensor to recieve power when the other votlage source is turned off.

Why? Why not power the sensor all the time, and only read it when appropriate?

PaulS:

Pin 5 is digital.

You can't read an FSR on a digital pin.

My bad, Pin 5 will just either HIGH or LOW.

I just need the sensor to recieve power when the other votlage source is turned off.

Why? Why not power the sensor all the time, and only read it when appropriate?

This project is to simulate once the driver of a vehicle turns the ignition off. That is when sensor turns on. When driver turns on vehicle(ignition on), sensor turns off.

I think an if statement will do right?

9V battery through a 5V regulator operation. You want to save power too.

Roger, the AVR has built-in 20K-50K ohm pullup resistors on all the I/O pins.
If you set pinMode( pinNumber, INPUT_PULLUP )
-- then grounding that pin will read LOW, not grounded reads HIGH.
The circuit only drains current when the button is pressed and that through at least 20K ohms.
All it takes to test is a jumper plugged into the pin header and the other end touched to the USB jack.

I think an if statement will do right?

if(digitalRead(pin6) == LOW)
{
    int fsrVal = analogRead(fsrPin);
    // Do something with fsrVal
}
else
{
   // who gives a damn what the fsr reading is?
}

Yes, I believe you are right.

Paul and everyone else who helped Thank you so much! I have my code. Everything I want my project to do, it is doing it. Now I just need to enclose it and present it! Thank you again for all your help. I plan on doing hobby projects over the summer to keep me busy. I will be coming back with more questions.

Sincerely,
Roger