0% found this document useful (0 votes)
23 views71 pages

Survillence Camera

The document presents a project report on a Smart Load Theft and Breakdown Detection System using GSM and GPS, aimed at enhancing surveillance and monitoring through IoT technology. It includes acknowledgments, an abstract discussing the importance of real-time monitoring and the use of surveillance robot cameras, and outlines the project's structure. The report also covers the introduction to IoT, literature survey, existing systems, proposed systems, and system requirements, culminating in a comprehensive approach to automated surveillance solutions.

Uploaded by

nwar7049
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)
23 views71 pages

Survillence Camera

The document presents a project report on a Smart Load Theft and Breakdown Detection System using GSM and GPS, aimed at enhancing surveillance and monitoring through IoT technology. It includes acknowledgments, an abstract discussing the importance of real-time monitoring and the use of surveillance robot cameras, and outlines the project's structure. The report also covers the introduction to IoT, literature survey, existing systems, proposed systems, and system requirements, culminating in a comprehensive approach to automated surveillance solutions.

Uploaded by

nwar7049
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
You are on page 1/ 71

SMART LOAD THEFT AND BREAKDOWN

DETECTION SYSTEM USING GSM AND GPS

A PROJECT REPORT

Submitted by

J.ABDUL RAHMAN 812021106001


P.ARVIND 812021106009
B.RAVI KANNAN 812021106031
R.SURYA SUBASH 812021106038

in partial fulfilment for the award of the degree

Of

BACHELOR OF ENGINEERING
In
ELECTRONICS & COMMUNICATION ENGINEERING

M.A.M COLLEGE OF ENGINEERING AND TECHNOLOGY

1
MAY 2025 ANNA UNIVERSITY::CHENNAI- 600 025

BONAFIDE CERTIFICATE
Certified that this report titled “SMART LOAD THEFT AND
BREAKDOWN DETECTION SYSTEM USING GPS AND GSM” is the
Bonafide work of ARUNKUMAR R (812021106008), ASWIN G
(812021106010), MADHESH B (812021106023), ESWARAN V
(8120201106302) who carried out the project work under my supervision.

SIGNATURE SIGNATURE

Dr. G. HARIDOSS, M.E., Ph.D., Mrs. S. KAVITHA, M.E.,

HEAD OF THE DEPARMENT SUPERVISOR

Associate Professor and Head Associate Professor

Department of ECE Department of ECE

M.A.M College of Engineering M.A.M College of Engineering and


and Technology and Technology

Trichy-621 105 Trichy-621 105

Submitted for the EC8811-Project Work held on _______________

Internal Examiner External Examiner

2
ACKNOWLEDGEMENT

With warm hearts and immense pleasure, I thank the almighty


for his grace and blessing bestowed on me, which drove me to the successful
completion of this project. I take this opportunity to express my sincere thanks
to the respected Director Dr.M.A. Maluk Mohammed, M.E., Ph.D., and
Secretary & Correspondent Mrs. Fathima Bathool Maluk, M.B.A., who is
guiding light for all activities in our college.

I take this opportunity to express my sincere thanks to the


respected Principal Dr.X.Susan Christina, M.E., Ph.D., who acts as the
mentor figure for all operations in our college.

I would like to thank our Head of the department Dr. G.


Haridoss, M.E., Ph.D., for his co-operation, advice and suggestions at every
stage of my project work.
I would also like to express with gratitude and my sincere thanks
to my guide Mr.M.Syed Abdul salam, Associate Professor, Department of
Electronics and Communication Engineering for motivating me throughout the
project work.

I am very proud to extend my sincere gratitude to our Project


coordinator Mrs. S. Kavitha, M.E., Associate Professor, Department of
Electronics and Communication Engineering, M.A.M College of Engineering &
Technology, for his excellent guidance, advice and encouragement which
boosted up our energy throughout the project development.

I also thank all the teaching faculties and non-teaching staff of the
Electronics and Communication Engineering, my parents, and all my friends for
their help and support to complete this project successfully.

3
ABSTRACT

In recent times, we used surveillance robot cameras for


monitoring and recording moments, but manual surveillance robot
and real-time monitoring is one of the most important and challenging
branches of computer vision, which has been widely applied in
peoples’ life, such as monitoring security. Wi-Fi network protocol is
one of the leading communication technologies used in the IoT world
which supports low transmit power along with low cost. ESP32 is the
second generation of Express if corporation IoT solution and it
includes Wi Fi. ESP32 reduces high network traffic and computing
load. This system facilitates the user to receive notifications
whenever the intrusion is detected with the help of sensors connected
with the surveillance robot cameras.

4
TABLE OF CONTENTS

CHAPTER NO TITLE PAGE NO

ABSTRACT 3

LIST OF FIGURE 7

LIST OF ABREVATION 8

1 INTRODUCTION 6
2 LITERATURE SURVEY 9
3 EXISTING SYSTEM 14
4 PROPOSED SYSTEM 16
4.1 PROPOSED SYSTEM 17
4.1.1 BLOCK DIAGRAM 18
4.2 ADRUINO NANO 19
4.3 ESP32CAM 20
4.4 ROBOTIC MODULE 21
4.5 BATTERY 22
4.6 BLUETOOTH 22
4.7 L298NDRIVER 22
5 SYSTEM REQUIREMENT 23
5.1 HARDWARE DESIGN 24
5.2 SOFTWARE DESIGN 44
5.3 RESULT 59
6 CONCLUSION 60
CODE 62
REFERENCES 70

5
CHAPTER 1

INTRODUCTION

The Internet of things (IoT) is network of objects, in which the objects of


everyday life are embedded with microcontroller, sensors and software that
enables these objects to collect and communicate data with one another and the
users, becoming the essential part of the internet. The IoT model, aims at
making the Internet even more persistent. Furthermore, by enabling easy access
and communication with a wide range of devices such as, for example, home
appliances, surveillance robot cameras, monitoring sensors and so on, the IoT is
implemented for the development of applications that makes use of the
enormous amount and the data generated by such objects provide services. This
method finds application in many different areas, such as home automate,
mobile healthcare, traffic management and many others.

Fig 1.1 Internets of Things

6
INTERNET OF THINGS

Internet of Things (IoT) is an ecosystem of connected physical objects


that are accessible through the internet. The ‘thing’ in IoT could be a person
with a heart monitor or an automobile with built-in-sensors, i.e. objects that
have been assigned an IP address and have the ability to collect and transfer
data over a network without manual assistance or intervention. The embedded
technology in the objects helps them to interact with internal states or the
external environment, which in turn affects the decisions taken.

On one hand, forest fires present a significant challenge to human life and
natural ecological environment. If a forest fire cannot be promptly extinguished,
it will have a bad impact on a wide area. Reaction time is one of the key factors
that determine the success of forest fire suppression. On the other hand, there
was extensive research on photoelectric- or ionization-based fire smoke
detectors. However, these sensors are limited by the fact that these always serve
as point sensors in space, which are unsuitable at monitoring larger areas such
as early forest fire detection. The limitations of current smoke sensors have
prompted researches on vision-based smoke detection methods.

Lightning is one of the reasons for natural forest fire .It occurs due to
combustion of dry fuel in the forest like leaves. Fire caused due to man-made
are more like smoking, due to any miscellaneous activities. The fire caused due
to man-made is more than natural forest fire. But large area damage is caused
by natural forest fire because it cannot be predicted.

So from this we can find that the damage in the forest are more and an
immediate precautions has to be taken to reduce the forest fires. A possible
action has to be taken by the government and also by the forest department to
reduce the fire. Some of the actions taken by the government is restricting the

7
people to enter the forest areas without any permission from the forest officers.
Usage of fire causing materials are prohibited inside the forest areas ,in any wild
life sanctuaries and also in local forest areas. Regular monitoring activities are
taken by the forest department by using cameras in the forest areas. To avoid
huge damage of forest from the natural fire an precautions are taken by the
government and forest departments by having some emergency equipment’s to
reduce the fire like fire extinguisher and some rangers are appointed in the
forest areas to give immediate information about the fire in the forest so that
immediate necessary actions can be taken. So to reduce the damages in the
forest area due to forest fires a device can be used were the device is built with
some modern technologies. In the modern world immediate information are
send and received in a quick time. Even normal activities are informed through
this technologies, it is possible and important to inform this kind of information
in a quicker time. This information helps the government to reduce the damage
in the forest by fire.

