ESP32 I2C interfacing problem with SEN0359 capacitive fingerprint sensor

Hello,

I've been stuck for hours trying to figure out how to get my finger print sensor to work. I'm using a ESP32NodeMCU, programmed through the ArduinoIDE. I'm simply trying to run the example code that comes along with it but nothing is being output on the serial monitor. I have a suspicion that the issue resides with the Wire.h library/ I2C bus. I've added 2k, 4.6k, 10k pull ups the SDA/ SCL as required for the ESP32 (only reasonable resistor sizes I had) but neither option has changed the result. I've checked the wiring numerous times and I've even tried the code on a back up sensor I brought just in case. I just have no idea why it isn't working. I'll included a weird error message I get along with the example code they provide. I'll also link the github page: GitHub - DFRobot/DFRobot_ID809_I2C.

One thing about the error message is the code compiles and still uploads but clearly something isn't right.
Error message:

Example code (To recieve basic information about the sensor):

/*!
 * @file getDeviceInformation.ino
 * @brief Get fingerprint module information 
 * @details Experiment Phenomenon:serial print module ID, security level, baud rate, etc. 
 * @copyright  Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
 * @License     The MIT License (MIT)
 * @author [Eddard](Eddard.liu@dfrobot.com)
 * @version  V1.1
 * @date  2020-03-19
 * @url https://github.com/DFRobot/DFRobot_ID809_I2C
*/

#include <DFRobot_ID809_I2C.h>

DFRobot_ID809_I2C fingerprint;
//DFRobot_ID809_UART fingerprint(115200);
//String desc;

void setup(){
  /*Init print serial port */
  Serial.begin(9600);
  /*Take FPSerial as communication port of the module*/
  fingerprint.begin();
  /*Wait for Serial to open*/
  while(!Serial);
  /*Test whether device can communicate properly with mainboard 
    Return true or false
    */
  while(fingerprint.isConnected() == false){
    Serial.println("Communication with device failed, please check connection");
    /*Get error code information */
    //desc = fingerprint.getErrorDescription();
    //Serial.println(desc);
    delay(1000);
  }
}

uint8_t enrollCount;   //Number of registered users 

void loop(){
  /*Set module ID, available range: 1-255*/
  //fingerprint.setDeviceID(/*Device ID = */1);
  Serial.print("Module ID:");
  /*Read module ID*/
  Serial.println(fingerprint.getDeviceID());
  
  /*Set module security level, range 1-5. Default level: 3
    Security Level          Recognition rate 
      Level 1           FAR  0.1%
                        FRR  0.005%
      Level 2           FAR  0.003%
                        FRR  0 01%
      Level 3           FAR  0.001%
                        FRR  0.1%
      Level 4           FAR  0.003%
                        FRR  0.5%
      Level 5           FAR  0.0001%
                        FRR  1%
   */
  //fingerprint.setSecurityLevel(/*Security Level = */3);
  Serial.print("Module security level:");
  /*Read module security level*/
  Serial.println(fingerprint.getSecurityLevel());
  
  /*Set module baud rate, available range: 
    e9600bps    e19200bps   e38400bps   e57600bps    e115200bps
       1           2            3          4             5
   */
  //fingerprint.setBaudrate(fingerprint.e115200bps);
  Serial.print("Module baud rate: ");
  /*Read module baud rate*/
  Serial.println(fingerprint.getBaudrate());
  
  /*Set module self-learning function, 1(ON) 0(OFF)*/
  //fingerprint.setAutoLearn(/*Auto Learn = */1);
  Serial.print("Module self-learning function: ");
  /*Read the state of module self-learning function 
    Print ON if it is enabled, otherwise print OFF */
  Serial.println(fingerprint.getSelfLearn()?"ON":"OFF");
  
  /*Set module serial number, the number of characters of serial number should be small than 15 */
  //fingerprint.setModuleSN(/*Module SN = */"DFRobot");
  Serial.print("Module serial number:");
  /*Read module serial number */
  Serial.println(fingerprint.getModuleSN());
  
  Serial.print("Number of registered fingerprints in the module:");
  /*Get the number of registered users */
  Serial.println(enrollCount = fingerprint.getEnrollCount());
  /*Declare an array to hold ID list */
  uint8_t list[80] = {0};
  /*Get user list 
   */
  fingerprint.getEnrolledIDList(list);
  Serial.print("ID list of registered users: ");
  for(uint8_t i = 0; i < enrollCount; i++){
    Serial.print(list[i]);
    Serial.print(",");
  }
  
  Serial.print("\nNumber of broken fingerprints:");
  /*Get the number of broken fingerprints */
  Serial.println(fingerprint.getBrokenQuantity());
  /*Get the ID of the first broken fingerprint*/
  //fingerprint.getBrokenID();
  Serial.println("-----------------------------");

  delay(1000);
}

My googling also led me to believe there might be a solution by looking here at the library code for the sensor but I couldn't spot/ understand if I was in the right place, I've included an image below of what I mean:

Help us help you.

