You are on page 1of 30

CHAPTER FOUR

4.1 OUTPUT SPECIFICATION AND DESIGN

The fingerprint capturing system has a power supply section that is designed to operate

on a 3.7V battery. The system operates with a 5V supply. The fingerprint sensor and the esp32

module have an operating voltage of 5V. The power supply section has the following output

specification for the circuit operation:

1. Output Voltage- 5V

2. Output Current- 2A

The power supply section is designed to operate on a 3.7V supply voltage from the battery, this

battery voltage is boosted to 5V to meet the voltage requirement of the microcontroller and

fingerprint module using the MT3608 boost DC-DC converter. The MT3608 DC-DC boost

converter is a user adjustable step up DC-DC converter module and it input voltage can vary

between 2V to 24VDC, while it output voltage is adjustable between 5VDC to 28VDC. In this

project the output voltage has been set to 5VDC with the input voltage of 3.7V which is the

battery voltage

The MT3608 module is using very less amount of components and the main component of the

module is MT3608 IC. MT3608 is a highly efficient voltage booster IC with many built in

features like over heat protection, low quiescent current, soft start function, low external

components, overheat shutdown etc. Other components used in this module are two ceramic

capacitors, one variable resistor, one resistor and one schottky diode and a 22uH inductor which

is an important part of all voltage booster circuits.


The fingerprint capturing system has also incorporate a charging section to charge the battery to

prevent a failure or shutdown of the system due to low battery voltage. The charging of the

battery is achieved using a charging module namely TP4056. The TP4056 is 1A Standalone

Linear Li-lon Battery Charger with Thermal Regulation and two LED Indication in case SOIC-

8/SO-8/SOP-8. The TP4056 is a complete constant-current/constant-voltage linear charger for

single cell lithium-ion (Li-Ion) batteries. It has the following output specifications

1. Output Voltage- 4.2V

2. Output current – 1A

The fingerprint Capturing system incorporates a fingerprint module that captures the fingerprint

image when a finger is placed on it, the fingerprint image is captured and converted to a binary

file containing a stream of 1’s and 0’s which is sent over the internet to an email. The resultant

binary file is converted to a bitmap image using a python script. Figure 4.1 and 4.2 respectively

shows the fingerprint capturing process when a fingerprint image is placed on the sensor and the

resultant bitmap image after python conversion


Figure 4.1: Image capturing Process

Figure 4.2: Bitmap Image of Captured Fingerprint

4.2 INPUT SPECIFICATION AND DESIGN

The fingerprint capturing system incorporates a power supply section which has a battery and a

DC-DC boost converter module. The specification of the battery used are given below

1. Battery Voltage- 3.7V

2. Battery type- Lithium Ion

3. Battery capacity- 18,500mAh

The DC-DC boost converter module MT3608 has the following input specification
1. Input Voltage- 2VDC- 24VDC

The system incorporates a battery charging module to keep the battery charged so as to ensure

that the system does not shutdown. The battery charging module used is TP4056 which has the

following input specifications

1. Input Voltage range- 4VDC – 8VDC

2. Recommended input voltage – 5VDC(USB)

The system can be charged using a regular phone battery charger. It has a LED indicator to

indicate state of charge of the battery; when the battery is charging, a red LED is lit and when the

battery is fully charged, a green led is lit which indicates that the battery is fully charged. The

maximum charged voltage of the battery is 4.2V.

The TP4056 has the following features

 Lithium-ion battery charging and discharging module which supports a constant current –

constant voltage charging mechanism.

 Full charge voltage of 4.2 V.

 Over-discharge protection feature which prevents the battery from being discharged

below 2.4V by cutting off output power until the battery is recharged above 3V.

 The 5V input voltage is applied through micro USB or solder pads IN+ and IN-.

 The charging current is 1A and it is adjustable. You can change it by connecting a

resistor of 1kΩ at IN- pad.

 It can protect the battery from overcharging.

 Soft start protection is provided to limit the inrush currents.


 It can protect the battery from overcurrents and short circuits by cutting off the output

from the battery. This happens in a case when the discharge rate becomes greater than

3A.

The TP4056 charging module as shown in the figure below has six terminals which are as

described below:

Pin#1 OUT+

This is the output pin which supplies the positive voltage of a battery. It is connected to the

