0% found this document useful (0 votes)
3 views68 pages

Project Report

Project

Uploaded by

Samartha
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views68 pages

Project Report

Project

Uploaded by

Samartha
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

Jnana Sangama, Belagavi, Karnataka-590018

A Project Report on

“CPI COVID-19”
Submitted in Partial Fulfilment for the Award of Degree of

BACHELOR of ENGINEERING
in
ELECTRONICS & COMMUNICATION ENGINEERING
Submitted by

SAMARTHA L PRASANNA 1BI17EC103


SHASANK B M 1BI17EC110
SUMAN GOWDA T M 1BI17EC129
SWAROOP A 1BI17EC130

Under the guidance of


V SHYLAJA
Assistant professor
Dept. of ECE, BIT

Department of Electronics & Communication Engineering


BANGALORE INSTITUTE OF TECHNOLOGY

i
ABSTRACT

The COVID-19 pandemic is a collective stressor. The corona virus disease-19 is a highly
transmittable and pathogenic viral infection. The intermediate source of origin and transfer to
humans is not known, however, the rapid human-to-human transfer has been confirmed widely.
There is no clinically approved antiviral drug or vaccine available to be used against COVID-
19. In the current review, this research focuses on enhancing security to humans from the
deadly coronavirus by giving them the required guidance.

This research proposes two levels of providences:

➢ Firstly, it helps in easy tracking of all those people who has been in close contact with
the person carrying this device. Basically, it eases the procedure of finding the contact
history of a person who has been tested positive.
➢ Secondly, in case a person carrying this device gets tested positive, then that person will
be able to notify the same to all the other people who has been in his contact within the
stipulated vicinity. Thus, all the other people could take the required measures at an early
stage.

This research is based on an optimised format enabling the device to work efficiently.

ii
ACKNOWLEDGEMENT

Any achievement, be it scholastic or otherwise does not depend solely on the individual
efforts but on the guidance, encouragement and cooperation of intellectuals, elders and
friends. A number of personalities, in their own capacities have helped us in carrying out
this project work.

We would like to take this opportunity to thank them all. We would like to take this
opportunity to express our sincere gratitude to our project guide, Ms. SHYLAJA V,
Associate Professor, Department of Electronics and Communication Engineering, B.I.T,
Bengaluru for her constant encouragement, support and guidance.
We also thank Dr. MUKTHI S. L, Assistant Professor, Project Coordinator, Department
of Electronics and Communication Engineering, B.I.T, Bangalore for motivation and
regular source of encouragement.

We extend our thanks to Dr. SREE RANGA RAJU M. N, Professor and Head of the
Department, Electronics & Communication Engineering, B.I.T, who in his capacity gave
us all possible support and assistance for the completion of the report.

We would like to express our gratitude to Dr. M.U. ASWATH, Principal, Bangalore
Institute of Technology for providing us with excellent facilities and academic ambience
which has helped us in satisfactory completion of this Bachelor’s Degree.

This acknowledgement will be incomplete without thanking teaching and non-teaching


staffs, Department of Electronics & Communication, B.I.T, who contributed either,
directly or indirectly and our peers and friends who provided us with valuable
suggestions to improve our project.

SAMARTHA L PRASANNA
1BI17EC103

SHASHANK B M
1BI17EC110

SUMAN GOWDA T M
1BI17EC129

SWAROOP A
1BI17EC130

iii
TABLE OF CONTENTS

Sl No. CONTENTS Pg No.

CHAPTER 1
1.1 INTRODUCTION 1
1.2 WHAT IS ESP32? 2
1.3 SPECIFICATIONS OF ESP32 3
1.4 DIFFERENT WAYS TO PROGRAM 3
1.5 ESP32 DEVKIT-THE ESP32 DEVELOPMENT 4
BOARD
1.6 LAYOUT 5
1.7 PINOUT OF ESP32 BOARD 6
1.8 CONCLUSION 8
1.9 LITERATURE SURVEY 9
1.10 OBJECTIVES 12

CHAPTER 2
2.1 A BRIEF NOT ON BLE 13
2.2 DIFFERENT LAYERS IN BLE 14
2.3 IMPORTANT TERMS IN BLE 15
2.4 BLE STATES 16
2.5 BLE IN ESP32 17
2.6 ESP32 BLE SERVER CLIENT MODEL 17
2.7 ESP32 BLE SERVER 17
2.8 ESP32 BLE CLIENT 17
2.9 WORKING 18
2.10 ABOUT SPIFFS 21
2.11 CODE WALKTHROUGH 22

CHAPTER 3
3.1 ESP32 ARDUINO: SENDING DATA WITH SOCKET 25
CLIENT
3.2 INTRODUCTION 25
3.3 THE PYTHON CODES 25
3.4 THE ARDUINO CODES 29
3.5 TESTING THE CODES 33
3.6 WHY TO INTEGRATE WITH APPLICATION 35

iv
3.7 SOFTWARE TOOLS USED TO DEVELOP THE 35
APPLICATION
3.8 TECH STACK USED TO DEVELOP THE FRONT 35
END
3.9 WHAT IS REACT LIBRARY? 35
3.10 ADVANTAGES OF REACT 36
3.11 TECH STACK USED TO DEVELOP BACKEND 36
3.12 BACKEND DEVELOPMENT 37
3.13 PROPOSED MODEL 43
3.14 FLOW CHART 44

CHAPTER 4
4.1 RESULTS 46
4.2 EFFECTS OF SOCIAL DISTANCE OF RECEIVER 48
NODE RSSI
4.3 EFFECTS OF BODY ORIENTATION ON 49
RECEIVER NODE RSSI
4.4 EFFECTS OF SENDER-NODE BATTERY LEVEL 50
ON RECEIVER NODE RSSI
4.5 SIGN IN AND SIGN-UP PAGES 51
4.6 FEATURES 54
4.7 APPLICATIONS 55
4.8 CONCLUSION AND FUTURE WORK 56

CHAPTER 5
5.1 REFERENCE 57
5.2 STUDENT CONTACT DETAILS 58

v
LIST OF FIGURES

Figure Figure Name Page


No. No.
1 ESP32 ARCHITECTURE 2
2 ESP WROOM 32 IN ESP DEVELOPMENT KIT 4
3 ESP32 DEVELOPMENT KIT 5
4 COMPONENTS OF ESP32 DEVELOPMENT 6
BOARD
5 PIN DESCRIPTION OF ESP32 7
6 TWO ESP32 MODULES BRODACSTER AND 8
OBSERVER
7 BLUETOOTH USES IN REAL TIME 13
8 BLUETOOTH ARCHITECTURE LAYERS 14
9 BLE STATE DIAGRAM 16
10 BOOT BUTTON IN ESP32 18
11 CHANGING CHARACTERISTIC VALUE BY 19
SERVER
12 CHANGE IN CHARACTERISTIC VALUE BY 20
CLIENT
13 SELECTING SPIFFS IN ARDUINO IDE 21
WORKING WITH FILES IN SPIFF
14 WORKING WITH FILES IN SPIFFS 24
15 OUTPUT OF THE PROGRAM WHEN THE 33
PYTHON SOCKET SERVER IS NOT
CONNECTED
16 OUTPUT OF THE PROGRAM WHEN 34
RECEIVING DATA FROM ESP32
17 SUCCESSFUL CONNECTION TO THE 34
PYTHON SOCKET SERVER ON ESP32
18 FULL FLOW CHART OF THE SYSTEM 43
19 ESP32 NODE USIND IN OUR PROTOTYPE 46
SYSTEM
20 EXPERIMENTAL SETTINGS 47
21 EXPERIMENTAL EVALUATION RESULTS 50
22 SIGN IN PAGE 51
23 SIGN UP PAGE 51