Recent advancements in microcontroller technology have enhanced the


capabilities and overall functioning of surveillance robot systems by providing
additional features such as live streaming over distance, augmenting android
applications, interfacing sensors for actuating mechanism, storage capabilities,
cost effectiveness and easier implementation. Additionally, implementation of
various algorithms such as Background Subtraction Technique for detection of
unattended objects can provide additional layer of security in the sensitive areas.
The objective of the suggested implementation is to benefit end user with
aforementioned features by assembling surveillance robot system in one
complete package using Internet of Things (IoT) enabled devices. The proposed
implementation acquires low resolution video using detachable Arducam-Mini-
2Mega Pixels (MP) camera module which is interfaced with Arducam ESP32
nano board.

8
CHAPTER 2

LITERATURE SURVEY

C M Srilakshmi1, Dr M C Padma2 “IOT BASED SMART SURVEILLANCE


ROBOT SYSTEM” International Research Journal of Engineering and
Technology (IRJET)Volume: 04 Issue:05| May-2017

IoT Based Smart Surveillance robot System. This paper is presented by


M Sri Lakshmi., C Padma IoT technology is being used in almost each and
every aspect in this modern world. This paper elaborates the way of using the
power of Iot in the field of Surveillance robot. The IoT based surveillance robot
systems enables the user to view the activity from a remote location. It also
facilitates the user to receive notifications whenever the intrusion is detected
with the help of sensors connected with the surveillance robot cameras. This
reduces the human intervention in the Surveillance robot monitoring and
reduces the errors of manual surveillance robot.

F.Adaramola ,Michael.A.K.Adelabu “IMPLEMENTATION OF CLOSED-


CIRCUIT TELEVISION (CCTV) USING WIRELESS INTERNET
PROTOCOL (IP) CAMERA” 1.School Of Engineering, Lagos State
Polytechnic, Ikorodu, P.M.B. 21,606, Ikeja. Lagos. Nigeria

Implementation of Closed-circuit Television (CCTV) Using Wireless


Internet Protocol (IP)Camera. This paper is presented by A Michael F
Adaramola. In this paper, the implementation of Surveillance robot camera
using Wi-Fi based technology is presented. The live streaming of vide based
surveillance robot can be adapted for the image detection and tracking for real-
time intelligent surveillance robot system design

9
Rishabh Paunikar, Shubham Thakare, Utkarsh Anuse “ ACTION
RECOGNITION USING SURVEILLANCE ROBOT SYSTEM ”
International Journal of Engineering Applied Science and Technology (IJEAST
) Volume: 04 Issue:12| April-2020

Action Recognition using Surveillance robot system. This paper is


presented by Rishabh Paunikar, Shubham Thakare, Utkarsh Anuse. Surveillance
robot systems that use CCTV cameras or other surveillance robot equipment
continuously record the footage while they are in use. The majority of the data
is idle data, meaning there is no activity taking place. When viewing a
previously recorded activity, the viewer must go through all of the film to
determine when and what occurred.

Mrs. Prajakta Jadhav1, Mrs. Shweta Suryawanshi2, Mr. Devendra Jadhav3


“AUTOMATED VIDEO SURVEILLANCE ROBOT” International
Research Journal of Engineering and Technology (IRJET) Volume: 04 Issue: 05
| May -2017

Automation in Surveillance robot. This paper is presented by Prajakta


Jadhav, Shweta Suryawanshi, Mr. Devendra Jadhav. In this paper, the authors
discuss the approaches in the automation and how to make it possible. It also
mentions the storing the data in a minimal space. Most of the idle data where no
event takes place occupies the storage and also the operator has to go through
the entire footage to identify the particular incident. So, by using Smart
surveillance robot systems, this time-consuming task can be reduced. This
automation in surveillance robot can be achieved through Smart surveillance
robot monitoring system.

10
Prashant Balraj Balla , K.T.Jadhao “IOT BASED FACIAL RECOGNITION
SECURITY SYSTEM” International Conference on Smart City and Emerging
Technology (ICSCET) Volume:01 Issue:04| May- 2018.

IoT Based Facial Recognition Security System. This paper is presented


by Prashanth Balraj Balla, K.T. Jadhao. The main purpose of this paper is to set
as an alert for home visitors and provide information about the visitors in a
dynamic website and phone application. The alerts are sent based on the data
acquisition using sensors and the alerts of intrusion or thefts, will be sent to the
registered user along with the picture of the incident using a camera module.

M. Van Der Werff, X. Gui and W.L. xu, “A MOBILE BASED HOME
AUTOMATION SYSTEM,” 2005 2nd Asia pacific conference on Mobile
Technology, Applications and systems, 2005, pp.5, doi:
10.1109/MTAS.2005.207158.

A mobile-based home automation system. This paper presented by M.


van Der Werff, X Gui, W.L. Xu, Massey University, New Zealand; They
presented a system that included a java-enabled phone, a cellular modem, and a
controller board with a microcontroller. A user can interact with the home
automation system using their cell phone as a remote control.

A. Alheraish, “DESIGN AND IMPLEMENTATION OF HOME


AUTOMATION SYSTEM,” in IEEE Transactions on consumer
Electronics,vol.50,no.4,pp.1087-1092,nov.2004,doi:
10.1109/TCE.2004.1362503.

[7]. Design and Implementation of Home Automation System. This paper


presented by A. Alheraish, Member, IEEEA remotecontrol system is designed

11
and implemented using the GSM cellular connection network. This design
incorporates the controlled device, the microcontroller, and the GSM Module,
allowing it to be used in a variety of applications. Instead of a microcontroller,
the proposed M2M system in this study uses a PC as the terminal user.

Y. Gu et al., “DESIGN AND IMPLEMENTATION OF UPNP-BASED


SURVEILLANCE ROBOT CAMERA SYSTEM FOR HOME
SECURITY”,2013 International conference on information science and
Applications(ICISA),2013,pp.4,doi:10.1109/ICISA.2013. 6698209

Design and Implementation of UPnP-Based Surveillance robot Camera


System for Home Security. This paper is presented by Yi Gu, Myoungjin Kim
Division of Internet & Multimedia Engineering, Konkuk University, Seoul,
South Korea. The main focus of this article is on the rapid development of
mobile devices and Internet services, and how these devices and services might
be used to manage home security. We propose the UPnPbased Security Camera
System (USCS), which uses UPnP technology to search, operate, and
administer IP-based cameras, to broaden the range of usability of traditional
home surveillance robot cameras.

A. Jain, S. Basantwani, O. Kazi and Y. Bang, “ SMART SURVEILLANCE


ROBOT MONITORING SYSTEM,”2017 international conference on Data
Management ,Analytics and innovation (ICDMAI),2017,pp.269-273,doi:
10.1109/ICDMAI.2107.

Smart surveillance robot monitoring system. This paper is presented by


Akshat Jain, Owais Kazi Computer Engineering Department, Pune Institute of

12
Computer Technology, Pune, India. The primary goal of this article is to
demonstrate that in today's world, when everyone wants to keep their assets safe
and secure, video surveillance robot for viewing a specific region has become a
need. To address this issue, we developed a smart monitoring system for
locations such as bank vaults and houses where human presence is not
available. It is not necessary to continuously monitor the area with cameras in
such situations. This consumes both the power and the storage space required
for the footages. Using a PIR sensor, our system will detect human presence.
For remote sensing and surveillance robot, Raspberry Pi operates and controls
motiondetecting sensors and video cameras, transmits live video and records it
for later viewing.

B. Van Thanh Trung and N. Van Cuong, “MONITORING AND


CONTROLLING DEVICES SYSTEM BY GPRS ON FPGA
PLATFORM”, 2013 International conference on Advanced Technologies for
communications (ATC 2013), 2013, pp.713-717

Monitoring and controlling devices system by GPRS on FPGA platform.


This paper is presented by Nguyen Van Cuong, Bui Van Thanh Trung. The
major goal of this work is to provide a novel method for controlling and
monitoring household appliances via GPRS utilizing an embedded system on an
FPGA platform with the microprocessor Micro Flame and the real-time
operating system Free RTOS, as well as using a PIR sensor to detect break-ins.

13
CHAPTER 3