circuit which needs power from a battery, in this case, it is connected to the MT3608 positive

input terminal.

Pin#2 B+

Connect the Positive terminal of lithium battery with this pin using a battery connector.

Pin#3 B-

Connect the Negative terminal of lithium battery with this pin using a battery connector.

Pin#4 OUT-

This the output pin which supplies the negative voltage of the battery. It is connected to the

circuit which needs power from a battery, in this case it is connected to MT3608 negative input.

Pin#5 IN+ and Pin#6 IN-


These pins are used to charge the battery by providing +5V at IN+ and -5V at IN- terminals

when you don’t have a USB cable. Otherwise, you can directly charge from USB supply by

using a USB cable.

The figure 4.3 below shows the pin labelling of TP4056

Figure 4.3: TP4056 Charging module

The fingerprint module FPM10A used for this project has the following technical specifications:

1. Power supply voltage: 3.3-6V

2. Supply current: working current: <120mA

3. Peak current: <140mA

4. The time of fingerprint image input: < 1 second

5. The window size: 14 x 18 mm

6. Profile: 256 bytes


7. Template file: 512 bytes

8. Storage capacity: 300

9. False accept rate (FAR): < 0.001% (safety grade 3)

10. FRR (FRR): < 1% (safety grade 3)

11. The search time: < 1 seconds (1:500, mean)

12. Computer interface: UART (TTL logic level)

13. The communication baud rate (UART): (9600 x N) BPS where N=1 ~ 12 (the default

value of N=6, namely 57600bps)

14. Working environment: temperature: -20°C to +50°C

15. Relative humidity: 40%RH to 85%RH (no treatment)

16. Storage conditions: temperature: -40°C to +85°C

17. Relative humidity: < 85%H (no treatment)

18. Dimensions (L * W * H): 46.25 x 20.4 x 18.1mm

4.3 FILE DESIGN

The project file contains all the necessary file needed for the device operation and the

structure is as given below


Fingerprint Project

ESP32

Image_2_buffer.ino

Getimage

Getimage.py

Image.bin

Image.bmp

4.4 INPUT DESIGN

The fingerprint capturing system has different section namely:

1. The Charging Section

2. The power supply section

3. The Fingerprint capturing section

The charging section design is achieved using a TP4056 charging module which provides the

charging current for the battery from a 5V USB source.

The power supply section is achieved using a DC-DC step up converter module namely MT3608

which converts the batter voltage of 3.7V- 4.2VDC to a sufficiently high voltage of 5VDC for

powering the fingerprint module and the ESP32 module.

The fingerprint module is connected to the ESP32 module through the UART interface at a baud

rate of 57600 and a voltage level of 3.3V- 3.7V. The RX of the fingerprint module FPM10A is
connected to the TX pin of the ESP32 and the TX pin of the fingerprint module is connected to

the RX pin of the ESP32 module and the connection is as shown in the figure 3.

If the pins are not properly connected, communication between the two modules will not be

possible.

4.5 JUSTIFICATION OF PROGRAMMING LANGUAGE USED

This project makes use of an ESP32 module which serves as the central processing unit of the

project. ESP32 is a low-powered, low-cost microcontroller (MCU) board, with both Wi-Fi and

Bluetooth built in, and is based on a dual-core processor mechanism.

ESP32 module used for this project was programmed using the Arduino C in the Arduino

integrated development environment (IDE)

In order to run a program on the ESP32 Development Board, we will need to write our

program into the flash memory of the development board. Since it is easy to write code

and flash programs with Arduino IDE , it is a good tool to use with the ESP32

Development Board. It runs on FreeRTOS, a leading operating system supported by Arduino.

A big advantage of ESP32 is that it is readily supported by Arduino IDE as a “shield” which can

be accessed from Board Manager. One can easily use functions from the FreeRTOS libraries

when coding for the ESP32 within the Arduino IDE.

Arduino software uses Arduino Programming language which is C based to write the code. Since

the programming language is C based, the difficulty of writing the program in assembly

language is removed. As the software coverts the C based program into assembly code internally

and then uploads it to the board. Along with the code editor, the software also consists of a

compiler, an uploader, libraries for the peripheral devices.


In order to obtain the bitmap image of the captured fingerprint, this project makes use of python