vi
24 SHOWING ABOUT FILES 52
25 SHOWING ABOUT CONTACT 53

vii
BANGALORE INSTITUTE OF TECHNOLOGY

VISION
To establish and develop the Institute as a centre of higher learning, ever abreast with expanding
horizon of knowledge in the field of engineering and technology, with entrepreneurial thinking,
leadership excellence for life-long success and solve societal problem.

MISSION
• Provide high quality education in the engineering disciplines from the undergraduate through
doctoral levels with creative academic and professional programs.

• Develop the Institute as a leader in Science, Engineering, Technology and management,


Research
and apply knowledge for the benefit of society.

• Establish mutual beneficial partnerships with industry, alumni, local, state and central
governments
by public service assistance and collaborative research.

• Inculcate personality development through sports, cultural and extracurricular activities and
engage in the social, economic and professional challenges.

LONG TERM GOALS


• To be among top 3 private engineering colleges in Karnataka and top 20 in India.

• To be the most preferred choice of students and faculty.

• To be the preferred partner of corporate.

• To provide knowledge through education and research in engineering.

• To develop in each student mastery of fundamentals, versatility of mind, motivation for


learning, intellectual discipline and self-reliance which provide the best foundation for
continuing professional achievement.

• To provide a liberal; as well as a professional education so that each student acquires a


respect for moral values, a sense of their duties as a citizen, a feeling for taste and style, and
a better human understanding.

viii
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING
BANGALORE INSTITUTE OF TECHNOLOGY

VISION
Imparting Quality Education to achieve Academic Excellence in Electronics and Communication
Engineering for Global Competent Engineers.

MISSION
• Create state of art infrastructure for quality education.
• Nurture innovative concepts and problem-solving skills.
• Delivering Professional Engineers to meet the societal needs

Program Educational Objectives (PEOS)


• Prepare graduates to be professionals, practicing engineers and entrepreneurs in the field
of Electronics and Communication Engineering.
• To acquire sufficient knowledge base for innovative techniques in design and
development of systems.
• Capable of competing globally in multidisciplinary field.
• Achieve personal and professional success with awareness and commitment to ethical
and social responsibilities as an individual as well as a team.
• Graduates will maintain and improve technical competence through continuous learning
process.

Program Specific Outcomes (PSOS)


• PSO1: The graduates will be able to apply the principles of Electronics and
Communication Engineering in core areas.
• PSO2: An ability to use latest hardware and software tools in Electronics and
Communication Engineering.
• PSO3: Preparing Graduates to satisfy industrial needs and pursue higher studies with
social-awareness and universal moral values.

ix
DECLARATION

We hereby declare that the project work titled “CPI COVID-19”, is a project report of the
original work done by us at Bangalore Institute of Technology, Bengaluru and to the best of
our knowledge and belief, no part of it has been submitted for any degree or diploma of any
institution previously This project is submitted to Visvesvaraya Technological University,
Belagavi at Bangalore Institute of Technology, Department of Electronics and
Communication Engineering, Bengaluru in partial fulfilment for the award of Bachelor of
Engineering in Electronics and Communication during the academy year 2017-21.

SAMARTHA L PRASANNA
USN:1BI17EC103

SHASHANK B M
USN:1BI17EC110

SUMAN GOWDA TM
USN:1BI17EC129

SWAROOP A
USN:1BI17EC130

x
CPI COVID-19 2020-2021

CHAPTER 1

INTRODUCTION

Arduino is a great platform for beginners into the World of Microcontrollers and
Embedded Systems. With a lot of cheap sensors and modules, you can make
several projects either as a hobby or even commercial.

As technology advanced, new project ideas and implementations came into play
and one particular concept is the Internet of Things or IoT. It is a connected
platform, where several “things” or devices are connected over internet for
exchange of information.

In DIY community, the IOT projects are mainly focused on Home Automation
and Smart Home applications but commercial and industrial IoT projects have
far complex implementations like Machine Learning, Artificial Intelligence,
Wireless Sensor Networks etc.

The important thing in this brief intro is whether it is a small DIY project by a
hobbyist or a complex industrial project, any IoT project must have connectivity
to Internet. This is where the likes of ESP8266 and ESP32 come into picture.

If you want to add Wi-Fi connectivity to your projects, then ESP8266 is a great
option. But if you want build a complete system with Wi-Fi connectivity,
Bluetooth connectivity, high resolution ADCs, DAC, Serial Connectivity and
many other features, then ESP32 is the ultimate choice.

Department of Electronics and Communication Engineering, BIT Page 1


CPI COVID-19 2020-2021

WHAT IS ESP32?
ESP32 is a low-cost System on Chip (SoC) Microcontroller from Espressif
Systems, the developers of the famous ESP8266 SoC. It is a successor to
ESP8266 SoC and comes in both single-core and dual-core variations of the
Tensilica’s 32-bit Xtensa LX6 Microprocessor with integrated Wi-Fi and
Bluetooth.

The good thing about ESP32, like ESP8266 is its integrated RF components like
Power Amplifier, Low-Noise Receive Amplifier, Antenna Switch, Filters and RF
Balun. This makes designing hardware around ESP32 very easy as you require
very few external components.

Fig. 1 ESP32 Architectures

Another important thing to know about ESP32 is that it is manufactured using


TSMC’s ultra-low-power 40 nm technology. So, designing battery operated
applications like wearables, audio equipment, baby monitors, smart watches, etc.,
using ESP32 should be very easy.

Department of Electronics and Communication Engineering, BIT Page 2


CPI COVID-19 2020-2021

SPECIFICATIONS OF ESP32
ESP32 has a lot more features than ESP8266 and it is difficult to include all the
specifications in this Getting Started with ESP32 guide. So, I made a list of some
of the important specifications of ESP32 here. But for complete set of
specifications, I strongly suggest you to refer to the Datasheet.

• Single or Dual-Core 32-bit LX6 Microprocessor with clock frequency up


to 240 MHz
• 520 KB of SRAM, 448 KB of ROM and 16 KB of RTC SRAM.
• Supports 802.11 b/g/n Wi-Fi connectivity with speeds up to 150 Mbps.
• Support for both Classic Bluetooth v4.2 and BLE specifications.
• 34 Programmable GPIOs.
• Up to 18 channels of 12-bit SAR ADC and 2 channels of 8-bit DAC
• Serial Connectivity include 4 x SPI, 2 x I2C, 2 x I2S, 3 x UART.
• Ethernet MAC for physical LAN Communication (requires external PHY).
• 1 Host controller for SD/SDIO/MMC and 1 Slave controller for
SDIO/SPI.
• Motor PWM and up to 16-channels of LED PWM.
• Secure Boot and Flash Encryption.
• Cryptographic Hardware Acceleration for AES, Hash (SHA-2), RSA,
ECC and RNG.

DIFFERENT WAYS TO PROGRAM


A good hardware like ESP32 will be more user friendly if it can be programmed
(writing code) in more than one way. And not surprisingly, the ESP32 supports
multiple programming environments.

Some of the commonly used programming environments are:

• Arduino IDE
• Platform IO IDE (VS Code)
• LUA
• Micro Python
• Espressif IDF (IoT Development Framework)
• JavaScript

