vinci cloud
Published © GPL3+

Wireless Lock/Unlock Smart Devices Gadget by Arduino

We want to make a gadget that can make a safe zone for your devices to be locked/unlocked

BeginnerFull instructions provided3 hours220
Wireless Lock/Unlock Smart Devices Gadget by Arduino

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
r301t fingerprint module
×1
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1
SparkFun RGB LED Breakout - WS2812B
SparkFun RGB LED Breakout - WS2812B
×1
Li-Ion Battery 1000mAh
Li-Ion Battery 1000mAh
×1
Female/Female Jumper Wires
Female/Female Jumper Wires
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Custom parts and enclosures

R301T fingerprint

Schematics

Circuit

Code

Safe zone Arduino

C/C++
#include "Adafruit_Fingerprint.h"
#include "SoftwareSerial.h"
SoftwareSerial mySerial(2, 3);
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
int cc=0;
void setup()  
{
 Serial.begin(9600);
 while (!Serial);  // For Yun/Leo/Micro/Zero/...
 delay(100);
 Serial.println("\n\nAdafruit finger detect test");
 // set the data rate for the sensor serial port
 finger.begin(57600);
 if (finger.verifyPassword()) {
   Serial.println("Found fingerprint sensor!");
 } else {
   Serial.println("Did not find fingerprint sensor :(");
   while (1) { 
        pinMode(13,OUTPUT);
       digitalWrite(13,LOW);
       pinMode(9,OUTPUT);
       digitalWrite(9,HIGH);
     }
 }
 finger.getTemplateCount();
 Serial.print("Sensor contains "); Serial.print(finger.templateCount); Serial.println(" templates");
 Serial.println("Waiting for valid finger...");
}
void loop()                     // run over and over again
{
 getFingerprintIDez();
 delay(50);            //don't ned to run this at full speed.
}
uint8_t getFingerprintID() {
 uint8_t p = finger.getImage();
 switch (p) {
   case FINGERPRINT_OK:
     Serial.println("Image taken");
     break;
   case FINGERPRINT_NOFINGER:
     Serial.println("No finger detected");
     return p;
   case FINGERPRINT_PACKETRECIEVEERR:
     Serial.println("Communication error");
     return p;
   case FINGERPRINT_IMAGEFAIL:
     Serial.println("Imaging error");
     return p;
   default:
     Serial.println("Unknown error");
     return p;
 }
 // OK success!
 p = finger.image2Tz();
 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!
 p = finger.fingerFastSearch();
 if (p == FINGERPRINT_OK) {
   Serial.println("Found a print match!");
 } else if (p == FINGERPRINT_PACKETRECIEVEERR) {
   Serial.println("Communication error");
   return p;
 } else if (p == FINGERPRINT_NOTFOUND) {
   Serial.println("Did not find a match");
   return p;
 } else {
   Serial.println("Unknown error");
   return p;
 }   
 // found a match!
 Serial.print("Found ID #"); 
 Serial.print(finger.fingerID); 
 Serial.print(" with confidence of "); 
 Serial.println(finger.confidence); 
 for (int i=255;i>1;i--)
{analogWrite(9,i); delay(10);}
 if (cc%2==0)digitalWrite(13,HIGH);
 else digitalWrite(13,LOW);
 cc++;
 return finger.fingerID;
}
// returns -1 if failed, otherwise returns ID #
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)  return -1;
 // found a match!
 Serial.print("Found ID #"); Serial.print(finger.fingerID); 
 Serial.print(" with confidence of "); Serial.println(finger.confidence);
 return finger.fingerID; 
} 

Credits

vinci cloud

vinci cloud

2 projects • 1 follower

Comments