You are on page 1of 48

A PROJECT

REPORT ON

“SOCIAL
DISTANCE
USING ARDUINO”
SUBMITTED IN PARTIAL FUFILLMENT

FOR THE AWORD OF THE

DEGREE OF BACHELOR OF TECHNOLOGY

IN DEPARTMENT OF COMPUTER SCINCE & ENGINEERING

(ACADEMIC SESSION 2021-22)

SUBMITTED BY

DAMINI
MAMTA SONKAL

1
DECLARATION

WE the undersigned solemnly declare that the report of the project work entitled “Social
Distancing Alaram Using Arduino” is based on our own work carried out during the course of
our study.

We assert that the statements made and the conclusions drawn are an outcome of the project work.
We further declare that to the best of our knowledge and belief that the report does not contain any
part of any work which has been submitted for the award of any other
Degree/diploma/certificate in this university or any other university.

------------------------- -----------------------
(Signature of candidate) (Signature of candidate)

DAMINI MAMTA SONKALI

Roll No:- 301302217032 Roll No:-301302217056

Enrollent No:-BD4925 Enrollment no:-BD5538

CERTIFICATE

2
This is to certify that the report of the project submitted is an outcome of the project work
entitled “Social Distancing Detection” carried out by

DAMINI Roll No. : 301302217032 Enrollment No. : BD4925

MAMTA SONKALI Roll No. : 301302217056 Enrollment No. : BD5538

under my guidance and supervision for the award of Degree in Bachelor of Engineering in
COMPUTER SCIENCE AND ENGINEERING OF Chhattisgarh Swami Vivekananda
Technical University, Bhilai (C.G.), India.
To the best of my knowledge the report Embodies the work of the candidate him/herself, has duly
been completed, Fulfills the requirement of the ordinance relating to the BE degree of the
University and is up to the desired standard for the purpose of which is submitted.

---------------------------

(Head of Department)

Prof. K.J SATAO

ASSOCIATE PROFESSOR
DEPARTMRNT OF COMPUTER SCIENCE

& ENGINEERING

3
ACKNOWLEDGEMENT

I have great pleasure in the submission of this project report Entitled Social Distancin Alarm
Using Arduino in partial fulfillment the degree of B.E. COMPUTER SCIENCE AND
Engineering. While submitting this Project report, I take this opportunity to thank those directly
or indirectly related to project work.

I would like to express sincere thanks and gratitude to Principal, Head of Department,
(COMPUTER SCIENCE & ENGINEERING).

I avail this opportunity to thank respected PROF.K.J SATO head of the department of
COMPUTER SCIENCE & engineering for facilitating such a working and pleasant environment
in our department and also his everlasting encouragement and support throughout.

I also like to thank many people in my college, faculty members of the COMUTER SCIENCE &
ENGINEERING department and supporting staff, for always being helpful over the years.

Acknowledgement is due to our parents, family members, friends and all those persons who have
helped us directly or indirectly in the successful completion of the project work.

DAMINI MAMTA SONKALI

4

Table of Contents

Content Page No

Abstract 7-7

List of figure 8-8

Chapter 1 Introduction 9 - 11

Chapter 2 Literature Review 12 -13

Chapter 3 Identification 14 - 16
3.1 Scale Variation Problem

3.2 Occlusion

3.3 Deformation

Chapter 4 Introduction of Microcontroller 17 - 22

4.1 Using a digital input with a microcontroller


4.2 Using a digital input sensor with a microcontroller
4.3 Using an analog input with a microcontroller
4.4 Using an Altrasonic Sensor with a microcontroller

Chapter 5 Component’sStructure23 - 43

5

5.1 Stuctureof Arduino Uno

5.2 Structure ofPir Sensor

5.3Structure of Altrasonic Sensor

5.4 Structure of Led

5.5 Stucture of Buzzer

5.6 Structure of Trangister

5.7 Structure of Resistance

Chapter 6 Distance Measuring44 - 45

Chapter 7 Result Discussion 46 - 46

Chapter 8 Conclusion And Future Scope 47 - 48

Bibliography 48 - 49

6

Abstract

Social Distancing has been proven as an effective measure against the spread of the
infections Coronavirus Disease 2019 (COVID-19). However, individuals are not used
to tracking the required –feet (2-metres) distances between themselves and their
surroundings. An active surveillance system capable of detecting distances between
individuals and warning them can slow down the spread of the deadly disease. Social
national health authorities have set the 2-m physical distancing as a mandatory safety
measure in shopping centers, schools and other covered areas.

In this research, we develop a Arduino Uno Microcontroller , Pir Sensor, UltraSonic


Sensor Buzzer, Transmiter,Resistance,Led To all the connected to each otherr
possitive and negative terminal and vcc +5 volts in this when the distance between you
and other person is less than 1 meter this device turns on the buzzer and a vibration
will occur indicating you have to maintain social distancing.If the space greater than 1
meter then this device automatically turns off.
This is a great projeGive me suggestions so can improve it or any feedback you want
to give to my email.

also give me suggestion to make my new device extra ordinary.model for automated
people detection in the crowd in indoor and outdoor environments using This device
security Alarm.. We identify high-risk zones with the highest possibility of virus
spread and infection. The developed model is a generic and accurate people detection
and tracking solution.

7

List of Figures

Figure 1 5.1 The Architecture of Arduino Uno

Figure 2 5.2 The Architecture of Pir Sensor

Figure 3 5.3The Architecture of Altasonic Sensor

Figure 4 5.4Working of Buzzer System

Figure 5 5.5Working of Light Emitted Diode

Figure 6 5.6Transmitter

Figure 7 5.7Resistance’s

Figure 8 6.1 Distance Measuring

Figure 9 7.1 Result image

Figure 10 8.1Conclusion

8

Chapter 1

