Andrey Ovcharov

Professional Software Engineer and hobbyist Hardware enthusiast

Andrey Ovcharov

FPC1020 Fingerprint Scanner - detecting finger presence

After some disruption on hardware design, I have returned to writing driver for the FPC1020 fingerprint scanner. It’s sad, but as I don’t have complete documentation the process takes a significant amount of time and a lot of effort. To speed up the evaluation I started to write relevant code using C++ and Arduino Framework.

Next article in the series - How to detect finger presence with the scanner with the Arduino. I am using the ESP8266 development board to run the examples.

The process is relatively simple.

// send the command FPC102X_REG_FINGER_PRESENT_QUERY = 32
fpc.command(FPC102X_REG_FINGER_PRESENT_QUERY);

// read the interrupt value with clear
// FPC102X_REG_READ_INTERRUPT_WITH_CLEAR = 28
uint8_t interrupt = fpc.interrupt(true);
if (interrupt == 0x81)
{
    // FPC102X_REG_FINGER_PRESENT_QUERY = 32
    uint16_t status = fpc.finger_present_status();
    Serial.printf("Finger present status: 0x%04X\n", status);
    print_finger_present(status);
}

The scanner has 12 detection sensors arranged in a matrix of 3 rows and 4 columns. Every sensor is represented as one bit in the status value.

Finger detector

The following function is used to display the sensors in the serial monitor:

void print_finger_present(uint16_t status)
{
    for (int row = 0; row < 3; row++)    {
        for (int col = 0; col < 4; col++)
        {
            uint16_t bit = 1 << (row * 4 + col);

            if ((status & bit) != 0)
            {
                Serial.print('#');
            }
            else
            {
                Serial.print('.');
            }
        }

        Serial.println();
    }
    Serial.println();
}

For example, when the right bottom part of the scanner is covered with the finger output looks like

Finger present status: 0x0CC0
....
..##
..##

When the scanner is not fully covered I can take the data from the finger detector register and therefore reduce the area to retrieve fingerprint image. It can be very helpful to reduce the required memory and CPU time for the microcontroller. As well finger detector can be used to implement button-like behaviour or even simple gesture recognition if one is required.

The code for the test project is available in my GitHub repository FPC1020-Arduino.