EXISTING SYSTEM

An embedded system is a special-purpose computer system that is


designed to execute one or a few specific functions, often under time
limitations. It's frequently found as part of a larger gadget that includes both
hardware and mechanical components. A general-purpose computer, such as a
personal computer, on the other hand, can do a wide range of functions
depending on the programming. Embedded systems have become increasingly
significant in today's world, as they manage many of the items we use on a daily
basis.

An embedded system is a set of computer hardware and software that is


either fixed in capabilities or programmable and is built for a certain type of
application device. Embedded systems can be found in a variety of places,
including industrial machines, automobiles, medical equipment, cameras,
household appliances, aeroplanes, vending machines, and toys (in addition to
the more visible cellular phone and PDA). A programming interface is provided
for programmable embedded systems, and embedded systems programming is a
specialist vocation. Embedded Java and Windows XP Embedded, for example,
are operating systems and language platforms specifically designed for the
embedded market.

Here, to control the usage of security guard, the robot was designed with
flipper arm mechanism, camera, Wi-Fi module and some sensors like
ultrasonic, thermal and sound. This robot can be operated through Arduino
UNO.

The surveillance robot robot is designed to be multitasking, cost efficient


and feasible machine that can be implemented for the military purpose. These
machines replace the Indian army soldiers and dogs that are used at the borders

14
during the time of war saving the lives from opponents or enemy nations and
from environmental condition such as extreme cold and heat.

The security paradigm has shifted from "investigation of occurrences" to


"prevention of potentially catastrophic incidents" as a result of recent global
events. Existing digital video surveillance robot systems simply provide the
technology for capturing, storing, and distributing video, leaving danger
detection to human operators alone. Surveillance robot video monitoring by
humans is a time-consuming task. It's widely acknowledged that monitoring
video feeds necessitates a higher level of visual focus than most other tasks.
Specifically, vigilance, or the ability to pay attention and react to unusual
events, is exceedingly difficult and prone to inaccuracy due to attention lapses.

DISADVANTAGES

 Less efficient because of controller based control


 Less accurate and
 High limitation in the existing techniques

15
CHAPTER 4

PROPOSED SYTEM

In this project, we'll use the ESP32-CAM to create a surveillance robot


system that detects the presence of illegal people. With the ESP32-S chip, the
ESP32-CAM is an extremely compact camera module. We can build a face
recognition system using the ESP32- CAM module without any complex
programming or additional components. We're going to use an ESP32 camera
with IR sensors and an Arduino Uno in this system. If the sensors detect an
illegal person entering, an alarm will be sent to the individuals via GSM
module, as well as buzzer alerts at the surveillance robot system's premises.

The proposed functionalities of the design; we divide the system into two
main units: data acquisition and system control. The data acquisition is
modelled using the Arduino, IR sensor. Control system is through single-chip
microcomputer controlling the ESP Camera, then the real-time display of the
received information is achieved using ESPCamera.

• In this project, we'll use the ESP32-CAM to create a surveillance robot


system that detects the presence of illegal people.

• With the ESP32-S chip, the ESP32-CAM is an extremely compact


camera module.

• We can build a web system using the ESP32- CAM module without any
complex programming or additional components.

• Solar with battery power system will operate the visual surveillance robot
system.

16
A surveillance robot using ESP32-CAM is a system that utilizes the
ESP32-CAM board and a robot chassis to create a mobile surveillance device.
The ESP32-CAM is a low-cost development board that integrates a small
camera module and Wi-Fi connectivity.

The robot chassis allows the device to move around and capture video in
different locations. The system can be controlled through a Arduino NANO
based Bluetooth Control APK and PC interface based object detection
surveillance on the ESP32-CAM board. The PC interface allows the user to
monitor and bluetooth control the robot's movement, view live video streams,
and take snapshots of the video feed.

BLOCK DIAGRAM:

Fig. Proposed Block Diagram

ARDUINO NANO

The Arduino Nano V3 is a small, complete, and breadboard-friendly


board based on the ATmega328P. It lacks only a DC power jack and works with
a Mini-B USB cable instead of a standard one. The Nano Board R3 with CH340
chip without USB Cable chipboard is based on the famous Arduino platform
and does all the functions of Uno, but with a smaller footprint. The Nano Board
R3 with CH340 chip without USB Cable is vital for your small project where
you don’t need much of pin-outs but the small size is very important to make it
look good.

ESP32 CAM

17
The ESP32-CAM is a development board with an ESP32-S chip, an
OV2640 camera, microSD card slot and several GPIOs to connect peripherals.
ESP integrates WiFi, traditional Bluetooth, and BLE Beacon, with 2 high-
performance 32-bit LX6 CPUs, 7-stage pipeline architecture. It has the main
frequency adjustment range of 80MHz to 240MHz, on-chip sensor, Hall sensor,
temperature sensor, etc.

Fig. ESP32 Cam

ROBOTIC MODULE

The fundamental idea behind a wheeled or track robot lies in it's drive
mechanism – differential drive and skid drive. Differential drive robots have 2
wheels and one or two caster wheels/balls, while skid steer drive robots have
either tracks, or 4 or more wheels. Differential drives robots are simpler to build
and control, but that skid steer drive robots, especially track robots look more
cool.

18
Fig. Robotic Frame

19
BATTERY
(12V/ 1.2A – LEAD ACID)

• To provide the infinite network lifetime to the WSN nodes.

• The ambient light energy from the sun is harvested by the solar modules
and renewed into electrical energy (D.C. voltage).

• This D.C. voltage can be directly applied to power the WSN node load or
can be stored in a rechargeable battery for later use.

• This D.C. power obtained from solar energy is unregulated, and therefore,
we need voltage regulation/ power conditioning circuits.

Fig. Battery

20
BLUETOOTH

Fig. Bluetooth Module

HC-05 6 Pin Wireless Serial Bluetooth Module is a Bluetooth module for use
with any microcontroller. It uses the UART protocol to make it easy to send
and receive data wirelessly. The HC-06 module is a slave only device. This
means that it can connect to most phones and computers with Bluetooth but it
cannot connect to another slave-only device such as keyboards and other HC-06
modules. To connect with other slave devices a master module would be
necessary such as the HC-05 version which can do both master and slave.

L298N DRIVER

L298N 2A Based Motor Driver is a high power motor driver perfect for
driving DC Motors and Stepper Motors. It uses the popular L298 motor driver
IC and has an onboard 5V regulator which it can supply to an external circuit. It
can control up to 4 DC motors, or 2 DC motors with directional and speed
control. This motor driver is perfect for robotics and mechatronics projects and
perfect for controlling motors from microcontrollers, switches, relays, etc.
Perfect for driving DC and Stepper motors for micro mouse, line following
robots, robot arms, etc.

21
Fig. Driver Module

In conclusion, the surveillance robot using ESP32-CAM is a promising project


that can be used for various applications, such as monitoring and surveillance of
homes or offices. The ESP32-CAM module provides a compact and cost-
effective solution for capturing images and streaming video.

22
CHAPTER 5

SYSTEM REQUIREMENTS

HARDWARE REQUIREMENTS

 ESP32 Cam
 Arduino NANO
 LCD Display
 Robot Model
 Battery
 Charge Controller
 Power Supply

SOFTWARE REQUIREMENTS

 Arduino IDE 1.8 (Embedded C Programming)

23
HARDWARE DESIGN

Power Supply

A power supply (sometimes known as a power supply unit or PSU) is a


device or system that supplies electrical or other types of energy to an output
load or group of loads. The term is most commonly applied to electrical energy
supplies, less often to mechanical ones, and rarely to others.

This circuit is a small +5V power supply, which is useful when


experimenting with digital electronics. Small inexpensive wall transformers
with variable output voltage are available from any electronics shop and
supermarket. Those transformers are easily available, but usually their voltage
regulation is very poor, which makes then not very usable for digital circuit
experimenter unless a better regulation can be achieved in some way. The
following circuit is the answer to the problem.

5V Power Supply

Transformer

A transformer is a device that transfers electrical energy from one circuit


to another through inductively coupled wires. A changing current in the first
circuit (the primary) creates a changing magnetic field; in turn, this magnetic

