44 Licensed for non-commercial use, must include this license message
55 basically, Feel free to hack away at it, but just give me credit for my work =)
66 TLDR; Wil Wheaton's Law
7-
7+
88 Description: This code enrolls a fingerprint by creating a ID template. It requires
99 three samples of your fingerprint.
10-
10+
1111 This code should work with the any model of ADH-Tech's FPS as long as
1212 you are within the minimum logic level threshold for the FPS serial UART.
1313 This code has been tested with these models:
1616 GT-521F32 [ https://www.sparkfun.com/products/14518 ]
1717 GT-511C3 [ https://www.sparkfun.com/products/11792 ]
1818 GT-511C1R [ https://www.sparkfun.com/products/13007 ]
19-
20- -------------------- HARDWARE HOOKUP with 5V Arduino --------------------
2119
22- 1.) Dedicated Bi-Directional Logic Level Converter (LLC)
20+ -------------------- HARDWARE HOOKUP with 5V Arduino --------------------
21+
22+ 1.) Dedicated Bi-Directional Logic Level Converter (LLC)
2323
24- It is recommended to use a dedicated bi-direcitonal LLC
25- [ https://www.sparkfun.com/products/12009 ] for a reliable connection if you
26- are using a 5V Arduino microcontroller:
24+ It is recommended to use a dedicated bi-direcitonal LLC
25+ [ https://www.sparkfun.com/products/12009 ] for a reliable connection if you
26+ are using a 5V Arduino microcontroller:
2727
2828 Fingerprint Scanner (Pin #) <-> Logic Level Converter <-> 5V Arduino w/ Atmega328P
2929 UART_TX (3.3V TTL)(Pin 1) <-> LV1 <-> HV1 <-> RX (pin 4)
3030 UART_RX (3.3V TTL)(Pin 2) <-> LV4 <-> HV4 <-> TX (pin 5)
3131 GND (Pin 3) <-> GND <-> GND <-> GND
3232 Vin (3.3V~6V) (Pin 4) <-> HV <-> 5V
3333 LV <-> 3.3V
34-
35- 2.) Voltage Division w/ 3x 10kOhm Resistors
3634
37- Otherwise, you could use 3x 10kOhm resistors [ https://www.sparkfun.com/products/11508 ]
38- to divide the voltage from a 5V Arduino down to 3.3V FPS similar to the
39- "Uni-Directional" application circuit on our old logic level converter
40- [ https://cdn.sparkfun.com/assets/b/0/e/1/0/522637c6757b7f2b228b4568.png ]:
35+ 2.) Voltage Division w/ 3x 10kOhm Resistors
36+
37+ Otherwise, you could use 3x 10kOhm resistors [ https://www.sparkfun.com/products/11508 ]
38+ to divide the voltage from a 5V Arduino down to 3.3V FPS similar to the
39+ "Uni-Directional" application circuit on our old logic level converter
40+ [ https://cdn.sparkfun.com/assets/b/0/e/1/0/522637c6757b7f2b228b4568.png ]:
4141
4242 Voltage Divider <-> Fingerprint Scanner(Pin #) <-> Voltage Divider <-> 5V Arduino w/ Atmega328P
4343 <-> UART_TX (3.3V TTL) (Pin 1) <-> <-> RX (pin 4)
4444 GND <-> 10kOhm <-> 10kOhm <-> UART_RX (3.3V TTL) (Pin 2) <-> 10kOhm <-> TX (pin 5)
4545 GND <-> GND (Pin 3) <-> GND <-> GND
4646 <-> Vin (3.3V~6V) (Pin 4) <-> <-> 5V
47-
48- Note: You can add the two 10kOhm resistors in series for 20kOhms. =)
4947
50- --------------------------------------------------------------------------------
48+ Note: You can add the two 10kOhm resistors in series for 20kOhms. =)
49+
50+ --------------------------------------------------------------------------------
5151
5252*****************************************************************/
5353
@@ -60,83 +60,89 @@ Note: You can add the two 10kOhm resistors in series for 20kOhms. =)
6060FPS_GT511C3 fps (4 , 5 ); // (Arduino SS_RX = pin 4, Arduino SS_TX = pin 5)
6161
6262/* If using another Arduino microcontroller, try commenting out line 60 and
63- uncommenting line 69 due to the limitations listed in the
64- library's note => https://www.arduino.cc/en/Reference/softwareSerial . Do
65- not forget to rewire the connection to the Arduino*/
63+ uncommenting line 69 due to the limitations listed in the
64+ library's note => https://www.arduino.cc/en/Reference/softwareSerial . Do
65+ not forget to rewire the connection to the Arduino*/
6666
6767// FPS (TX) is connected to pin 10 (Arduino's Software RX)
6868// FPS (RX) is connected through a converter to pin 11 (Arduino's Software TX)
6969// FPS_GT511C3 fps(10, 11); // (Arduino SS_RX = pin 10, Arduino SS_TX = pin 11)
7070
7171void setup ()
7272{
73- Serial.begin (9600 ); // set up Arduino's hardware serial UART
74- delay (100 );
75- fps.Open (); // send serial command to initialize fps
76- fps.SetLED (true ); // turn on LED so fps can see fingerprint
73+ Serial.begin (9600 ); // set up Arduino's hardware serial UART
74+ delay (100 );
75+ fps.Open (); // send serial command to initialize fps
76+ fps.SetLED (true ); // turn on LED so fps can see fingerprint
7777
78- Enroll (); // begin enrolling fingerprint
78+ Enroll (); // begin enrolling fingerprint
7979}
8080
8181void Enroll ()
8282{
83- // Enroll test
84-
85- // find open enroll id
86- int enrollid = 0 ;
87- bool usedid = true ;
88- while (usedid == true )
89- {
90- usedid = fps.CheckEnrolled (enrollid);
91- if (usedid==true ) enrollid++;
92- }
93- fps.EnrollStart (enrollid);
94-
95- // enroll
96- Serial.print (" Press finger to Enroll #" );
97- Serial.println (enrollid);
98- while (fps.IsPressFinger () == false ) delay (100 );
99- bool bret = fps.CaptureFinger (true );
100- int iret = 0 ;
101- if (bret != false )
102- {
103- Serial.println (" Remove finger" );
104- fps.Enroll1 ();
105- while (fps.IsPressFinger () == true ) delay (100 );
106- Serial.println (" Press same finger again" );
107- while (fps.IsPressFinger () == false ) delay (100 );
108- bret = fps.CaptureFinger (true );
109- if (bret != false )
110- {
111- Serial.println (" Remove finger" );
112- fps.Enroll2 ();
113- while (fps.IsPressFinger () == true ) delay (100 );
114- Serial.println (" Press same finger yet again" );
115- while (fps.IsPressFinger () == false ) delay (100 );
116- bret = fps.CaptureFinger (true );
117- if (bret != false )
118- {
119- Serial.println (" Remove finger" );
120- iret = fps.Enroll3 ();
121- if (iret == 0 )
122- {
123- Serial.println (" Enrolling Successful" );
124- }
125- else
126- {
127- Serial.print (" Enrolling Failed with error code:" );
128- Serial.println (iret);
129- }
130- }
131- else Serial.println (" Failed to capture third finger" );
132- }
133- else Serial.println (" Failed to capture second finger" );
134- }
135- else Serial.println (" Failed to capture first finger" );
83+ // Enroll test
84+
85+ // find open enroll id
86+ int enrollid = 0 ;
87+ bool usedid = true ;
88+ while (usedid == true )
89+ {
90+ usedid = fps.CheckEnrolled (enrollid);
91+ if (usedid == true ) enrollid++;
92+ }
93+ fps.EnrollStart (enrollid);
94+
95+ // enroll
96+ Serial.print (" Press finger to Enroll #" );
97+ Serial.println (enrollid);
98+ while (fps.IsPressFinger () == false ) delay (100 );
99+ bool bret = fps.CaptureFinger (true );
100+ int iret = 0 ;
101+ if (bret != false )
102+ {
103+ Serial.println (" Remove finger" );
104+ iret = fps.Enroll1 ();
105+ while (fps.IsPressFinger () == true ) delay (100 );
106+ Serial.println (" Press same finger again" );
107+ while (fps.IsPressFinger () == false ) delay (100 );
108+ bret = fps.CaptureFinger (true );
109+ if (bret != false && !iret)
110+ {
111+ Serial.println (" Remove finger" );
112+ iret = fps.Enroll2 ();
113+ while (fps.IsPressFinger () == true ) delay (100 );
114+ Serial.println (" Press same finger yet again" );
115+ while (fps.IsPressFinger () == false ) delay (100 );
116+ bret = fps.CaptureFinger (true );
117+ if (bret != false && !iret)
118+ {
119+ Serial.println (" Remove finger" );
120+ iret = fps.Enroll3 ();
121+ if (iret == 0 )
122+ {
123+ Serial.println (" Enrolling Successful" );
124+ }
125+ else
126+ {
127+ Serial.print (" Enrolling Failed with error code:" );
128+ Serial.println (iret);
129+ }
130+ }
131+ else if (iret) {
132+ Serial.print (" Enrolling Failed with error code:" );
133+ Serial.println (iret);
134+ } else Serial.println (" Failed to capture third finger" );
135+ }
136+ else if (iret) {
137+ Serial.print (" Enrolling Failed with error code:" );
138+ Serial.println (iret);
139+ } else Serial.println (" Failed to capture second finger" );
140+ }
141+ else Serial.println (" Failed to capture first finger" );
136142}
137143
138144
139145void loop ()
140146{
141- delay (100000 );
147+ delay (100000 );
142148}
0 commit comments