Friday, August 11, 2017

Project V - 34. Attendance List using Fingerprint Sensor (Arduino Based)

Attendance List using Fingerprint Sensor 



The data from the fingerprint is stored on Arduino internal EEPROM, in this project only 10 employee data is used, but if you want to add more it is very possible. Furthermore RTC is used to know when an employee performs absenteeism. To view the attendance list of the ten employees can use the serial monitor (the default Sketch Arduino software).

Hardware Requirement
  • Arduino Uno Board
  • RTC DS1307 Module
  • Fingerprint Sensor (Unknown Type)
  • LCD 16*2
  • A Buzzer
  • Power supply +5 Volt
  • Jumper


Fingerprint Sensor | Source



                             RTC DS1307 Module | Source                     Buzzer | Source


Schematic



Arduino - Fingerprint Sensor Wiring



Arduino - LCD Wiring



Arduino - RTC Wiring



Arduino - Buzzer Wiring



Source Code/Sketch
#include <Adafruit_Fingerprint.h>
#include <SoftwareSerial.h>
#include <LiquidCrystal.h>
#include <EEPROM.h>
#include <Wire.h>
#define DS1307_ADDRESS 0x68
byte zero = 0x00;
LiquidCrystal lcd(8, 9, 10, 11, 12, 13);
byte second ,minute,hour, weekDay;
byte monthDay,month,year;
uint8_t id;
uint8_t getFingerprintEnroll();
// pin #2 is IN from sensor (GREEN wire)
// pin #3 is OUT from arduino (WHITE wire)
SoftwareSerial mySerial(2, 3);
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
void setup(){
pinMode(7, OUTPUT);
digitalWrite(7, LOW);
delay(500);
Wire.begin();
/*
// Seting RTC
second=0;
minute=50;
hour=12;
monthDay=15;
month=10;
year=16;
setingRTC();
delay(100);
*/
Serial.begin(9600);
lcd.begin(16, 2);
lcd.clear();
lcd.print("Absensi karyawan");
lcd.setCursor(0,1);
lcd.print(" dg sidik jari");
delay(2000);
lcd.clear();
lcd.print("Test Koneksi");
// set the data rate for the sensor serial port
finger.begin(57600);
if (finger.verifyPassword()) {
lcd.setCursor(0,1);
lcd.print("OK !");
} else {
lcd.setCursor(0,1);
lcd.print("ERROR !");
while (1);
}
delay(2000);
}
//===================program utama
void loop(){
// bacaRTC();
lcd.setCursor(0, 0);
lcd.print("Absensi Karyawan");
lcd.setCursor(0, 1);
lcd.print(" Letakkan Jari ");
getFingerprintIDez();
kirimSerial();
delay(50);
}
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_NOTFOUND){
lcd.clear();
lcd.print(" Akses");
lcd.setCursor(0,1);
lcd.print(" Tidak Diterima");
digitalWrite(7, HIGH);
delay(3000);
digitalWrite(7, LOW);
delay(100);
return p;
}
if (p != FINGERPRINT_OK) return -1;
// found a match!
digitalWrite(7, HIGH);
delay(500);
digitalWrite(7, LOW);
delay(50);
bacaRTC();
lcd.clear();
lcd.print("Karyawan ");
lcd.print(finger.fingerID);
lcd.setCursor(0,1);
lcd.print(hour);
lcd.print(":");
lcd.print(minute);
lcd.print(":");
lcd.print(second);
lcd.print(" ");
lcd.print(monthDay);
lcd.print("/");
lcd.print(month);
lcd.print(" ");
//-------------------simpan data
id=finger.fingerID;
byte addr = (monthDay*10)+id;
EEPROM.write(addr, 0);
delay(4000);
lcd.clear();
return finger.fingerID;
}
/****************************************
* peta penyimpanan di EEPROM
* tanggal disimpan pada alamt 0
* ----------------------------------------------------------
* tgl | Alamat EEPROM karyawan
* | 1 2 3 4 5 6 7 8 9 10
* -----------------------------------------------------------
* 1 | 11 12 13 14 15 16 17 18 19 20
* 2 | 21 22 23 24 25 26 27 28 29 30
* 3 | 31 32 33 34 35 36 37 38 39 40
*
* 30 | 311 312 313 314 315 316 317 318 319 320
* ---------------------------------------------
* Rumus Penyimpanan EEPROM=
* alamatSimpan = (tgl * 10)+id
*
* kode absensi:
* * 0 = Hadir
* * 255 = Alpha
*/
//---------------------------RTC Area
byte decToBcd(byte val){
return ( (val/10*16) + (val%10) );
}
byte bcdToDec(byte val) {
return ( (val/16*10) + (val%16) );
}
void bacaRTC(){
Wire.beginTransmission(DS1307_ADDRESS);
Wire.write(zero);
Wire.endTransmission();
Wire.requestFrom(DS1307_ADDRESS, 7);
second = bcdToDec(Wire.read());
minute = bcdToDec(Wire.read());
hour = bcdToDec(Wire.read() & 0b111111);
weekDay = bcdToDec(Wire.read());
monthDay = bcdToDec(Wire.read());
month = bcdToDec(Wire.read());
year = bcdToDec(Wire.read());
}
void setingRTC(){
Wire.beginTransmission(DS1307_ADDRESS);
Wire.write(zero); //stop RTC
Wire.write(decToBcd(second));
Wire.write(decToBcd(minute));
Wire.write(decToBcd(hour));
Wire.write(decToBcd(weekDay));
Wire.write(decToBcd(monthDay));
Wire.write(decToBcd(month));
Wire.write(decToBcd(year));
Wire.write(zero); //start
Wire.endTransmission();
}
void kirimSerial(){
if(Serial.available()){
char str;
str=Serial.read();
if (str=='R'){
/*
* ---------------------------------------------
* tgl | Absensi karyawan
* | 1 2 3 4 5 6 7 8 9 10
* ----------------------------------------------
* 1 | H H - - H H H H H H
* 2 | H H H H - H H H H H
* 3 |
*
* 30 |
* ---------------------------------------------
* H = HADIR
* - = ALPHA
*/
for(byte i=0; i<60;i++){
Serial.print('-');
}
Serial.println('-');
Serial.println(" tgl | Absensi Karyawan");
Serial.print (" | ");
for(byte i=1; i<11;i++){
Serial.print(i);
Serial.print(" ");
}
Serial.println(" ");
for(byte i=0; i<60;i++){
Serial.print('-');
}
Serial.println('-');
byte value;
byte address;
byte j=0;
String absensi="";
for(byte tgl=1; tgl<31; tgl++){
Serial.print(tgl);
Serial.print(" |");
j=tgl*10;
for(byte i=1; i<11; i++){
address=i+j;
value = EEPROM.read(address);
if (value==0) absensi="H";
else absensi="-";
Serial.print(" "+absensi+" ");
}
Serial.println(" ");
}
str=' ';
}
else if(str=='D'){
Serial.println("Hapus Data");
for(word i=0; i<310; i++){
EEPROM.write(i, 255);
Serial.println(".");
delay(5);
}
Serial.println("Hapus Data Sukses!");
}
}
}


How it Works

1. Connect the Arduino with Peripherals needed
2. Plug in the Power Source on the device
3. Compile and upload the script program above to your arduino
4. Before you use, firstly register 10 fingerprints on the fingerprint sensor using enroll program    
    (Project V -33)
5. First initial LCD display 

Attendance List
With fingerprint

6. Connection test between Fingerprint sensor and Arduino

Connection Test
OK !

7. Main display
Employees Attendance
Put the fingerprint

8. Put your finger into the surface of the sensor, if your finger has been registered will be shown like 
    this

     First line : Show Employees ID, and the second line : show the time

9. Open the serial with 9600 of baud rate + Carriage return

10. Type R and press enter.



Video for Project V - 34. Attendance List using Fingerprint Sensor (Arduino Based)




Required File


No comments:

Post a Comment