I2C scanner

What did the I2C scanner report?

I'm using an ESP32NodeMCU Micro-controller. I'm also using the Gravity Capacitive Fingerprint Sensor from DFRobot (SEN0359) connected through I2C. I am trying to run the getDeviceInformation example code given by them in their library

DFRobot_ID809_I2C.h

When I run this code:

/*!
 * @file getDeviceInformation.ino
 * @brief Get fingerprint module information 
 * @details Experiment Phenomenon:serial print module ID, security level, baud rate, etc. 
 * @copyright  Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
 * @License     The MIT License (MIT)
 * @author [Eddard](Eddard.liu@dfrobot.com)
 * @version  V1.1
 * @date  2020-03-19
 * @url https://github.com/DFRobot/DFRobot_ID809_I2C
*/

#include <DFRobot_ID809_I2C.h>

DFRobot_ID809_I2C fingerprint;
//DFRobot_ID809_UART fingerprint(115200);
//String desc;

void setup(){
  /*Init print serial port */
  Serial.begin(9600);
  /*Take FPSerial as communication port of the module*/
  fingerprint.begin();
  /*Wait for Serial to open*/
  while(!Serial);
  /*Test whether device can communicate properly with mainboard 
    Return true or false
    */
  while(fingerprint.isConnected() == false){
    Serial.println("Communication with device failed, please check connection");
    /*Get error code information */
    //desc = fingerprint.getErrorDescription();
    //Serial.println(desc);
    delay(1000);
  }
}

uint8_t enrollCount;   //Number of registered users 

void loop(){
  /*Set module ID, available range: 1-255*/
  //fingerprint.setDeviceID(/*Device ID = */1);
  Serial.print("Module ID:");
  /*Read module ID*/
  Serial.println(fingerprint.getDeviceID());
  
  /*Set module security level, range 1-5. Default level: 3
    Security Level          Recognition rate 
      Level 1           FAR  0.1%
                        FRR  0.005%
      Level 2           FAR  0.003%
                        FRR  0 01%
      Level 3           FAR  0.001%
                        FRR  0.1%
      Level 4           FAR  0.003%
                        FRR  0.5%
      Level 5           FAR  0.0001%
                        FRR  1%
   */
  //fingerprint.setSecurityLevel(/*Security Level = */3);
  Serial.print("Module security level:");
  /*Read module security level*/
  Serial.println(fingerprint.getSecurityLevel());
  
  /*Set module baud rate, available range: 
    e9600bps    e19200bps   e38400bps   e57600bps    e115200bps
       1           2            3          4             5
   */
  //fingerprint.setBaudrate(fingerprint.e115200bps);
  Serial.print("Module baud rate: ");
  /*Read module baud rate*/
  Serial.println(fingerprint.getBaudrate());
  
  /*Set module self-learning function, 1(ON) 0(OFF)*/
  //fingerprint.setAutoLearn(/*Auto Learn = */1);
  Serial.print("Module self-learning function: ");
  /*Read the state of module self-learning function 
    Print ON if it is enabled, otherwise print OFF */
  Serial.println(fingerprint.getSelfLearn()?"ON":"OFF");
  
  /*Set module serial number, the number of characters of serial number should be small than 15 */
  //fingerprint.setModuleSN(/*Module SN = */"DFRobot");
  Serial.print("Module serial number:");
  /*Read module serial number */
  Serial.println(fingerprint.getModuleSN());
  
  Serial.print("Number of registered fingerprints in the module:");
  /*Get the number of registered users */
  Serial.println(enrollCount = fingerprint.getEnrollCount());
  /*Declare an array to hold ID list */
  uint8_t list[80] = {0};
  /*Get user list 
   */
  fingerprint.getEnrolledIDList(list);
  Serial.print("ID list of registered users: ");
  for(uint8_t i = 0; i < enrollCount; i++){
    Serial.print(list[i]);
    Serial.print(",");
  }
  
  Serial.print("\nNumber of broken fingerprints:");
  /*Get the number of broken fingerprints */
  Serial.println(fingerprint.getBrokenQuantity());
  /*Get the ID of the first broken fingerprint*/
  //fingerprint.getBrokenID();
  Serial.println("-----------------------------");

  delay(1000);
}

I get this error message:

In file included from c:\Users\Natha\Documents\Arduino\libraries\arduino_110033/DFRobot_ID809_I2C.h:22,
                 from c:\Users\Natha\Documents\Arduino\libraries\arduino_110033\DFRobot_ID809_I2C.cpp:12:
C:\Users\Natha\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\Wire\src/Wire.h: In member function 'virtual void DFRobot_ID809_I2C::sendPacket(pCmdPacketHeader_t)':
C:\Users\Natha\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\Wire\src/Wire.h:127:13: note: candidate 1: 'uint8_t TwoWire::requestFrom(int, int)'
     uint8_t requestFrom(int address, int size);
             ^~~~~~~~~~~