Department of Electronics and Communication Engineering, BIT Page 3


CPI COVID-19 2020-2021

ESP32 Devkit – THE ESP32 DEVELOPMENT BOARD


Espressif Systems released several modules based on ESP32 and one of the
popular options is the ESP-WROOM-32 Module. It consists of ESP32 SoC, a 40
MHz crystal oscillator, 4 MB Flash IC and some passive components.

Fig. 2 ESP wroom 32 in ESP development kit

The good thing about ESP-WROOM-32 Module is the PCB has edge
castellations. So, what third-part manufacturers do is take the ESP-WROOM-32
Module and design a break-out board for this module.

One such board is the ESP32 Devkit Board. It contains the ESP-WROOM-32 as
the main module and also some additional hardware to easily program ESP32
and make connections with the GPIO Pins.

Department of Electronics and Communication Engineering, BIT Page 4


CPI COVID-19 2020-2021

Fig. 3 ESP32 development kit

LAYOUT
We will see what a typical ESP32 Development Board consists of by taking a
look at the layout of one of the popular low-cost ESP Boards available in the
market called the ESP32 Devkit Board.

The following image shows the layout of an ESP32 Development Board which I
have.

IMPORTANT NOTE: There are many ESP32 Boards based on ESP-WROOM-


32 Module available in the market. The layout, pinout and features vary from
board to board.

Department of Electronics and Communication Engineering, BIT Page 5


CPI COVID-19 2020-2021

The board which I have has 30 Pins (15 pins on each side). There are some board
with 36 Pins and some with slightly less Pins. So, double check the pins before
making connections or even powering up the board.

Fig. 4 Components of ESP32 development board

As you can see from the image, the ESP32 Board consists of the following:

• ESP-WROOM-32 Module
• Two rows of IO Pins (with 15 pins on each side)
• CP2012 USB – UART Bridge IC
• micro–USB Connector (for power and programming)
• AMS1117 3.3V Regulator IC
• Enable Button (for Reset)
• Boot Button (for flashing)
• Power LED (Red)
• User LED (Blue – connected to GPIO2)
• Some passive components

Department of Electronics and Communication Engineering, BIT Page 6


CPI COVID-19 2020-2021

PINOUT OF ESP32 BOARD

I will make a separate dedicated tutorial on ESP32 Pinout. But for the time
being, take a look the pinout diagram of the ESP32 Development Board.

This pinout is for the 30 – pin version of the ESP Board. In the pinout tutorial, I
will explain the pin out of both the 30 – pin as well as the 36 – pin version of the
ESP Boards.

Fig. 5 Pin description of ESP32

Department of Electronics and Communication Engineering, BIT Page 7


CPI COVID-19 2020-2021

CONCLUSION
This is a complete beginner’s tutorial on ESP32, an excellent SoC with
integrated Wi-Fi and Bluetooth connectivity. You learned about the ESP32
Microcontroller, its specifications, development board layout and a brief pinout
as well.

Fig. 6 Two ESP32 modules as broadcaster and observer

Department of Electronics and Communication Engineering, BIT Page 8


CPI COVID-19 2020-2021

LITERATURE SURVEY

1. Contact Tracing App for Containing Diseases Spread:

ABSTRACTION:
This application is a tool that tracks the places where a confirmed patient went,
so that every person that had contact with him/her can call the authorities or self-
isolate.
METHODOLOGY:
•The Google Maps JS API to represent the marked locations on the map.
•Open Cage Geocoding API to convert an address or the name of a place to
coordinates.
•Chart-JS to represent the daily number of new cases and the total number
of cases.
LIMITATIONS:
•Since the users expected to turn on location, privacy really becomes an issue.
• Power consumption becomes unusually high.
•Location might be inaccurate, leading to overestimate of contacts.

2. Privacy-Preserving Contact Tracing and Public Risk Assessment


Using Block chain for COVID-19 Pandemic:

ABSTRACTION:
This application is a tool that tracks the places using Bluetooth where a
confirmed patient went, so that every person that had contact with him/her can
call the authorities or self-isolate.
METHODOLOGY:
•A digital contact tracing app is built using block chain application.
•Bluetooth is used trace other devices.
•Block chain tech is used to save user privacy.
Department of Electronics and Communication Engineering, BIT Page 9
CPI COVID-19 2020-2021

LIMITATIONS:
•Block chain being a cutting-edge technology there not enough flexible tool
out there to easily develop applications.
•Internet connection is mandatory but it might not be available in every part
of the planet.

3. Contact Tracing of Infectious Diseases Using Wi-Fi Signals and


Machine Learning Classification:

ABSTRACTION:
The proposed method uses the Wi-Fi signals data from a possible contact
and a confirmed patient’s Smartphone to detect whether the two shared the same
physical space. Simulation results show up to 95% tracing accuracy depending on
area size.
METHODOLOGY:
•The main idea is used to detect if someone has been nearby of a confirmed
patient based on Wi-Fi signals collected from both people smart phones.
•Machine learning model is used to predict whether the two smart phones
shared same location
•Features introduced in training model
[Link] point-APs ratio
[Link] Wi-Fi signal strength information (RSSI) difference
[Link] RSSI difference between the infected patient’s and possible
contact’s Smartphone.
LIMITATIONS:
•A model is trained with these datasets to predict whether the person is
potential contact or not.

Department of Electronics and Communication Engineering, BIT Page 10


CPI COVID-19 2020-2021

4. Detection and Tracking Contagion using IOT-Edge


Technologies: Confronting COVID-19 Pandemic

ABSTRACTION:
It is a monitoring, advance warning and detection of a person’s fever, heart beat
rate, cardiac conditions and some of the radiological features to detect the infected
(suspicious) person using wearable smart gadgets. This provides continually
updated map/pattern of communication chain of COVID-19 infected persons that
may span around in our national community.

Department of Electronics and Communication Engineering, BIT Page 11


CPI COVID-19 2020-2021

OBJECTIVES

• Enables easy and faster tracking of all the people who have had close contact
with the person tested positive.
• Effectively helps to prevent the spread of the virus as people can be notified
within minimal amount of time, from an infected person so that other
people too can take up the required precautionary measures as early as
possible.
• Nowhere in the procedure the identity or personal information of the
infected person is exposed to others expect the fact that they were in close
contact with a person tested positive now.
• It is basically an offline device. Thus, does not require a person to have
internet connectivity always.
• The working of the device as well as the app is based on a well-structured
procedure thereby involving minimal steps to be followed up by the people
using it. This facilitates that those people with or without minimal
education can also make use of this device effectively.
• The device just requires the user to possess a smart phone, which usually
everyone owns these days.
• This device could also be used in future to battle against any similar
pandemic.

Department of Electronics and Communication Engineering, BIT Page 12


CPI COVID-19 2020-2021

CHAPTER 2

A BRIEF NOTE ON BLE (Bluetooth Low Energy)

The main feature of the Bluetooth 4.0 Specification was the integration of
Bluetooth Low Energy or simply BLE. BLE (previously marketed as
Bluetooth Smart) is a highly optimized version of Classic Bluetooth designed
specifically for low power wireless communication.

While the Classic Bluetooth (often described as Basic Rate and Enhanced Dara
Rate in technical documents referring to its data speeds) was designed as a
replacement to wired communication with short-range wireless
communication. It was designed with data speeds in mind and the applications
include large file transfers, wireless audio, etc.

