考勤系統(tǒng)是用于標(biāo)記辦公室和學(xué)校存在的常用系統(tǒng)。從在考勤登記冊(cè)中手動(dòng)標(biāo)記考勤到使用高科技應(yīng)用程序和生物識(shí)別系統(tǒng),這些系統(tǒng)都得到了顯著改進(jìn)。在我們以前的項(xiàng)目中,我們已經(jīng)涵蓋了使用RFID和AVR微控制器,8051和樹(shù)莓派的其他電子考勤系統(tǒng)項(xiàng)目。在這個(gè)項(xiàng)目中,我們使用指紋模塊和Arduino來(lái)獲取和保存考勤數(shù)據(jù)和記錄。通過(guò)使用指紋傳感器,系統(tǒng)對(duì)用戶來(lái)說(shuō)將變得更加安全。以下部分介紹了使用 Arduino 制作基于指紋的生物識(shí)別考勤系統(tǒng)的技術(shù)細(xì)節(jié)。
必需組件
- 阿杜伊諾 -1
- 指紋模塊 -1
- 按鈕 - 4
- 指示燈 -1
- 1K 電阻器 -2
- 2.2K 電阻 -1
- 權(quán)力
- 連接線
- 箱
- 蜂鳴器 -1
- 16x2 液晶顯示器 -1
- 面包板 -1
- RTC 模塊 -1
項(xiàng)目描述:
在這個(gè)指紋考勤系統(tǒng)電路中,我們使用指紋傳感器模塊通過(guò)在系統(tǒng)中輸入手指來(lái)驗(yàn)證真實(shí)的人或員工。在這里,我們使用4個(gè)按鈕來(lái)注冊(cè),刪除,向上/向下。注冊(cè)和 DEL 密鑰具有三重功能。ENROLL 密鑰用于將新人員注冊(cè)到系統(tǒng)中。因此,當(dāng)用戶想要注冊(cè)新手指時(shí),他/她需要按注冊(cè)鍵,然后LCD要求輸入ID,用戶想要在其中存儲(chǔ)指紋圖像?,F(xiàn)在,如果此時(shí)用戶不想繼續(xù),那么他/她可以再次按REGISTER鍵返回。這次 ENROLL 鍵表現(xiàn)為后退鍵,即 ENROLL 鍵同時(shí)具有注冊(cè)和返回功能。此外,注冊(cè)密鑰還用于通過(guò)串行監(jiān)視器下載考勤數(shù)據(jù)。同樣,DEL/OK 鍵也具有相同的雙重功能,就像用戶注冊(cè)新手指時(shí)一樣,然后他/她需要使用另外兩個(gè)鍵(即 UP 和 DOWN)來(lái)選擇手指 ID?,F(xiàn)在用戶需要按 DEL/OK 鍵(這次此鍵的行為類似于確定)以繼續(xù)使用選定的 ID。Del鍵用于重置或刪除Arduino的EEPROM中的數(shù)據(jù)。
指紋模塊:
指紋傳感器模塊捕獲手指的打印圖像,然后將其轉(zhuǎn)換為等效模板,并根據(jù)Arduino選擇的ID將它們保存到其內(nèi)存中。所有過(guò)程都由Arduino命令,例如拍攝指紋的圖像,將其轉(zhuǎn)換為模板并存儲(chǔ)為ID等。
在這里,我們添加了一個(gè)黃色LED,表示指紋模塊已準(zhǔn)備好拍攝手指的圖像。蜂鳴器也用于各種指示。Arduino是該系統(tǒng)的主要組件,它負(fù)責(zé)控制整個(gè)系統(tǒng)。
基于指紋的考勤系統(tǒng)工作原理
這個(gè)指紋考勤系統(tǒng)項(xiàng)目的工作相當(dāng)簡(jiǎn)單。首先,用戶需要在按鈕的幫助下注冊(cè)用戶的指紋。為此,用戶需要按REGISTER鍵,然后LCD要求輸入指紋的ID,以按ID名稱將其保存在內(nèi)存中。所以現(xiàn)在用戶需要使用向上/向下鍵輸入ID。選擇ID后,用戶需要按確定鍵(DEL鍵)?,F(xiàn)在LCD將要求將手指放在指紋模塊上。現(xiàn)在用戶需要將手指放在指紋模塊上,然后模塊獲取手指圖像?,F(xiàn)在LCD會(huì)說(shuō)從指紋模塊中取出手指,然后再次要求再次放置手指?,F(xiàn)在用戶需要再次放置手指,模塊獲取圖像并將其轉(zhuǎn)換為模板,并通過(guò)選定的ID將其存儲(chǔ)到指紋模塊的內(nèi)存中?,F(xiàn)在,用戶將被注冊(cè),他/她可以通過(guò)將手指放在指紋模塊上來(lái)提供出勤。通過(guò)相同的方法,所有用戶都將注冊(cè)到系統(tǒng)中。
現(xiàn)在,如果用戶想要?jiǎng)h除或刪除任何存儲(chǔ)的ID或指紋,那么他/她需要按DEL鍵。按下刪除鍵后,液晶屏將要求選擇需要?jiǎng)h除的ID?,F(xiàn)在用戶需要選擇ID并按確定鍵(相同的DEL鍵)。現(xiàn)在LCD會(huì)讓您知道指紋已成功刪除。
考勤如何在此指紋考勤系統(tǒng)項(xiàng)目中工作:
每當(dāng)用戶將手指放在指紋模塊上時(shí),指紋模塊就會(huì)捕獲手指圖像,并搜索系統(tǒng)中是否有任何ID與此指紋相關(guān)聯(lián)。如果檢測(cè)到指紋ID,則LCD將顯示已注冊(cè)出勤,同時(shí)蜂鳴器將發(fā)出一次嗶嗶聲,LED將熄滅,直到系統(tǒng)準(zhǔn)備好再次輸入。
除了指紋模塊,我們還使用了時(shí)間和日期的RTC模塊。時(shí)間和日期在系統(tǒng)中連續(xù)運(yùn)行。因此,每當(dāng)真正的用戶將手指放在指紋上并將它們保存在EEPROM中分配的內(nèi)存插槽時(shí),Arduino都會(huì)花費(fèi)時(shí)間和日期。
在這里,我們?cè)诖讼到y(tǒng)中創(chuàng)建了5個(gè)用戶空間,為期30天。通過(guò)按下Arduino中的RESET按鈕,然后立即注冊(cè)鍵將負(fù)責(zé)從Arduino EEPROM存儲(chǔ)器通過(guò)串行監(jiān)視器下載考勤數(shù)據(jù)。
內(nèi)存管理:
我們?cè)?Arduino UNO 中有 1023 字節(jié)的內(nèi)存,其中我們有 1018 字節(jié)來(lái)存儲(chǔ)數(shù)據(jù),我們已經(jīng)在 30 天內(nèi)獲取了 5 個(gè)用戶出勤數(shù)據(jù)。每次出席都會(huì)記錄時(shí)間和日期,因此這將成為 7 字節(jié)的數(shù)據(jù)。
所以所需的總內(nèi)存是
5307=1050,所以這里我們需要更多的32字節(jié)
但是如果我們要使用 4 個(gè)用戶,那么我們需要
4307=840
在這里,我們通過(guò)占用 5 個(gè)用戶內(nèi)存完成了這個(gè)項(xiàng)目演示。這樣,我們將無(wú)法存儲(chǔ) 32 字節(jié)或 5 個(gè)出席記錄的 5^千^用戶。
您可以通過(guò)更改代碼中的某些行來(lái)嘗試 4 個(gè)用戶。我已經(jīng)在需要更改的代碼中做了注釋。
指紋考勤系統(tǒng)項(xiàng)目電路圖及說(shuō)明
這個(gè)基于指紋的考勤系統(tǒng)項(xiàng)目的電路,如上圖所示,非常簡(jiǎn)單。它具有用于控制項(xiàng)目所有過(guò)程的Arduino,用于注冊(cè),刪除,選擇ID和考勤的按鈕,用于警報(bào)的蜂鳴器,用于指示的LED和用于指示用戶并顯示結(jié)果消息的LCD。
如電路圖所示,一個(gè)按鈕直接連接到Arduino的引腳A0(ENREGISTRATION),A1(DEL),A2(UP),A3(DOWN)相對(duì)于地面,黃色LED通過(guò)1k電阻連接到Arduino的數(shù)字引腳D7相對(duì)于接地。指紋模塊的 Rx 和 Tx 直接連接到 Arduino 的串行引腳 D2 和 D3(軟件串行)。5v 電源用于為取自 Arduino 板的指紋模塊供電。蜂鳴器也連接在引腳 A5 上。16x2 LCD 配置為 4 位模式,其 RS、EN、D4、D5、D6 和 D7 直接連接到 Arduino 的數(shù)字引腳 D13、D12、D11、D10、D9 和 D8。
代碼說(shuō)明:
arduino的指紋考勤系統(tǒng)代碼將在后續(xù)部分中給出。盡管代碼通過(guò)注釋很好地解釋了,但我們?cè)谶@里討論的是代碼的幾個(gè)重要部分。我們使用指紋庫(kù)將 指紋模塊與Arduino板連接 。
首先,我們包含頭文件并定義輸入和輸出引腳,并定義宏和聲明的變量。之后,在設(shè)置功能中,我們指示定義的引腳并啟動(dòng)LCD和指紋模塊
之后,我們必須編寫(xiě)用于下載考勤數(shù)據(jù)的代碼。
void setup()
{
delay(1000);
lcd.begin(16,2);
Serial.begin(9600);
pinMode(enroll, INPUT_PULLUP);
pinMode(up, INPUT_PULLUP);
pinMode(down, INPUT_PULLUP);
pinMode(del, INPUT_PULLUP);
pinMode(match, INPUT_PULLUP);
pinMode(buzzer, OUTPUT);
pinMode(indFinger, OUTPUT);
digitalWrite(buzzer, LOW);
if(digitalRead(enroll) == 0)
{
digitalWrite(buzzer, HIGH);
delay(500);
digitalWrite(buzzer, LOW);
lcd.clear();
lcd.print("Please wait");
lcd.setCursor(0,1);
lcd.print("Downloding Data");
之后,我們必須編寫(xiě)代碼來(lái)清除EEPROM中的出勤數(shù)據(jù)。
if(digitalRead(del) == 0)
{
lcd.clear();
lcd.print("Please Wait");
lcd.setCursor(0,1);
lcd.print("Reseting.....");
for(int i=1000;i<1005;i++)
EEPROM.write(i,0);
for(int i=0;i<841;i++)
EEPROM.write(i, 0xff);
lcd.clear();
lcd.print("System Reset");
delay(1000);
}
之后,我們啟動(dòng)指紋模塊,通過(guò)LCD顯示歡迎消息,并啟動(dòng)RTC模塊。
之后,在循環(huán)功能中,我們讀取了RTC時(shí)間并將其顯示在LCD上
void loop()
{
now = rtc.now();
lcd.setCursor(0,0);
lcd.print("Time->");
lcd.print(now.hour(), DEC);
lcd.print(':');
lcd.print(now.minute(), DEC);
lcd.print(':');
lcd.print(now.second(), DEC);
lcd.print(" ");
lcd.setCursor(0,1);
lcd.print("Date->");
lcd.print(now.day(), DEC);
lcd.print('/');
lcd.print(now.month(), DEC);
lcd.print('/');
lcd.print(now.year(), DEC);
之后,等待指紋接受輸入并將捕獲的圖像 ID 與存儲(chǔ)的 ID 進(jìn)行比較。如果發(fā)生匹配,則繼續(xù)下一步。并檢查注冊(cè)德?tīng)栨I
int result=getFingerprintIDez();
if(result>0)
{
digitalWrite(indFinger, LOW);
digitalWrite(buzzer, HIGH);
delay(100);
digitalWrite(buzzer, LOW);
lcd.clear();
lcd.print("ID:");
lcd.print(result);
lcd.setCursor(0,1);
lcd.print("Please Wait....");
delay(1000);
attendance(result);
lcd.clear();
lcd.print("Attendance ");
lcd.setCursor(0,1);
lcd.print("Registed");
delay(1000);
digitalWrite(indFinger, HIGH);
return;
}
給定 void checkKeys() 函數(shù)用于檢查是否按下注冊(cè)或 DEL 鍵以及按下時(shí)該怎么做。如果按下 ENROL 鍵,則調(diào)用 Enroll( ) 函數(shù)并按下 DEL 鍵,則調(diào)用 delete() 函數(shù)。
void delet( ) 函數(shù)用于輸入要?jiǎng)h除的 ID 并調(diào)用uint8_t *deleteFingerprint(uint8_t id) *函數(shù),該函數(shù)將從記錄中刪除手指。
給定功能用于獲取指紋圖像并將其轉(zhuǎn)換為模板,并通過(guò)選定的ID保存到指紋模塊存儲(chǔ)器中。
uint8_t getFingerprintEnroll()
{
int p = -1;
lcd.clear();
lcd.print("finger ID:");
lcd.print(id);
lcd.setCursor(0,1);
lcd.print("Place Finger");
delay(2000);
while (p != FINGERPRINT_OK)
{
p = finger.getImage();
..... .....
....... ....
給定功能用于在EEPROM的分配插槽中存儲(chǔ)考勤時(shí)間和日期
void attendance(int id)
{
int user=0,eepLoc=0;
if(id == 1)
{
eepLoc=0;
user=user1++;
}
else if(id == 2)
{
eepLoc=210;
user=user2++;
}
else if(id == 3)
.... ....
.....
給定功能用于從EEPROM獲取數(shù)據(jù)并發(fā)送到串行監(jiān)視器
void download(int eepIndex)
{
if(EEPROM.read(eepIndex) != 0xff)
{
Serial.print("T->");
if(EEPROM.read(eepIndex)<10)
Serial.print('0');
Serial.print(EEPROM.read(eepIndex++));
Serial.print(':');
if(EEPROM.read(eepIndex)<10)
Serial.print('0');
Serial.print(EEPROM.read(eepIndex++));
#include
#include
LiquidCrystal lcd(13,12,11,10,9,8);
#include
SoftwareSerial fingerPrint(2, 3);
#include
#include "RTClib.h"
RTC_DS1307 rtc;
#include "Adafruit_Fingerprint.h"
uint8_t id;
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&fingerPrint);
#define enroll 14
#define del 15
#define up 16
#define down 17
#define match 5
#define indFinger 7
#define buzzer 5
#define records 4 // 5 for 5 user
int user1,user2,user3,user4,user5;
DateTime now;
void setup()
{
delay(1000);
lcd.begin(16,2);
Serial.begin(9600);
pinMode(enroll, INPUT_PULLUP);
pinMode(up, INPUT_PULLUP);
pinMode(down, INPUT_PULLUP);
pinMode(del, INPUT_PULLUP);
pinMode(match, INPUT_PULLUP);
pinMode(buzzer, OUTPUT);
pinMode(indFinger, OUTPUT);
digitalWrite(buzzer, LOW);
if(digitalRead(enroll) == 0)
{
digitalWrite(buzzer, HIGH);
delay(500);
digitalWrite(buzzer, LOW);
lcd.clear();
lcd.print("Please wait");
lcd.setCursor(0,1);
lcd.print("Downloding Data");
Serial.println("Please wait");
Serial.println("Downloding Data..");
Serial.println();
Serial.print("S.No. ");
for(int i=0;i
digitalWrite(buzzer, HIGH);
delay(500);
digitalWrite(buzzer, LOW);
Serial.print(" User ID");
Serial.print(i+1);
Serial.print(" ");
}
Serial.println();
int eepIndex=0;
for(int i=0;i<30;i++)
{
if(i+1<10)
Serial.print('0');
Serial.print(i+1);
Serial.print(" ");
eepIndex=(i*7);
download(eepIndex);
eepIndex=(i*7)+210;
download(eepIndex);
eepIndex=(i*7)+420;
download(eepIndex);
eepIndex=(i*7)+630;
download(eepIndex);
// eepIndex=(i*7)+840; // 5th user
// download(eepIndex);
Serial.println();
}
}
if(digitalRead(del) == 0)
{
lcd.clear();
lcd.print("Please Wait");
lcd.setCursor(0,1);
lcd.print("Reseting.....");
for(int i=1000;i<1005;i++)
EEPROM.write(i,0);
for(int i=0;i<841;i++)
EEPROM.write(i, 0xff);
lcd.clear();
lcd.print("System Reset");
delay(1000);
}
lcd.clear();
lcd.print(" Attendance ");
lcd.setCursor(0,1);
lcd.print(" System ");
delay(2000);
lcd.clear();
lcd.print("Circuit Digest");
lcd.setCursor(0,1);
lcd.print("Saddam Khan");
delay(2000);
digitalWrite(buzzer, HIGH);
delay(500);
digitalWrite(buzzer, LOW);
for(int i=1000;i<1000+records;i++)
{
if(EEPROM.read(i) == 0xff)
EEPROM.write(i,0);
}
finger.begin(57600);
Serial.begin(9600);
lcd.clear();
lcd.print("Finding Module");
lcd.setCursor(0,1);
delay(1000);
if (finger.verifyPassword())
{
Serial.println("Found fingerprint sensor!");
lcd.clear();
lcd.print("Found Module ");
delay(1000);
}
else
{
Serial.println("Did not find fingerprint sensor :(");
lcd.clear();
lcd.print("module not Found");
lcd.setCursor(0,1);
lcd.print("Check Connections");
while (1);
}
if (! rtc.begin())
Serial.println("Couldn't find RTC");
// rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
if (! rtc.isrunning())
{
Serial.println("RTC is NOT running!");
// following line sets the RTC to the date & time this sketch was compiled
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
// This line sets the RTC with an explicit date & time, for example to set
// January 21, 2014 at 3am you would call:
// rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
}
lcd.setCursor(0,0);
lcd.print("Press Match to ");
lcd.setCursor(0,1);
lcd.print("Start System");
delay(2000);
user1=EEPROM.read(1000);
user2=EEPROM.read(1001);
user3=EEPROM.read(1002);
user4=EEPROM.read(1003);
user5=EEPROM.read(1004);
lcd.clear();
digitalWrite(indFinger, HIGH);
}
void loop()
{
now = rtc.now();
lcd.setCursor(0,0);
lcd.print("Time->");
lcd.print(now.hour(), DEC);
lcd.print(':');
lcd.print(now.minute(), DEC);
lcd.print(':');
lcd.print(now.second(), DEC);
lcd.print(" ");
lcd.setCursor(0,1);
lcd.print("Date->");
lcd.print(now.day(), DEC);
lcd.print('/');
lcd.print(now.month(), DEC);
lcd.print('/');
lcd.print(now.year(), DEC);
lcd.print(" ");
delay(500);
int result=getFingerprintIDez();
if(result>0)
{
digitalWrite(indFinger, LOW);
digitalWrite(buzzer, HIGH);
delay(100);
digitalWrite(buzzer, LOW);
lcd.clear();
lcd.print("ID:");
lcd.print(result);
lcd.setCursor(0,1);
lcd.print("Please Wait....");
delay(1000);
attendance(result);
lcd.clear();
lcd.print("Attendance ");
lcd.setCursor(0,1);
lcd.print("Registed");
delay(1000);
digitalWrite(indFinger, HIGH);
return;
}
checkKeys();
delay(300);
}
// dmyyhms - 7 bytes
void attendance(int id)
{
int user=0,eepLoc=0;
if(id == 1)
{
eepLoc=0;
user=user1++;
}
else if(id == 2)
{
eepLoc=210;
user=user2++;
}
else if(id == 3)
{
eepLoc=420;
user=user3++;
}
else if(id == 4)
{
eepLoc=630;
user=user4++;
}
/*else if(id == 5) // fifth user
{
eepLoc=840;
user=user5++;
}*/
else
return;
int eepIndex=(user*7)+eepLoc;
EEPROM.write(eepIndex++, now.hour());
EEPROM.write(eepIndex++, now.minute());
EEPROM.write(eepIndex++, now.second());
EEPROM.write(eepIndex++, now.day());
EEPROM.write(eepIndex++, now.month());
EEPROM.write(eepIndex++, now.year()>>8 );
EEPROM.write(eepIndex++, now.year());
EEPROM.write(1000,user1);
EEPROM.write(1001,user2);
EEPROM.write(1002,user3);
EEPROM.write(1003,user4);
// EEPROM.write(4,user5); // figth user
}
void checkKeys()
{
if(digitalRead(enroll) == 0)
{
lcd.clear();
lcd.print("Please Wait");
delay(1000);
while(digitalRead(enroll) == 0);
Enroll();
}
else if(digitalRead(del) == 0)
{
lcd.clear();
lcd.print("Please Wait");
delay(1000);
delet();
}
}
void Enroll()
{
int count=1;
lcd.clear();
lcd.print("Enter Finger ID:");
while(1)
{
lcd.setCursor(0,1);
lcd.print(count);
if(digitalRead(up) == 0)
{
count++;
if(count>records)
count=1;
delay(500);
}
else if(digitalRead(down) == 0)
{
count--;
if(count<1)
count=records;
delay(500);
}
else if(digitalRead(del) == 0)
{
id=count;
getFingerprintEnroll();
for(int i=0;i
if(EEPROM.read(i) != 0xff)
{
EEPROM.write(i, id);
break;
}
}
return;
}
else if(digitalRead(enroll) == 0)
{
return;
}
}
}
void delet()
{
int count=1;
lcd.clear();
lcd.print("Enter Finger ID");
while(1)
{
lcd.setCursor(0,1);
lcd.print(count);
if(digitalRead(up) == 0)
{
count++;
if(count>records)
count=1;
delay(500);
}
else if(digitalRead(down) == 0)
{
count--;
if(count<1)
count=records;
delay(500);
}
else if(digitalRead(del) == 0)
{
id=count;
deleteFingerprint(id);
for(int i=0;i
if(EEPROM.read(i) == id)
{
EEPROM.write(i, 0xff);
break;
}
}
return;
}
else if(digitalRead(enroll) == 0)
{
return;
}
}
}
uint8_t getFingerprintEnroll()
{
int p = -1;
lcd.clear();
lcd.print("finger ID:");
lcd.print(id);
lcd.setCursor(0,1);
lcd.print("Place Finger");
delay(2000);
while (p != FINGERPRINT_OK)
{
p = finger.getImage();
switch (p)
{
case FINGERPRINT_OK:
Serial.println("Image taken");
lcd.clear();
lcd.print("Image taken");
break;
case FINGERPRINT_NOFINGER:
Serial.println("No Finger");
lcd.clear();
lcd.print("No Finger");
break;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println("Communication error");
lcd.clear();
lcd.print("Comm Error");
break;
case FINGERPRINT_IMAGEFAIL:
Serial.println("Imaging error");
lcd.clear();
lcd.print("Imaging Error");
break;
default:
Serial.println("Unknown error");
lcd.clear();
lcd.print("Unknown Error");
break;
}
}
// OK success!
p = finger.image2Tz(1);
switch (p) {
case FINGERPRINT_OK:
Serial.println("Image converted");
lcd.clear();
lcd.print("Image converted");
break;
case FINGERPRINT_IMAGEMESS:
Serial.println("Image too messy");
lcd.clear();
lcd.print("Image too messy");
return p;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println("Communication error");
lcd.clear();
lcd.print("Comm Error");
return p;
case FINGERPRINT_FEATUREFAIL:
Serial.println("Could not find fingerprint features");
lcd.clear();
lcd.print("Feature Not Found");
return p;
case FINGERPRINT_INVALIDIMAGE:
Serial.println("Could not find fingerprint features");
lcd.clear();
lcd.print("Feature Not Found");
return p;
default:
Serial.println("Unknown error");
lcd.clear();
lcd.print("Unknown Error");
return p;
}
Serial.println("Remove finger");
lcd.clear();
lcd.print("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");
lcd.clear();
lcd.print("Place Finger");
lcd.setCursor(0,1);
lcd.print(" 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");
return;
}
}
// 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!");
lcd.clear();
lcd.print("Stored!");
delay(2000);
} 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;
}
}
int getFingerprintIDez()
{
uint8_t p = finger.getImage();
if (p != FINGERPRINT_OK)
return -1;
p = finger.image2Tz();
if (p != FINGERPRINT_OK)
return -1;
p = finger.fingerFastSearch();
if (p != FINGERPRINT_OK)
{
lcd.clear();
lcd.print("Finger Not Found");
lcd.setCursor(0,1);
lcd.print("Try Later");
delay(2000);
return -1;
}
// found a match!
Serial.print("Found ID #");
Serial.print(finger.fingerID);
return finger.fingerID;
}
uint8_t deleteFingerprint(uint8_t id)
{
uint8_t p = -1;
lcd.clear();
lcd.print("Please wait");
p = finger.deleteModel(id);
if (p == FINGERPRINT_OK)
{
Serial.println("Deleted!");
lcd.clear();
lcd.print("Figer Deleted");
lcd.setCursor(0,1);
lcd.print("Successfully");
delay(1000);
}
else
{
Serial.print("Something Wrong");
lcd.clear();
lcd.print("Something Wrong");
lcd.setCursor(0,1);
lcd.print("Try Again Later");
delay(2000);
return p;
}
}
void download(int eepIndex)
{
if(EEPROM.read(eepIndex) != 0xff)
{
Serial.print("T->");
if(EEPROM.read(eepIndex)<10)
Serial.print('0');
Serial.print(EEPROM.read(eepIndex++));
Serial.print(':');
if(EEPROM.read(eepIndex)<10)
Serial.print('0');
Serial.print(EEPROM.read(eepIndex++));
Serial.print(':');
if(EEPROM.read(eepIndex)<10)
Serial.print('0');
Serial.print(EEPROM.read(eepIndex++));
Serial.print(" D->");
if(EEPROM.read(eepIndex)<10)
Serial.print('0');
Serial.print(EEPROM.read(eepIndex++));
Serial.print('/');
if(EEPROM.read(eepIndex)<10)
Serial.print('0');
Serial.print(EEPROM.read(eepIndex++));
Serial.print('/');
Serial.print(EEPROM.read(eepIndex++)<<8 | EEPROM.read(eepIndex++));
}
else
{
Serial.print("---------------------------");
}
Serial.print(" ");
}
-
生物識(shí)別
+關(guān)注
關(guān)注
3文章
1210瀏覽量
52493 -
考勤系統(tǒng)
+關(guān)注
關(guān)注
0文章
40瀏覽量
11196 -
Arduino
+關(guān)注
關(guān)注
187文章
6457瀏覽量
186501 -
指紋模塊
+關(guān)注
關(guān)注
0文章
25瀏覽量
3876
發(fā)布評(píng)論請(qǐng)先 登錄
相關(guān)推薦
評(píng)論