INTRODUCTION
In such situations, Artificial Intelligence can play an important role in facilitating
social distancing monitoring. Computer Vision, as a sub-field of Artificial
Intelligence, has been very successful in solving various complex health care
problems and can contribute to Social-distancing monitoring as well.

The novel generation of the coronavirus disease (COVID-19) was reported in late
December 2019 in Wuhan, China. After only a few months, the virus became a
global outbreak in 2020. On May 2020 The World Health Organization (WHO)
announced the situation as pandemic. The statistics by WHO on 8th October 2020
confirm 36 million infected people and a scary number of 1,056,000 deaths in 200
countries. With the growing trend of patients, there is still no effective cure or
available treatment for the virus. While scientists, healthcare organizations, and
researchers are continuously working to produce appropriate medications or
vaccines for the deadly virus, no definite success has been reported at the time of
this research, and there is no certain treatment or recommendation to prevent or
cure this new disease. Therefore, precautions are taken by the whole world to limit

9

the spread of infection. These harsh conditions have forced the global communities
to look for alternative ways to reduce the spread of the virus.

Social distancing is referred to precaution actions to prevent the proliferation of the


disease, by minimizing the proximity of human physical contacts in covered or
crowded public places (e.g., schools, workplaces, gyms, lecture theatres, etc.) to
stop the widespread accumulation of the infection risk. According to the defined
requirements by the WHO, the minimum distance between individuals must be at
least 6 feet (2 m) in order to observe an adequate social distancing among the
people. Recent research has confirmed that people with mild or no symptoms may
also be carriers of the novel coronavirus infection. Therefore, it is important all
individuals maintain controlled behaviors and observations.
Detecting an object which is in motion, incorporates two stages: object detection
and object classification. The primary stage of object detection could be achieved
by using background subtraction, optical flow and spatiotemporal filtering
techniques. In the background subtraction method, the difference between the
current frame and a background frame (first frame), at pixel or block level is
computed. Adaptive Gaussian mixture, temporal differencing, hierarchical
background models, warping background and non-parametric background are the
most popular approaches of background subtraction.

Gather components like Arduino Uno \Arduino Nano, ultrasonic sensor, buzzer,
vibrator motor, 9v battery with clip, switch, a cardboard box, some velcro strips. 2.
Take Cardboard box and place velcro strips in box. 3. Take front part of the box
and stick ultrasonic sensor, buzzer, vibrator motor. 4. Take Arduino upload the

10

code. 5. After uploading code, stick the arduino in box and place switch and 9v
battery in box. 6. Now do connections from circuit diagram. 7. Stick the front part
on the box and check for its working.. 8. Now decorate the box and stick it with
velcro to hand.

excellent improvements in terms of speed while trading the gained speed with the
efficiency. The detector module exhibits powerful generalization capabilities of
representing an entire image.

11

Chapter 2

LITERATURE REVIEW
Social distancing is arguably the most effective no pharmaceutical way to prevent
the spread of a disease — by definition, if people are not close together, they
cannot spread germs. We can use Arduino Uno \Arduino Nano, ultrasonic sensor,
buzzer, vibrator motor, 9v battery with clip, switch, a cardboard box, some velcro
strips. 2. Take Cardboard box and place velcro strips in box. 3. Take front part of
the box and stick ultrasonic sensor, buzzer, vibrator motor. 4. Take Arduino upload
the code. 5. After uploading code, stick the arduino in box and place switch and 9v
battery in box. 6. Now do connections from circuit diagram. 7. Stick the front part
on the box and check for its working.. 8. Now decorate the box and stick it with
velcro to hand.

In recent years, object detection techniques using deep models [6] are potentially
more capable than shallow models in handling complex tasks and they have
achieved spectacular progress in computer vision. Deep models for person
detection focus on feature learning contextual information learning, and occlusion
handling. Deep learning object detection models can now mainly be divided into
two families: (i) two-stage detectors such as ALTRASONIC SENSOR AND PIR
SENSOR and Faster Detection or and send the output the arduino Connected to
the pir sensor and altrasonic sensor.

12

In two-stage detectors detection is performed in stages, in the first stage,
computed proposals and classified in the second stage into object categories.
However, some methods,, consider detection as a regression issue and look at
the image once for detection.

Since the social distancing topic is very recent, there has not been much dedicated
research regarding the accuracy of people detection and inter-people distance
estimation in the crowd, no experiment on challenging datasets has been performed,
no standard comparison has been conducted on common datasets, and no analytical
studies or post- processing have been considered after the people detection-phase
to analyse the risk of infection distribution.

This model not only performs more accurate and faster than the state-of-the-art but
also will be trained and tested using a large and comprehensive dataset, in
challenging environments and lighting conditions. This will ensure the model is
capable of performing in real-world scenarios, particularly in covered shopping
centres.

13

Chapter 3

PROBLEM
IDENTIFICATION
People detection in image sequences is one of the most important sub-branches in
the field of object detection and computer vision. Although many research works
have been done in human detection and human action recognition, the majority of
them are either limited to indoor applications or suffer from accuracy issues under
outdoor challenging lighting conditions. A range of other research works rely on
manual tuning methodologies to identify people activities, however, limited
functionality has always been an issue.

Though object detection has achieved great progress in the past decades, it still has
many challenges when pushing the progress of object detection. In the following
part, three common and typical challenges of object detection will be discussed,
and some solutions are also introduced.

14

3.1 Scale Variation Problem

As the distance from objects to camera can be various, objects of various scales
usually appear on the image. Thus, scale variation is an inevitable problem for
object detection. The solutions to scale variation can be divided into two main
classes: (1) Object pyramid- based methods and (2) feature pyramid-based methods.
Generally, Object pyramid-based methods firstly resize the original image into
multiple different scales and then use the same detector to detect the rescaled
images, respectively. Feature pyramid-based methods firstly generate multiple
feature maps of different resolution based on the input image and then use different
feature maps to detect objects of different scales.

