Finger print Sensor not finding sensors

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
EthanReed
 
Posts: 2
Joined: Wed Jun 16, 2021 11:21 am

Finger print Sensor not finding sensors

Post by EthanReed »

Hi,


I have been working on a project and wanted to use the slim optical fingerprint sensor to protect it. I got my order in from Adafruit and started out on the fingerprint sensor. I followed the guide that was posted on the Adafruit website even though the tutorial and wiring diagram was showing the bigger finger print sensor. I thought that the code and wires might be the same so I went on and plugged in the wires and ran the enroll code provided in the Adafruit Fingerprint library.


Code: Select all

/***************************************************
  This is an example sketch for our optical Fingerprint sensor

  Designed specifically to work with the Adafruit BMP085 Breakout
  ----> http://www.adafruit.com/products/751

  These displays use TTL Serial to communicate, 2 pins are required to
  interface
  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.
  BSD license, all text above must be included in any redistribution
 ****************************************************/

#include <Adafruit_Fingerprint.h>


#if (defined(__AVR__) || defined(ESP8266)) && !defined(__AVR_ATmega2560__)
// For UNO and others without hardware serial, we must use software serial...
// pin #2 is IN from sensor (GREEN wire)
// pin #3 is OUT from arduino  (WHITE wire)
// Set up the serial port to use softwareserial..
SoftwareSerial mySerial(2, 3);

#else
// On Leonardo/M0/etc, others with hardware serial, use hardware serial!
// #0 is green wire, #1 is white
#define mySerial Serial1

#endif


Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

uint8_t id;

void setup()
{
  Serial.begin(9600);
  while (!Serial);  // For Yun/Leo/Micro/Zero/...
  delay(100);
  Serial.println("\n\nAdafruit Fingerprint sensor enrollment");

  // set the data rate for the sensor serial port
  finger.begin(57600);

  if (finger.verifyPassword()) {
    Serial.println("Found fingerprint sensor!");
  } else {
    Serial.println("Did not find fingerprint sensor :(");
    while (1) { delay(1); }
  }

  Serial.println(F("Reading sensor parameters"));
  finger.getParameters();
  Serial.print(F("Status: 0x")); Serial.println(finger.status_reg, HEX);
  Serial.print(F("Sys ID: 0x")); Serial.println(finger.system_id, HEX);
  Serial.print(F("Capacity: ")); Serial.println(finger.capacity);
  Serial.print(F("Security level: ")); Serial.println(finger.security_level);
  Serial.print(F("Device address: ")); Serial.println(finger.device_addr, HEX);
  Serial.print(F("Packet len: ")); Serial.println(finger.packet_len);
  Serial.print(F("Baud rate: ")); Serial.println(finger.baud_rate);
}

uint8_t readnumber(void) {
  uint8_t num = 0;

  while (num == 0) {
    while (! Serial.available());
    num = Serial.parseInt();
  }
  return num;
}

void loop()                     // run over and over again
{
  Serial.println("Ready to enroll a fingerprint!");
  Serial.println("Please type in the ID # (from 1 to 127) you want to save this finger as...");
  id = readnumber();
  if (id == 0) {// ID #0 not allowed, try again!
     return;
  }
  Serial.print("Enrolling ID #");
  Serial.println(id);

  while (!  getFingerprintEnroll() );
}

uint8_t getFingerprintEnroll() {

  int p = -1;
  Serial.print("Waiting for valid finger to enroll as #"); Serial.println(id);
  while (p != FINGERPRINT_OK) {
    p = finger.getImage();
    switch (p) {
    case FINGERPRINT_OK:
      Serial.println("Image taken");
      break;
    case FINGERPRINT_NOFINGER:
      Serial.println(".");
      break;
    case FINGERPRINT_PACKETRECIEVEERR:
      Serial.println("Communication error");
      break;
    case FINGERPRINT_IMAGEFAIL:
      Serial.println("Imaging error");
      break;
    default:
      Serial.println("Unknown error");
      break;
    }
  }

  // OK success!

  p = finger.image2Tz(1);
  switch (p) {
    case FINGERPRINT_OK:
      Serial.println("Image converted");
      break;
    case FINGERPRINT_IMAGEMESS:
      Serial.println("Image too messy");
      return p;
    case FINGERPRINT_PACKETRECIEVEERR:
      Serial.println("Communication error");
      return p;
    case FINGERPRINT_FEATUREFAIL:
      Serial.println("Could not find fingerprint features");
      return p;
    case FINGERPRINT_INVALIDIMAGE:
      Serial.println("Could not find fingerprint features");
      return p;
    default:
      Serial.println("Unknown error");
      return p;
  }

  Serial.println("Remove finger");
  delay(2000);
  p = 0;
  while (p != FINGERPRINT_NOFINGER) {
    p = finger.getImage();
  }
  Serial.print("ID "); Serial.println(id);
  p = -1;
  Serial.println("Place same finger again");
  while (p != FINGERPRINT_OK) {
    p = finger.getImage();
    switch (p) {
    case FINGERPRINT_OK:
      Serial.println("Image taken");
      break;
    case FINGERPRINT_NOFINGER:
      Serial.print(".");
      break;
    case FINGERPRINT_PACKETRECIEVEERR:
      Serial.println("Communication error");
      break;
    case FINGERPRINT_IMAGEFAIL:
      Serial.println("Imaging error");
      break;
    default:
      Serial.println("Unknown error");
      break;
    }
  }

  // OK success!

  p = finger.image2Tz(2);
  switch (p) {
    case FINGERPRINT_OK:
      Serial.println("Image converted");
      break;
    case FINGERPRINT_IMAGEMESS:
      Serial.println("Image too messy");
      return p;
    case FINGERPRINT_PACKETRECIEVEERR:
      Serial.println("Communication error");
      return p;
    case FINGERPRINT_FEATUREFAIL:
      Serial.println("Could not find fingerprint features");
      return p;
    case FINGERPRINT_INVALIDIMAGE:
      Serial.println("Could not find fingerprint features");
      return p;
    default:
      Serial.println("Unknown error");
      return p;
  }

  // OK converted!
  Serial.print("Creating model for #");  Serial.println(id);

  p = finger.createModel();
  if (p == FINGERPRINT_OK) {
    Serial.println("Prints matched!");
  } else if (p == FINGERPRINT_PACKETRECIEVEERR) {
    Serial.println("Communication error");
    return p;
  } else if (p == FINGERPRINT_ENROLLMISMATCH) {
    Serial.println("Fingerprints did not match");
    return p;
  } else {
    Serial.println("Unknown error");
    return p;
  }

  Serial.print("ID "); Serial.println(id);
  p = finger.storeModel(id);
  if (p == FINGERPRINT_OK) {
    Serial.println("Stored!");
  } else if (p == FINGERPRINT_PACKETRECIEVEERR) {
    Serial.println("Communication error");
    return p;
  } else if (p == FINGERPRINT_BADLOCATION) {
    Serial.println("Could not store in that location");
    return p;
  } else if (p == FINGERPRINT_FLASHERR) {
    Serial.println("Error writing to flash");
    return p;
  } else {
    Serial.println("Unknown error");
    return p;
  }

  return true;
}
I was following the diagram off of Adafruit's Website https://learn.adafruit.com/adafruit-opt ... th-arduino

And the video tutorial I was following https://www.youtube.com/watch?v=1diFaa5OsFg
And this sensor I am using https://www.adafruit.com/product/4750



Also, while compiling, the error messages said

Code: Select all

/Users/ethan/Documents/Arduino/libraries/Adafruit_Fingerprint_Sensor_Library/Adafruit_Fingerprint.cpp: In member function 'uint8_t Adafruit_Fingerprint::setPassword(uint32_t)':
/Users/ethan/Documents/Arduino/libraries/Adafruit_Fingerprint_Sensor_Library/Adafruit_Fingerprint.cpp:415:54: warning: narrowing conversion of '(password >> 24)' from 'uint32_t {aka long unsigned int}' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]
   SEND_CMD_PACKET(FINGERPRINT_SETPASSWORD, (password >> 24), (password >> 16),
                                            ~~~~~~~~~~^~~~~~
/Users/ethan/Documents/Arduino/libraries/Adafruit_Fingerprint_Sensor_Library/Adafruit_Fingerprint.cpp:37:21: note: in definition of macro 'GET_CMD_PACKET'
   uint8_t data[] = {__VA_ARGS__};                                              \
                     ^~~~~~~~~~~
/Users/ethan/Documents/Arduino/libraries/Adafruit_Fingerprint_Sensor_Library/Adafruit_Fingerprint.cpp:415:3: note: in expansion of macro 'SEND_CMD_PACKET'
   SEND_CMD_PACKET(FINGERPRINT_SETPASSWORD, (password >> 24), (password >> 16),
   ^~~~~~~~~~~~~~~
/Users/ethan/Documents/Arduino/libraries/Adafruit_Fingerprint_Sensor_Library/Adafruit_Fingerprint.cpp:415:72: warning: narrowing conversion of '(password >> 16)' from 'uint32_t {aka long unsigned int}' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]
   SEND_CMD_PACKET(FINGERPRINT_SETPASSWORD, (password >> 24), (password >> 16),
                                                              ~~~~~~~~~~^~~~~~
/Users/ethan/Documents/Arduino/libraries/Adafruit_Fingerprint_Sensor_Library/Adafruit_Fingerprint.cpp:37:21: note: in definition of macro 'GET_CMD_PACKET'
   uint8_t data[] = {__VA_ARGS__};                                              \
                     ^~~~~~~~~~~
/Users/ethan/Documents/Arduino/libraries/Adafruit_Fingerprint_Sensor_Library/Adafruit_Fingerprint.cpp:415:3: note: in expansion of macro 'SEND_CMD_PACKET'
   SEND_CMD_PACKET(FINGERPRINT_SETPASSWORD, (password >> 24), (password >> 16),
   ^~~~~~~~~~~~~~~
/Users/ethan/Documents/Arduino/libraries/Adafruit_Fingerprint_Sensor_Library/Adafruit_Fingerprint.cpp:416:29: warning: narrowing conversion of '(password >> 8)' from 'uint32_t {aka long unsigned int}' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]
                   (password >> 8), password);
                   ~~~~~~~~~~^~~~~
/Users/ethan/Documents/Arduino/libraries/Adafruit_Fingerprint_Sensor_Library/Adafruit_Fingerprint.cpp:37:21: note: in definition of macro 'GET_CMD_PACKET'
   uint8_t data[] = {__VA_ARGS__};                                              \
                     ^~~~~~~~~~~
/Users/ethan/Documents/Arduino/libraries/Adafruit_Fingerprint_Sensor_Library/Adafruit_Fingerprint.cpp:415:3: note: in expansion of macro 'SEND_CMD_PACKET'
   SEND_CMD_PACKET(FINGERPRINT_SETPASSWORD, (password >> 24), (password >> 16),
   ^~~~~~~~~~~~~~~
/Users/ethan/Documents/Arduino/libraries/Adafruit_Fingerprint_Sensor_Library/Adafruit_Fingerprint.cpp:37:32: warning: narrowing conversion of 'password' from 'uint32_t {aka long unsigned int}' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]
   uint8_t data[] = {__VA_ARGS__};                                              \
                                ^
/Users/ethan/Documents/Arduino/libraries/Adafruit_Fingerprint_Sensor_Library/Adafruit_Fingerprint.cpp:50:3: note: in expansion of macro 'GET_CMD_PACKET'
   GET_CMD_PACKET(__VA_ARGS__);                                                 \
   ^~~~~~~~~~~~~~
/Users/Ethan/Documents/Arduino/libraries/Adafruit_Fingerprint_Sensor_Library/Adafruit_Fingerprint.cpp:415:3: note: in expansion of macro 'SEND_CMD_PACKET'
   SEND_CMD_PACKET(FINGERPRINT_SETPASSWORD, (password >> 24), (password >> 16),
   ^~~~~~~~~~~~~~~
After all of that, I opened the serial monitor to see
Adafruit Fingerprint sensor enrollment
Did not find fingerprint sensor :(



After trying everything I could, I kept getting this message.



If anybody knows how to fix this with code or wiring, please help me.


Thank You

User avatar
jerryn
 
Posts: 1865
Joined: Sat Sep 14, 2013 9:05 am

Re: Finger print Sensor not finding sensors

Post by jerryn »

There are wiring instructions for this sensor on the product page:
https://www.adafruit.com/product/4750

Code: Select all

Use this pin-out to connect to your microcontroller, and then use our library to interface over UART pins. This sensor now uses 57600 baud but some older versions were set to 115200 baud rather than the 'standard' 57600 used by many other sensors, so you may need to update the examples to 115200 baud for the sensor to respond (just try both!)

Black to GND
Yellow to Microcontroller TX (data out from microcontroller)
Green to Microcontroller RX (data in from microcontroller)
Red to 3.3V VIN
White to IRQ (can leave disconnected)
Blue to 3.3V VCC (can leave disconnected)


I think you can ignore the warnings as long as it compiles successfully.
Note: I do not represent Adafruit. Just trying to help.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”