24
field induces a changing voltage in the second circuit (the secondary). By
adding a load to the secondary circuit, one can make current flow in the
transformer, thus transferring energy from one circuit to the other. The
secondary induced voltage VS is scaled from the primary VP by a factor ideally
equal to the ratio of the number of turns of wire in their respective windings:

By appropriate selection of the numbers of turns, a transformer thus


allows an alternating voltage to be stepped up — by making NS more than NP
or stepped down, by making it less.

A key application of transformers is to reduce the current before


transmitting electrical energy over long distances through wires. Most wires
have resistance and so dissipate electrical energy at a rate proportional to the
square of the current through the wire. By transforming electrical power to a
high-voltage, and therefore low-current form for transmission and back again
afterwards, transformers enable the economic transmission of power over long
distances. Consequently, transformers have shaped the electricity supply
industry, permitting generation to be located remotely from points of demand.
All but a fraction of the world's electrical power has passed through a series of
transformers by the time it reaches the consumer.

Transformers are some of the most efficient electrical 'machines', with


some large units able to transfer 99.75% of their input power to their output.
Transformers come in a range of sizes from a thumbnail-sized coupling
transformer hidden inside a stage microphone to huge gigavolt-ampere-rated
units used to interconnect portions of national power grids. All operate with the
same basic principles, though a variety of designs exist to perform specialized
roles throughout home and industry.

25
The transformer is based on two principles: first, that an electric current
can produce a magnetic field (electromagnetism) and, second, that a changing
magnetic field within a coil of wire induces a voltage across the ends of the coil
(electromagnetic induction). By changing the current in the primary coil, one
changes the strength of its magnetic field; since the secondary coil is wrapped
around the same magnetic field, a voltage is induced across the secondary.

An ideal step-down transformer

A simplified an ideal step-down transformer design is shown in the above


figure. A current passing through the primary coil creates a magnetic field. The
primary and secondary coils are wrapped around a core of very high magnetic
permeability, such as iron; this ensures that most of the magnetic field lines
produced by the primary current are within the iron and pass through the
secondary coil as well as the primary coil.

Rectifier

A rectifier is an electrical device that converts alternating current (AC),


which periodically reverses direction, to direct current (DC), which flows in
only one direction. The process is known as rectification. Rectifiers are used as

26
components of power supplies and as detectors of radio signals. Mainly there
are three types of rectifier i.e. half wave rectifier, full wave rectifier and Bridge
Rectifier.

Bridge Rectifier

A diode bridge is an arrangement of four (or more) diodes in a bridge


circuit configuration that provides the same polarity of output for either polarity
of input. When used in its most common application, for conversion of an
alternating current (AC) input into a direct current (DC) output, it is known as a
bridge rectifier. A bridge rectifier provides full-wave rectification from a two-
wire AC input, resulting in lower cost and weight as compared to a rectifier
with a 3-wire input from a transformer with a center-tapped secondary winding.
The essential feature of a diode bridge is that the polarity of the output is the
same regardless of the polarity at the input.

Basic operation

According to the conventional model of current flow, current is defined to


be positive when it flows through electrical conductors from the positive to the
negative pole. In actuality, free electrons in a conductor nearly always flow
from the negative to the positive pole. In the vast majority of applications,
however, the actual direction of current flow is irrelevant. Therefore, in the
discussion below the conventional model is retained.

27
Operation of bridge rectifier

In each case, the upper right output remains positive and lower right
output negative. Since this is true whether the input is AC or DC, this circuit not
only produces a DC output from an AC input, it can also provide what is
sometimes called "reverse polarity protection". That is, it permits normal
functioning of DC-powered equipment when batteries have been installed
backwards, or when the leads (wires) from a DC power source have been
reversed, and protects the equipment from potential damage caused by reverse
polarity.

IC Voltage Regulators

Voltage regulators comprise a class of widely used ICs. Regulator IC


units contain the circuitry for reference source, comparator amplifier, control
device, and overload protection all in a single IC. Although the internal
construction of the IC is somewhat different from that described for discrete
voltage regulator circuits, the external operation is much the same. IC units
provide regulation of either a fixed positive voltage, a fixed negative voltage, or
an adjustable set voltage. A power supply can be built using a transformer
connected to the ac supply line to step the ac voltage to desired amplitude, then
rectifying that ac voltage, filtering with a capacitor and RC filter, if desired, and
finally regulating the dc voltage using an IC regulator. The regulators can be

28
selected for operation with load currents from hundreds of milliamperes to tens
of amperes, corresponding to power ratings from milliwatts to tens of watts.

Three-Terminal Voltage Regulators

Three-Terminal Voltage Regulators

Figure shows the basic connection of a three-terminal voltage regulator


IC to a load. The fixed voltage regulator has an unregulated dc input voltage, Vi,
applied to one input terminal, a regulated output dc voltage, Vo, from a second
terminal, with the third terminal connected to ground. For a selected regulator,
IC device specifications list a voltage range over which the input voltage can
vary to maintain a regulated output voltage over a range of load current. The
specifications also list the amount of output voltage change resulting from a
change in load current (load regulation) or in input voltage (line regulation).
The series 78 regulators provide fixed regulated voltages from 5 to 24 V. Figure
shows how one such IC, a 7805, is connected to provide voltage regulation with
output from this unit of +5V dc. An unregulated input voltage V is filtered by
capacitor C1 and connected to the IC’s IN terminal. The IC’s OUT terminal
provides a regulated + 12V which is filtered by capacitor C2 (mostly for any
high-frequency noise). The third IC terminal is connected to ground (GND).
While the input voltage may vary over some permissible voltage range, and the
output load may vary over some acceptable range, the output voltage remains
constant within specified voltage variation limits. These limitations are spelled

29
out in the manufacturer’s specification sheets. There are two types of voltage
regulator they are 78xx series and 79xx series.

78xx series

There are common configurations for 78xx ICs, including 7805 (5 V),
7806 (6 V), 7808 (8 V), 7809 (9 V), 7810 (10 V), 7812 (12 V), 7815 (15 V),
7818 (18 V), and 7824 (24 V) versions. The 7805 is the most common, as its
regulated 5-volt supply provides a convenient power source for most TTL
components.

Less common are lower-power versions such as the LM78Mxx series


(500 mA) and LM78Lxx series (100 mA) from National Semiconductor. Some
devices provide slightly different voltages than usual, such as the LM78L62
(6.2 volts) and LM78L82 (8.2 volts) as well as the STMicroelectronics
L78L33ACZ (3.3 volts).

79xx series

The 79xx devices have a similar "part number" to "voltage output"


scheme, but their outputs are negative voltage, for example 7905 is -5 V and
7912 is -12 V. The 7912 has been a popular component in ATX power supplies,
and 7905 was popular component in ATX before -5 V was removed from the
ATX specification.

Positive Voltage Regulators in 7800 series

IC Part Output Voltage (V) Vi (V)

7805 +5 7.3
7806 +6 8.3
7808 +8 10.5

30
7810 +10 12.5

7812 +12 13.6


7815 +15 17.7
7818 +18 21.0
7824 +24 27.1

ESP32

ESP32-S3 is a low-power MCU-based system-on-chip (SoC) that


supports 2.4 GHz Wi-Fi and Bluetooth® Low Energy (Bluetooth LE). It
consists of high-performance dual-core microprocessor (Xtensa® 32-bit LX7), a
low power coprocessor, a Wi-Fi baseband, a Bluetooth LE baseband, RF
module, and peripherals. The block diagram of the SoC is shown below.

31
Figure 1: Block Diagram of ESP32S3

SOLUTION HIGHLIGHTS

 A complete WiFi subsystem that complies with IEEE 802.11b/g/n


protocol and supports Station, SoftAP, and SoftAP + Station modes
 A Bluetooth LE subsystem that supports features of Bluetooth 5 and
Bluetooth mesh
32
 Highly integrated RF module that provides industry-leading power and
RF performance
 State of the art power management designed for a wide range of
applications with its multiple low-power modes. The ULP coprocessor
can operate in ultra-low-power mode.
 Powerful storage capacities ensured by 512 KB SRAM and 384 KB
ROM on the chip, and SPI, Dual SPI, Quad SPI, Octal SPI, QPI, and OPI
interfaces that allow connection to flash and external RAM
 Rich set of peripheral interfaces and GPIOs, ideal for various
scenarios and complex applications

FEATURES