C:\Users\Natha\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\Wire\src/Wire.h:125:13: note: candidate 2: 'uint8_t TwoWire::requestFrom(uint8_t, uint8_t)'
     uint8_t requestFrom(uint8_t address, uint8_t size);
             ^~~~~~~~~~~
C:\Users\Natha\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\Wire\src/Wire.h:127:13: note: candidate 1: 'uint8_t TwoWire::requestFrom(int, int)'
     uint8_t requestFrom(int address, int size);
             ^~~~~~~~~~~
C:\Users\Natha\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\Wire\src/Wire.h:125:13: note: candidate 2: 'uint8_t TwoWire::requestFrom(uint8_t, uint8_t)'
     uint8_t requestFrom(uint8_t address, uint8_t size);
             ^~~~~~~~~~~
C:\Users\Natha\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\Wire\src/Wire.h:127:13: note: candidate 1: 'uint8_t TwoWire::requestFrom(int, int)'
     uint8_t requestFrom(int address, int size);
             ^~~~~~~~~~~
C:\Users\Natha\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\Wire\src/Wire.h:125:13: note: candidate 2: 'uint8_t TwoWire::requestFrom(uint8_t, uint8_t)'
     uint8_t requestFrom(uint8_t address, uint8_t size);
             ^~~~~~~~~~~
C:\Users\Natha\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\Wire\src/Wire.h:127:13: note: candidate 1: 'uint8_t TwoWire::requestFrom(int, int)'
     uint8_t requestFrom(int address, int size);
             ^~~~~~~~~~~
C:\Users\Natha\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\Wire\src/Wire.h:125:13: note: candidate 2: 'uint8_t TwoWire::requestFrom(uint8_t, uint8_t)'
     uint8_t requestFrom(uint8_t address, uint8_t size);
             ^~~~~~~~~~~
C:\Users\Natha\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\Wire\src/Wire.h: In member function 'virtual size_t DFRobot_ID809_I2C::readN(void*, size_t)':
C:\Users\Natha\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\Wire\src/Wire.h:127:13: note: candidate 1: 'uint8_t TwoWire::requestFrom(int, int)'
     uint8_t requestFrom(int address, int size);
             ^~~~~~~~~~~
C:\Users\Natha\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\Wire\src/Wire.h:125:13: note: candidate 2: 'uint8_t TwoWire::requestFrom(uint8_t, uint8_t)'
     uint8_t requestFrom(uint8_t address, uint8_t size);
             ^~~~~~~~~~~

I'm not running this in a simulation, I've created the circuit on a breadboard and I've also used the I2C scanner to verify it has found the fingerprint scanner at the correct address:

Scanning...
I2C device found at address 0x1F  !
done

This is the circuit on the breadboard:

I've checked that the SDA/ SCL are indeed on pin 21 and 22 respectively. I'm a bit confused as to whether I've connected the pull up resistors correctly but I think they are in the correct place as shown in the image.

My issue is that the module information is not being printed on the serial monitor. It remains blank. I should be seeing some basic information about the fingerprint sensor as shown by the example on their webpage: Gravity: Capacitive Fingerprint Scanner/Sensor Arduino Wiki - DFRobot
Here's their github again which contains the library and code examples: GitHub - DFRobot/DFRobot_ID809_I2C

I have exact same problem, did you manage to find solution?

Hi @ashishoc

welcometo the arduino-forum.

This posting is too general to informative
You should explain if your problem is

  • One thing about the error message is the code compiles and still uploads but clearly something isn't right.
    Error message:

or

  • My issue is that the module information is not being printed on the serial monitor. It remains blank.

You should clarify this.
You should post your code as a code-section

helping analysing the problem:

If you know how to add serial output to the code add the serialoutput

best regards Stefan

Are you trying to the exact same thing as me? Using the DFRobot :Gravity capacitive fingerprint sensor with an ESP32 of some sort? If so then no, after various trouble shooting I could not find a way to get the sensor to work. This error I talked about here was a warning message and actually didn't interfere with running the code. However after fixing it the code would not go past the:

fingerprint.begin(); Method

for an unknown reason. There is a shining light though, I decided to test the sensor with an ESP8266 and it managed to run the fingerprint matching example and device information example perfectly, so if you have one around or can order one of those try it with the ESP8266 instead.

To fix the warning message:

  1. Go into the .cpp file that is where ever you installed the DFRobot_ID809_I2C library on your computer. mine was in c:\Users\insert_username_here\Documents\Arduino\libraries\arduino_110033\DFRobot_ID809_I2C.cpp

  2. Change all _pWire->requestFrom(_deviceAddr, 1); occurrences to:

_pWire->requestFrom(_deviceAddr, (uint8_t)1);

There should be 5 in total, that'll get rid of the long warning message that pops up.

FYI..

That directory name usually indicates you had 2 instances of the IDE open when you did the install. If you only have one instance running, the directory name would have been "DFRobot_ID809_I2C" which makes locating a whole lot easier :slight_smile:

thanks for input, really appreciate that!. I will try with another controller. and see if it works. Thanks again very helpful.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.