Components and supplies
Arduino Mini 05
Voltage Regulator Module
Biometric Sensor - Model: FPM10A
Relay (generic)
Tools and machines
Tape, Electrical
Plier, Long Nose
Solder Wire, Lead Free
Soldering iron (generic)
Apps and platforms
Arduino Web Editor
Project description
Code
Code of security System Motorcycle
arduino
1/*************************************************** 2 This is an example sketch for our optical Fingerprint sensor 3 4 Designed specifically to work with the Adafruit BMP085 Breakout 5 ----> http://www.adafruit.com/products/751 6 7 These displays use TTL Serial to communicate, 2 pins are required to 8 interface 9 Adafruit invests time and resources providing this open source code, 10 please support Adafruit and open-source hardware by purchasing 11 products from Adafruit! 12 13 Written by Limor Fried/Ladyada for Adafruit Industries. 14 BSD license, all text above must be included in any redistribution 15 ****************************************************/ 16int chave=0; 17int verde=5; 18int azul=4; 19int vermelho=6; 20int rele=7; 21#include <Adafruit_Fingerprint.h> 22 23// On Leonardo/Micro or others with hardware serial, use those! #0 is green wire, #1 is white 24// uncomment this line: 25// #define mySerial Serial1 26 27// For UNO and others without hardware serial, we must use software serial... 28// pin #2 is IN from sensor (GREEN wire) 29// pin #3 is OUT from arduino (WHITE wire) 30// comment these two lines if using hardware serial 31SoftwareSerial mySerial(2, 3); 32 33Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial); 34 35void setup() 36{ 37 pinMode(4,OUTPUT); 38 pinMode(5,OUTPUT); 39 pinMode(6,OUTPUT); 40 pinMode(7,OUTPUT); 41 digitalWrite(rele,1); 42 //Serial.begin(9600); 43 //while (!Serial); // For Yun/Leo/Micro/Zero/... 44 delay(100); 45 //Serial.println("\ 46\ 47Adafruit finger detect test"); 48 digitalWrite(azul,1); 49 // set the data rate for the sensor serial port 50 finger.begin(57600); 51 /* 52 if (finger.verifyPassword()) { 53 Serial.println("Found fingerprint sensor!"); 54 } else { 55 Serial.println("Did not find fingerprint sensor :("); 56 while (1) { delay(1); } 57 } 58*/ 59 //finger.getTemplateCount(); 60 //Serial.print("Sensor contains "); Serial.print(finger.templateCount); Serial.println(" templates"); 61 //Serial.println("Waiting for valid finger..."); 62 digitalWrite(azul,0); 63 digitalWrite(vermelho,1); 64 digitalWrite(verde,0); 65} 66 67 68void loop() // run over and over again 69{ 70 71 if(getFingerprintIDez()==1){ 72 chave=!chave; 73 74 delay(500); 75 } 76 digitalWrite(rele,!chave); 77 digitalWrite(verde,chave); 78 digitalWrite(vermelho,digitalRead(rele)); 79 delay(50); //don't ned to run this at full speed. 80} 81 82uint8_t getFingerprintID() { 83 uint8_t p = finger.getImage(); 84 switch (p) { 85 case FINGERPRINT_OK: 86 //Serial.println("Image taken"); 87 break; 88 case FINGERPRINT_NOFINGER: 89 //Serial.println("No finger detected"); 90 return p; 91 case FINGERPRINT_PACKETRECIEVEERR: 92 //Serial.println("Communication error"); 93 return p; 94 case FINGERPRINT_IMAGEFAIL: 95 //Serial.println("Imaging error"); 96 return p; 97 default: 98 //Serial.println("Unknown error"); 99 return p; 100 } 101 102 // OK success! 103 104 p = finger.image2Tz(); 105 switch (p) { 106 case FINGERPRINT_OK: 107 //Serial.println("Image converted"); 108 break; 109 case FINGERPRINT_IMAGEMESS: 110 //Serial.println("Image too messy"); 111 return p; 112 case FINGERPRINT_PACKETRECIEVEERR: 113 //Serial.println("Communication error"); 114 return p; 115 case FINGERPRINT_FEATUREFAIL: 116 //Serial.println("Could not find fingerprint features"); 117 return p; 118 case FINGERPRINT_INVALIDIMAGE: 119 //Serial.println("Could not find fingerprint features"); 120 return p; 121 default: 122 //Serial.println("Unknown error"); 123 return p; 124 } 125 126 // OK converted! 127 p = finger.fingerFastSearch(); 128 if (p == FINGERPRINT_OK) { 129 //Serial.println("Found a print match!"); 130 } else if (p == FINGERPRINT_PACKETRECIEVEERR) { 131 //Serial.println("Communication error"); 132 return p; 133 } else if (p == FINGERPRINT_NOTFOUND) { 134 //Serial.println("Did not find a match"); 135 return p; 136 } else { 137 //Serial.println("Unknown error"); 138 return p; 139 } 140 141 // found a match! 142 //Serial.print("Found ID #"); Serial.print(finger.fingerID); 143 //Serial.print(" with confidence of "); Serial.println(finger.confidence); 144 145 return finger.fingerID; 146} 147 148// returns -1 if failed, otherwise returns ID # 149int getFingerprintIDez() { 150 uint8_t p = finger.getImage(); 151 if (p != FINGERPRINT_OK) return -1; 152 153 p = finger.image2Tz(); 154 if (p != FINGERPRINT_OK) return -1; 155 156 p = finger.fingerFastSearch(); 157 if (p != FINGERPRINT_OK) return -1; 158 159 // found a match! 160 161 //Serial.print("Found ID #"); Serial.print(finger.fingerID); 162 //Serial.print(" with confidence of "); Serial.println(finger.confidence); 163 return finger.fingerID; 164} 165
Downloadable files
Wiring diagram
Wiring diagram
Wiring diagram
Wiring diagram
Comments
Only logged in users can leave comments