Testing the GT-511C3 Fingerprint Scanner Module

Created on: 8 January 2015

This basic test uses an Arduino Uno to test that communications with the GT-511C3 fingerprint scanner module are working.

The test sketch sends a command packet containing the Open command and non-zero command parameter. This causes a working GT-511C3 to send back an ACK followed by a data packet containing the devices static information (firmware version, serial number).

As an Amazon Associate I earn from qualifying purchases:

Bytes from the response packet (containing ACK) and data packet (containing device info.) are displayed in hexadecimal format in the Arduino IDE Serial Monitor window to confirm that the communications of the fingerprint module are working.

GT-511C3 Test Sketch

The test sketch for the fingerprint module is shown below. The GT-511C3 must be wired as shown in the article on the GT-511C3 hardware and wiring. See the wiring diagram near the bottom of the page.

It is important to wire the module correctly when connecting it to a 5V microcontroller such as the one on the Arduino Uno. This is because the RX pin of the fingerprint module can handle only 3.3V signals. The wiring diagram shows how to connect to the Arduino Uno using a voltage divider.

/*------------------------------------------------------------------------------
  Program:      GT-511C3_test

  Description:  Sketch that tests basic GT-511C3 communications by sending an
                "open" command and displaying the returned data in the Serial
                Monitor window of the Arduino IDE
  
  Hardware:     - Arduino Uno
                - GT-511C3 Optical Fingerprint Scanner Module
                
  Software:     - Developed using Arduino 1.0.6 software
                - Should be compatible with Arduino 1.0 +
  
  References:   GT-511C3 datasheet v1.1, www.adh-tech.com.tw
  
  Date:         8 January 2015
 
  Author:       W.A. Smith, http://startingelectronics.org
------------------------------------------------------------------------------*/
#include <SoftwareSerial.h>

// need a serial port to communicate with the GT-511C3
SoftwareSerial gtSerial(8, 7); // Arduino RX (GT TX), Arduino TX (GT RX)
// the Arduino TX pin needs a voltage divider, see wiring diagram at:
// http://startingelectronics.org/articles/GT-511C3-fingerprint-scanner-hardware/

// command packet that sends the "Open" command to the GT-511C3 module
byte tx_cmd[12] = { 0x55, 0xAA,             // header
                    0x01, 0x00,             // device ID
                    0x01, 0x00, 0x00, 0x00, // input parameter - get extra info
                    0x01, 0x00,             // command code - Open
                    0x02, 0x01              // checksum
                  };
                  
void setup() {
  Serial.begin(115200);  // for displaying received data from the GT-511C3
  gtSerial.begin(9600);  // for communicating with the GT-511C3
}

byte rx_byte = 0;        // stores received byte

void loop() {
  // send any character from the Serial Monitor window to send packet
  if (Serial.available()) {
    // flush the buffer so we only send packet once per received character
    rx_byte = Serial.read();
    gtSerial.write(tx_cmd, 12); // send the command packet to the GT-511C3
  }
  // check for a packet from the GT-511C3
  if (gtSerial.available()) {
    rx_byte = gtSerial.read();     // get the received byte
    Serial.print("0x");
    Serial.println(rx_byte, HEX);  // echo the byte to the Serial Monitor window
  }
}

Running the Test

Copy and paste the above code to your Arduino IDE and load it to the Arduino. At this stage the Arduino must be wired up as described in the fingerprint module wiring article (diagram also shown below).

Wiring diagram for testing the GT-511C3 fingerprint module using Arduino
Wiring the GT-511C3 to an Arduino Uno

Open the Serial Monitor window in the Arduino IDE. Make sure that the baud rate at the bottom of the IDE window is set to 115200.

Now send any character to the Arduino. If the GT-511C3 module is wired correctly and working, bytes will be received and displayed in the Serial Monitor window.

As an Amazon Associate I earn from qualifying purchases:

The video below shows the fingerprint module being tested.

Testing the GT-511C3 fingerprint module: