I am thinking of using the CLUE with the adafruit fingerprint sensor: https://learn.adafruit.com/adafruit-opt ... r/overview.
Wanted to know if that is possible and also I see that the fingerprint sensor needs the UART pins but those pins are missing on the CLUE. Iam trying to avoid using an audrino or a raspberry pi.
Also in the example, it says that I need to add the follwoing section :
# If using with a computer such as Linux/RaspberryPi, Mac, Windows with USB/serial converter:
# import serial
# uart = serial.Serial("/dev/ttyUSB0", baudrate=57600, timeout=1)
I tried installing the serial library from the audrino website, but the clue keeps looking for the serial library in the lib folder and I am not able to find serial library for the clue.
Any help would be greatly apprecaited.
Can I use CLUE with the fingerprint sensor?
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- jerryn
- Posts: 1869
- Joined: Sat Sep 14, 2013 9:05 am
Re: Can I use CLUE with the fingerprint sensor?
According to the Pinout the pinouts - the RX/TX are on the #0/#1 pads https://learn.adafruit.com/adafruit-clue/pinouts
You should be able to connect the fingerprint sensor to those.
Then use the Circuitptyhon example https://learn.adafruit.com/adafruit-opt ... 3044769-20 its does not use "serial"
It uses busio.UART
Note: I have not tried this myself and I don't represent Adafruit. Just trying to help.
You should be able to connect the fingerprint sensor to those.
Then use the Circuitptyhon example https://learn.adafruit.com/adafruit-opt ... 3044769-20 its does not use "serial"
It uses busio.UART
Note: I have not tried this myself and I don't represent Adafruit. Just trying to help.
- jerryn
- Posts: 1869
- Joined: Sat Sep 14, 2013 9:05 am
Re: Can I use CLUE with the fingerprint sensor?
FYI - I hooked up one of the R503 Fingeprint sensors to my CLUE as above and it worked. I did have to make one change to the code.
CircuitPython does not accept the "flush=True" argument to the Print commands so I had to remove them all.
Otherwise it worked normally.
here is the modified fingerprint_simpletest.py that I used
CircuitPython does not accept the "flush=True" argument to the Print commands so I had to remove them all.
Otherwise it worked normally.
here is the modified fingerprint_simpletest.py that I used
Code: Select all
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
import time
import board
import busio
from digitalio import DigitalInOut, Direction
import adafruit_fingerprint
led = DigitalInOut(board.D13)
led.direction = Direction.OUTPUT
uart = busio.UART(board.TX, board.RX, baudrate=57600)
# If using with a computer such as Linux/RaspberryPi, Mac, Windows with USB/serial converter:
# import serial
# uart = serial.Serial("/dev/ttyUSB0", baudrate=57600, timeout=1)
# If using with Linux/Raspberry Pi and hardware UART:
# import serial
# uart = serial.Serial("/dev/ttyS0", baudrate=57600, timeout=1)
finger = adafruit_fingerprint.Adafruit_Fingerprint(uart)
##################################################
def get_fingerprint():
"""Get a finger print image, template it, and see if it matches!"""
print("Waiting for image...")
while finger.get_image() != adafruit_fingerprint.OK:
pass
print("Templating...")
if finger.image_2_tz(1) != adafruit_fingerprint.OK:
return False
print("Searching...")
if finger.finger_search() != adafruit_fingerprint.OK:
return False
return True
# pylint: disable=too-many-branches
def get_fingerprint_detail():
"""Get a finger print image, template it, and see if it matches!
This time, print out each error instead of just returning on failure"""
print("Getting image...", end="")
i = finger.get_image()
if i == adafruit_fingerprint.OK:
print("Image taken")
else:
if i == adafruit_fingerprint.NOFINGER:
print("No finger detected")
elif i == adafruit_fingerprint.IMAGEFAIL:
print("Imaging error")
else:
print("Other error")
return False
print("Templating...", end="")
i = finger.image_2_tz(1)
if i == adafruit_fingerprint.OK:
print("Templated")
else:
if i == adafruit_fingerprint.IMAGEMESS:
print("Image too messy")
elif i == adafruit_fingerprint.FEATUREFAIL:
print("Could not identify features")
elif i == adafruit_fingerprint.INVALIDIMAGE:
print("Image invalid")
else:
print("Other error")
return False
print("Searching...", end="")
i = finger.finger_fast_search()
# pylint: disable=no-else-return
# This block needs to be refactored when it can be tested.
if i == adafruit_fingerprint.OK:
print("Found fingerprint!")
return True
else:
if i == adafruit_fingerprint.NOTFOUND:
print("No match found")
else:
print("Other error")
return False
# pylint: disable=too-many-statements
def enroll_finger(location):
"""Take a 2 finger images and template it, then store in 'location'"""
for fingerimg in range(1, 3):
if fingerimg == 1:
print("Place finger on sensor...", end="")
else:
print("Place same finger again...", end="")
while True:
i = finger.get_image()
if i == adafruit_fingerprint.OK:
print("Image taken")
break
if i == adafruit_fingerprint.NOFINGER:
print(".", end="")
elif i == adafruit_fingerprint.IMAGEFAIL:
print("Imaging error")
return False
else:
print("Other error")
return False
print("Templating...", end="")
i = finger.image_2_tz(fingerimg)
if i == adafruit_fingerprint.OK:
print("Templated")
else:
if i == adafruit_fingerprint.IMAGEMESS:
print("Image too messy")
elif i == adafruit_fingerprint.FEATUREFAIL:
print("Could not identify features")
elif i == adafruit_fingerprint.INVALIDIMAGE:
print("Image invalid")
else:
print("Other error")
return False
if fingerimg == 1:
print("Remove finger")
time.sleep(1)
while i != adafruit_fingerprint.NOFINGER:
i = finger.get_image()
print("Creating model...", end="")
i = finger.create_model()
if i == adafruit_fingerprint.OK:
print("Created")
else:
if i == adafruit_fingerprint.ENROLLMISMATCH:
print("Prints did not match")
else:
print("Other error")
return False
print("Storing model #%d..." % location, end="")
i = finger.store_model(location)
if i == adafruit_fingerprint.OK:
print("Stored")
else:
if i == adafruit_fingerprint.BADLOCATION:
print("Bad storage location")
elif i == adafruit_fingerprint.FLASHERR:
print("Flash storage error")
else:
print("Other error")
return False
return True
##################################################
def get_num():
"""Use input() to get a valid number from 1 to 127. Retry till success!"""
i = 0
while (i > 127) or (i < 1):
try:
i = int(input("Enter ID # from 1-127: "))
except ValueError:
pass
return i
while True:
print("----------------")
if finger.read_templates() != adafruit_fingerprint.OK:
raise RuntimeError("Failed to read templates")
print("Fingerprint templates:", finger.templates)
print("e) enroll print")
print("f) find print")
print("d) delete print")
print("----------------")
c = input("> ")
if c == "e":
enroll_finger(get_num())
if c == "f":
if get_fingerprint():
print("Detected #", finger.finger_id, "with confidence", finger.confidence)
else:
print("Finger not found")
if c == "d":
if finger.delete_model(get_num()) == adafruit_fingerprint.OK:
print("Deleted!")
else:
print("Failed to delete")
- jerryn
- Posts: 1869
- Joined: Sat Sep 14, 2013 9:05 am
Re: Can I use CLUE with the fingerprint sensor?
An update on the "flush" argument. It turns out that it is a bug in CircuitPython. See this issue for progress on fixing it https://github.com/adafruit/circuitpython/issues/4888.
For now , you can just remove the "flush" arguments as I noted.
For now , you can just remove the "flush" arguments as I noted.
- dkanday
- Posts: 60
- Joined: Mon Jun 07, 2021 4:49 pm
Re: Can I use CLUE with the fingerprint sensor?
Thanks Jerryn
- dkanday
- Posts: 60
- Joined: Mon Jun 07, 2021 4:49 pm
Re: Can I use CLUE with the fingerprint sensor?
Hi Jerryn,
I am trying to use the R503 fingerprint sensor with the clue(modified audrino code). The way I am implementing the code is when I press the left button or button A, I enroll the user and when pressing the button B, I search for the fingerprint.
The issue I am facing is when I store a fingerprint, it says stored successfully and when I tried to read back the same fingerprint it says unknown fingerprint.
The reason I have modified is to remove unwanted data and also I removed the ID# as I cannot input an ID into it.(attached is the code for reference)
But when I run the default example code on the UNO, it stores the data correctly.
Questions:
1. Can removing the ID cause an issue? if not what can cause this error.
2. Also can I have a built in counter where it remembers the last known ID which the finger print got associated to and when I enroll it, the ID increments by itself?
Any help is greatly appreciated.
I am trying to use the R503 fingerprint sensor with the clue(modified audrino code). The way I am implementing the code is when I press the left button or button A, I enroll the user and when pressing the button B, I search for the fingerprint.
The issue I am facing is when I store a fingerprint, it says stored successfully and when I tried to read back the same fingerprint it says unknown fingerprint.
The reason I have modified is to remove unwanted data and also I removed the ID# as I cannot input an ID into it.(attached is the code for reference)
But when I run the default example code on the UNO, it stores the data correctly.
Questions:
1. Can removing the ID cause an issue? if not what can cause this error.
2. Also can I have a built in counter where it remembers the last known ID which the finger print got associated to and when I enroll it, the ID increments by itself?
Any help is greatly appreciated.
- Attachments
-
[The extension ino has been deactivated and can no longer be displayed.]
- jerryn
- Posts: 1869
- Joined: Sat Sep 14, 2013 9:05 am
Re: Can I use CLUE with the fingerprint sensor?
There is a lot going on in your example and it is hard for me to follow it clearly especially with ll the commented code.
Also, I have not used the Arduino Library so I am not familiar with it. I have been working under CircuitPython.
However, if you comment out the finger.storemode call as you have
it is not clear that you are actually storing the fingerprint in the reader.
I would suggest trying to simplify the example to debug the fingerprint sensor operation.
It is good to know that the library examples work OK.
Also, I have not used the Arduino Library so I am not familiar with it. I have been working under CircuitPython.
However, if you comment out the finger.storemode call as you have
Code: Select all
// p = finger.storeModel(id); // D v6 commenting this line
I would suggest trying to simplify the example to debug the fingerprint sensor operation.
It is good to know that the library examples work OK.
- dkanday
- Posts: 60
- Joined: Mon Jun 07, 2021 4:49 pm
Re: Can I use CLUE with the fingerprint sensor?
Hi Jerryn,
enabling the section mentioned in the code and modifying made it work. Thanks for the suggestion :)
enabling the section mentioned in the code and modifying made it work. Thanks for the suggestion :)
- jerryn
- Posts: 1869
- Joined: Sat Sep 14, 2013 9:05 am
Re: Can I use CLUE with the fingerprint sensor?
Great! Glad it is working.
Good luck with your project!
Good luck with your project!
- dkanday
- Posts: 60
- Joined: Mon Jun 07, 2021 4:49 pm
Re: Can I use CLUE with the fingerprint sensor?
Hi jerryn,
Were you able to turn on and off the LEDs on the sensor? I am having trouble understanding how to do that.
Were you able to turn on and off the LEDs on the sensor? I am having trouble understanding how to do that.
- jerryn
- Posts: 1869
- Joined: Sat Sep 14, 2013 9:05 am
Re: Can I use CLUE with the fingerprint sensor?
I have not used the Arduino Library -- I have only used the R503 with Circuitpython. The LED works with Circuitpython.
With Arduino, I think you use the LEDcontrol function https://github.com/adafruit/Adafruit-Fi ... t.cpp#L339
Have you tried this example? I am not sure if it is for the R503 https://github.com/adafruit/Adafruit-Fi ... ontrol.ino
With Arduino, I think you use the LEDcontrol function https://github.com/adafruit/Adafruit-Fi ... t.cpp#L339
Have you tried this example? I am not sure if it is for the R503 https://github.com/adafruit/Adafruit-Fi ... ontrol.ino
- dkanday
- Posts: 60
- Joined: Mon Jun 07, 2021 4:49 pm
Re: Can I use CLUE with the fingerprint sensor?
Thanks.. let me try that out.
- dkanday
- Posts: 60
- Joined: Mon Jun 07, 2021 4:49 pm
Re: Can I use CLUE with the fingerprint sensor?
Thanks Jerryn,
That example worked for me.
That example worked for me.
Please be positive and constructive with your questions and comments.