WiFi

 IEEE 802.11 b/g/n-compliant


 Supports 20 MHz, 40 MHz bandwidth in 2.4 GHz band
 Wi-Fi Multimedia (WMM)
 TX/RX A-MPDU, TX/RX A-MSDU
 Immediate Block ACK
 Fragmentation and defragmentation
 Automatic Beacon monitoring (hardware TSF)
 4 × virtual Wi-Fi interfaces
 Simultaneous support for Infrastructure BSS in Station, SoftAP, or
Station
 SoftAP modes Note that when ESP32-S3 scans in Station mode, the
SoftAP channel will change along with the Station channel
 Antenna diversity
 802.11mc FTM
 External PA is supported
33
ESP32 - NodeMCU

BLUETOOTH

 Bluetooth LE: Bluetooth 5, Bluetooth mesh


 High power mode (20 dBm, share the same PA with Wi-Fi)
 Speed: 125 Kbps, 500 Kbps, 1 Mbps, 2 Mbps
 Advertising extensions
 Multiple advertisement sets
 Channel selection algorithm #2
 Internal co-existence mechanism between Wi-Fi and Bluetooth to share
the same antenna

CPU AND MEMORY

 Xtensa® dual-core 32-bit LX7 microprocessor, up to 240 MHz


 CoreMark® score:
- 1 core at 240 MHz: 613.86 CoreMark; 2.56 CoreMark/MHz
- 2 cores at 240 MHz: 1181.60 CoreMark; 4.92 CoreMark/MHz

34
 128-bit data bus and SIMD commands
 384 KB ROM
 512 KB SRAM
 16 KB SRAM in RTC
 SPI, Dual SPI, Quad SPI, Octal SPI, QPI and OPI interfaces that allow
connection to multiple flash and external RAM
 Flash controller with cache is supported
 Flash in-Circuit Programming (ICP) is supported

ESP32 DEVKIT DOIT

ESP32 DEVKIT DOIT board as a reference. But the information on this


page is also compatible with other ESP32 development boards with the ESP-
WROOM-32 chip.

SPECIFICATIONS

When it comes to the ESP32 chip specifications, find that:

 The ESP32 is dual core; this means it has 2 processors.


 It has Wi-Fi and bluetooth built-in.
 It runs 32 bit programs.
 The clock frequency can go up to 240MHz and it has a 512 kB RAM.
 This particular board has 30 or 36 pins, 15 in each row.
 It also has wide variety of peripherals available, like: capacitive touch,
ADCs, DACs, UART, SPI, I2C and much more.
 It comes with built-in hall effect sensor and built-in temperature sensor.

35
SPECIFICATIONS – ESP32 DEVKIT V1 DOIT

Number of cores 2 (dual core)

Wi-Fi 2.4 GHz up to 150 Mbits/s

Bluetooth BLE (Bluetooth Low Energy) and legacy Bluetooth

Architecture 32 bits

Clock frequency Up to 240 MHz

RAM 512 KB

Pins 30 or 36 (depends on the model)

Peripherals ADC (analog to digital converter),

DAC (digital to analog converter),

I2C (Inter-Integrated Circuit),

UART (universal asynchronous receiver/transmitter),

CAN 2.0 (Controller Area Network),

SPI (Serial Peripheral Interface),

I2S (Integrated Inter-IC Sound),

PWM (pulse width modulation), and more.

36
ESP32 PINOUT GUIDE

The ESP32 has more GPIOs with more functionality compared to the
ESP826. With the ESP32 you can decide which pins are UART, I2C, or SPI –
you just need to set that on the code. This is possible due to the ESP32 chip’s
multiplexing feature that allows to assign multiple functions to the same pin. If
you don’t set them on the code, the pins will be used as default – as shown in
the figure below (the pin location can change depending on the manufacturer).

The core of this module is the ESP32 chip, which is scalable and
adaptive. Two CPU cores can be individually controlled. The clock frequency is
adjustable from 80 MHz to 240 MHz and supports RTOS. It is a general-
purpose Wi-Fi+BT+BLE MCU module.ESP-WROOM-32s. The module
integrates traditional Bluetooth, Bluetooth low energy and Wi-Fi. Wide range of
uses: Wi-Fi supports a wide range of communication connections, as well as
direct connection to the Internet via a router; Bluetooth allows users to connect
to a mobile phone or broadcast a BLE Beacon for signal detection. The module
supports data rates up to 150 Mbps and antenna output power of 20 dBm for
maximum wireless communication. As a result, this module has industry-
leading specifications and performs well in terms of high integration, wireless
transmission distance, power consumption, and network connectivity.

37
ESP32 V1.1 38Pin NodeMCU Pin Diagram