3.2 Occlusion Problem

Object occlusion is very common. For example, most of pedestrians (about 70%)
in street scenes are occluded in at least one frame. Thus, detecting occluded
object is very necessary and important for computer vision application.

It was found that if some parts of pedestrian are occluded, the block features of
corresponding region uniformly respond to the block scores of linear classifier.
Based on this phenomenon, they proposed to use the score of each block to judge
whether the corresponding region is occluded or not. Based on the scores of each
block, the occlusion likelihood images are segmented by the mean shift approach.
If occlusion occurs, the part detector is applied on the unoccluded regions to output
the final detection result.

15

3.3 Deformation Problem

Object deformation can be caused by non-grid deformation, intra-class shape


variability, and so on. For example, people can jump or squat. Thus, a good object
detection method should be robust to the deformation of object. Before CNN,
researchers have done many attempts to handle deformation. For example, DPM
uses the mixtures of multi-scale deformable part models (i.e., one lowresolution
root model and six high-resolution part models) to handle deformation. HSC
further incorporates histograms of sparse codes into deformable part model. To
accelerate detection speed of DPM, CDPM and FDPM are further proposed. It
proposed to detect large-scale pedestrians by deformable part model.

16

Chapter 4

Introduction to Microcontrollers

The goal(s) of this activity is to introduce students to a microcontroller and how it can be used.

i) we will introduce microcontrollers and block programming


ii) we set up a computer with their Arduino board and create a simple flashing circuit
using block program and an LED circuit. Note: The web-based simulator can be used
if the supplies are not available.
iii) We will watch next video in the video series iv) Students will be given an exit card
on microcontrollers
Materials/Equipment required if in class: LEDs, 220 Ohm resistors, breadboards, male to male
connecting wires, 9 Volt batteries and battery connectors, Arduino UNOs and connecting
cables, computers, and Arduino programming software (WEB LINKto Arduino website)
Resources: The details of this activity will be described in a video that can watch on the
OCTE website or the OCTE YouTube channel. If the student is at school, the student can
watch the video in class or at home and then complete the activity using the tools and supplies
in class. If the student is at home, they can begin working on the task using the web-based
simulator. Supplementary resources can be used if the student is home for an extended period
of time.

17

Activity 4.1 Using a Digital Input with a Microcontroller

The goal(s) of this activity is to have students create a digital input using a microcontroller.

i) We will introduce how to create a digital input circuit with a microcontroller. A solid
understanding of pull down and pull up resistors in digital input circuits is always a
challenging topic for students. A student must try to understand that when no current
flows in a circuit there is no voltage drop across a resistor. This can be difficult for
students to understand.
ii) we set up a computer with their Arduino board and create an input with a pushbutton.
Note: The web-based simulator can be used if the supplies are not available.
iii) we shall watch next video in the video series
Materials/Equipment required if in class: LEDs, 220 Ohm resistors (or some value close),
pushbuttons, pull down/up resistors (10 kOhm), Arduino UNOs and connecting cables,
computers, and Arduino programming software (WEB LINKto Arduino website)
Resources: The details of this activity will be described in a video that can watch on the
OCTE website or the OCTE YouTube channel. If the student is at school, the student can
watch the video in class or at home and then complete the activity using the tools and supplies
in class. If the student is at home, they can begin working on the task using the web-based
simulator. Supplementary resources can be used if the student is home for an extended period
of time.

Synopsis of video: This video introduces to how a pushbutton is used along with a pull
down/up resistor to create a digital input to a microcontroller. The video demonstrates the use
of a pull down resistor with a pushbutton and how it can turn on an LED circuit.

18

Activity 4.2Using a Digital Input Sensor with a Microcontroller

The goal(s) of this activity is to have students use a digital input sensor such as a passive infrared
sensor (PIR) to a microcontroller.
i) we will introduce sensors as digital inputs to a microcontroller. Students will set up a PIR
sensor and see how it operates. Students should be warned that this device is sensitive to
infrared and may be triggered by light coming in through the class window or from the lights
in the classroom. Students can search the internet to determine the function of the two
potentiometers on the side of the PIR sensor. They will need a Phillips screwdriver to set
these potentiometers. Students should see if they can turn on an LED when the PIR is
activated.
ii) we shall watch next video in the video series
iii) we demonstrate use of PIR sensor to teacher using the materials listed below and their
Arduino boards. Note: The web-based simulator can be used if the supplies are not available.

Materials/Equipment required if in class: LEDs, 220 Ohm resistors (or some value close), passive
infrared sensor (PIR), small Phillips screwdriver (to set pots on PIR), Arduino UNOs and connecting
cables, computers, and Arduino programming software (WEB LINKto Arduino website)
IMPORTANT: The passive infrared sensor (PIR) detects infrared and is sensitive to sunlight coming
in through windows and lights in the classroom. Warn students of this before handing out this
device. This will be a good opportunity to teach students that not all sensors will function exactly as
expected and time will be needed to test this device in various environments. Note that there is a
sensitivity potentiometer on the side of the device that can be set to help with this issue.
Resources: The details of this activity will be described in a video that can watch on the OCTE
website or the OCTE YouTube channel. If the student is at school, the student can watch the video
in class or at home and then complete the activity using the tools and supplies in class. If the student
is at home, they can begin working on the task using the web-based simulator. Supplementary
resources can be used if the student is home for an extended period of time.

Synopsis of video: This video introduces to the PIR sensor and how it functions in a virtual
environment. The video demonstrates how a PIR sensor can be set up to turn on an LED when the

19

Activity 4.3 Using an Analog Input with a Microcontroller