BLE on the other hand is optimized for low power consumption instead of
higher data rates and is designed with IoT and battery-operated applications in
mind. Some of the popular applications of BLE are smart watches, fitness
trackers, health monitoring devices, radio beacons, etc.

Fig. 7 Bluetooth uses in real time

Department of Electronics and Communication Engineering, BIT Page 13


CPI COVID-19 2020-2021

DIFFERENT LAYERS IN BLE


A BLE device consists of three layers:

• Controller
• Host
• Applications

Fig. 8 Bluetooth architecture layers

The controller contains the following:

• PHY – The Physical Layer


• LL – The Link Layer
• HCI – Controller side Host-Controller Interface

Department of Electronics and Communication Engineering, BIT Page 14


CPI COVID-19 2020-2021

The host contains the following:

• HCI – Host side Host-Controller Interface


• L2CAP – Logical Link Control and Application Protocol
• SM – Security Manager
• ATT – Attribute Protocol
• GAP – Generic Access Profile
• GATT – Generic Attribute Profile

The application layer is the highest layer which contains user interface, data
handling and logical aspects of the application.

IMPORTANT TERMS IN BLE


Let us briefly see some of the important terms associated with BLE.

• GATT: It is short for Generic Attribute Profile. It defines the


specifications for data transfer between BLE devices using Service and
Characteristics.
• Characteristic: Characteristic is a group of information called Attribute
and Attribute is a group of information transferred between devices. A
characteristic usually contains the following attributes:
• Value: Data value of the characteristic
• Declaration: Properties of the characteristic (location, type like read, write,
notify, indicate etc.)
• Description: ASCII String describing the characteristic.
• Service: A collection of characteristics is called a Service. Each Service
has a unique 16-bit or 128-bit ID called UUID.
• UUID: Universally Unique Identifier is a 128-bit ID given to each service
and characteristic in a profile. Use the website UUID Generator to
generate unique IDs. Each service and characteristic have a unique 16-bit
or 128-bit ID called UUID. A sample UUID looks something like this:
o 583f8b30-74b4-4757-8143-56048fd88b25

Department of Electronics and Communication Engineering, BIT Page 15


CPI COVID-19 2020-2021

BLE STATES
A BLE device can have 5 possible states:

• Standby
• Advertising
• Scanning
• Initiating
• Connected

Fig. 9 State diagram of BLE

The communication between two BLE devices can be either a Broadcast Type or
a Connection Type. In broadcasting, the ‘broadcaster’ BLE Device sends data to
any ‘observer’ BLE Device. It is a one-way data transfer.

For two-way communication, you need a ‘Connection’ between the BLE


Devices. A Central (Master) BLE Device repeatedly scans for advertising data
packets from Peripheral (Slave) BLE Device which sends the packets.

Department of Electronics and Communication Engineering, BIT Page 16


CPI COVID-19 2020-2021

BLE IN ESP32
We know that the main feature of ESP32 is Wi-Fi. But additionally, the ESP32
SoC also has Bluetooth support as well. ESP32 Bluetooth is a dual-mode system.
This means ESP32 supports both Classic Bluetooth as well as Bluetooth Low
Energy (BLE).

Specifically, the Bluetooth system in ESP32 is compliant with Bluetooth v4.2


Classic Bluetooth (BR/EDR) and BLE specifications.

ESP32 BLE SERVER CLIENT MODEL


Any BLE Device can be configured as a Server or a Client. ESP32 is no
exception to this i.e., ESP32 can be either a Server, which advertises its presence
so that clients can read its data or as a client, which scans for servers and makes a
connection to receive data from the server.

In this project, we will use two ESP32 Boards, one programmed as BLE Server
and the other as BLE Slave.

ESP32 BLE SERVER


First, we will see how to setup an ESP32 as a BLE Server. Take an ESP32 Board
and connect it to the computer. We will call this board as ‘ESP32-BLE_Server’.
Open Arduino IDE and make sure that proper ESP32 Development Board and
COM port is selected.

ESP32 BLE CLIENT


Take another ESP32 Board (which we will call ESP32-BLE_Client) and connect
it to the computer. In the Arduino IDE, select the COM port for this board.

Department of Electronics and Communication Engineering, BIT Page 17


CPI COVID-19 2020-2021

WORKING
After uploading codes to both the ESP32 Boards, you need to monitor the serial
ports of both the boards to see the communication. For this, I am using the
Arduino IDE’s Serial Monitor to open the COM port of the ESP32 BLE Client
Device and another software (like Putty or Terminal) to open the serial port of
ESP32 BLE Server Device.

After opening the respective serial port terminals for both ESP32 BLE Server
and Client, reset both the boards by pressing respective ENABLE (EN) buttons.

Fig. 10 Boot button in ESP32

The ESP32 BLE Server device will start the BLE Server and starts advertising its
services. If you observe the Client ESP32’s Code, we used the Server ESP32’s
Service UUID and Characteristic UUID. What this means is that the Client
ESP32 scans for BLE devices and if the BLE with the particular UUIDs is found,
then it makes a connection.

Once the connection is established, the ESP32 BLE Client first reads the
characteristic value from the server (we set this as ‘Hello, World!’ in the Server’s
code) and prints it on the terminal.

After that, the client tries to set the characteristic value of the server with a new
value every couple of seconds. You can see the client’s terminal in the following
image.

Department of Electronics and Communication Engineering, BIT Page 18


CPI COVID-19 2020-2021

Fig. 11 Changing characteristic value by server

Coming to the Server, once it starts the BLE Server, it reads its own
characteristic value every couple of seconds. You can see the following image
that the Server’s characteristic value is updated by the client and is read by the
server.

Department of Electronics and Communication Engineering, BIT Page 19


CPI COVID-19 2020-2021

Fig. 12 Changing characteristic value from client

Department of Electronics and Communication Engineering, BIT Page 20


CPI COVID-19 2020-2021

ABOUT SPIFFS
SPIFFS (SPI Flash File Storage), which is used for storing larger data in the
form of files. Think of SPIFFS as a very small SD Card onboard the ESP32 chip
itself. By default, about 1.5 MB of the onboard flash is allocated to SPIFFS. You
can see that for yourself by going through Tools −> Partition Scheme.

You can see that there are several other partition options available.

Fig. 13 Selecting spiffs in Arduino ide

Department of Electronics and Communication Engineering, BIT Page 21


CPI COVID-19 2020-2021

CODE WALKTHROUGH
We will again use the example code provided. Go to File −> Examples −>
SPIFFS −> SPIFFS_Test. This code is ideal for understanding all the file
operations possible with SPIFFS.

We begin with the inclusion of two libraries: FS.h and SPIFFS.h. FS stands for
File System.
#include "FS.h"
#include "SPIFFS.h"

Next, you see a macro definition, FORMAT_SPIFFS_IF_FAILED. There is an


associated comment which suggests that you need to format the SPIFFS only the
first time you run a test. What this means is that you can set the value of this
macro to false after your first run. Formatting the SPIFFS takes time, and need
not be done every time you run your code. The main code doesn't include the
format command. In this example though, for the sake of completeness, this
macro has been kept as true.
/* You only need to format SPIFFS the first time you run a
test or else use the SPIFFS plugin to create a partition
[Link] */
#Define FORMAT_SPIFFS_IF_FAILED true

Next, you can see that a number of functions have been defined for different file
system operations. They are −

• listDir − To list all directories