programming language to convert the binary image file sent over the internet to the email to a

bitmap image of the captured fingerprint.

Python provides many useful features which make it popular and valuable from the other

programming languages. It supports object-oriented programming, procedural programming

approaches and provides dynamic memory allocation. Listed below are a few essential features

to support the use of python for the binary file conversion to bitmap

1) Easy to Learn and Use

Python is easy to learn as compared to other programming languages. Its syntax is

straightforward and much the same as the English language. There is no use of the semicolon or

curly-bracket, the indentation defines the code block. It is the recommended programming

language for beginners.

2) Expressive Language

Python can perform complex tasks using a few lines of code. A simple example, the hello world

program you simply type print("Hello World"). It will take only one line to execute, while Java

or C takes multiple lines.

3) Interpreted Language

Python is an interpreted language; it means the Python program is executed one line at a time.

The advantage of being interpreted language, it makes debugging easy and portable.
4) Cross-platform Language

Python can run equally on different platforms such as Windows, Linux, UNIX, and Macintosh,

etc. So, we can say that Python is a portable language. It enables programmers to develop the

software for several competing platforms by writing a program only once.

5) Free and Open Source

Python is freely available for everyone. It is freely available on its official

website www.python.org. It has a large community across the world that is dedicatedly working

towards make new python modules and functions. Anyone can contribute to the Python

community. The open-source means, "Anyone can download its source code without paying any

penny."

6) Object-Oriented Language

Python supports object-oriented language and concepts of classes and objects come into

existence. It supports inheritance, polymorphism, and encapsulation, etc. The object-oriented

procedure helps to programmer to write reusable code and develop applications in less code.

7) Extensible

It implies that other languages such as C/C++ can be used to compile the code and thus it can be

used further in our Python code. It converts the program into byte code, and any platform can use

that byte code.


8) Large Standard Library

It provides a vast range of libraries for the various fields such as machine learning, web

developer, and also for the scripting. There are various machine learning libraries, such as

Tensor flow, Pandas, Numpy, Keras, and Pytorch, etc. Django, flask, pyramids are the popular

framework for Python web development.

4.6 SYSTEM REQUIREMENTS

The minimum system requirements to run the project software are given below:

1. Windows 7 or higher

2. 4gb Ram

3. 1.6ghz speed

4. 100gb hard disk space

5. Python 3.0 or higher installed on the system

6. Arduino IDE installed on the system


CHAPTER FIVE

5.1 SUMMARY

In today's life use of the vehicle is an important part of life and along with its safety concerns are

also very important. To increase the safety of vehicle different type of security systems are

available in the market out of which the most common are beepers, fire alarms, security cameras,

and personal safety products, but, the issue with this is that automobiles loaded with all the above

facilities comes with a high price. To overcome this problem in this work Biometric system is

used as security for vehicles. Biometric System is the combination of two different technologies

which are Embedded systems and biometrics. Fingerprint proves one of the best recognition

systems. The security system implemented using ESP32 and fingerprint module is presented in

this project and this can be incorporated in any vehicle irrespective of model. The project

provides the user or car owner with real-time information on intruders trying to access the

vehicle irrespective of the user’s location by capturing the intruder’s fingerprint and sending it

over email. All records of the captured fingerprint can be retrieved from the user’s email and in

the event of a car. The fingerprint captured can be used by security agencies to locate the

possible suspects since the fingerprint is unique to each person.

5.2 SYSTEM MAINTENANCE

The system can be maintained as highlighted below

1. The system should be charged using the recommended 5V USB charger.

2. The fingerprint sensor should cleaned with a neat and dust free fabric

3. The device should be handled with care to avoid damage to the internal circuitry

4. The device should be switched off when not in use to avoid draining of the battery.
5.3 SUGGESTED AREAS FOR FURTHER STUDIES

This project has proposed a security system for vehicles using fingerprint capturing

system, which captures and send the fingerprint of any intruder to the user’s email and the

fingerprint image can further be used for security reasons in the case of a car theft. This system

can further be improved by incorporating the following:

1. GSM Module to also alert the user by SMS whenever a fingerprint is detected, for

additional safety so that if an unauthorized person tries to access the vehicle, SMS is sent

automatically to the owner.

2. The present module can be extended to include a GPS module for additional safety so