The goal(s) of this activity is for students to create an analog input and send this input to a
microcontroller.
i) we will introduce variable resistors and how they can act as an analog input to a
microcontroller. The teacher will also give examples of other devices that can act as analog
inputs such as volume controls and dimmer controls for lights.
ii) we shall watch next video in the video series
iii) we demonstrate use of analog input to teacher using the materials listed below and their
Arduino boards
Materials/Equipment required if in class: potentiometers, Arduino UNOs and connecting cables,
computers, and Arduino programming software (WEB LINKto Arduino website)
Resources: The details of this activity will be described in a video that student can watch on the
OCTE website or the OCTE YouTube channel. If the student is at school, the student can watch the
video in class or at home and then complete the activity using the tools and supplies in class. If the
student is at home, they can begin working on the task using the web-based simulator.
Supplementary resources can be used if the student is home for an extended period of time.

Synopsis of video: This video introduces to how an analog input is used with a microcontroller. In
the video, a potentiometer is used as an input device and students learn how a range of voltages from
zero to 5 Volts is interpreted to a ten bit binary number by the microcontroller (0 to 1023). The
students are shown the voltage change on the input using a voltmeter and how the serial monitor can
be used to see the value of the ten bit binary number.

20

Activity 4.4 – Using an Ultrasonic Sensor with a


Microcontroller

The goal(s) of this activity is to introduce students to an ultrasonic sensor and


how it can be used as an analog input to a microcontroller.

Materials/Equipment required if in class: ultrasonic sensors, Arduino UNOs and connecting cables,
computers, and Arduino programming software (WEB LINKto Arduino website)
Resources: The details of this activity will be described in a video that student can watch on the
OCTE website or the OCTE YouTube channel. If the student is at school, the student can watch the
video in class or at home and then complete the activity using the tools and supplies in class. If the
student is at home, they can begin working on the task using the web-based simulator.
Supplementary resources can be used if the student is home for an extended period of time. Web
link: Video –Using an ultrasonic sensor with a microcontroller

Synopsis of video: This video introduces students to how an ultrasonic device operates through the
use of sound waves. Students learn how sound waves are sent out of the transmit port of the device
and then bounce off an object and return and enter the receive port of the device.
Assessment/Evaluation: Quiz – Digital and Analog input devices (see Appendix D)

21

Chapter-5
COMPONENT’S STRUCTURE
The detection system helps to ensure the safety of the people at public places by
automatically monitoring and generate sound’s them whether they maintain a safe social
distance. This section briefly describes the solution architecture and how the proposed
system will automatically functions in an automatic manner to prevent the coronavirus
spread. The system uses a transfer learning approach to performance optimization with a
deep learning algorithm and a computer vision to automatically monitor people in public
places with a camera in a computer system and detect people if they are violating social
distancing or not.

5.1 Structure of Arduino Uno:

The Arduino Uno is a microcontroller board based on the ATmega328 (datasheet). It has 14 digital input/output
pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz crystal oscillator, a USB connection,
a power jack, an ICSP header, and a reset button. It contains everything needed to support the microcontroller;
simply connect it to a computer with a USB cable or power it with a AC-to-DC adapter or battery to get started.
The Uno differs from all preceding boards in that it does not use the FTDI USB-to-serial driver chip. Instead, it
features the Atmega8U2 programmed as a USB-to-serial converter.

"Uno" means one in Italian and is named to mark the upcoming release of Arduino 1.0. The Uno and version
1.0 will be the reference versions of Arduno, moving forward. The Uno is the latest in a series of USB Arduino
boards, and the reference model for the Arduino platform; for a comparison with previo
Digital I/O Pins 14 (of which 6 provide PWM
output)
Analog Input Pins 6
DC Current per I/O Pin 40 mA
DC Current for 3.3V Pin 50 mA

22

EAGLE files: arduino-duemilanove-uno-design.zip Schematic: arduino-uno-schematic.pdf

Microcontroller ATmega328
Operating Voltage 5V
Input Voltage (recommended) 7-12V
Input Voltage (limits) 6-20V
32 KB of which 0.5 KB used by
Flash Memory
bootloader
SRAM 2 KB
EEPROM 1 KB
Clock Speed 16 MHz

The Arduino Uno can be powered via the USB connection or with an external power supply. The power source
is selected automatically.

23

External (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or battery. The adapter can

be connected by plugging a 2.1mm center-positive plug into the board's power jack. Leads from a battery can
be inserted in the Gnd and Vin pin headers of the POWER connector.

The board can operate on an external supply of 6 to 20 volts. If supplied with less than 7V, however, the 5V
pin may supply less than five volts and the board may be unstable. If using more than 12V, the voltage
regulator may overheat and damage the board. The recommended range is 7 to 12 volts.

The power pins are as follows:

• VIN. The input voltage to the Arduino board when it's using an external power source (as opposed to 5
volts from the USB connection or other regulated power source). You can supply voltage through this
pin, or, if supplying voltage via the power jack, access it through this pin.
• 5V. The regulated power supply used to power the microcontroller and other components on the board.
This can come either from VIN via an on-board regulator, or be supplied by USB or another regulated
5V supply.
• 3V3. A 3.3 volt supply generated by the on-board regulator. Maximum current draw is 50 mA.
• GND. Ground pins.

The Atmega328 has 32 KB of flash memory for storing code (of which 0,5 KB is used for the bootloader); It has
also 2 KB of SRAM and 1 KB of EEPROM (which can be read and written with the EEPROM library).

Each of the 14 digital pins on the Uno can be used as an input or output, using pinMode(),digitalWrite(), and
digitalRead()functions. They operate at 5 volts. Each pin can provide or receive a maximum of 40 mA and has
an internal pull-up resistor (disconnected by default) of 20-50 kOhms. In addition, some pins have specialized
functions:

• Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. TThese pins are
connected to the corresponding pins of the ATmega8U2 USB-to-TTL Serial chip .
• External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a low value, a
rising or falling edge, or a change in value. See the attachInterrupt()function for details.
• PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite()function.
• SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication, which, although
provided by the underlying hardware, is not currently included in the Arduino language.

• LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH value, the LED is on,
when the pin is LOW, it's off.
The Uno has 6 analog inputs, each of which provide 10 bits of resolution (i.e. 1024 different values). By default
they measure from ground to 5 volts, though is it possible to change the upper end of their range using the
AREF pin and the analogReference() function. Additionally, some pins have specialized functionality:

• I2C: 4 (SDA) and 5 (SCL). Support I2C (TWI) communication using the Wire library.

There are a couple of other pins on the board:

• AREF. Reference voltage for the analog inputs. Used with analogReference().

24

• Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset button to shields
which block the one on the board.

See also the mapping between Arduino pins and Atmega328 ports.

The Arduino Uno can be programmed with the Arduino software (download). Select "Arduino Uno w/
ATmega328" from the Tools > Board menu (according to the microcontroller on your board). For details, see
the referenceand tutorials.

The ATmega328 on the Arduino Uno comes preburned with a bootloaderthat allows you to upload new code to it
without the use of an external hardware programmer. It communicates using the original STK500 protocol
(reference,C header files).

You can also bypass the bootloader and program the microcontroller through the ICSP (In-Circuit Serial
Programming) header; see these instructionsfor details.

The ATmega8U2 firmware source code is available . The ATmega8U2 is loaded with a DFU bootloader, which
can be activated by connecting the solder jumper on the back of the board (near the map of Italy) and then
resetting the 8U2. You can then use Atmel's FLIP software(Windows) or the DFU programmer(Mac OS X and
Linux) to load a new firmware. Or you can use the ISP header with an external programmer (overwriting the
DFU bootloader).

Rather than requiring a physical press of the reset button before an upload, the Arduino Uno is designed in a
way that allows it to be reset by software running on a connected computer. One of the hardware flow control
lines (DTR) of the ATmega8U2 is connected to the reset line of the ATmega328 via a 100 nanofarad capacitor.
When this line is asserted (taken low), the reset line drops long enough to reset the chip. The Arduino software
uses this capability to allow you to upload code by simply pressing the upload button in the Arduino environment.
This means that the bootloader can have a shorter timeout, as the lowering of DTR can be well-coordinated with
the start of the upload.

This setup has other implications. When the Uno is connected to either a computer running Mac OS X or Linux,
it resets each time a connection is made to it from software (via USB). For the following half-second or so, the
bootloader is running on the Uno. While it is programmed to ignore malformed data (i.e. anything besides an
upload of new code), it will intercept the first few bytes of data sent to the board after a connection is opened. If
a sketch running on the board receives one-time configuration or other data when it first starts, make sure that
the software with which it communicates waits a second after opening the connection and before sending this
data.

The Uno contains a trace that can be cut to disable the auto-reset. The pads on either side of the trace can be
soldered together to re-enable it. It's labeled "RESET-EN". You may also be able to disable the auto-reset by
connecting a 110 ohm resistor from 5V to the reset line; see this forum threadfor details.

The Arduino Uno has a resettable polyfuse that protects your computer's USB ports from shorts and overcurrent.
Although most computers provide their own internal protection, the fuse provides an extra layer of protection. If

25

more than 500 mA is applied to the USB port, the fuse will automatically break the connection until the short or
overload is removed.