• readFile − To read a specific file
• writeFile − To write to a file (this overwrites the content already present in
the file)
• appendFile − To append content to a file (use this when you want to add to
the existing content, not overwrite it
• renameFile − To change the name of a file
• deleteFile − To delete a file

Note that all of the above functions aren't asking for a file name. They are asking
for the full file path. Because this is a file system. You could have directories,
subdirectories, and files within those subdirectories. Therefore, ESP32 needs to
know the full path of the file you want to operate on.
Department of Electronics and Communication Engineering, BIT Page 22
CPI COVID-19 2020-2021

Next comes a function that isn't exactly a file operation function – test File IO.
This is more of a time benchmarking function. It does the following −

• Writes about 1 MB (2048 * 512 bytes) of data to the file path that you
provide and measures the write time
• Reads the same file and measures the read time

Note that the but array is never initialized with any value. We may very well be
writing garbage bytes to the file. That doesn't matter because the purpose of the
function is to measure the write time and the read time.

Once our functions have been defined, we move on to the setup, where the
invocation of each of these functions is shown.

The setup does essentially the following −

• It first initializes the SPIFFS using [Link](). The macro defined at


the beginning is used here. When true, it formats the SPIFFS
(time−consuming); when false, it initializes the SPIFFS without
formatting.
• It then lists all the directories at the root level. Note that we have specified
levels as 0. Therefore, we are not listing the subdirectories within the
directories. You can increase the nesting by incrementing the levels
argument.
• It then writes "Hello" to a file [Link] in the root. (The file will get
created if it doesn't exist)
• It then reads back [Link]
• It then renames [Link] to [Link]
• It then reads [Link] to see if the rename worked. You should see "Hello"
printed because that's what is stored in the file.
• It then deletes [Link]
• It then performs the test File IO routine on a new file [Link]
• Once the routine is performed, it deletes [Link]

Since we don't want to perform any recurring activity here, the loop is blank.

void loop () {
}

Department of Electronics and Communication Engineering, BIT Page 23


CPI COVID-19 2020-2021

The output shown in the Serial Monitor will perhaps look like the image below –

Fig. 14 Working with files in spiffs

Department of Electronics and Communication Engineering, BIT Page 24


CPI COVID-19 2020-2021

CHAPTER 3

ESP32 ARDUINO: SENDING DATA WITH SOCKET


CLIENT
In this ESP32 tutorial we will check how to send data with a socket client on the
Arduino core. The tests were performed using a DFRobot’s ESP32
module integrateDina ESP32developmentboard.

INTRODUCTION
In this ESP32 tutorial we will check how to send data with a socket client on the
Arduino core.

THE PYTHON CODES


To get started, we will import Python’s socket module, which will make available
the functions we need to set the socket server.

1 import socket

After that, we create an object of class socket, which we will use to configure the
server and to listen to incoming connections.

1 s = [Link]()

Now that we have our socket object, we need to bind it to an IP and port. These
will be the two parameters that our socket client needs to know in order to reach
the server.

To perform this binding, we need to call the bind method on our socket object,
passing as first input the IP, as a string, and as second input the port, as a number.

Since we are going to expose the server to be reached in the local network, we will
use the ‘[Link]’ IP, which will bind the socket to all the IP addresses on the
machine. Later, we will need to find out what is the actual local IP of the machine,
so we can reach it from the client.

Department of Electronics and Communication Engineering, BIT Page 25


CPI COVID-19 2020-2021

We will use port 8090 in this code, but you can try with other port. Just make sure
the port you are going to use is available and not already in use by other
application.

1 [Link](('[Link]', 8090 ))

After the binding, we need to make our server start listening to connections. We
do it by calling the listen method on the socket object.

Note that this method receives as input the number of unaccepted connections that
are allowed before refusing new connections [1]. Since our simple use case doesn’t
involve multiple clients, we can pass the value 0.

1 [Link](0)

To start receiving the actual connections, we need to call the accept method on
our socket object. This is a blocking method, which means the execution of the
program will stop until a new client connects to the server.

Once a client connects to the server, this method returns a pair with a new socket
object and the address of the client. We can then use this new socket object to
establish the communication with the connected client.

Note that since sockets are bi-directional mechanisms, we can both send and
receive data from it.

Assuming that we want our server to run indefinitely, we do this accept method
call inside an infinite loop.

1 while True:
2
3 client, addr = [Link]()
4 # Client handling code

Now we will start receiving data from the client. We will also assume that the
client will be the one closing the connection after sending all the data, so we also
read the data inside a nested loop, which will only break when the client
disconnects.

Department of Electronics and Communication Engineering, BIT Page 26


CPI COVID-19 2020-2021

To receive data sent by the client, we simply need to call the recv method on the
socket object returned by the previously called accept method.

Note that in Python 3.x (the one I’m using for this tutorial) the recv method returns
the data as a byte’s object. On other hand, on Python 2.x, the data is returned as a
string, so if you are using an older Python version you should adapt your code
accordingly.

As input, the recv receives the maximum number of bytes to receive at once. If
more than the specified number of bytes are sent by the client, they can be retrieved
with other calls to the recv method.

One important thing to keep in mind is that the recv method is also blocking. So,
after calling this method, the execution will block until either the client sends some
data or disconnects.

In case of disconnection, the recv method will return an empty byte’s object,
which we can leverage as stopping condition for the data reading loop.

1 while True:
2
3 client, addr = [Link]()
4
5 while True:
6 content = [Link](32)
7
8 if len(content) ==0:
9 break

10
else:
11
print(content)
12

Finally, when the client disconnects, we call the close method on the client socket
object to free the resources and go back to listening to a new connection. The final
Python code can be seen below and already includes this call.

1 import socket
2
3 s = [Link]()

Department of Electronics and Communication Engineering, BIT Page 27


CPI COVID-19 2020-2021

4
5 [Link](('[Link]', 8090 ))
6 [Link](0)

7
while True:
8
9
client, addr = [Link]()
10
11 while True:
12 content = [Link](32)
13
14 if len(content) ==0:
15 break
16
17 else:
18 print(content)
19
print ("Closing connection")
20
[Link]()
21
22

Department of Electronics and Communication Engineering, BIT Page 28


CPI COVID-19 2020-2021

THE ARDUINO CODES

In the Arduino code, we will start to include the WiFi.h library, so we can connect
to a WIFI network and then establish the socket connection.

1 #include <WiFi.h>

As global variables, we will declare the credentials of the WIFI network to which
we are going to connect. We will need the network name (SSID) and password.

1 const char* ssid = "yourNetworkName";


2 const char* password = "yourNetworkPass";

We will also declare as global variables the IP address and port of the socket server
we have implemented in Python. As we have seen in the Python code, we did not
bind the server to a particular IP address, but rather used the ‘[Link]’ IP, which
means the server should be available in all the IPs of that machine.

Thus, we need to figure out the local IP of the machine on the local network, so
we can use that IP on the Arduino code. The easiest way to obtain the IP is by
typing the ipconfig command on the command line if you are on Windows, or the
ifconfig command if you are on Linux. These commands should be sent on the
machine that will be running the Python code.

Note that for the ESP32 to be able to reach the Python server hosted on a computer,
both devices need to be on the same network since we are not doing any port
forwarding and we are simply using local IPs.

Alternatively, you can obtain your machine’s local IP from this website.

Note that in the code below I’m using the local IP of my computer on my local
network. Yours will most likely be different. The port was 8090, as we have
defined in the Python code.

1 const uint16_t port = 8090;


2 const char * host = "[Link]";

Department of Electronics and Communication Engineering, BIT Page 29


CPI COVID-19 2020-2021

Moving on the Arduino setup function, we will simply open a serial connection to
output the results of our program and take care of connecting to the WiFi network,
using the previously declared credentials.

1
void setup ()
2
{
3
4 [Link](115200);
5
6 [Link](ssid, password);
7 while ([Link]()! = WL_CONNECTED) {
8 delay (500);
9 [Link]("...");
10 }
11
[Link]("WiFi connected with IP: ");
12
[Link]([Link]());
13
14
}
15

Next, on the Arduino loop, we will establish the connection to the server
periodically and send some data to it.

First, we declare an object of class WIFI Client, which we will use to establish
the connection and send the data.

1 WiFiClient client;

Then, to establish the actual connection, we need to call the connect method on
our WIFI Client object, passing as first input the IP of the server and as second
the port.

This method returns 1 if the connection was successful and 0 otherwise, so we can
use this to do some error checking. In case the connection fails, then we print a
message to the serial connection and delay for a second before trying to connect
again.

1 if (![Link](host, port)) {
2

Department of Electronics and Communication Engineering, BIT Page 30


CPI COVID-19 2020-2021

3 [Link]("Connection to host failed");


4
5 delay (1000);
return;
6
}
7

In case of success, we move on and send the actual data to the server, which is
done by calling the print method on the WIFI Client object and passing as input
the string to send.

Note that there other methods that we can use to send data to the server, such as
the write method.

1 [Link]("Hello from ESP32!");

Since this is a simple introductory tutorial, we will not be expecting data from the
server, so we can simply finish the connection by calling the stop method on our
WIFI Client object, thus freeing the resources.

1 [Link]();

The final source code is shown below. It contains some additional prints and a 10
seconds delay between each iteration of the Arduino loop.

1 #include <WiFi.h>
2
3 const char* ssid = "yourNetworkName";
4 const char* password = "yourNetworkPass";

5
const uint16_t port = 8090;
6
const char * host = "[Link]";
7
8
void setup ()
9 {
10
11 [Link](115200);
12
13 [Link](ssid, password);
14 while ([Link]()! = WL_CONNECTED) {

Department of Electronics and Communication Engineering, BIT Page 31


CPI COVID-19 2020-2021

15 delay (500);
16 [Link]("...");
17 }

18
[Link]("WiFi connected with IP: ");
19
[Link]([Link]());
20
21
}
22
23 void loop ()
24 {
25 WiFiClient client;
26
27 if (![Link](host, port)) {
28
29 [Link]("Connection to host failed");
30
delay (1000);
31
return;
32
}
33
34
[Link]("Connected to server successful!");
35
36 [Link] ("Hello from ESP32!");
37
38 [Link]("Disconnecting...");
39 [Link]();
40
41 delay (10000);
42 }
43
44
45

Department of Electronics and Communication Engineering, BIT Page 32


CPI COVID-19 2020-2021

TESTING THE CODE

To test the whole system, we will start by compiling and uploading the Arduino
code to the ESP32. Once the procedure finishes, simply open the Arduino IDE
serial monitor.

Since the Python server is not yet running, then the connection attempts should
fail.

Fig. 15 Output of the program when the Python socket server is not connected

Next, run the Python code on the tool of your choice. In my case, I’m running it
on IDLE, the Python IDE that comes with the language installation.

Once the server is up and running, you should start receiving the messages from
the ESP32.

Department of Electronics and Communication Engineering, BIT Page 33


CPI COVID-19 2020-2021

Fig. 16 Output of the Python program when receiving data from the ESP32

If you go back to the Arduino IDE serial monitor, you should start seeing the
connection and disconnection messages we have included in our code, as shown
in figure 3.

Fig. 17 Successful connection to the Python socket server on the ESP32

Department of Electronics and Communication Engineering, BIT Page 34


CPI COVID-19 2020-2021

WHY TO INTEGRATE WITH APPLICATION?

● Ease of accessing the information through smartphone or desktops


● Ease of uploading data from ESP-32 to the database
● Maintaining confidentiality by only transferring ids from sensor
● Easy to add new features as per the requirements

SOFTWARE TOOLS USED TO DEVELOP THE


APPLICATION
• Vscode and GitHub

TECH STACK USED TO DEVELOPE FRONT END

1) React js
React is a free and open-source front-end JavaScript library for building
user interfaces or UI components. It is maintained by Facebook and a
community of individual developers and companies. React can be used as a
base in the development of single-page or mobile applications. However,
React is only concerned with state management and rendering that state to
the DOM, so creating React applications usually requires the use of
additional libraries for routing, as well as certain client-side functionality

WHAT IS REACT LIBRARY?

DOM manipulation becomes complicated for complex web pages, so to make it


simple we use React to develop user interfaces. It is used to develop single page
applications, rendering components dynamically from the client side to provide good
user experience. React was developed by Facebook in 2013 and made it as an open-
source project. React has a huge community and has huge ecosystem built around it.
Some of the famous dependencies include redux, react router, some CSS
dependencies like material UI, react bootstrap.... There are some other frameworks
built on top of react like REACT NATIVE, NEXT JS......

Department of Electronics and Communication Engineering, BIT Page 35


CPI COVID-19 2020-2021

ADVANTAGES OF REACT

• Less Coding and Increased Reuse of Code


• Virtual DOM
• Smooth rendering
• Learn Once, Write Anywhere
• Performance Enhancement
• Creating Dynamic Web Applications Becomes Easier

TECH STACK USED TO DEVELOP BACK END

1)Nodejs
As an asynchronous event-driven JavaScript runtime, [Link] is designed to build
scalable network applications. In the following "hello world" example, many
connections can be handled concurrently. Upon each connection, the call back is
fired, but if there is no work to be done, [Link] will sleep. This is in contrast to
today's more common concurrency model, in which OS threads are employed.
Thread-based networking is relatively inefficient and very difficult to use.
Furthermore, users of [Link] are free from worries of dead-locking the process,
since there are no locks. Almost no function in [Link] directly performs I/O, so the
process never blocks. Because nothing blocks, scalable systems are very reasonable
to develop in [Link].