that if a vehicle is stolen, by GPS module we can track the location of the vehicle

3. A camera module can also be used with this security device to take a picture of the

intruder and send it alongside the fingerprint to the user’s email.

5.4 USER’S MANUAL

The user should take note of the following in order to use the device:

1. Set Up the dedicated on your phone or your handheld device with following details

 Fingerprintproject@yahoo.com

 Password: Fingerprint22

2. Turn on notifications for the mail

3. Set up the device as desired

4. The device is switched on by pushing the green push button

5. The device can be reset by pushing the yellow push button

6. The green LED indicates the state of the device as follows


 When the device is switched on, the green led comes on after 5 seconds

approximately indicating that device is ready to capture a fingerprint

 After the fingerprint is successfully captured, the green LED goes off.

 If the fingerprint is not successfully captured, the green LED flickers five times

and the whole process start all over.

 While the green LED is off, the device is running.

 The green LED comes on again after about 5 seconds indicating the image is

ready to be sent to the mail.

 Once the image is sent to the mail successfully, the green LED goes off.

 The whole process is repeated over again

APPENDIX

//#include "Arduino.h"
#include <HardwareSerial.h>
#include <FPM.h>
#include "ESP32_MailClient.h"
#include <FS.h>
#include <SPIFFS.h>
#include <WiFi.h>
//#include <ESP_Mail_Client.h>

/* Save a fingerprint image to a RAM buffer/array.


* THIS WON'T COMPILE UNLESS YOU HAVE AN MCU WITH AT LEAST ~37K RAM
* LIKE THE ESP32.
*/

/* pin #2 is IN from sensor (GREEN wire)


pin #3 is OUT from arduino (WHITE/YELLOW wire)
*/

/* select UART1 */
/*
* Insert your network credentials in the following variables:
*/
int LED = 4;
const char* ssid = "MTN_4G_0A77A4";
const char* password = "75818080";
/*
* Type the email sender account on the emailSenderAccount variable and
* its password on the emailSenderPassword variable.
*/
#define emailSenderAccount "fingerprintproject@yahoo.com"
#define emailSenderPassword "dfcepkzyvhcwhjho"
/*
* wfikbgxqlhcysfnp
* Insert the recipient’s email. This is the email that will receive the emails sent by the ESP32:
*/

#define emailRecipient "fingerprintreceiver@yahoo.com"


/*
* Insert your email provider SMTP settings on the following lines.
* We’re using the settings for a Gmail account.
*/

#define smtpServer "smtp.mail.yahoo.com"


#define smtpServerPort 465

#define emailSubject "Fingerprint Detected"


/*
* Create an STMPData object called smtpData that contains the
* data to send via email and all the other configurations.
*/
SMTPData smtpData;
//The file will be temporarily saved in SPIFFS under the name image.bn

#define FILE_IMAGE "/image.bin"

HardwareSerial fserial(1);

FPM finger(&fserial);
FPM_System_Params params;

