-
-
Are functions as replacement supported? I would love to be able to use my RunlengthEncoding snippets.
let RLE = { enc: t => t.replace(/([^\d])\1*/g, m => m.length > 1 ? m.length + m[0] : m[0]), dec: t => t.replace(/(\d+)([^\d])/g, (m, r, c) => new Array(+r + 1).join(c)) }
-- Edit --
I did flash this version on my espruino wifi and it seems to work!
But i run into LOW MEMORY issues while using RLE.dec with a ~5k chars long string. -
-
I did not find anything about that in the datasheets. But it acts as an usb drive so there are sure ways to do this. I ordered one because i am very interested in the touch wake up feature.
About the algorithm.. i dont think this will help. The matching of a fingerprint is not like simple string matching. You cant just let the fingerprint generate a template and then search for a match in a database. There is all kinds of magic and fairy dust involved :)
-
Checking the datasheet for it right as we "speak".
-
I think both are not feasible. Your best bet would be to upload templates to DB check against it and repeat until you found the right one. But this could take quite a while.. so this might not be feasible too.
-- Edit --
Or you can get your hands on a GT-511C5 .. it can store up to 2000 fingerprints.-- Edit 2 --
Found a source here. Not as pricey as i thought :)Even better GT-521F52.
Up to 3000 fingerprint, wake on touch and its mentioned a shared database via network! -
In each step of the enrollment the template gets refined so to speak.. after the 3 captures at enrollment you get one template. At verify/identify the finger is captured once, some kind of match rating is calculated and then matched (match rating > some threshold)
against a specific template (verify) or the database (identify).You can fill the sensor DB with your stored templates and use identify.. or if you know which template should match just validate against a single template.
Look at the datasheets i linked. The functions are Verify/Identify/VerifyTemplate/IdentifyTemplate
-- Edit --
@allObjects This sensor is quite finicky at enrollment.. you have to press and release your finger.. and if i press the finger more then a tiny bit a different way the enrollment fails. Switching fingers fails too. -
The code is on my github repo here.
Cant remember the exact display i bought but i do remember it does have a lower resolution.
So i will have to resize the image.. or get a different e-ink display for this :) -
Well after a a long private message session user81574 and i figured it out and the GT511-xx series should work. Of course i had a few bugs in my code but at the end it was the minification with Esprima that roadblocked us. But i guess at least in part thats my fault too.. poor esprima cant make sense of my mess i think.
Next i want to try do display the captured images of the sensor on a eink display i have for a while now. I never used it so far.. so first step would be to get the display going and then see how i.. preferably stream.. images from the fingerprint scanner to it.
-
-
-
My example was to get the template of slot 0. So you need to have previously enrolled a fingerprint to slot 0. You can check how many templates are stored with getEnrollCount()
or check if a particular slot is used by a template with checkEnrolled(slot).I will try to make a more complete example later today.
-
Okay.. i think it works now. I uploaded the module on my github so its easy to share.
Try this example to get you started:let GT511 = require('https://github.com/PaddeK/espruino-gt511cxx/blob/master/gt511cxx.js'); let serial = Serial.find(B7); serial.setup(9600, {rx: B7, tx: B6}); let g = new GT511(GT511.Devices.GT511C1R, serial), open = () => g.open(), close = () => g.close(), getTemplate = (t) => () => g.getTemplate(t); let base64Enc = (bytes) => btoa(bytes.reduce((p, c) => p + String.fromCharCode(c), '')), base64Dec = (string) => E.toUint8Array(atob(string).split('')); GT511.sequence([open, getTemplate(0), close]).then(result => { // result is an array that contains the return values of all functions called in the sequence (in same order) let template = result[1], b64 = base64Enc(template); console.log('template', template); console.log('base64', b64); console.log('validate', base64Dec(b64).slice(0, -1).toString() === template.toString()); // something is fishy here }).catch(err => console.log(err));
And i guess i found a bug in espruino somewhere.. while converting the template back to a Uint8Array i have to remove a trailing zero.. which i have no clue why it is there in the first place.
-
-
-
-
Something like this should do the trick.
let GT511CXX = require('./gt511cxx.js'), fps = new GT511CXX(GT511CXX.Devices.GT511C3, Serial1); fps.open().then(() => { fps.getTemplate(0).then(template => { console.log('template', template); }).catch(err => console.log(err)); }).catch(err => console.log(err));
This example should return you the template in the first slot (slot: 0).
It should return an error if there is no template in the given slot. -
-
-
I was glad too.. i had not much experience with promises at that time but this was my chance to get my feet wet so to speak :)
In terms of memory usage i have to admit that i have no clue. This was my first little project with microcontrollers and espruino i just hacked away and was hoping for the best. -
I cant really test it.. but i looked a bit at the index.js and saw i was testing a function for complete enrollment. A few minor changes i think and you should get it to work.
Try this as a replacement for the index.js
'use strict'; let GT511CXX = require('./gt511cxx.js'); GT511CXX.prototype.enroll = function(id) { let me = this, open = () => me.open(), start = () => me.enrollStart(id), capture = () => me.captureFinger(true), waitFinger = () => me.waitFinger(10000, false), waitReleaseFinger = () => me.waitFinger(10000, true), ledOn = () => me.switchLED(true), ledOff = () => me.switchLED(false), enroll1 = () => me.enroll1(), enroll2 = () => me.enroll2(), enroll3 = () => me.enroll3(), enrollDelay = () => new Promise(resolve => setTimeout(resolve, 500)), blinkDelay = () => new Promise(resolve => setTimeout(resolve, 100)); return new Promise((resolve, reject) => { let errorHandler = (err) => { ledOff(); reject(err); }, successHandler = () => { console.log('enroll success'); resolve(); }; open() .then(ledOn) .then(() => console.log('press finger')) .then(waitFinger) .then(start) .then(capture) .then(enroll1) .then(() => console.log('enroll 1 done')) .then(ledOff) .then(blinkDelay) .then(ledOn) .then(() => console.log('release finger')) .then(waitReleaseFinger) .then(enrollDelay) .then(() => console.log('press finger')) .then(waitFinger) .then(capture) .then(enroll2) .then(() => console.log('enroll 2 done')) .then(ledOff) .then(blinkDelay) .then(ledOn) .then(() => console.log('release finger')) .then(waitReleaseFinger) .then(enrollDelay) .then(() => console.log('press finger')) .then(waitFinger) .then(capture) .then(enroll3) .then(() => console.log('enroll 3 done')) .then(ledOff) .then(successHandler) .catch(errorHandler); }); }; let fps = new GT511CXX(GT511CXX.Devices.GT511C1R, Serial1); fps.enroll(0); // ID 0 means first storage slot .. slot has to be empty
The enrollment function itself shows a lot of the usage i had in mind.
It is more a series of module calls then a module function itself.. but the
complete enrollment process was so tedious that i wanted to provide a solution with
the module i guess.Btw. pretty much all of the code is based on the documents i found here:
http://www.adh-tech.com.tw/files/GT-511C3_datasheet_V1%201_20131127.pdf
http://www.adh-tech.com.tw/files/GT-511C1R_datasheet_V2-2016-10-25.pdf--- Edit ---
About the profile size.. its 506 or 498 bytes depending on the sensor model.
As far as i can see i already can handle the profiles.. but the fingerprint images the sensor
can capture are in the order of 50kb.. and with that i had no luck. But before i could really dig in to it i destroyed my GT-511C1R.. but i was lucky.. my espruino wifi survived. -
I started a while ago a module for this but never got to the finishing touches.
I am sure it could be improved quite a lot but as a starter it should work.
As far as i remember i got stuck with memory issues while trying to handle the
fingerprint images.. i wanted them to display on an eink. I guess with the improvements in espruino 1v93 and 1v94 its possible now. Sadly i damaged my fingerprint sensor in an tee spill excitend so i cant finish the module.I attached the code as is.. let me know if you need help to make sense of the mess :)
-
I did not test it unminified. Let me try that later today and i will let you know if anything changes.