2)Express js
Express is a minimal and flexible [Link] web application framework that
provides a robust set of features for web and mobile applications. With a
myriad of HTTP utility methods and middleware at your disposal, creating a
robust API is quick and easy. Express provides a thin layer of fundamental
web application features, without obscuring [Link] features that you know
and love.

3)MongoDB
MongoDB’s document data model naturally supports JSON and its expressive
query language is simple for developers to learn and use. Functionality such
as automatic failover, horizontal scaling, and the ability to assign data to a
location are built-in.
Department of Electronics and Communication Engineering, BIT Page 36
CPI COVID-19 2020-2021

BACKEND DEVELOPMENT

User is the only entity that is stored in the database and with few attributes as
possible. Here is the code:

const mongoose =
require("mongoose");

const uuidv1 = require("uuid/v1");

const crypto = require("crypto");

const userSchema = new [Link]({

name: {

type: String,

required: true,

maxlength: 32,

},

email: {

type: String,

required: true,

},

encry_password: {

type: String,

},

salt: {

type: String,

},

Department of Electronics and Communication Engineering, BIT Page 37


CPI COVID-19 2020-2021

phoneNumber: {

type: Number,

required: true,

},

deviceid: {

type: String,

required: true,

},

role: {

type: Number,

default: 0,

},

isPrimaryContact: {

type: Boolean,

},

contacts: {

type: Array,

default: [],

},

});

userSchema