void setup(void) {
// Connect to Wi-Fi
Serial.begin(57600);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
Serial.print("Connecting to WiFi...");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println();

/*
* Initialize SPIFFS (SPI Flash File System) to save the file
*/
if (!SPIFFS.begin(true)) {
Serial.println("An Error has occurred while mounting SPIFFS");
ESP.restart();
}
else {
delay(500);
Serial.println("SPIFFS mounted successfully");
}

// Print ESP32 Local IP Address


Serial.print("IP Address: http://");
Serial.println(WiFi.localIP());
pinMode(LED, OUTPUT);
//Configure and initialize fingerprint sensor
Serial.println("SAVE IMAGE TO BUFFER test");
fserial.begin(57600, SERIAL_8N1, 16, 17);
if (finger.begin()) {
finger.readParams(&params);
Serial.println("Found fingerprint sensor!");
digitalWrite(LED, HIGH);
Serial.print("Capacity: "); Serial.println(params.capacity);
Serial.print("Packet length: "); Serial.println(FPM::packet_lengths[params.packet_len]);
delay(2000);
digitalWrite(LED, LOW);
}
else {
Serial.println("Did not find fingerprint sensor :(");
for (int k=0;k<=5;k++)
{
ledBLINK();
}
while (1) yield();
}

void loop() {

stream_image();
yield();
}
#define IMAGE_SZ 36864UL
uint8_t image_buffer[IMAGE_SZ];

void stream_image(void) {
if (!set_packet_len_128()) {
Serial.println("Could not set packet length");
return;
}

delay(100);

int16_t p = -1;
Serial.println("Waiting for a finger...");
digitalWrite(LED,HIGH);
while (p != FPM_OK) {
p = finger.getImage();
switch (p) {
case FPM_OK:
Serial.println("Image taken");
digitalWrite (LED, LOW);
break;
case FPM_NOFINGER:
break;
case FPM_PACKETRECIEVEERR:
Serial.println("Communication error");
break;
case FPM_IMAGEFAIL:
Serial.println("Imaging error");
break;
default:
Serial.println("Unknown error");
break;
}
yield();
}

p = finger.downImage();
switch (p) {
case FPM_OK:
Serial.println("Starting image stream...");
break;
case FPM_PACKETRECIEVEERR:
Serial.println("Communication error");
return;
case FPM_UPLOADFAIL:
Serial.println("Cannot transfer the image");
return;
}
/* flag to know when we're done */
bool read_finished;
/* indicate the max size to read, and also returns how much was actually read */
uint16_t readlen = IMAGE_SZ;
uint16_t pos = 0;
int16_t count = 0;
while (true) {
bool ret = finger.readRaw(FPM_OUTPUT_TO_BUFFER, image_buffer + pos, &read_finished,
&readlen);
if (ret) {
count++;
pos += readlen;
readlen = IMAGE_SZ - pos;
if (read_finished){
digitalWrite(LED, HIGH);
storeInSPIFFS(image_buffer, IMAGE_SZ);
sendemail();
delay(1000);
digitalWrite (LED, LOW);
delay(1000);
break;
}

}
else {
Serial.print("\r\nError receiving packet ");
Serial.println(count);
return;
}
yield();
}

Serial.println();
Serial.print(count * FPM::packet_lengths[params.packet_len]); Serial.println(" bytes read.");
Serial.println("Image stream complete.");
}

/* no need to call this for R308 */


bool set_packet_len_128(void) {
uint8_t param = FPM_SETPARAM_PACKET_LEN; // Example
uint8_t value = FPM_PLEN_128;
int16_t p = finger.setParam(param, value);
switch (p) {
case FPM_OK:
Serial.println("Packet length set to 128 bytes");
break;
case FPM_PACKETRECIEVEERR:
Serial.println("Comms error");
break;
case FPM_INVALIDREG:
Serial.println("Invalid settings!");
break;
default:
Serial.println("Unknown error");
}

return (p == FPM_OK);
}

void storeInSPIFFS(byte* payload, unsigned long length){


//create a new file in SPIFFS where the photo will be saved.
Serial.printf("Picture file name: %s\n", FILE_IMAGE);
File file = SPIFFS.open(FILE_IMAGE, "wb");

//Check if the file was successfully created. If not, print an error message.
if (!file) {
Serial.println("Failed to open file in writing mode");
}
else{
Serial.println("file opened");
Serial.printf("Start Position = %u \n", file.position()); // Prints what position in the file we're in
Serial.print(F("SizePayload: "));
Serial.println(length);
}

// for (int i = 0; i < length; i++) { // for debug purposes check the content of the payload
// Serial.print((byte)payload[i]); // DEBUG
// Serial.print(":"); // DEBUG
// } // DEBUG
Serial.println(""); // DEBUG
file.write(payload, length);
file.close();
}

void sendemail (void){


//The following line sets the SMTP Server host, SMTP port,
//account email address and password used to login:

smtpData.setLogin(smtpServer, smtpServerPort, emailSenderAccount, emailSenderPassword);


//Set the sender name and sender email

smtpData.setSender("ESP32", emailSenderAccount);

//Set the email priority.

smtpData.setPriority("High");

//Set the email subject.

smtpData.setSubject(emailSubject);

//The following line sets the message.

smtpData.setMessage("<h2>Fingerprint detected and binary file attached to this mail<h2>", true);

//set the recipient email. This is the email that will receive the messages from the ESP32.

smtpData.addRecipient(emailRecipient);

//Then, to attach a file, you just need to call the addAtatachFile() on the smtpData object and pass as argument
the file path.

smtpData.addAttachFile(FILE_IMAGE, "image/bin");

//Finally, you need to set where your files are saved (SPIFFS or SD card). We’re using SPIFFS:

smtpData.setFileStorageType(MailClientStorageType::SPIFFS);
//Set a callback function that will be called upon sending an email.

smtpData.setSendCallback(sendCallback);

//The sendCallback() function returns whether the email was successfully sent or not.

if (!MailClient.sendMail(smtpData))
Serial.println("Error sending Email, " + MailClient.smtpErrorReason());
//clear all the data from the smtpData object.

smtpData.empty();

}
void sendCallback(SendStatus msg) {

Serial.println(msg.info());

if (msg.success()) {
Serial.println("----------------");
SPIFFS.remove(FILE_IMAGE);
}
}

void ledBLINK(void)
{
digitalWrite(LED, HIGH);
delay(1000);
digitalWrite(LED,LOW);
delay(1000);
}

A python Script was written to convert the binary file to a bitmap image showing the fingerprint image in black
and white

WIDTH = 256
HEIGHT = 288
READ_LEN = int(WIDTH * HEIGHT / 2)

DEPTH = 8
HEADER_SZ = 54

print("----------Extract Fingerprint Image------------")


print()

# assemble bmp header for a grayscale image


def assembleHeader(width, height, depth, cTable=False):
header = bytearray(HEADER_SZ)
header[0:2] = b'BM' # bmp signature
byte_width = int((depth*width + 31) / 32) * 4
if cTable:
header[2:6] = ((byte_width * height) + (2**depth)*4 + HEADER_SZ).to_bytes(4, byteorder='little') #file
size
else:
header[2:6] = ((byte_width * height) + HEADER_SZ).to_bytes(4, byteorder='little') #file size
#header[6:10] = (0).to_bytes(4, byteorder='little')
if cTable:
header[10:14] = ((2**depth) * 4 + HEADER_SZ).to_bytes(4, byteorder='little') #offset
else:
header[10:14] = (HEADER_SZ).to_bytes(4, byteorder='little') #offset

header[14:18] = (40).to_bytes(4, byteorder='little') #file header size


header[18:22] = width.to_bytes(4, byteorder='little') #width
header[22:26] = (-height).to_bytes(4, byteorder='little', signed=True) #height
header[26:28] = (1).to_bytes(2, byteorder='little') #no of planes
header[28:30] = depth.to_bytes(2, byteorder='little') #depth
#header[30:34] = (0).to_bytes(4, byteorder='little')
header[34:38] = (byte_width * height).to_bytes(4, byteorder='little') #image size
header[38:42] = (1).to_bytes(4, byteorder='little') #resolution
header[42:46] = (1).to_bytes(4, byteorder='little')
#header[46:50] = (0).to_bytes(4, byteorder='little')
#header[50:54] = (0).to_bytes(4, byteorder='little')
return header

def options():
print("Options:")
print("\tPress 1 to extract and save the fingerprint image as bmp file")
print("\tPress 2 to view help")
print("\tPress 3 to exit")
print()
choice = input(">> ")
print()
return choice

def getPrint():
'''
enter the filename of the image with menu option 2:
>>> Enter filename/path of output file (without extension): myprints

.
.
.
.
.
.
Extracting image...saved as <filename>.bmp

'''
out = open(input("Enter filename/path of output file (without extension): ")+'.bmp', 'wb')
# assemble and write the BMP header to the file
out.write(assembleHeader(WIDTH, HEIGHT, DEPTH, True))
for i in range(256):
# write the colour palette
out.write(i.to_bytes(1,byteorder='little') * 4)

with open("image.bin", "rb") as file:

while True:
byte= file.read(1)
if not byte:
#print("Timeout!")
break
# make each nibble a high nibble
out.write((byte[0] & 0xf0).to_bytes(1, byteorder='little'))
out.write(((byte[0] & 0x0f) << 4).to_bytes(1, byteorder='little'))

out.close() # close file


print('Image saved as', out.name)

while True:
chose = options()
if chose == "3":
break
elif chose == "1":
getPrint()
elif chose == "2":
print('================= HELP ==================')
print(getPrint.__doc__)
print('=========================================')

You might also like