The maximum length and width of the Uno PCB are 2.7 and 2.1 inches respectively, with the USB connector
and power jack extending beyond the former dimension. Three screw holes allow the board to be attached to
a surface or case. Note that the distance between digital pins 7 and 8 is 160 mil (0.16"), not an even multiple
of the 100 mil spacing of the other pins.

5.2 STRUCTURE OF PIR SENSOR

PIR Motion Sensor

Overview
PIR sensors allow you to sense motion, almost always used to detect whether a human has moved in
or out of the sensors range. They are small, inexpensive, low-power, easy to use and don't wear out.
For that reason they are commonly found in appliances and gadgets used in homes or businesses.
They are often referred to as PIR, "Passive Infrared", "Pyroelectric", or "IR motion" sensors.

PIRs are basically made of a pyroelectric sensor (https://adafru.it/aKh) (which you can see below as
the round metal can with a rectangular crystal in the center), which can detect levels of infrared
radiation. Everything emits some low level radiation, and the hotter something is, the more radiation
is emitted. The sensor in a motion detector is actually split in two halves. The reason for that is that
we are looking to detect motion (change) not average IR levels. The two halves are wired up so that

26

they cancel each other out. If one half sees more or less IR radiation than the other, the output will
swing high or low.

Along with the pyroelectic sensor is a bunch of supporting circuitry, resistors and capacitors. It seems
that most small hobbyist sensors use the BISS0001 ("Micro Power PIR Motion Detector IC")
(https://adafru.it/clR), undoubtedly a very inexpensive chip. This chip takes the output of the sensor
and does some minor processing on it to emit a digital output pulse from the analog sensor.
Our older PIRs looked like this:

Our new PIRs have more adjustable settings and have a header installed in the 3-pin
ground/out/power pads

27

For many basic projects or products that need to detect when a person has left or entered the area, or
has approached, PIR sensors are great. They are low power and low cost, pretty rugged, have a wide
lens range, and are easy to interface with. Note that PIRs won't tell you how many people are around
or how close they are to the sensor, the lens is often fixed to a certain sweep and distance (although it
can be hacked somewhere) and they are also sometimes set off by housepets. Experimentation is key!

How PIRs Work


PIR sensors are more complicated than many of the other sensors explained in these tutorials (like
photocells, FSRs and tilt switches) because there are multiple variables that affect the sensors input
and output. To begin explaining how a basic sensor works, we'll use this rather nice diagram

The PIR sensor itself has two slots in it, each slot is made of a special material that is sensitive to IR.
The lens used here is not really doing much and so we see that the two slots can 'see' out past some
distance (basically the sensitivity of the sensor). When the sensor is idle, both slots detect the same
amount of IR, the ambient amount radiated from the room or walls or outdoors. When a warm body
like a human or animal passes by, it first intercepts one half of the PIR sensor, which causes a positive
differential change between the two halves. When the warm body leaves the sensing area, the reverse
happens, whereby the sensor generates a negative differential change. These change pulses are what
is detected.

28

The PIR Sensor


The IR sensor itself is housed in a hermetically sealed metal can to improve
noise/temperature/humidity immunity. There is a window made of IR-transmissive material (typically
coated silicon since that is very easy to come by) that protects the sensing element. Behind the
window are the two balanced sensors.

LeftimagefromMuratadatasheet(https://adafru.it/cm5)

29

ImagefromRE200Bdatasheet(https://adafru.it/clS)

You can see above the diagram showing the element window, the two pieces of sensing material

ImagefromRE200Bdatasheet(https://adafru.it/clS)

This image shows the internal schematic. There is actually a JFET inside (a type of transistor) which
is very low-noise and buffers the extremely high impedence of the sensors into something a low-cost
chip (like the BIS0001) can sense.

Lenses
PIR sensors are rather generic and for the most part vary only in price and sensitivity. Most of the real
magic happens with the optics. This is a pretty good idea for manufacturing: the PIR sensor and
circuitry is fixed and costs a few dollars. The lens costs only a few cents and can change the breadth,
range, sensing pattern, very easily.

In the diagram up top, the lens is just a piece of plastic, but that means that the detection area is just
two rectangles. Usually we'd like to have a detection area that is much larger. To do that, we use a
simple
lens (https://adafru.it/aKq) such as those found in a camera: they condenses a large area (such as a
landscape) into a small one (on film or a CCD sensor). For reasons that will be apparent soon, we
would like to make the PIR lenses small and thin and moldable from cheap plastic, even though it
may add distortion. For this reason the sensors are actually Fresnel lenses (https://adafru.it/aKr):

ImagefromSensorsMagazine(https://adafru.it/aKs)

30

The Fresnel lens condenses light, providing a larger range of IR to the sensor.

ImagefromBHlens.com(https://adafru.it/aKt)

ImagefromCypressappnote2105(https://adafru.it/cm6)

OK, so now we have a much larger range. However, remember that we actually have two sensors, and
more importantly we dont want two really big sensing-area rectangles, but rather a scattering of
multiple small areas. So what we do is split up the lens into multiple section, each section of which is
a fresnel lens.

Here you can see the multiple facet-sections

31

5.3 -HC-SR04 Ultrasonic Sensor

The purpose of this file is to explain how the HC-SR04 works. It will give a brief
explanation of how ultrasonic sensors work in general. It will also explain how to wire the sensor up
to a microcontroller and how to take/interpret readings. It will also discuss some sources of errors
and bad readings.

1. How Ultrasonic Sensors Work


2. HC-SR04 Specifications
3. Timing chart, Pin explanations and Taking
Distance Measurements
4. Wiring HC-SR04 with a microcontroller
5. Errors and Bad Readings

1. How Ultrasonic Sensors Work


Ultrasonic sensors use sound to determine the distance between the sensor and the closest
object in its path. How do ultrasonic sensors do this? Ultrasonic sensors are essentially sound
sensors, but they operate at a frequency above human hearing.

The sensor sends out a sound wave at a specific frequency. It then listens for that specific sound
wave to bounce off of an object and come back (Figure 1). The sensor keeps track of the time
between sending the sound wave and the sound wave returning. If you know how fast something is
going and how long it is traveling you can find the distance traveled with equation 1.

Equation 1.d = v × t

32

The speed of sound can be calculated based on the a variety of atmospheric conditions,
including temperature, humidity and pressure. Actually calculating the distance will be shown later
on in this document.
It should be noted that ultrasonic sensors have a cone of detection, the angle of this cone
varies with distance, Figure 2 show this relation. The ability of a sensor to detect an object also
depends on the objects orientation to the sensor. If an object doesn’t present a flat surface to the
sensor then it is possible the sound wave will bounce off the object in a way that it does not return to
the sensor.

2. HC-SR04 Specifications
The sensor chosen for the Firefighting Drone Project was the HC-SR04. This section
contains the specifications and why they are important to the sensor module. The sensor modules
requirements are as follows.

● Cost
● Weight
● Community of hobbyists and support
● Accuracy of object detection
● Probability of working in a smoky environment
● Ease of use

The HC-SR04 Specifications are listed below. These specifications are from the
Cytron Technologies HC-SR04 User’s Manual (source 1).

● Power Supply: +5V DC


● Quiescent Current: <2mA
● Working current: 15mA

33

● Effectual Angle: <15º
● Ranging Distance: 2-400 cm
● Resolution: 0.3 cm
● Measuring Angle: 30º
● Trigger Input Pulse width: 10uS
● Dimension: 45mm x 20mm x 15mm
● Weight: approx. 10 g

The HC-SR04’s best selling point is its price; it can be purchased at around $2 per unit.

3. Timing Chart and Pin Explanations


The HC-SR04 has four pins, VCC, GND, TRIG and ECHO; these pins all have different
functions. The VCC and GND pins are the simplest -- they power the HC-SR04. These pins need to
be attached to a +5 volt source and ground respectively. There is a single control pin: the TRIG pin.
The TRIG pin is responsible for sending the ultrasonic burst. This pin should be set to HIGH for 10
μs, at which point the HC-SR04 will send out an eight cycle sonic burst at 40 kHZ. After a sonic
burst has been sent the ECHO pin will go HIGH. The ECHO pin is the data pin -- it is used in taking
distance measurements. After an ultrasonic burst is sent the pin will go HIGH, it will stay high
until an ultrasonic burst is detected back, at which point it will go LOW.
Taking Distance Measurements
The HC-SR04 can be triggered to send out an ultrasonic burst by setting the TRIG pin to
HIGH. Once the burst is sent the ECHO pin will automatically go HIGH. This pin will remain
HIGH until the the burst hits the sensor again. You can calculate the distance to the object by
keeping track of how long the ECHO pin stays HIGH. The time ECHO stays HIGH is the time the
burst spent traveling. Using this measurement in equation 1 along with the speed of sound will yield
the distance travelled. A summary of this is listed below, along with a visual representation in
Figure 2.

1. Set TRIG to HIGH


2. Set a timer when ECHO goes to HIGH
3. Keep the timer running until ECHO goes to LOW

34

4. Save that time
5. Use equation 1 to determine the distance travelled

Source 2
To interpret the time reading into a distance you need to change equation 1. The clock on the
device you are using will probably count in microseconds or smaller. To use equation 1 the speed of
sound needs to determined,which is 343 meters per second at standard temperature and pressure. To
convert this into more useful form use equation 2
to change from meters per second to microseconds per centimeter. Then equation 3 can be
used to easily compute the distance in centimeters.

Equation 2. Distance = 17S0p.e1e5dm × M10e0tecrms × 117e06.1 μ5Sm × 58.7c7m2 μS

Equation 3. Distance = ti5m8e = μsμ/csm = cm

4. Wiring the HC-SR04 to a Microcontroller


This section only covers the hardware side. For information on how to integrate the software
side, look at one of the links below or look into the specific microcontroller you are using.

35

5.4 - Tutorial Of The Buzzer
Ke

As a basic electronic component that generates sound. We always encounter Buzzers in life,

whether it's in the computer, the alarm clock, or the printer, the scanner, and the alarm, etc. It is widely

used, and its usage is extremely simple. In this section, we will learn some relevant knowledge of the

buzzer.

Key points:

1.Finish the programming of the buzzer to get different tones.

2.Get familiar to the programming for Arduino and some relative functions 3.Equipment
needed:USB cable,miniQ .

36

5.5 Light Emitting Diodes (LEDs)

Light Emitting Diodes Principle Synopsis:


To explain the theory and the underlying principle behind the functioning of an LED

Theory:
A Light emitting diode (LED) is essentially a pn junction diode. When carriers are injected across a
forward-biased junction, it emits incoherent light. Most of the commercial LEDs are realized using a
highly doped n and a p Junction.

Figure 1: p-n+ Junction under Unbiased and biased conditions.


(pn Junction Devices and Light Emitting Diodes by Safa Kasap)

To understand the principle, let’s consider an unbiased pn+ junction (Figure1 shows the pn+ energy
band diagram). The depletion region extends mainly into the p-side. There is a potential barrier from
Ec on the n-side to the Ec on the p-side, called the built-in voltage, V0. This potential barrier prevents
the excess free electrons on the n+ side from diffusing into the p side.

37

When a Voltage V is applied across the junction, the built-in potential is reduced from V0 to V0 – V.
This allows the electrons from the n+ side to get injected into the p-side. Since electrons are the
minority carriers in the p-side, this process is called minority carrier injection. But the hole injection
from the p side to n+ side is very less and so the current is primarily due to the flow of electrons into
the p-side.
These electrons injected into the p-side recombine with the holes. This recombination(see

The recombination can be classified into the following two kinds


• Direct recombination
• Indirect recombination

ηext = Pout(optical) / IV
For indirect bandgap semiconductors ηext is generally less than 1%, where as for a direct band gap
material it could be substantial.
ηint = rate of radiation recombination/ Total recombination

The internal efficiency is a function of the quality of the material and the structure and composition of
the layer.
Applications: LED have a lot of applications. Following are few examples.
• Devices, medical applications, clothing, toys
• Remote Controls (TVs, VCRs)
• Lighting
• Indicators and signs
• Optoisolators and optocouplers

Figure 5: Optocoupler schematic showing LED and phototransistor (Wikipedia)

• Swimming pool lighting(see Appendix 9).

38

1) ice
2) Following is a list of semiconductor materials and the corresponding colors:
• Aluminium gallium arsenide (AlGaAs) — red and infrared
• Aluminium gallium phosphide (AlGaP) — green
• Aluminium gallium indium phosphide (AlGaInP) — high-brightness orange-red, orange,
yellow, and green

• Gallium arsenide phosphide (GaAsP) — red, orange-red, orange, and yellow


• Gallium phosphide (GaP) — red, yellow and green
• Gallium nitride (GaN) — green, pure green (or emerald green), and blue also white (if it has
an AlGaN Quantum Barrier)

• Indium gallium nitride (InGaN) — 450 nm - 470 nm — near ultraviolet, bluishgreen and blue
• Silicon carbide (SiC) as substrate — blue
• Silicon (Si) as substrate — blue (under development)
• Sapphire (Al2O3) as substrate — blue
• Zinc selenide (ZnSe) — blue
• Diamond (C) — ultraviolet
• Aluminium nitride (AlN), aluminium gallium nitride (AlGaN), aluminium gallium indium
nitride (AlGaInN) — near to far ultraviolet (down to 210 nm)

9) Temperature effects on LEDs


Following picture shows the effect of temperature on LEDs.

39

(Solid State Light Emitters, Light Emitting Diodes, Dr. János Schanda ,Colour and Multimedia Laboratory of the
University of Veszprém)

40

5.6 TRANSISTOR CONSTRUCTION

A transistor has three terminals, namely emitter (E), base (B) and collector (C). We have two types of
transistors, npn and pnp. These are shown in Fig. 2.1.
The emitter is heavily doped and injects a large number of majority carriers into the base. The emitter
is always forward biased with respect to the base. In pnp transistors, majority carriers are holes and in
npn transistors, majority carriers are electrons.
electrons are collected by the collector. A few electrons also flow out of the base terminal. The BE
bias voltage must be greater than the forward voltage drop of 0.7 V at the BE junction.

2.2.2 pnp Transistor


A pnp transistor behaves exactly the same way as an npn transistor, with the difference that the
majority carriers are holes. Here too, the base is lightly doped compared to the emitter and collector.
The BE junction is forward biased and CB junction reverse biased as shown in Fig. 2.5.
BE junction CB junction
byemitter
Holesemitted
E biasvoltage
source
+BE+ p+ + n+B + biasvoltage
+
psource
+CB
+ bycollector
Holescollected
C

Fig. 2.5 pnp transistor

Holes emitted from the p-type emitter are injected into the base. Some of the holes flow out through
the base. Most of them are collected by the collector. The BE junction bias voltage controls the large
emitter and collector current.

2.3 TRANSISTOR VOLTAGES

41
41

The polarities of the terminals are important when we define the voltages of the transistor. The bias
voltage sources are connected to the transistor via resistors. The base bias source is designated VBB (or
VB) and connected to the base terminal through RB. The collector bias voltage source is designated VCC
and is always much larger than VBB, to ensure that the CBjunction is reverse biased. The voltages are
shown in Fig. 2.6 for an npn transistor.

+
–VBE
CB –+ V
+– V
+
VBB (b) BiasRBsource connections
–RCL VCC

BCE

(a) Terminal voltages

Fig. 2.6 Transistor voltages for npn transistor

Note that the base is biased positive with respect to emitter. In a pnp transistor the base is biased
negative with respect to emitter. The voltages and source connections are shown in Fig. 2.7.

+–VBE
CB +
–V
VBB(b)Biassourceconnections
RB RC VCC

BCE

(a) Terminal voltages

Fig. 2.7 Transistor voltages for pnp transistor

2.4 TRANSISTOR CURRENTS

Consider the pnp transistor with currents as shown in Fig. 2.8.

42
42

VBB IE E B IB CIC VCC

Fig. 2.8 Currents in a pnp transistor

The current flowing into the emitter terminal is IE; the current flowing out of the base is IB and out of
the collector is IC. The currents shown are the conventional currents. Here IB and IC flow out of the
transistor and IE flows into the transistor. Hence,

IE IB B C IC

Fig. 2.9 Currents in an npn transistor

Here, the base and collector currents enter the transistor and the emitter current leaves the transistor.
These are the directions of the conventional currents. All equations from (2.1) to (2.8) are the same.

The comparison of the three configurations is shown in Table 2.1.

Table - Transistor configurations

Type CB CE CC

Voltage gain High Medium Low

Current gain Low () High () High ()

Power gain Low High Medium

Input resistance Low Medium High

Output resistance High Medium Low

43
43

Applications For high frequencies Andio frequency Impedance
applications applications matching
Phase relationship In-phase Out of phase In-phase
between input and
output
Output current IC = IE + ICBO IC = IB + (1 + ) ICBO IE = IB + ICBO

Chapter 6
Distance Measuring:

44
44

Chapter 7

RESULT DISCUSSION

45
45

Figure 5.1 Result Image

Chapter 8

CONCLUSION AND
FUTURE SCOPE
8.1 Conclusion

46
46

Our project proposes an efficient real-time deep learning based framework to automate
the process of monitoring the social distancing via object detection and tracking
approaches, where each individual is identified in the real-time with the help of
bounding boxes. The generated bounding boxes aid in identifying the clusters or groups
of people satisfying the closeness property computed with the help of pairwise
vectorized approach.

The number of violations are confirmed 9 by computing the number of groups formed
and violation index term computed as the ratio of the number of people to the number of
groups. The extensive trials were conducted with popular state-of-the-art object detection
models: YOLO v3. Since this approach is highly sensitive to the spatial location of the
camera, the same approach can be fine tuned to better adjust with the corresponding field
of view. Thesolutionhasthepotentialtosignificantlyreduceviolationsbyreal-
timeinterventions,sotheproposedsystemwouldimprovepublicsafetythroughsavingtimea
ndhelpingtoreducethespreadofcoronavirus.Thissolutioncanbeusedinplacesliketemples,s
hoppingcomplex,metrostations,airports,etc

8.2 Future Scope

The solution has the potential to significantly reduce violations by real-time


interventions, so the system would improve public safety through saving time and
helping to reduce the spread of coronavirus. This solution can be used in places like
temples, shopping complex, metro stations, airports, etc.

Since this application is intended to be used in any working environment; accuracy and
precision are highly desired to serve the purpose.

47
47

Bibliography

1. Agarwal, S., Awan, A., and Roth, D. (2004). Learning to detect objects in
images via a sparse, part-based representation. IEEE Trans. Pattern Anal. Mach. Intell.
26,1475–
1490. doi:10.1109/TPAMI.2004.108

2. Alexe, B., Deselaers, T., and Ferrari, V. (2010). “What is an object?,” in


ComputerVision and Pattern Recognition (CVPR), 2010 IEEE Conference on (San
Francisco,CA: IEEE), 73–80. doi:10.1109/CVPR.2010.5540226

3. Aloimonos, J., Weiss, I., and Bandyopadhyay, A. (1988). Active vision. Int.
J.Comput. Vis. 1, 333–356. doi:10.1007/BF00133571

48
48

You might also like