.set(function (password) {

this._password = password;

[Link] = uuidv1();

this.encry_password =

Department of Electronics and Communication Engineering, BIT Page 38


CPI COVID-19 2020-2021

[Link](password);

})

.get(

function () {

return this._password;

},

{ timestamps: true }

);

[Link] = {

authenticate: function (plainpassword) {

return this.encry_password ===


[Link](plainpassword);
},

securepassword: function (plainpassword) {

if (!plainpassword) return "";

try {

return crypto

.createHmac("sha256", [Link])

.update(plainpassword)

.digest("hex");

} catch (error) {

return "";

},

};

Department of Electronics and Communication Engineering, BIT Page 39


CPI COVID-19 2020-2021

[Link] = [Link]("User",
userSchema);

There are three routes as shown in the architecture


1)Sign in
2)Signup
3)Homepage
4)Add contacts (for Authorized)

Core part of Backend -Add contact’s route


Authorized person will have authorization to add json file consisting primary
contacts id this particular route

Json file looks like:

{
"confirmedPatient": "123457",
"suspectedContacts": [
"123453",
"123455"
]
}

This contacts details will be fetched from database and is added to user
contacts attribute through which we can extract details.

Department of Electronics and Communication Engineering, BIT Page 40


CPI COVID-19 2020-2021

Json file is parsed from the frontend and it transferred to this route

[Link] = (req, res) => {


const errors = validationResult(req);

if (![Link]()) {
return [Link](422).json({
error: "missing attribute",
});
}
const { confirmedPatient, suspectedContacts } = [Link];

var patients = new Array();


const detail = {};
[Link]({ deviceid: confirmedPatient }, (err, user) => {
if (err) {
return [Link]({
error: "User not found",
});
}
// [Link](user)
});
for (i = 0; i < [Link]; i++) {
[Link]({ deviceid: suspectedContacts[i] }, (err, user1) => {
if (err) {
return [Link]({ eror: "could find device id attribute" });
}

const { deviceid, phoneNumber, name } = user1[0];


var obj = {
deviceid: deviceid,

Department of Electronics and Communication Engineering, BIT Page 41


CPI COVID-19 2020-2021

phoneNumber: phoneNumber,
name: name,
};
[Link](obj);
[Link](obj);
[Link](patients);
[Link](
{ deviceid: confirmedPatient },
{ $push: { contacts: obj } },
(err, user2) => {
if (err) {
return [Link]({ error: "could not add attribute" });
}
}
);
});
}
[Link]({ deviceid: confirmedPatient }, (err, user) => {
if (err) {
return [Link](err);
}
return [Link](user);
});
};

Department of Electronics and Communication Engineering, BIT Page 42


CPI COVID-19 2020-2021

PROPOSED MODEL

Nodes periodically broadcast BLE advertising packets, which include the


MAC address of the sender node and a Universally Unique Identifier (UUID)
for system identification.

When a node receives from a neighbouring node a BLE advertising packet


including the proposed system’s UUID, the receiving node records in internal
memory the reception time, the source MAC address of the packet, the
received signal strength indication (RSSI),

When a node receives a BLE advertising packet, it uses RSSI to estimate the
approximate distance between nodes.

Device ON
Configured Scan
Period, Rebroadcast

Fig. 18 Full flow chart of the system

Department of Electronics and Communication Engineering, BIT Page 43


CPI COVID-19 2020-2021

FLOW CHART: Device flow chart:

Set a unique id for device

Set device as broadcaster


for 10 sec

Set device as listening


mode for 2 sec

In broadcaster:

Set unique id and set


transmission power

In listening mode:

Advertise the data to near


devices

Scan for available devices

NO

If
devices
available
?

Department of Electronics and Communication Engineering, BIT Page 44


CPI COVID-19 2020-2021

For all available devices store


their id in [Link] file

For data sending mode:

Set socket server in laptop


using pythons

Set ESP. 32 as WIFI client

Send data from ESP. 32 to


laptop to destination port

Store data from port to hard


disk

Department of Electronics and Communication Engineering, BIT Page 45


CPI COVID-19 2020-2021

CHAPTER 4

RESULTS

We used ESP32 devices as nodes in our implemented system (Fig. 2). Which
supports Wi-Fi (IEEE 802.11b/g/n) and Bluetooth (classic and BLE). An ESP32
has dimensions 24×24×14 mm and weighs 33 g. With inbuild LED and Memory

Nodes in the implemented system send a BLE advertising packet every second.
The ESP32 cannot change its transmission power. Up to 31 bytes of advertising
data can be included in each BLE advertising packet. Adverting packets in our
implemented system include a flag, a 16-byte service UUID, and two bytes of
battery voltage information used for power consumption evaluation and
debugging. The overall size of an advertising packet, including its header, CRC,
etc., is 43 bytes.

The following sections present evaluations of our implemented system,


especially for between-node BLE communication. There have been many
previous studies measuring RSSI in BLE communications, but here we measure
social distances using BLE communication between ESP32 devices hanging
from the neck and holding to hand.

Fig. 19 ESP32 node used in our prototype system

Department of Electronics and Communication Engineering, BIT Page 46


CPI COVID-19 2020-2021

Fig. 20 Experimental settings

Department of Electronics and Communication Engineering, BIT Page 47


CPI COVID-19 2020-2021

EFFECTS OF SOCIAL DISTANCE ON RECEIVER-NODE


RSSI

We first evaluated the effect of node distance on receiver-node RSSI. We


performed these experiments with two subjects on the third-floor elevator hall of
Building 38 at Kandia University. One subject wore a sender node that
periodically broadcasts only BLE advertising packets, and the other subject wore
a receiver node that only receives advertising packets (Fig. 3). The direction of
the subject wearing the sender node is defined as 0°, and the between-subject
distance was varied in a range of 0.5 to 5 m in 0.5 m increments. The sender
node broadcasts 100 BLE adverting packets at each distance. All nodes were
powered by wired cables to avoid effects due to remaining battery power.

Here, 0 m indicates two terminals immediately adjacent to each other. As this


figure shows, there are RSSI variations even at the same distance, but RSSI
averages and medians decrease with distance. Therefore, it is possible to roughly
estimate social distances by transmitting and receiving BLE advertising packets
between sender and receiver nodes some number of times and acquiring average
or median values. The consulted guideline for COVID-19 close contacts
stipulates not only distances but also contact durations exceeding fifteen minutes.
Therefore, for estimation of close contact, we can use the results of a certain
number of packet transmissions and receptions.

We also investigated distances at which nodes can receive BLE advertising


packets. The results of this evaluation indicated that sender nodes can deliver
BLE advertising packets to receiver nodes from distances up to 20 m. Therefore,
even if a BLE advertising packet is received, it cannot be determined whether
people are in close contact.

We should note here that we obtained these evaluation results under limited
conditions. In future work, we will perform additional evaluations by changing
conditions including combinations of nodes, combinations of people, postures of
persons wearing monitors, and the environments in which measurements are
performed.

Department of Electronics and Communication Engineering, BIT Page 48


CPI COVID-19 2020-2021

EFFECTS OF BODY ORIENTATION ON RECEIVER-


NODE RSSI

We next evaluated the effects of body orientation on receiver-node RSSI. In


these experiments, we fixed the distance between subjects to 2 m, and varied the
orientation of the subject wearing the sender node in 90° increments. At each
orientation, the sender node broadcasted 100 BLE adverting packets.

