GT511Core Fingerprint Sensor Library

This library is an alternate to the FPS_GT511C3 Josh Hawley created, which has been updated and maintained by sparkfun.

The advantages of this library:

  1. It can use either hardware (Serial, Serial1, etc.) or software (SoftwareSerial or AltSoftSerial) serial ports
  2. Receive will time out after a specified duration
  3. It can recover from spurious data received by the GT511.
  4. It has the most common functions already programmed.
  5. It works with both the GT511C1 and GT511C3.
  6. It uses less memory and program space

The disadvantages of this library:

  1. A serial object must be created separately.
  2. The serial port must be initialized by calling .begin(9600), then passed as a parameter when calling the GT511Core’s .begin
  3. Not all functions of the GT511 are implemented, most notably the upload and download functions.

Declaration:

#include <GT511Core.h>
GT511Core fingerPrintScanner

Initialization:
mySerialPort.begin(9600);
fingerPrintScanner(mySerialPort);

Usage:

Unless otherwise noted, the functions return ‘true’ if the command was acknowleged by the device.

.begin(pSerial); Required for use. Does not return a value.

.ledOn(); Turns on big blue LED

.ledOff(); Turns off LED

.isFingerPressed(); Returns ‘true’ if finger is on sensor. It also turns on the LED.

.isRecognized(pUserID); Turns on LED, and waits indefinely until a finger is placed on the scanner. Returns true if finger belongs to pUserID. If pUserID is GT511_ALLUSERS, then returns true if finger belongs to anyone registered on the device. Turns off LED when complete.

.exist(pUserID); Returns ‘true’ if there is an identity stored in slot pUserID.

.add(pUserID); This will add or replace the identity in slot pUserID. The user places their finger on the sensor when the sensor is glowing steady, and removes it when it is flashing. The process is done with the same finger 3 times. Returns ‘true’ and and flashes the LED twice if successfully added. Turns LED off when complete.

.remove(pUserID); This removes the identity stored in slot pUserID. If pUserID is GT511_ALLUSERS, then it deletes entire database.

.sendCommand(pCommand, pData); Low-level driver to send a command to the device. pCommand is the hex byte of the GT511 command, and pData is the least significant byte of the data sent to the unit. Can be further modified by variable commandStr.

.getResponse(); Low-level driver that receives the standard 12 byte response packet from the device. Returns true if ACK received. Additional data can be read from the responseData variable.

.setBaud(pNewBaud); Change from current baud (power-on default is 9600). Valid values are 9600, 19200, 38400, 57600, and 115200. After sending this command, the serial port must call its .end and repeat its .begin with the new rate, then repeat the .begin process with the GT511Core object. See GT511ChangeBaud example. Note that if the layout/design cannot reliably support the higher rate, the project must be power-cycled in order to recover.

– Hardware (Simplified Wire Diagram)

  |------------|
  |            |
  |   GT511    |      GT511                         Arduino
  |            |
  |  (Sensor)  |       TX --------( 1.0 kohm )-------(RX*)
  |    side    |
  |            |       RX --------( 560 ohm )-|------(TX*)
  |            |                              |
  |------------|               /-( 1.0 kohm )-/
  |            |       GND-----|----------------------GND
  |  1 2 3 4   |
  |------------|       PWR----------------------------5V
     T R G V
     X X N i
         D n

RX* and TX* are connected to the pins that will be used as a serial port to talk with the GT511. They are NOT the TX and RX pins on the Arduino, unless you do not intend to use the USB port when the GT511 is connected. Instead, you will be using another serial port, such as Serial1 (Mega only), or a software-driven serial port (SoftwareSerial or AltSoftSerial), with their associated RX and TX pins.

The resistors protect the GT511 and Arduino. The GT511 specifications lack detail as to whether the RX input can tolerate 5V, and so it is divided down to less than 3.3V. Also, miswires of TX and RX are common, so the resistor on the TX line is there to prevent any damage if an output is connected to another output.

USB is unable to power the Arduino and GS511 together, so external power MUST be used even when programming the project.

GT511Core.zip (14.4 KB)