Sistem Kerja Alat
Pendaftaran sidik jari (Enroll) mendaftarkan sidik jari tangan manusia pada sensor fingerprint dengan Arduino tampilan berupa LCD.
- Arduino UNO Board
- Sensor Fingerprint (Tipe belum diketahui)
- LCD 2X16
- 3 Tombol push ON
- Power Supply 7-9 Vdc
Sensor Fingerprint (Source)
Schematics
Koneksi Arduino UNO dengan Modul Sensor Fingerprint
Koneksi Arduino UNO dengan Tombol
Source Code/Sketch
\#include <Adafruit_Fingerprint.h>
#include <SoftwareSerial.h>
#include <LiquidCrystal.h> INKUBATEK
LiquidCrystal lcd(8, 9, 10, 11, 12, 13);
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(4, INPUT);
pinMode(5, INPUT);
pinMode(6, INPUT);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
delay(500);
lcd.begin(16, 2);
lcd.clear();
lcd.print(" Pendaftaran");
lcd.setCursor(0,1);
lcd.print(" sidk 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);
}
void readnumber() {
while(digitalRead(6)){
if(digitalRead(4)==0){
id++;
delay(300);
}
if(digitalRead(5)==0 && id > 0) {
id--;
delay(300);
}
lcd.setCursor(6, 1);
lcd.print(id);
}
delay(300);
}
void loop() // run over and over again
{
lcd.clear();
lcd.print("Tentukan no ID");
lcd.setCursor(0, 1);
lcd.print("No ID:");
readnumber();
lcd.clear();
lcd.print("Letakkan Jari ");
delay(2000);
while (! getFingerprintEnroll() );
}
uint8_t getFingerprintEnroll() {
int p = -1;
lcd.clear();
lcd.print("Tunggu Sampai");
lcd.setCursor(0, 1);
lcd.print("No ID:");
lcd.print(id);
lcd.print(" Benar !");
while (p != FINGERPRINT_OK) {
p = finger.getImage();
switch (p) {
case FINGERPRINT_OK:
lcd.clear();
lcd.print("sidik diambil");
break;
case FINGERPRINT_NOFINGER:
break;
case FINGERPRINT_PACKETRECIEVEERR:
lcd.clear();
lcd.print("komunikasi error");
break;
case FINGERPRINT_IMAGEFAIL:
lcd.clear();
lcd.print("sidik error");
break;
default:
lcd.clear();
lcd.print("Error tidak");
lcd.setCursor(0, 1);
lcd.print("diketahui");
break;
}
}
delay(1000);
// OK success!
p = finger.image2Tz(1);
switch (p) {
case FINGERPRINT_OK:
lcd.clear();
lcd.print("konversi sidik");
break;
case FINGERPRINT_IMAGEMESS:
lcd.clear();
lcd.println("sidik kacau");
return p;
case FINGERPRINT_PACKETRECIEVEERR:
lcd.clear();
lcd.print("komunikasi error");
return p;
case FINGERPRINT_FEATUREFAIL:
lcd.clear();
lcd.print("FiturFingerprint");
lcd.setCursor(0, 1);
lcd.print("tidak ditemukan");
return p;
case FINGERPRINT_INVALIDIMAGE:
lcd.clear();
lcd.print("FiturFingerprint");
lcd.setCursor(0, 1);
lcd.print("tidak ditemukan");
return p;
default:
lcd.clear();
lcd.print("Error tidak");
lcd.setCursor(0, 1);
lcd.print("diketahui");
return p;
}
delay(1000);
lcd.clear();
lcd.print("Lepas Jari");
delay(1000);
p = 0;
while (p != FINGERPRINT_NOFINGER) {
p = finger.getImage();
}
lcd.print(" ID:"); lcd.println(id);
p = -1;
lcd.setCursor(0,0);
lcd.print("Letakkan jari lg");
while (p != FINGERPRINT_OK) {
p = finger.getImage();
switch (p) {
case FINGERPRINT_OK:
lcd.clear();
lcd.print("sidik diambil");
break;
case FINGERPRINT_NOFINGER:
break;
case FINGERPRINT_PACKETRECIEVEERR:
lcd.clear();
lcd.print("komunikasi error");
break;
case FINGERPRINT_IMAGEFAIL:
lcd.clear();
lcd.print("sidik error");
break;
default:
lcd.clear();
lcd.print("Error tidak");
lcd.setCursor(0, 1);
lcd.print("diketahui");
break;
}
// OK success!
delay(1000);
lcd.clear();
p = finger.image2Tz(2);
switch (p) {
case FINGERPRINT_OK:
lcd.print("konfersi sidik");
break;
case FINGERPRINT_IMAGEMESS:
lcd.print("sidik kacau");
return p;
case FINGERPRINT_PACKETRECIEVEERR:
lcd.print("komunikasi error");
return p;
case FINGERPRINT_FEATUREFAIL:
lcd.clear();
lcd.print("FiturFingerprint");
lcd.setCursor(0, 1);
lcd.print("tidak ditemukan");
return p;
case FINGERPRINT_INVALIDIMAGE:
lcd.clear();
lcd.print("FiturFingerprint");
lcd.setCursor(0, 1);
lcd.print("tidak ditemukan");
return p;
default:
lcd.clear();
lcd.print("Error tidak");
lcd.setCursor(0, 1);
lcd.print("diketahui");
return p;
}
// OK converted!
delay(1000);
lcd.clear();
lcd.print("sidikID:");
lcd.print(id);
lcd.print(" dibuat");
delay(1000);
p = finger.createModel();
if (p == FINGERPRINT_OK) {
lcd.clear();
lcd.print("sidik jari");
lcd.setCursor(0, 1);
lcd.print("Cocok!");
} else if (p == FINGERPRINT_PACKETRECIEVEERR) {
lcd.clear();
lcd.print("komunikasi error");
return p;
} else if (p == FINGERPRINT_ENROLLMISMATCH) {
lcd.clear();
lcd.print("Sidik Jari");
lcd.setCursor(0, 1);
lcd.print("Tidak Cocok!");
return p;
} else {
lcd.clear();
lcd.print("Error tidak");
lcd.setCursor(0, 1);
lcd.print("diketahui");
return p;
}
delay(2000);
lcd.clear();
lcd.print("ID:"); lcd.print(id);
p = finger.storeModel(id);
if (p == FINGERPRINT_OK) {
lcd.setCursor(0, 1);
lcd.print("Disimpan!");
} else if (p == FINGERPRINT_PACKETRECIEVEERR) {
lcd.clear();
lcd.print("komunikasi error");
return p;
} else if (p == FINGERPRINT_BADLOCATION) {
lcd.clear();
lcd.print("tdk dpt disimpan");
lcd.setCursor(0,1);
lcd.print("pd lokasi trsbt");
return p;
} else if (p == FINGERPRINT_FLASHERR) {
lcd.clear();
lcd.print("kesalahan tulis");
lcd.setCursor(0,1);
lcd.print(" ke flash");
return p;
} else {
lcd.clear();
lcd.print("Error tidak");
lcd.setCursor(0, 1);
lcd.print("diketahui");
return p;
}
delay(3000);
}
#include <SoftwareSerial.h>
#include <LiquidCrystal.h> INKUBATEK
LiquidCrystal lcd(8, 9, 10, 11, 12, 13);
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(4, INPUT);
pinMode(5, INPUT);
pinMode(6, INPUT);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
delay(500);
lcd.begin(16, 2);
lcd.clear();
lcd.print(" Pendaftaran");
lcd.setCursor(0,1);
lcd.print(" sidk 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);
}
void readnumber() {
while(digitalRead(6)){
if(digitalRead(4)==0){
id++;
delay(300);
}
if(digitalRead(5)==0 && id > 0) {
id--;
delay(300);
}
lcd.setCursor(6, 1);
lcd.print(id);
}
delay(300);
}
void loop() // run over and over again
{
lcd.clear();
lcd.print("Tentukan no ID");
lcd.setCursor(0, 1);
lcd.print("No ID:");
readnumber();
lcd.clear();
lcd.print("Letakkan Jari ");
delay(2000);
while (! getFingerprintEnroll() );
}
uint8_t getFingerprintEnroll() {
int p = -1;
lcd.clear();
lcd.print("Tunggu Sampai");
lcd.setCursor(0, 1);
lcd.print("No ID:");
lcd.print(id);
lcd.print(" Benar !");
while (p != FINGERPRINT_OK) {
p = finger.getImage();
switch (p) {
case FINGERPRINT_OK:
lcd.clear();
lcd.print("sidik diambil");
break;
case FINGERPRINT_NOFINGER:
break;
case FINGERPRINT_PACKETRECIEVEERR:
lcd.clear();
lcd.print("komunikasi error");
break;
case FINGERPRINT_IMAGEFAIL:
lcd.clear();
lcd.print("sidik error");
break;
default:
lcd.clear();
lcd.print("Error tidak");
lcd.setCursor(0, 1);
lcd.print("diketahui");
break;
}
}
delay(1000);
// OK success!
p = finger.image2Tz(1);
switch (p) {
case FINGERPRINT_OK:
lcd.clear();
lcd.print("konversi sidik");
break;
case FINGERPRINT_IMAGEMESS:
lcd.clear();
lcd.println("sidik kacau");
return p;
case FINGERPRINT_PACKETRECIEVEERR:
lcd.clear();
lcd.print("komunikasi error");
return p;
case FINGERPRINT_FEATUREFAIL:
lcd.clear();
lcd.print("FiturFingerprint");
lcd.setCursor(0, 1);
lcd.print("tidak ditemukan");
return p;
case FINGERPRINT_INVALIDIMAGE:
lcd.clear();
lcd.print("FiturFingerprint");
lcd.setCursor(0, 1);
lcd.print("tidak ditemukan");
return p;
default:
lcd.clear();
lcd.print("Error tidak");
lcd.setCursor(0, 1);
lcd.print("diketahui");
return p;
}
delay(1000);
lcd.clear();
lcd.print("Lepas Jari");
delay(1000);
p = 0;
while (p != FINGERPRINT_NOFINGER) {
p = finger.getImage();
}
lcd.print(" ID:"); lcd.println(id);
p = -1;
lcd.setCursor(0,0);
lcd.print("Letakkan jari lg");
while (p != FINGERPRINT_OK) {
p = finger.getImage();
switch (p) {
case FINGERPRINT_OK:
lcd.clear();
lcd.print("sidik diambil");
break;
case FINGERPRINT_NOFINGER:
break;
case FINGERPRINT_PACKETRECIEVEERR:
lcd.clear();
lcd.print("komunikasi error");
break;
case FINGERPRINT_IMAGEFAIL:
lcd.clear();
lcd.print("sidik error");
break;
default:
lcd.clear();
lcd.print("Error tidak");
lcd.setCursor(0, 1);
lcd.print("diketahui");
break;
}
// OK success!
delay(1000);
lcd.clear();
p = finger.image2Tz(2);
switch (p) {
case FINGERPRINT_OK:
lcd.print("konfersi sidik");
break;
case FINGERPRINT_IMAGEMESS:
lcd.print("sidik kacau");
return p;
case FINGERPRINT_PACKETRECIEVEERR:
lcd.print("komunikasi error");
return p;
case FINGERPRINT_FEATUREFAIL:
lcd.clear();
lcd.print("FiturFingerprint");
lcd.setCursor(0, 1);
lcd.print("tidak ditemukan");
return p;
case FINGERPRINT_INVALIDIMAGE:
lcd.clear();
lcd.print("FiturFingerprint");
lcd.setCursor(0, 1);
lcd.print("tidak ditemukan");
return p;
default:
lcd.clear();
lcd.print("Error tidak");
lcd.setCursor(0, 1);
lcd.print("diketahui");
return p;
}
// OK converted!
delay(1000);
lcd.clear();
lcd.print("sidikID:");
lcd.print(id);
lcd.print(" dibuat");
delay(1000);
p = finger.createModel();
if (p == FINGERPRINT_OK) {
lcd.clear();
lcd.print("sidik jari");
lcd.setCursor(0, 1);
lcd.print("Cocok!");
} else if (p == FINGERPRINT_PACKETRECIEVEERR) {
lcd.clear();
lcd.print("komunikasi error");
return p;
} else if (p == FINGERPRINT_ENROLLMISMATCH) {
lcd.clear();
lcd.print("Sidik Jari");
lcd.setCursor(0, 1);
lcd.print("Tidak Cocok!");
return p;
} else {
lcd.clear();
lcd.print("Error tidak");
lcd.setCursor(0, 1);
lcd.print("diketahui");
return p;
}
delay(2000);
lcd.clear();
lcd.print("ID:"); lcd.print(id);
p = finger.storeModel(id);
if (p == FINGERPRINT_OK) {
lcd.setCursor(0, 1);
lcd.print("Disimpan!");
} else if (p == FINGERPRINT_PACKETRECIEVEERR) {
lcd.clear();
lcd.print("komunikasi error");
return p;
} else if (p == FINGERPRINT_BADLOCATION) {
lcd.clear();
lcd.print("tdk dpt disimpan");
lcd.setCursor(0,1);
lcd.print("pd lokasi trsbt");
return p;
} else if (p == FINGERPRINT_FLASHERR) {
lcd.clear();
lcd.print("kesalahan tulis");
lcd.setCursor(0,1);
lcd.print(" ke flash");
return p;
} else {
lcd.clear();
lcd.print("Error tidak");
lcd.setCursor(0, 1);
lcd.print("diketahui");
return p;
}
delay(3000);
}
Jalannya Alat :
1. Tampilan pertama pada LCD
2. Selanjutnya tes koneksi antara sensor Fingerprint dengan Arduino, jika sukses maka tampilanya
seperti ini
3. Tampilan normal LCD menampilkan tulisan
5. Jika sudah tekan tombol OK.
6. Letakan jari pada sensor fingerprint sampai ada tulisan “Lepaskan Jari” pada LCD
Video Project V - 33. Simpan Data Sidik Jari dengan Tampilan LCD berbasis Arduino Uno
KAMI MELAYANI JASA PEMBUATAN HARDWARE ATAU SOFTWARE BERBASIS ARDUINO
KONTAK KAMI 085743320570 (adi sanjaya)
No comments:
Post a Comment