As the Figure shows, there were variations in RSSI even among same
orientations. However, the average and median RSSI decreased with orientation.
Compared to the case where both subjects faced each other (defined as 0°), RSSI
decreased by about 5 dBm at sender-node subject orientations of 90 and 270°,
and by about 10 dBm at 180°. There will likely be situations where students sit
side-by-side on campus, so it is necessary to estimate close contact with a margin
of about 5 dBm.

Here, as an outlier, also shows a point at which RSSI exceeded -100 dBm at a
180° orientation. The influence of such outliers can be reduced by using median
values when estimating social distancing.

Department of Electronics and Communication Engineering, BIT Page 49


CPI COVID-19 2020-2021

EFFECTS OF SENDER-NODE BATTERY LEVEL ON


RECEIVER-NODE RSSI

To evaluate any effects of sender-node battery levels on receiver-node RSSI, we


conducted experiments with two nodes at a fixed distance of 1 m. In these
experiments, receiver nodes were powered with a wired cable and sender nodes
were powered by its internal battery. Two nodes were fixed on a laboratory
workbench, because we expected measurement times to be long.

We found that the battery voltage fell below 3.0 V after the sender node
transmitted 2130 BLE advertising packets. Figure 4(c) shows the relation
between battery voltage and RSSI as a scatter diagram. As the figure shows, we
found no correlation between battery voltage and received signal strength. The
calculated correlation coefficient was -0.0133. We therefore conclude that in us

implementation, there is no need for considering effects of sender-node battery


voltage on RSSI. Accordingly, it is not necessary to include battery voltage
information in advertising packets.

Fig. 21 Experimental evaluation results

Department of Electronics and Communication Engineering, BIT Page 50


CPI COVID-19 2020-2021

SIGN UP & SIGN IN PAGES

Fig. 22 Sign in Page

Fig. 23 Sign up Page

Department of Electronics and Communication Engineering, BIT Page 51


CPI COVID-19 2020-2021

Signup page- data required from the user


1)Name and email
2)password and phone Number
3)device id

Sign In page -data required from the user


1)Phone Number
2)password

Based on the role of the user he will be redirected to either home page (normal
user) or add contacts page (Authorized user)

Authorized user (who has responsibility of inserting data from ESP. 32


sensor):
JSON file as mentioned before is uploaded and all the data corresponding to
primary contacts will be returned from the server.
For an authorized person the sign in page would redirect to add contact’s page

Fig. 24 Showing about Files

Department of Electronics and Communication Engineering, BIT Page 52


CPI COVID-19 2020-2021

Once json file received from the ESP32 is uploaded it shows the user details
in card like structure.

Fig. 25 Showing about Contacts

This application is quite simple but our primary focus of the project was to
develop sensor that senses other and saves id.

Lot of new features can be added including location-based features

Department of Electronics and Communication Engineering, BIT Page 53


CPI COVID-19 2020-2021

FEATURES

• Detecting Active Users in the Proximity: The device broadcasts the


signal nearby to its range and notifies the user when another device user
enters in a range of 2 meters. This process continues in the background
unless paused.
• Stores History: The device stores scanning status of past 30 days at every
30 seconds with date and time for future use when anyone was getting
infected.
• Pause Scanning: Users can pause the device scanning when not in use
like sleeping time.
• Low Energy Consumption: BLE consumes very little power from device
and runs continuously in the background without consuming more power.
• Maintain the user’s privacy: The device does not store any data on the
server and keeps all data locally on the user's device to maintain their
privacy.

Department of Electronics and Communication Engineering, BIT Page 54


CPI COVID-19 2020-2021

APPLICATIONS

• Public Transport (Bus/ Railways/ Metros etc.): In this pandemic, when


passengers are waiting for the bus at a bus stop or for a train at the
platform or while travelling, they can use this device to be socially distant
from others and minimize the risk of infection.
• Crowded Public Places: People are doing a lot of stuff in crowded places
like government offices, markets, and malls in daily life. At those places,
individuals can turn on the device to get alerts. Even this device can be
used everywhere to maintain social distancing.
• Company's workplaces: Several companies and manufacturing units
have started their productions and other works with 50% of employees, but
infection protection is a big challenge in this pandemic. So, at the
workplace to maintain social distance, they can use this device
• Healthcare workers: In this pandemic, we all know frontline corona
warriors like doctors, nurses, and medical staff doing their duties 24x7
tirelessly at hospitals. There is a high risk of getting them infectious. So,
they can use this device to minimize the risk.
• Construction workers: Now, construction works are also resumed after a
long time, there is a chance that workers might get infected at construction
places. This device is useful for them too.
• Education institutions: After some days, when education institutions will
also be resumed with offline classes, then there will be a big challenge to
maintain the hygiene of students as well as teaching and non-teaching
staff. This device will be helpful to maintain safe social distancing status
at the campus.
• Warehouse workers: At the warehouse, where products are stored for
delivery to the customers, and at the grocery shop wherever there is a
chance of physical contact, this application can be used.
• Road and municipal workers: Road and municipal workers can also use
this application to be socially distant at their workplace.

Department of Electronics and Communication Engineering, BIT Page 55


CPI COVID-19 2020-2021

CONCLUSION AND FUTURE WORK

We have developed and presented a "Social Distancing and tracking system"


with an optimized algorithm to maintain social distancing using Bluetooth Low
Energy (BLE) RSSI and Transmission Power (TX Power) that is independent of
signal propagation constant. Due to no such environmental-based constraints,
Algorithm1 provided relevant results for BLE proximity detection to maintain
social distancing effectively and prevent the spread of COVID-19. ESP 32 -
supported BLE-based technology makes it available for many users (~2.5 billion)
without any cost of implementation along with minimal power consumption that
makes it convenient and durable. We have also concluded that RSSI-based BLE
depends on several conditions, which make the whole work complex from the
mathematical point of view and to resolve this, we can use Algorithm1. In the
future, these techniques should be integrated as a pandemic mode with
smartphones and also with a wide range of Bluetooth and Global Positioning
Systems (GPS) supported low-cost micro devices like smart-watches, bands, etc.
to minimize the risk of a pandemic and improvement in the healthcare system.

Department of Electronics and Communication Engineering, BIT Page 56


CPI COVID-19 2020-2021

CHAPTER 5

REFERENCE

1. Contact Tracing App for Containing Diseases Spread


2. Privacy-Preserving Contact Tracing and Public Risk Assessment Using Block
chain for COVID-19 Pandemic
3. Contact Tracing of Infectious Diseases Using Wi-Fi Signals and Machine
Learning Classification
4. Detection and Tracking Contagion using IOT-Edge Technologies:
Confronting COVID-19 Pandemic
5. [Link]

Department of Electronics and Communication Engineering, BIT Page 57


CPI COVID-19 2020-2021

STUDENT CONTACT DETAILS

NAME: Samartha L Prasanna


USN : 1BI17EC103
CONTACT NUMBER: 8296173346
EMAIL ID: [Link]@[Link]

NAME: Shashank BM
USN : 1BI17EC110
CONTACT NUMBER: 8073534448
EMAIL ID: shashankbm073@[Link]

NAME: Suman Gowda TM


USN : 1BI17EC129
CONTACT NUMBER: 7619502557
EMAIL ID: sumangowda0538@[Link]

NAME: Swaroop A
USN : 1BI17EC130
CONTACT NUMBER: 8105687933
EMAIL ID: swaroopaee98@[Link]

Department of Electronics and Communication Engineering, BIT Page 58

You might also like