根据Pen State University的研究人员的说法,人们更有可能信任机器而不是人们,这很容易证明,因为我们很容易地将ATM引脚暴露到了机器上。如今,在AI,机器学习,聊天机器人,智能扬声器,机器人等正在蓬勃发展的世界中,人与机器人之间的这种协同作用只会增加。如今,从过桥收费员到收银员,我们周围的一切都被机器取代,从而使工作更轻松,更高效。为了跟上阶段的进度,在这个项目中,我们将使用AVR微控制器构建一个生物识别出勤系统,以取代手动出勤的程序。该系统将节省时间并避免闪避,因此将更加可靠和高效。
指纹考勤系统已经可以从市场上直接获得,但是有什么比构建指纹考勤系统更有趣的呢?从早期的基于RFID的简单考勤系统到使用Arduino和Raspberry Pi的基于IoT的生物特征考勤系统,我们还建立了各种各样的考勤系统。在该项目中,我们使用了指纹模块和AVR(atmega32)来注册出勤。通过使用指纹传感器,该系统对于用户而言将变得更加安全。以下各节介绍了使用AVR制作基于指纹的生物识别出勤系统的技术细节 。
所需组件
- Atmega32 -1
- 指纹模块(r305)-1
- 按钮或薄膜按钮-4
- LED -2
- 1K电阻-2
- 2.2K电阻-1
- 电源12v适配器
- 连接线
- 蜂鸣器-1
- 16x2液晶屏-1
- PCB或面包板
- RTC模块(ds1307或ds3231)-1
- LM7805 -1
- 1000uf,10uf电容器-1
- Burgstips男女
- DC JACK(可选)
- BC547晶体管-1
在此 指纹考勤系统电路中,我们使用了“指纹传感器”模块 ,通过在系统中获取他们的指纹输入来验证个人或员工的身份。在这里,我们使用4个按钮来注册,删除,递增和递减指纹数据。密钥1用于将新人员注册到系统中。因此,当用户想要注册新手指时,他/她需要按下键1,然后LCD要求他/她将手指放在指纹传感器上两次,然后要求输入员工ID。同样,键2具有双重功能,例如当用户注册新手指时,他/她需要选择指纹ID。通过使用另外两个键(即3和4)。现在,用户需要按键1(这次该键的行为类似于OK)以继续选择ID。键2也用于从微控制器的EEPROM复位或删除数据。
指纹传感器模块捕获手指的打印图像,然后将其转换为等效模板,然后根据微控制器选择的ID将其保存到其内存中。所有过程都由微控制器控制,就像拍摄手指的指纹一样。将其转换为模板并存储为ID等。您还可以签出这些其他指纹传感器项目,我们在其中建立了指纹传感器安全系统和指纹传感器投票机。
电路原理图
基于指纹的考勤系统项目的完整电路图如下所示。它具有用于控制项目所有过程的Atmega32微控制器。按钮或薄膜按钮用于注册,删除,选择考勤ID,蜂鸣器用于指示以及16x2 LCD指示用户如何使用机器。
如电路图所示,按钮或薄膜按钮相对于地面直接连接到微控制器的引脚PA2(ENROL键1),PA3(DEL键2),PA0(上键3),PA1(下键4)。或PA4。 LED通过一个1k电阻相对于地连接在微控制器的PC2引脚上。指纹模块的Rx和Tx直接连接到微控制器的串行引脚PD1和PD3。 5v电源用于通过LM7805稳压器为整个电路供电由12v直流适配器供电。蜂鸣器也连接在PC3引脚上。16x2 LCD配置为4位模式,其RS,RW,EN,D4,D5,D6和D7直接连接在微控制器的PB0,PB1,PB2,PB4,PB5,PB6,PB7引脚上。RTC模块连接到I2Cpin PC0 SCL和PC1 SDA。PD7用作软UART Tx引脚,用于获取当前时间。
指纹考勤系统如何工作
每当用户将手指放在指纹模块上时,指纹模块都会捕获手指图像,并在系统中搜索是否有任何ID与该指纹相关联。如果检测到指纹ID,则LCD将显示出勤记录,同时蜂鸣器将发出一声哔声。
除了指纹模块,我们还使用了 RTC模块来存储时间和日期数据。时间和日期在系统中连续运行,因此,只要真正的用户将手指放在指纹传感器上,然后将其保存在分配的内存插槽中的EEPROM中,微控制器都可以获取时间和日期。
用户可以通过按住键4来下载考勤数据。将电源连接到电路上并等待,一段时间后,LCD会显示“正在下载…”。用户可以通过串行监视器看到考勤数据,在此代码软件中,UART在PD7-pin20引脚上被编程为Tx,用于将数据发送到终端。用户还需要一个TTL转USB转换器才能通过串行终端查看考勤数据。
And if the user wants to delete all the data then he/she has to press and hold key 2 and then connect power and wait for some time. Now after some time LCD will show ‘Please wait…’ and then ‘Record Deleted successfully’. These two steps are not shown in demonstration video given in the end.
Code Explanation
Complete code along with the video for this biometric attendance system is given at the end. Code of this project is a little bit lengthy and complex for beginner. Hence we have tried to take descriptive variables to make good readability and understanding. First of all, we have included some necessary header file then written macros for different-different purpose.
#define F_CPU 8000000ul #include #include
After this, we have declared some variables and arrays for fingerprint command and response. We have also added some functions for fetching and setting data to RTC.
void RTC_stp() { TWCR=(1<
Then we have some functions for LCD which are responsible to drive the LCD. LCD driver function is written for 4-bit mode drive. Followed by that we also have some UART driver functions which are responsible for initializing UART and exchanging data between fingerprint sensor and microcontroller.
void serialbegin() { UCSRC = (1 << URSEL) - (1 << UCSZ0) - (1 << UCSZ1); UBRRH = (BAUD_PRESCALE >> 8); UBRRL = BAUD_PRESCALE; UCSRB=(1<
Now we have some more UART function but they are software UART. It is used for transferring saved data to the computer via serial terminal. These functions are delay-based and don’t use any type of interrupt. And for UART only tx signal will work and we have hardcoded baud rate for soft UART as 9600.
void SerialSoftWrite(char ch) { PORTD&=~(1<<7); _delay_us(104); for(int i=0;i<8;i++) { if(ch & 1) PORTD-=(1<<7); else PORTD&=~(1<<7); _delay_us(104); ch>>=1; } PORTD-=(1<<7); _delay_us(104); } void SerialSoftPrint(char *str) { while(*str) { SerialSoftWrite(*str); str++; } }
Followed by that we have functions that are responsible for displaying the RTC time in the LCD. The below given functions are used for writing attendance data to EEPROM and reading attendance data from EEPROM.
int eeprom_write(unsigned int add,unsigned char data) { while(EECR&(1<
The below function is responsible for reading fingerprint image and convert them in template and matching with already stored image and show result over LCD.
void matchFinger() { // lcdwrite(1,CMD); // lcdprint("Place Finger"); // lcdwrite(192,CMD); // _delay_ms(2000); if(!sendcmd2fp((char *)&f_detect,sizeof(f_detect))) { if(!sendcmd2fp((char *)&f_imz2ch1,sizeof(f_imz2ch1))) { if(!sendcmd2fp((char *)&f_search,sizeof(f_search))) { LEDHigh; buzzer(200); uint id= data; id<<=8; id+=data; uint score=data; score<<=8; score+=data; (void)sprintf((char *)buf1,"Id: %d",(int)id); lcdwrite(1,CMD); lcdprint((char *)buf1); saveData(id); _delay_ms(1000); lcdwrite(1,CMD); lcdprint("Attendance"); lcdwrite(192,CMD); lcdprint("Registered"); _delay_ms(2000); LEDLow; }
Followed by that we have a function that is used for enrolling a new finger and displaying the result or status on LCD. Then the below function is used for deleting stored fingerprint from the module by using id number and show status of the same.
void deleteFinger() { id=getId(); f_delete=id>>8 & 0xff; f_delete=id & 0xff; f_delete=(21+id)>>8 & 0xff; f_delete=(21+id) & 0xff; if(!sendcmd2fp(&f_delete,sizeof(f_delete))) { lcdwrite(1,CMD); sprintf((char *)buf1,"Finger ID %d ",id); lcdprint((char *)buf1); lcdwrite(192, CMD); lcdprint("Deleted Success"); } else { lcdwrite(1,CMD); lcdprint("Error"); } _delay_ms(2000); }
Below function is responsible for sending attendance data to serial terminal via soft UART pin PD7 and TTL to USB converter.
/*function to show attendence data on serial moinitor using softserial pin PD7*/ void ShowAttendance() { char buf; lcdwrite(1,CMD); lcdprint("Downloding…."); SerialSoftPrintln("Attendance Record"); SerialSoftPrintln(" "); SerialSoftPrintln("S.No ID1 ID2 Id3 ID4 ID5 "); //serialprintln("Attendance Record"); //serialprintln(" "); //serialprintln("S.No ID1 ID2 Id3 ID4 ID5"); for(int cIndex=1;cIndex<=8;cIndex++) { sprintf((char *)buf,"%d " "%d:%d:%d %d/%d/20%d " "%d:%d:%d %d/%d/20%d " "%d:%d:%d %d/%d/20%d " "%d:%d:%d %d/%d/20%d " "%d:%d:%d %d/%d/20%d ", cIndex, eeprom_read((cIndex*6)),eeprom_read((cIndex*6)+1),eeprom_read((cIndex*6)+2),eeprom_read((cIndex*6)+3),eeprom_read((cIndex*6)+4),eeprom_read((cIndex*6)+5), eeprom_read((cIndex*6)+48),eeprom_read((cIndex*6)+1+48),eeprom_read((cIndex*6)+2+48),eeprom_read((cIndex*6)+3+48),eeprom_read((cIndex*6)+4+48),eeprom_read((cIndex*6)+5+48), eeprom_read((cIndex*6)+96),eeprom_read((cIndex*6)+1+96),eeprom_read((cIndex*6)+2+96),eeprom_read((cIndex*6)+3+96),eeprom_read((cIndex*6)+4+96),eeprom_read((cIndex*6)+5+96), eeprom_read((cIndex*6)+144),eeprom_read((cIndex*6)+1+144),eeprom_read((cIndex*6)+2+144),eeprom_read((cIndex*6)+3+144),eeprom_read((cIndex*6)+4+144),eeprom_read((cIndex*6)+5+144), eeprom_read((cIndex*6)+192),eeprom_read((cIndex*6)+1+192),eeprom_read((cIndex*6)+2+192),eeprom_read((cIndex*6)+3+192),eeprom_read((cIndex*6)+4+192),eeprom_read((cIndex*6)+5+192)); SerialSoftPrintln(buf); //serialprintln(buf); } lcdwrite(192,CMD); lcdprint("Done"); _delay_ms(2000); }
Below function is used for deleting all the attendance data from the microcontroller’s EEPROM.
void DeleteRecord() { lcdwrite(1,CMD); lcdprint("Please Wait…"); for(int i=0;i<255;i++) eeprom_write(i,10); _delay_ms(2000); lcdwrite(1,CMD); lcdprint("Record Deleted"); lcdwrite(192,CMD); lcdprint("Successfully"); _delay_ms(2000); }
In the main function we will initialize all the used module and gpio pins. Finally, all-controlling event are performed in this as shown below
while(1) { RTC(); // if(match == LOW) // { matchFinger(); // } if(enrol == LOW) { buzzer(200); enrolFinger(); _delay_ms(2000); // lcdinst(); } else if(delet == LOW) { buzzer(200); getId(); deleteFinger(); _delay_ms(1000); } } return 0; }
The complete working set-up is shown in the video linked below. Hope you enjoyed the project and learnt something new. If you have any questions leave them in the comment section or use the forums for other technical questions.