|
5 | 5 | basically, Feel free to hack away at it, but just give me credit for my work =)
|
6 | 6 | TLDR; Wil Wheaton's Law
|
7 | 7 |
|
8 |
| - This simple sketch turns the LED on and off similar to the Arduino blink sketch. |
| 8 | + Description: This simple sketch turns the LED on and off similar to the Arduino blink sketch. |
9 | 9 | It is used to show that communications are working.
|
| 10 | + |
| 11 | + This code should work with the any model of ADH-Tech's FPS as long as |
| 12 | + you are within the minimum logic level threshold for the FPS serial UART. |
| 13 | + This code has been tested with these models: |
| 14 | + |
| 15 | + GT-511C3 [ https://www.sparkfun.com/products/11792 ] |
| 16 | + GT-511C1R [ https://www.sparkfun.com/products/13007 ] |
| 17 | + |
10 | 18 | */
|
11 | 19 |
|
12 | 20 | #include "FPS_GT511C3.h"
|
13 | 21 | #include "SoftwareSerial.h"
|
14 | 22 |
|
15 |
| -// Hardware setup - FPS connected to: |
16 |
| -// digital pin 4(arduino rx, fps tx) |
17 |
| -// digital pin 5(arduino tx - 560ohm resistor fps tx - 1000ohm resistor - ground) |
18 |
| -// this brings the 5v tx line down to about 3.2v so we dont fry our fps |
| 23 | +/*-------------------- HARDWARE HOOKUP with 5V Arduino -------------------- |
| 24 | +1.) Dedicated Bi-Directional Logic Level Converter (LLC) |
19 | 25 |
|
20 |
| -FPS_GT511C3 fps(4, 5); |
| 26 | +It is recommended to use a dedicated bi-direcitonal LLC |
| 27 | +[ https://www.sparkfun.com/products/12009 ] for a reliable connection if you |
| 28 | +are using a 5V Arduino microcontroller: |
| 29 | +
|
| 30 | + Fingerprint Scanner (Pin #) <-> Logic Level Converter <-> 5V Arduino w/ Atmega328P |
| 31 | + UART_TX (3.3V TTL)(Pin 1) <-> LV1 <-> HV1 <-> RX (pin 4) |
| 32 | + UART_RX (3.3V TTL)(Pin 2) <-> LV4 <-> HV4 <-> TX (pin 5) |
| 33 | + GND (Pin 3) <-> GND <-> GND <-> GND |
| 34 | + Vin (3.3V~6V) (Pin 4) <-> HV <-> 5V |
| 35 | + LV <-> 3.3V |
| 36 | + |
| 37 | +2.) Voltage Division w/ 3x 10kOhm Resistors |
| 38 | +
|
| 39 | +Otherwise, you could use 3x 10kOhm resistors [ https://www.sparkfun.com/products/11508 ] |
| 40 | +to divide the voltage from a 5V Arduino down to 3.3V FPS similar to the |
| 41 | +"Uni-Directional" application circuit on our old logic level converter |
| 42 | +[ https://cdn.sparkfun.com/assets/b/0/e/1/0/522637c6757b7f2b228b4568.png ]: |
| 43 | +
|
| 44 | + Voltage Divider <-> Fingerprint Scanner(Pin #) <-> Voltage Divider <-> 5V Arduino w/ Atmega328P |
| 45 | + <-> UART_TX (3.3V TTL) (Pin 1) <-> <-> RX (pin 4) |
| 46 | + GND <-> 10kOhm <-> 10kOhm <-> UART_RX (3.3V TTL) (Pin 2) <-> 10kOhm <-> TX (pin 5) |
| 47 | + GND <-> GND (Pin 3) <-> GND <-> GND |
| 48 | + <-> Vin (3.3V~6V) (Pin 4) <-> <-> 5V |
| 49 | + |
| 50 | +Note: You can add the two 10kOhm resistors in series for 20kOhms. =) |
| 51 | +
|
| 52 | +--------------------------------------------------------------------------------*/ |
| 53 | + |
| 54 | +// set up software serial pins for Arduino's w/ Atmega328P's |
| 55 | +// FPS (TX) is connected to pin 4 (Arduino's Software RX) |
| 56 | +// FPS (RX) is connected through a converter to pin 5 (Arduino's Software TX) |
| 57 | +FPS_GT511C3 fps(4, 5); // (Arduino SS_RX = pin 4, Arduino SS_TX = pin 5) |
| 58 | + |
| 59 | +/*If using another Arduino microcontroller, try commenting out line 57 and |
| 60 | +uncommenting line 66 due to the limitations listed in the |
| 61 | +library's note => https://www.arduino.cc/en/Reference/softwareSerial . Do |
| 62 | +not forget to rewire the connection to the Arduino*/ |
| 63 | + |
| 64 | +// FPS (TX) is connected to pin 10 (Arduino's Software RX) |
| 65 | +// FPS (RX) is connected through a converter to pin 11 (Arduino's Software TX) |
| 66 | +//FPS_GT511C3 fps(10, 11); // (Arduino SS_RX = pin 10, Arduino SS_TX = pin 11) |
21 | 67 |
|
22 | 68 | void setup()
|
23 | 69 | {
|
24 |
| - Serial.begin(9600); |
| 70 | + Serial.begin(9600); //set up Arduino's hardware serial UART |
25 | 71 | fps.UseSerialDebug = true; // so you can see the messages in the serial debug screen
|
26 |
| - fps.Open(); |
| 72 | + fps.Open(); //send serial command to initialize fps |
27 | 73 | }
|
28 | 74 |
|
29 |
| - |
30 | 75 | void loop()
|
31 | 76 | {
|
32 | 77 | // FPS Blink LED Test
|
|
0 commit comments