38
ARDUINO:
Introduction:
Arduino is an open source platform for prototyping based on user-
friendly software. It provides a flexible base for engineers to experiment on
designing interactive environments. They can be programmed for specific
applications to create embedded systems which can control and sense real
time parameters. It consists of a microcontroller ATmega328 which is
programmed using the arduino software. The Arduino R3/Genuino R3 is the
Indian version of the Arduino Uno Board with an Arduino Uno Boot loader. It
behaves like the arduino board and programmed using the arduino IDE.
 Its main components are
 14 digital input/output pins ( 6 can be used as PWM outputs)
 6 analog inputs(can also be used for digital I/O - so a total of 20 digital
I/O's)
 16 MHz crystal oscillator
 USB connection
 ICSP header
 reset button

List of On-Board Peripherals

Function Peripheral Pin number

Digital In-Built Output 1 LED 13

Digital I-O Pins - 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13

PWM Output - 3, 5, 6, 9, 10, 11

Serial Communication - 0,1

39
Analog Input - A0. A1, A2,m A3, A4, A5

THE MICROCONTROLLER
The Arduino R3 comes with an ATmega 328 Microcontroller with an
Arduino Uno Bootloader. The Bootloader facilitates the Programming of the
IC from within the Arduino IDE.

Fig.: Microcontroller AT328-Pin Diagram

Memory
Memory can be broadly divided into 3 classes:
 32KB Flash memory –This is the storage space of the compiled
program of which the boot loader uses 0.5 KB.
 2KB SRAM – This is mainly used during run time.
 1KB EEPROM –This is used for storing data that should not be
erased upon switching off power.
Power Setup

40
The Arduino R3 operates at 5 Volts. It can either be powered through
USB cable from the computer or through the DC jack provided on the Board.
The DC Jack
The voltage regulator 7805 is provided in the board for obtaining 5v
regulated output voltage. The input voltage applied can be between 7-25 volts
DC power.
USB Power
When powered through the USB, the 500mA Re-settable fuse on the USB
power line is used to abstain the board from drawing current in excess.
USB Connectivity
Since the ATmega328 does not use USB communication directly, the
need for a dedicated IC arises. FTDI FT232 IC is used to communicate
between the microcontroller and USB serially .The drivers required for the
Serial to USB converter has to be installed.

Summary
Microcontroller - ATmega328
Operating Voltage - 5V
Input Voltage - 7-12V
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
Flash Memory - 32 KB (ATmega328) of which 0.5 KB used
by Bootloader
SRAM - 2 KB (ATmega328)
EEPROM - 1 KB (ATmega328)

41
Clock Speed - 16 MHz

Arduino Pin Mapping

Hardware
The Arduino R3 / Arduino Uno Boards have 20 programmable I/O's.They
are grouped mainly as
 Pins 0 to 13
 Pins 0 to 5 [Analog Inputs 0 to 5]
Digital I/O's
The 20 I/O’s can accept digital signals as input as well as outputs. The
digital pins are numbered from 0 to 19.The Digital Pins can be used for
controlling LED's, Relays and for accepting input from Push-Buttons, Digital
Sensors
Analog I/O's
Analog inputs can be given to pins A0-A5.An inbuilt ADC analog to
digital converter is present that converts analog voltages in the range of 0 to 5
volts to a 10-bit value. Analog sensors that sense changes in temperature or
light can work with these inputs.

42
Analog Output
The six pins marked PWM are pins dedicated to produce Analog Output
Signal. They can produce analog voltages in the range of 0 to 5 volts with
a resolution of 8-bits. They can be used for Intensity Control, Speed Control,
Etc.

43
SOFTWARE DESIGN

ARDUINO

Arduino is an open-source electronics platform based on easy-to-use


hardware and software. Arduino boards are able to read inputs - light on a
sensor, a finger on a button, or a Twitter message - and turn it into an output -
activating a motor, turning on an LED, publishing something online. You can
tell your board what to do by sending a set of instructions to the microcontroller
on the board. To do so you use the Arduino programming language (based on
Wiring), and the Arduino Software (IDE), based on Processing.

Over the years Arduino has been the brain of thousands of projects, from
everyday objects to complex scientific instruments. A worldwide community of
makers - students, hobbyists, artists, programmers, and professionals - has
gathered around this open-source platform, their contributions have added up to
an incredible amount of accessible knowledge that can be of great help to
novices and experts alike.

Arduino was born at the Ivrea Interaction Design Institute as an easy tool
for fast prototyping, aimed at students without a background in electronics and
programming. As soon as it reached a wider community, the Arduino board
started changing to adapt to new needs and challenges, differentiating its offer
from simple 8-bit boards to products for IoT applications, wearable, 3D
printing, and embedded environments. All Arduino boards are completely open-
source, empowering users to build them independently and eventually adapt
them to their particular needs. The software, too, is open-source, and it is
growing through the contributions of users worldwide.

44
FEATURES

Inexpensive - Arduino boards are relatively inexpensive compared to


other microcontroller platforms. The least expensive version of the Arduino
module can be assembled by hand, and even the pre-assembled Arduino
modules cost less than \$50

Cross-platform - The Arduino Software (IDE) runs on Windows,


Macintosh OSX, and Linux operating systems. Most microcontroller systems
are limited to Windows.

Simple, clear programming environment - The Arduino Software


(IDE) is easy-to-use for beginners, yet flexible enough for advanced users to
take advantage of as well. For teachers, it's conveniently based on the
Processing programming environment, so students learning to program in that
environment will be familiar with how the Arduino IDE works.

Open source and extensible software - The Arduino software is


published as open source tools, available for extension by experienced
programmers. The language can be expanded through C++ libraries, and people
wanting to understand the technical details can make the leap from Arduino to
the AVR C programming language on which it's based. Similarly, you can add
AVR-C code directly into your Arduino programs if you want to.

Open source and extensible hardware - The plans of the Arduino


boards are published under a Creative Commons license, so experienced circuit
designers can make their own version of the module, extending it and
improving it. Even relatively inexperienced users can build the breadboard
version of the module in order to understand how it works and save money.

45
ARDUINO SOFTWARE (IDE)

The Arduino Integrated Development Environment - or Arduino Software


(IDE) - contains a text editor for writing code, a message area, a text console, a
toolbar with buttons for common functions and a series of menus. It connects to
the Arduino hardware to upload programs and communicate with them.

Writing Sketches

Programs written using Arduino Software (IDE) are called sketches.


These sketches are written in the text editor and are saved with the file
extension .ino. The editor has features for cutting/pasting and for
searching/replacing text. The message area gives feedback while saving and
exporting and also displays errors. The console displays text output by the
Arduino Software (IDE), including complete error messages and other
information. The bottom righthand corner of the window displays the
configured board and serial port. The toolbar buttons allow you to verify and
upload programs, create, open, and save sketches, and open the serial monitor.

46
Arduino IDE

 Verify Checks your code for errors compiling it.


 Upload Compiles your code and uploads it to the configured board. See
uploading below for details. Note: If you are using an external
programmer with your board, you can hold down the "shift" key on your
computer when using this icon. The text will change to "Upload using
Programmer"
 New Creates a new sketch.
 Open Presents a menu of all the sketches in your sketchbook. Clicking
one will open it within the current window overwriting its content.
 Save Saves your sketch.
 Serial Monitor Opens the serial monitor.

47
Arduino IDE Tool Icon

Additional commands are found within the five menus: File, Edit, Sketch,
Tools, Help. The menus are context sensitive, which means only those items
relevant to the work currently being carried out are available.

File

 New Creates a new instance of the editor, with the bare minimum
structure of a sketch already in place.
 Open Allows to load a sketch file browsing through the computer drives
and folders.
 Open Recent Provides a short list of the most recent sketches, ready to be
opened.
 Sketchbook Shows the current sketches within the sketchbook folder
structure; clicking on any name opens the corresponding sketch in a new
editor instance.
 Examples Any example provided by the Arduino Software (IDE) or
library shows up in this menu item. All the examples are structured in a
tree that allows easy access by topic or library.

48
 Close Closes the instance of the Arduino Software from which it is
clicked.
 Save Saves the sketch with the current name. If the file hasn't been
named before, a name will be provided in a "Save as.." window.
 Save as... Allows to save the current sketch with a different name.
 Page Setup It shows the Page Setup window for printing.
 Print Sends the current sketch to the printer according to the settings
defined in Page Setup.
 Preferences Opens the Preferences window where some settings of the
IDE may be customized, as the language of the IDE interface.
 Quit Closes all IDE windows. The same sketches open when Quit was
chosen will be automatically reopened the next time you start the IDE.

Edit

 Undo/Redo Goes back of one or more steps you did while editing; when
you go back, you may go forward with Redo.
 Cut Removes the selected text from the editor and places it into the
clipboard.
 Copy Duplicates the selected text in the editor and places it into the
clipboard.
 Copy for Forum Copies the code of your sketch to the clipboard in a
form suitable for posting to the forum, complete with syntax coloring.
 Copy as HTML Copies the code of your sketch to the clipboard as
HTML, suitable for embedding in web pages.
 Paste Puts the contents of the clipboard at the cursor position, in the
editor.
 Select All Selects and highlights the whole content of the editor.

49
 Comment/Uncomment Puts or removes the // comment marker at the
beginning of each selected line.
 Increase/Decrease Indent Adds or subtracts a space at the beginning of
each selected line, moving the text one space on the right or eliminating a
space at the beginning.
 Find Opens the Find and Replace window where you can specify text to
search inside the current sketch according to several options.
 Find Next Highlights the next occurrence - if any - of the string specified
as the search item in the Find window, relative to the cursor position.
 Find Previous Highlights the previous occurrence - if any - of the string
specified as the search item in the Find window relative to the cursor
position.

Sketch

 Verify/Compile Checks your sketch for errors compiling it; it will report
memory usage for code and variables in the console area.
 Upload Compiles and loads the binary file onto the configured board
through the configured Port.
 Upload Using Programmer This will overwrite the bootloader on the
board; you will need to use Tools > Burn Bootloader to restore it and be
able to Upload to USB serial port again. However, it allows you to use
the full capacity of the Flash memory for your sketch. Please note that
this command will NOT burn the fuses. To do so a Tools -> Burn
Bootloader command must be executed.
 Export Compiled Binary Saves a .hex file that may be kept as archive or
sent to the board using other tools.
 Show Sketch Folder Opens the current sketch folder.

50
 Include Library Adds a library to your sketch by inserting #include
statements at the start of your code. For more details, see libraries below.
Additionally, from this menu item you can access the Library Manager
and import new libraries from .zip files.
 Add File... Adds a source file to the sketch (it will be copied from its
current location). The new file appears in a new tab in the sketch window.
Files can be removed from the sketch using the tab menu accessible
clicking on the small triangle icon below the serial monitor one on the
right side o the toolbar.

Tools

 Auto Format This formats your code nicely: i.e. indents it so that
opening and closing curly braces line up, and that the statements inside
curly braces are indented more.
 Archive Sketch Archives a copy of the current sketch in .zip format. The
archive is placed in the same directory as the sketch.
 Fix Encoding & Reload Fixes possible discrepancies between the editor
char map encoding and other operating systems char maps.
 Serial Monitor Opens the serial monitor window and initiates the
exchange of data with any connected board on the currently selected Port.
This usually resets the board, if the board supports Reset over serial port
opening.
 Board Select the board that you're using. See below for descriptions of
the various boards.
 Port This menu contains all the serial devices (real or virtual) on your
machine. It should automatically refresh every time you open the top-
level tools menu.

51
 Programmer For selecting a hardware programmer when programming a
board or chip and not using the onboard USB-serial connection. Normally
you won't need this, but if you're burning a bootloader to a new
microcontroller, you will use this.
 Burn Bootloader The items in this menu allow you to burn a bootloader
onto the microcontroller on an Arduino board. This is not required for
normal use of an Arduino board but is useful if you purchase a new
ATmega microcontroller (which normally comes without a bootloader).
Ensure that you've selected the correct board from the Boards menu
before burning the bootloader on the target board. This command also set
the right fuses.

Help

Here you find easy access to a number of documents that come with the
Arduino Software (IDE). You have access to Getting Started, Reference, this
guide to the IDE and other documents locally, without an internet connection.
The documents are a local copy of the online ones and may link back to our
online website.

Find in Reference This is the only interactive function of the Help menu:
it directly selects the relevant page in the local copy of the Reference for the
function or command under the cursor.

Sketchbook

The Arduino Software (IDE) uses the concept of a sketchbook: a standard


place to store your programs (or sketches). The sketches in your sketchbook can
be opened from the File > Sketchbook menu or from the Open button on the
toolbar. The first time you run the Arduino software, it will automatically create

52
a directory for your sketchbook. You can view or change the location of the
sketchbook location from with the Preferences dialog.

 Tabs, Multiple Files, and Compilation

Allows you to manage sketches with more than one file (each of which
appears in its own tab). These can be normal Arduino code files (no visible
extension), C files (.c extension), C++ files (.cpp), or header files (.h).

Before compiling the sketch, all the normal Arduino code files of the
sketch (.ino, .pde) are concatenated into a single file following the order the tabs
are shown in. The other file types are left as is.

Uploading

Before uploading your sketch, you need to select the correct items from
the Tools > Board and Tools > Port menus. The boards are described below. On
the Mac, the serial port is probably something like /dev/tty.usbmodem241 (for
an Uno or Mega2560 or Leonardo) or /dev/tty.usbserial-1B1 (for a
Duemilanove or earlier USB board), or /dev/tty.USA19QW1b1P1.1 (for a serial
board connected with a Keyspan USB-to-Serial adapter). On Windows, it's
probably COM1 or COM2 (for a serial board) or COM4, COM5, COM7, or
higher (for a USB board) - to find out, you look for USB serial device in the
ports section of the Windows Device Manager. On Linux, it should be
/dev/ttyACMx , /dev/ttyUSBx or similar. Once you've selected the correct serial
port and board, press the upload button in the toolbar or select the Upload item
from the Sketch menu. Current Arduino boards will reset automatically and
begin the upload. With older boards (pre-Diecimila) that lack auto-reset, you'll
need to press the reset button on the board just before starting the upload. On
most boards, you'll see the RX and TX LEDs blink as the sketch is uploaded.
The Arduino Software (IDE) will display a message when the upload is
complete, or show an error.

53
When you upload a sketch, you're using the Arduino bootloader, a small
program that has been loaded on to the microcontroller on your board. It allows
you to upload code without using any additional hardware. The bootloader is
active for a few seconds when the board resets; then it starts whichever sketch
was most recently uploaded to the microcontroller. The bootloader will blink
the on-board (pin 13) LED when it starts (i.e. when the board resets).

Libraries

Libraries provide extra functionality for use in sketches, e.g. working


with hardware or manipulating data. To use a library in a sketch, select it from
the Sketch > Import Library menu. This will insert one or more #include
statements at the top of the sketch and compile the library with your sketch.
Because libraries are uploaded to the board with your sketch, they increase the
amount of space it takes up. If a sketch no longer needs a library, simply delete
its #include statements from the top of your code.

There is a list of libraries in the reference. Some libraries are included


with the Arduino software. Others can be downloaded from a variety of sources
or through the Library Manager. Starting with version 1.0.5 of the IDE, you do
can import a library from a zip file and use it in an open sketch. See these
instructions for installing a third-party library.

Third-Party Hardware

Support for third-party hardware can be added to the hardware directory


of your sketchbook directory. Platforms installed there may include board
definitions (which appear in the board menu), core libraries, bootloaders, and
programmer definitions. To install, create the hardware directory, then unzip the
third-party platform into its own sub-directory. (Don't use "arduino" as the sub-

54
directory name or you'll override the built-in Arduino platform.) To uninstall,
simply delete its directory.

Serial Monitor

This displays serial sent from the Arduino board over USB or serial
connector. To send data to the board, enter text and click on the "send" button or
press enter. Choose the baud rate from the drop-down menu that matches the
rate passed to Serial.begin in your sketch. Note that on Windows, Mac or Linux
the board will reset (it will rerun your sketch) when you connect with the serial
monitor. Please note that the Serial Monitor does not process control characters;
if your sketch needs a complete management of the serial communication with
control characters, you can use an external terminal program and connect it to
the COM port assigned to your Arduino board.

Preferences

Some preferences can be set in the preferences dialog (found under the
Arduino menu on the Mac, or File on Windows and Linux). The rest can be
found in the preferences file, whose location is shown in the preference dialog.

Boards

The board selection has two effects: it sets the parameters (e.g. CPU
speed and baud rate) used when compiling and uploading sketches; and sets and
the file and fuse settings used by the burn bootloader command. Some of the
board definitions differ only in the latter, so even if you've been uploading
successfully with a particular selection you'll want to check it before burning the
bootloader.

Arduino Software (IDE) includes the built in support for the boards in the
following list, all based on the AVR Core. The Boards Manager included in the
standard installation allows to add support for the growing number of new

55
boards based on different cores like Arduino Due, Arduino Zero, Edison,
Galileo and so on.

STARTED WITH THE ARDUINO

The Arduino Nano is a small, complete, and breadboard-friendly board


based on the ATmega328P. It offers the same connectivity and specs of the
UNO board in a smaller form factor.

Arduino NANO Interface

The Arduino Nano is programmed using the Arduino Software (IDE), our
Integrated Development Environment common to all our boards and running
both online and offline. For more information on how to get started with the
Arduino Software visit the Getting Started page.

Open your first sketch

 Open the LED blink example sketch: File > Examples > 01.Basics >
Blink.

Select your board type and port

 Select Tools > Board > Arduino AVR Boards > Arduino Nano.

56
NOTE: We have updated the Nano board with a fresh bootloader. Boards
sold by us from January 2018 have this new bootloader, while boards
manufactured before that date have the old bootloader. First, check that Tools >
Board > Boards Manager shows you have the Arduino AVR Boards 1.16.21
or later installed. Then, to program the NEW Arduino NANO boards you need
to choose Tools > Processor > ATmega328P. To program old boards you need
to choose Tools > Processor > ATmega328P (Old Bootloader). If you get an
error while uploading or you are not sure which bootloader you have, try each
Tools > Processor menu option until your board gets properly programmed.

Select the NANO Processor Type

Select the serial device of the board from the Tools | Serial Port menu.
This is likely to be COM3 or higher (COM1 and COM2 are usually reserved for
hardware serial ports). To find out, you can disconnect your board and re-open
the menu; the entry that disappears should be the Arduino board. Reconnect the
board and select that serial port.

57
Select Board Type

Upload and Run your first Sketch

To upload the sketch to the Arduino Nano, click the Upload button in the
upper left to load and run the sketch on your board:

Upload to Nano

Wait a few seconds - you should see the RX and TX LEDs on the board
flashing. If the upload is successful, the message "Done uploading." will appear
in the status bar.

58
RESULTS

By this project, we are implementing a smart surveillance robot system


using ESP32-CAM module. So, by using this system, if an intruder is entered
into the home or any suspects were walking around your home one can get an
immediate alert to their mobile through SMS along with-it buzzer will generate
an alarm.

CIRCUIT DIAGRAM

59
CHAPTER 6

CONCLUSION

With our proposed system, surveillance robot is much improved. Live


video streaming can be added. In addition with live video streaming, digital
processing techniques can be implemented. This system also enhanced in future
by adding addition infrared emitting system at home, bank cabin to detect the
people if they wore a mask on face. As a result, we may infer that our system is
capable of achieving all of the aforementioned goals and of overcoming the
existing system's challenges. With our proposed system, surveillance robot is
vastly improved. The designed system enabled us to achieve the following
goals: real-time monitoring, reduced human intervention, and use of active
sensors in the field.

60
CODE

#include <Wire.h>

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

//Define I/O

int motor = 12;

int incomingByte = 0;

//Define I/O

//L298N

//Left Motor A

const int L1 = 5; // Pin 14 of L293

const int L2 = 4; // Pin 10 of L293

//Right Motor B

const int R1 = 3; // Pin 7 of L293

const int R2 = 2; // Pin 2 of L293

//Main program

void setup()

//Pump Motor

pinMode(motor, OUTPUT);

61
//L293D Output

pinMode(L1, OUTPUT);

pinMode(L2, OUTPUT);

pinMode(R1, OUTPUT);

pinMode(R2, OUTPUT);

//Serial Begin

Serial.begin(9600);

mySerial.begin(9600);

delay(500);

Serial.println("System Ready...!");

mySerial.println("System Ready...!");

delay(100);

//Loop program

void loop()

// Serial.print("Obj. Distance: ");

// Serial.print(data);

// Serial.print(" ");

// Serial.println();

62
//

// mySerial.print("Obj. Distance: ");

// mySerial.print(data);

// mySerial.print(" ");

// mySerial.println();

//

serialmotor();

delay(500);

void serialmotor()

if (mySerial.available() > 0)

incomingByte = mySerial.read();

switch(incomingByte)

case '1':

digitalWrite(L1, LOW); // control for stop

digitalWrite(L2, LOW);

digitalWrite(R1, LOW);

digitalWrite(R2, LOW);

63
Serial.println("STOP\n");

mySerial.println("STOP\n");

incomingByte='*';

break;

case '2':

digitalWrite(L1, HIGH); // control for right

digitalWrite(L2, LOW);

digitalWrite(R1, HIGH);

digitalWrite(R2, LOW);

Serial.println("FORWARD\n");

mySerial.println("FORWARD\n");

incomingByte='*';

break;

case '3':

digitalWrite(L1, LOW); // control for left

digitalWrite(L2, HIGH);

digitalWrite(R1, LOW);

digitalWrite(R2, HIGH);

Serial.println("BACK\n");

mySerial.println("BACK\n");

incomingByte='*';

break;

64
case '4':

digitalWrite(L1, HIGH); // control for forward

digitalWrite(L2, LOW);

digitalWrite(R1, LOW);

digitalWrite(R2, HIGH);

Serial.println("LEFT\n");

mySerial.println("LEFT\n");

incomingByte='*';

break;

case '5':

digitalWrite(L1, LOW); // control for backward

digitalWrite(L2, HIGH);

digitalWrite(R1, HIGH);

digitalWrite(R2, LOW);

Serial.println("RIGHT\n");

mySerial.println("RIGHT\n");

incomingByte='*';

break;

65
OBJECT DETECTION CODE

import cv2

import numpy as np

import yagmail

import time

# Load Yolo

print("Loading Data...!")

net = cv2.dnn.readNetFromDarknet("yolov3.cfg", "yolov3.weights")

#save all the names in file o the list classes

classes = []

with open("coco.names", "r") as f:

classes = [line.strip() for line in f.readlines()]

#get layers of the network

layer_names = net.getLayerNames()

#Determine the output layer names from the YOLO model

output_layers = [layer_names[i[0] - 1] for i in net.getUnconnectedOutLayers()]

print("Video Started...!")

#http://192.168.115.41:81/stream http://192.168.118.41

#video_capture = cv2.VideoCapture('http://192.168.118.41:81/stream')

video_capture = cv2.VideoCapture(0)

while True:

66
# Capture frame-by-frame

re,img = video_capture.read()

#img = cv2.resize(img, None, fx=0.4, fy=0.4)

height, width, channels = img.shape

# USing blob function of opencv to preprocess image

blob = cv2.dnn.blobFromImage(img, 1 / 255.0, (416, 416),

swapRB=True, crop=False)

#Detecting objects

net.setInput(blob)

outs = net.forward(output_layers)

# Showing informations on the screen

class_ids = []

confidences = []

boxes = []

count = 0

for out in outs:

for detection in out:

scores = detection[5:]

class_id = np.argmax(scores)

confidence = scores[class_id]

if confidence > 0.5:

# Object detected

67
center_x = int(detection[0] * width)

center_y = int(detection[1] * height)

w = int(detection[2] * width)

h = int(detection[3] * height)

# Rectangle coordinates

x = int(center_x - w / 2)

y = int(center_y - h / 2)

boxes.append([x, y, w, h])

confidences.append(float(confidence))

class_ids.append(class_id)

#We use NMS function in opencv to perform Non-maximum Suppression

#we give it score threshold and nms threshold as arguments.

indexes = cv2.dnn.NMSBoxes(boxes, confidences, 0.5, 0.4)

font = cv2.FONT_HERSHEY_PLAIN

colors = np.random.uniform(0, 255, size=(len(classes), 3))

for i in range(len(boxes)):

if i in indexes:

x, y, w, h = boxes[i]

label = str(classes[class_ids[i]])

color = colors[class_ids[i]]

cv2.rectangle(img, (x, y), (x + w, y + h), color, 1)

68
cv2.putText(img, label, (x, y + 30), font, 1.5, color, 1)

if label == "knife":

print('Knife Detected..!')

color = colors[class_ids[i]]

cv2.rectangle(img, (x, y), (x + w, y + h), color, 1)

cv2.putText(img, label, (x, y + 30), font, 1.5, color, 1)

cv2.imwrite('Knife.jpg',img)

#if count == 0:

#mail_send()

#count = count+1

cv2.imshow("Image",cv2.resize(img, (800,600)))

if cv2.waitKey(1) & 0xFF == ord('q'):

break

video_capture.release()

cv2.destroyAllWindows()

69
REFERENCES

[1] C M Srilakshmi1, Dr M C Padma2 “Iot Based Smart Surveillance robot


System” International Research Journal of Engineering and Technology
(IRJET)Volume: 04 Issue:05| May-2017
[2] F.Adaramola ,Michael.A.K.Adelabu “Implementation of Closed-circuit
Television (CCTV) Using Wireless Internet Protocol (IP) Camera”
1.School Of Engineering, Lagos State Polytechnic, Ikorodu, P.M.B.
21,606, Ikeja. Lagos. Nigeria
[3] Rishabh Paunikar, Shubham Thakare, Utkarsh Anuse “ Action
Recognition Using Surveillance robot System ” International Journal of
Engineering Applied Science and Technology (IJEAST ) Volume: 04
Issue:12| April-2020
[4] Mrs. Prajakta Jadhav1, Mrs. Shweta Suryawanshi2, Mr. Devendra
Jadhav3 “Automated Video Surveillance robot eISSN: 2395 -0056 | p-
ISSN: 2395-0072” International Research Journal of Engineering and
Technology (IRJET) Volume: 04 Issue: 05 | May -2017 Mrs. Prajakta
Jadhav1, Mrs. Shweta Suryawanshi2, Mr. Devendra Jadhav3 “Automated
Video Surveillance robot eISSN: 2395 -0056 | p-ISSN: 2395-0072”
International Research Journal of Engineering and Technology (IRJET)
Volume: 04 Issue: 05 | May -2017
[5] Prashant Balraj Balla , K.T.Jadhao “IoT Based Facial Recognition
Security System” International Conference on Smart City and Emerging
Technology (ICSCET) Volume:01 Issue:04| May- 2018.
[6] M. Van Der Werff, X. Gui and W.L. xu, “A mobile based home
automation system,” 2005 2nd Asia pacific conference on Mobile
Technology, Applications and systems, 2005, pp.5, doi:
10.1109/MTAS.2005.207158.

70
[7] Alheraish, “Design and implementation of home automation system,” in
IEEE Transactions on consumer Electronics,vol.50,no.4,pp.1087-
1092,nov.2004,doi: 10.1109/TCE.2004.1362503.
[8] Y. Gu et al., “Design and implementation of Upnp-Based Surveillance
robot Camera system for Home security”,2013 International conference
on information science and
Applications(ICISA),2013,pp.4,doi:10.1109/ICISA.2013. 6698209
[9] Jain, S. Basantwani, O. Kazi and Y. Bang, “ smart surveillance robot
monitoring system,”2017 international conference on Data Management
,Analytics and innovation (ICDMAI),2017,pp.269-273,doi:
10.1109/ICDMAI.2107.
[10] Van Thanh Trung and N. Van Cuong, “Monitoring and controlling
devices system by GPRS on FPGA platform”, 2013 International
conference on Advanced Technologies for communications (ATC 2013),
2013, pp.713-717

71

You might also like