Mechatronics Project
Mechatronics Project
SECTION: F
COURSE CODE: ME-430
GROUP NO: 1
SUBMITTED TO: SIR UMAIR HASSAN KAZMI
DEPARTMENT: MECHANICAL ENGINEERING
GROUP MEMBERS
ABDUL RAZIQ (ME-19234)
MUHAMMAD USMAN KHOKHAR (ME-19224)
SYED MUHAMMAD YAWAR RIZVI (ME-19237)
HAMZA AHMED (ME-19229)
1|Page
Contents
1. FINGERPRINT LOCKER: ..................................................................3
1.1 SCOPE: .......................................................................................3
1.2 SECTOR: .....................................................................................3
2. ARDUINO IOT CLOUD: ...................................................................3
3. COMPONENETS USED: ..................................................................4
3.1 Arduino ...................................................................................4
3.2 Fingerprint Sensor: ..................................................................4
3.3 LEDS: .......................................................................................4
3.4 Breadboard: ............................................................................4
3.5 Jumpers: .................................................................................5
3.6 Resistors: ................................................................................5
3.7 USB Cable:...............................................................................5
4. SCHEMATIC DIAGRAM: .................................................................5
5. WORKING CODE:...........................................................................5
2|Page
1. FINGERPRINT LOCKER:
1.1 SCOPE:
Fingerprint based locks are revolutionary locking systems that open with just the touch of authorized
user’s finger; their increased use in various locking applications can actuate what would be known as
‘Keyless World’.
1.2 SECTOR:
Fingerprint lockers can be used across various sectors and industries. They are used in residentials to
provide secure storage for personal belongings. They are used in offices to protect important documents
and other things. They are used in Data and IT centers to protect critical infrastructure, hardware, and
sensitive information from unauthorized access.
3|Page
3. COMPONENETS USED:
3.1 Arduino:
The Arduino Uno is a type of Arduino board that is provided as an open-
source board that uses an ATmega328p microcontroller in the board. The
Arduino Uno contains a set of analog and digital pins that are input and
output pins which are used to connect the board to other components.
There are a total of fourteen I/O pins placed inboard in which six are analog
input pins. The board has a USB connection that can be used to a power
supply to the board. The board is used for electronics projects and used to design the circuit.
3.3 LEDS:
LEDS are placed to indicate whether the fingerprint sensor is working or not.
3.4 Breadboard:
A breadboard is a type of prototyping tool used to build and test electronic
circuits. It is a board with a series of holes in it, into which electronic
components can be inserted. The holes are connected in a way that allows
electrical connections to be made between the components, without the
need to solder them together. This makes it easy to experiment with
different circuit designs, and to make changes to a circuit without having to
start over from scratch. Breadboards are commonly used by hobbyists,
students, and engineers to quickly build and test electronic circuits, such as
those used in microcontroller projects, IoT devices and other electronic
devices.
4|Page
3.5 Jumpers:
Jumper wires, also known as jumper cables or simply jumpers, are short
electrical wires with connectors on either end. These connectors are typically
male and female headers, which are pins or sockets that can be plugged into
a breadboard or other electronic component. Jumping wires are used to make
connections between different components on a breadboard or circuit board,
allowing electrical current to flow between them.
3.6 Resistors:
Resistors are placed in between connection to LEDS to protect the LEDS from being fused as
it regulates the voltage.
4. SCHEMATIC DIAGRAM:
5. WORKING CODE:
1. #include <Adafruit_Fingerprint.h>
2. // On Leonardo/Micro or others with hardware serial, use those! #0 is
yellow wire, #1 is white
3. // uncomment this line:
4. // #define mySerial Serial1
5.
5|Page
6. // For UNO and others without hardware serial, we must use software
serial...
7. // pin #2 is IN from sensor (YELLOW wire)
8. // pin #3 is OUT from arduino (WHITE wire)
9. // comment these two lines if using hardware serial
10. #include <SoftwareSerial.h>
11. SoftwareSerial mySerial(2, 3);
12.
13. Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
14.
15. void setup()
16. {
17. pinMode(8,OUTPUT);
18. pinMode(9,OUTPUT);
19. Serial.begin(9600);
20. while (!Serial); // For Yun/Leo/Micro/Zero/...
21. delay(100);
22. Serial.println("\n\nAdafruit finger detect test");
23.
24. // set the data rate for the sensor serial port
25. finger.begin(57600);
26.
27. if (finger.verifyPassword()) {
28. Serial.println("Found fingerprint sensor!");
29. } else {
30. Serial.println("Did not find fingerprint sensor :(");
31. while (1) { delay(1); }
32. }
33.
34. finger.getTemplateCount();
35. Serial.print("Sensor contains "); Serial.print(finger.templateCount);
Serial.println(" templates");
36. Serial.println("Waiting for valid finger...");
37. }
38.
39. void loop() // run over and over again
40. {
41. getFingerprintIDez();
42. delay(50); //don't ned to run this at full speed.
43.
44. digitalWrite(9,HIGH);
45. }
46.
47. uint8_t getFingerprintID() {
48. uint8_t p = finger.getImage();
6|Page
49. switch (p) {
50. case FINGERPRINT_OK:
51. Serial.println("Image taken");
52. break;
53. case FINGERPRINT_NOFINGER:
54. Serial.println("No finger detected");
55. return p;
56. case FINGERPRINT_PACKETRECIEVEERR:
57. Serial.println("Communication error");
58. return p;
59. case FINGERPRINT_IMAGEFAIL:
60. Serial.println("Imaging error");
61. return p;
62. default:
63. Serial.println("Unknown error");
64. return p;
65. }
66.
67. // OK success!
68.
69. p = finger.image2Tz();
70. switch (p) {
71. case FINGERPRINT_OK:
72. Serial.println("Image converted");
73. break;
74. case FINGERPRINT_IMAGEMESS:
75. Serial.println("Image too messy");
76. return p;
77. case FINGERPRINT_PACKETRECIEVEERR:
78. Serial.println("Communication error");
79. return p;
80. case FINGERPRINT_FEATUREFAIL:
81. Serial.println("Could not find fingerprint features");
82. return p;
83. case FINGERPRINT_INVALIDIMAGE:
84. Serial.println("Could not find fingerprint features");
85. return p;
86. default:
87. Serial.println("Unknown error");
88. return p;
89. }
90.
91. // OK converted!
92. p = finger.fingerFastSearch();
93. if (p == FINGERPRINT_OK) {
7|Page
94. Serial.println("Found a print match!");
95. } else if (p == FINGERPRINT_PACKETRECIEVEERR) {
96. Serial.println("Communication error");
97. return p;
98. } else if (p == FINGERPRINT_NOTFOUND) {
99. Serial.println("Did not find a match");
100. return p;
101. } else {
102. Serial.println("Unknown error");
103. return p;
104. }
105.
106. // found a match!
107. Serial.print("Found ID #"); Serial.print(finger.fingerID);
108. Serial.print(" with confidence of ");
Serial.println(finger.confidence);
109.
110. return finger.fingerID;
111. }
112.
113. // returns -1 if failed, otherwise returns ID #
114. int getFingerprintIDez() {
115. uint8_t p = finger.getImage();
116. if (p != FINGERPRINT_OK) return -1;
117.
118. p = finger.image2Tz();
119. if (p != FINGERPRINT_OK) return -1;
120.
121. p = finger.fingerFastSearch();
122. if (p != FINGERPRINT_OK) return -1;
123.
124. // found a match!
125. digitalWrite(9,LOW);
126. digitalWrite(8,HIGH);
127. delay(1000);
128. digitalWrite(8,LOW);
129. Serial.print("Found ID #"); Serial.print(finger.fingerID);
130. Serial.print(" with confidence of ");
Serial.println(finger.confidence);
131. return finger.fingerID;
132. }
8|Page