Doorlock Fingerprint

Home Forum Coding / Program Arduino Doorlock Fingerprint

Topik ini mengandung 0 balasan, memiliki 1 suara, dan terakhir diperbarui oleh  Anak Agung Duwi Arsana 3 minggu, 5 hari yang lalu.

Melihat 1 tulisan (dari total 1)
  • Penulis
    Tulisan-tulisan
  • #12975

    Topik disini mengacu pada artikel yang saya tulis pada link berikut :

    Alat Membuka Pintu Dengan Sidik Jari

    Alat tersebut saya program dengan menggunakan software arduino yang terdiri dari 3 file coding terpisah. Dimana ketiga coding ini saling keterkaitan. Adapun coding tersebut terdiri dari coding utama, coding untuk merekam sidikjari dan coding untuk mengecek sidik jari benar atau salah.

    Coding utama adalah sebagai berikut :

    Coding Utama
    #include <Adafruit_Fingerprint.h>
    #include <SoftwareSerial.h>
    #include <EEPROM.h>
    #include <SoftwareSerial.h>
    int alamat=0;
    int led=5;
    int getFingerprintIDez();
    uint8_t getFingerprintEnroll(int id);
    SoftwareSerial mySerial(11, 12);
    Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
    int tombol=4;
    boolean a = false;
    int relay1=7;
    void setup(){
    Serial.begin(9600);
    pinMode(led,OUTPUT);
    alamat=EEPROM.read(0);
    if(alamat>200)EEPROM.write(0,0);
    pinMode(relay1,OUTPUT);
    pinMode(tombol,INPUT_PULLUP);
    finger.begin(57600);
    if (finger.verifyPassword()) {
    
    } else {
    while (1);
    }
    alamat=EEPROM.read(0);
    }
    
    void loop(){
    if(!digitalRead(tombol)){
    delay(500);
    if(!digitalRead(tombol)){
    finger.emptyDatabase();
    tone(8,1500,100);
    delay(100);
    tone(8,1800,100);
    delay(100);
    
    tone(8,2400,100);
    delay(100);
    tone(8,3000,500);
    delay(500);
    tone(8,1800,100);
    delay(100);
    tone(8,1500,100);
    delay(100);
    goto awal;
    }
    tone(8,1800,100);
    delay(100);
    alamat+=1;
    if(alamat>50)alamat=0;
    EEPROM.write(0, alamat);
    getFingerprintEnroll(alamat);
    alamat=EEPROM.read(0);
    }
    awal:
    getFingerprintIDez();
    digitalWrite(led,LOW);
    delay(100);
    }
    
    [collapse]
    Coding Enroll
    uint8_t getFingerprintEnroll(int id) {
    int p = -1;
    
    while (p != FINGERPRINT_OK) {
    p = finger.getImage();
    switch (p) {
    case FINGERPRINT_OK:
    
    break;
    case FINGERPRINT_NOFINGER:
    
    break;
    case FINGERPRINT_PACKETRECIEVEERR:
    
    break;
    case FINGERPRINT_IMAGEFAIL:
    
    break;
    default:
    
    break;
    }
    }
    
    p = finger.image2Tz(1);
    switch (p) {
    case FINGERPRINT_OK:
    
    break;
    case FINGERPRINT_IMAGEMESS:
    tone(8,1500,100);
    delay(100);
    tone(8,3000,200);
    delay(200);
    tone(8,1500,100);
    delay(100);
    tone(8,3000,200);
    delay(200);
    return p;
    case FINGERPRINT_PACKETRECIEVEERR:
    
    return p;
    case FINGERPRINT_FEATUREFAIL:
    tone(8,1500,100);
    delay(100);
    tone(8,3000,200);
    delay(200);
    tone(8,1500,100);
    delay(100);
    tone(8,3000,200);
    delay(200);
    return p;
    case FINGERPRINT_INVALIDIMAGE:
    tone(8,1500,100);
    delay(100);
    tone(8,3000,200);
    delay(200);
    tone(8,1500,100);
    delay(100);
    tone(8,3000,200);
    delay(200);
    return p;
    default:
    
    return p;
    }
    tone(8,1800,100);
    delay(100);
    Serial.println("Lepaskan jari");
    delay(1000);
    
    p = 0;
    while (p != FINGERPRINT_NOFINGER) {
    p = finger.getImage();
    }
    
    p = -1;
    tone(8,1800,100);
    delay(100);
    Serial.println("Tempelkan jari");
    while (p != FINGERPRINT_OK) {
    p = finger.getImage();
    switch (p) {
    case FINGERPRINT_OK:
    
    break;
    case FINGERPRINT_NOFINGER:
    
    break;
    case FINGERPRINT_PACKETRECIEVEERR:
    
    break;
    case FINGERPRINT_IMAGEFAIL:
    
    break;
    default:
    
    break;
    }
    }
    
    p = finger.image2Tz(2);
    switch (p) {
    case FINGERPRINT_OK:
    
    break;
    case FINGERPRINT_IMAGEMESS:
    
    return p;
    case FINGERPRINT_PACKETRECIEVEERR:
    
    return p;
    case FINGERPRINT_FEATUREFAIL:
    
    return p;
    case FINGERPRINT_INVALIDIMAGE:
    
    return p;
    default:
    
    return p;
    }
    
    p = finger.createModel();
    if (p == FINGERPRINT_OK) {
    
    
    } else if (p == FINGERPRINT_PACKETRECIEVEERR) {
    
    return p;
    } else if (p == FINGERPRINT_ENROLLMISMATCH) {
    
    return p;
    } else {
    
    return p;
    }
    
    p = finger.storeModel(id);
    if (p == FINGERPRINT_OK) {
    Serial.println("Disimpan");
    tone(8,1800,100);
    delay(100);
    tone(8,3000,500);
    delay(500);
    
    delay(1000);
    } else if (p == FINGERPRINT_PACKETRECIEVEERR) {
    
    return p;
    } else if (p == FINGERPRINT_BADLOCATION) {
    
    return p;
    } else if (p == FINGERPRINT_FLASHERR) {
    
    return p;
    } else {
    
    return p;
    }
    }
    
    [collapse]
    Coding Verifikasi
    uint8_t getFingerprintID() {
    uint8_t p = finger.getImage();
    switch (p) {
    case FINGERPRINT_OK:
    
    
    delay(1000);
    break;
    case FINGERPRINT_NOFINGER:
    
    return p;
    case FINGERPRINT_PACKETRECIEVEERR:
    
    return p;
    case FINGERPRINT_IMAGEFAIL:
    
    return p;
    default:
    
    return p;
    }
    
    p = finger.image2Tz();
    switch (p) {
    case FINGERPRINT_OK:
    
    delay(1000);
    break;
    case FINGERPRINT_IMAGEMESS:
    
    return p;
    case FINGERPRINT_PACKETRECIEVEERR:
    
    return p;
    case FINGERPRINT_FEATUREFAIL:
    
    return p;
    case FINGERPRINT_INVALIDIMAGE:
    
    return p;
    default:
    
    return p;
    }
    
    
    p = finger.fingerFastSearch();
    if (p == FINGERPRINT_OK) {
    
    
    } else if (p == FINGERPRINT_PACKETRECIEVEERR) {
    
    return p;
    } else if (p == FINGERPRINT_NOTFOUND) {
    
    return p;
    } else {
    
    return p;
    } 
    
    }
    
    int getFingerprintIDez() {
    digitalWrite(led,HIGH);
    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) 
    {
    Serial.println("Salah");
    tone(8,1500,100);
    delay(100);
    tone(8,3000,200);
    delay(200);
    tone(8,1500,100);
    delay(100);
    tone(8,3000,200);
    delay(200);
    while (p != FINGERPRINT_NOFINGER) {
    p = finger.getImage();
    Serial.println("Lepaskan");
    }
    delay(2000);
    return -1;
    }
    tone(8,1800,100);
    delay(100);
    tone(8,1500,100);
    delay(500);
    digitalWrite(relay1,HIGH);
    delay(5000);
    
    digitalWrite(relay1,LOW);
    
    
    return finger.fingerID; 
    }
    
    [collapse]



    Untuk yang belum nonton video nya bisa lihat ujicoba nya pada video berikut :

    Video

    [collapse]

    Jika kalian ada yang ditanyakan tentang coding ini silahkan ditanyakan melalui topik forum ini, terima kasih.

Melihat 1 tulisan (dari total 1)

Anda harus log masuk untuk membalas topik ini.