Sunteți pe pagina 1din 97

ABSTRACT

Nowadays Women Safety is the biggest concern in many parts of the world.
There is still a fear in alone areas for women as well as men. So here we
propose a security patrolling robot using Raspberry PI. The system uses
cameras and mic mounted on robotic vehicle for securing any premises. The
robotic vehicle moves at particular path and is equipped with camera and
sound sensors. It uses a predefined line to follow its path while patrolling. It
stops at particular points and moves to next points if sound is detected. The
system uses IR based path following system for patrolling assigned area. It
monitors each area to detect any problem using combination of two HD
cameras. It has the ability to monitor sound in the premises.

Robot hears Any sound after area is quite and it starts moving towards the
sound on its predefined path. It then scans the area using its camera to
detect any human faces detected. It captures and starts transmitting the
images of the situation immediately to the IOT website. Here we use IOT
gecko for receiving transmitted images and displaying them to user with alert
sounds. Thus we put forward a fully autonomous security robot that operates
tirelessly and patrols large areas on its own to secure the facility

iii
CONTENTS

Page no’s

Acknowledgement i

Declaration ii

Abstract iii

List of Figures iv

List of Tables v

List of Abbreviations vi

CHAPTER 1 : Introduction 1-7

1.1 Embedded system 2

1.2 Block Diagram 4

1.2.1 Block Diagram description 5

1.3 Schematic Diagram 6

1.3.1 Schematic Explanation

CHAPTER 2 : 2.1 Existed Method 8

2.2 Proposed Method

CHAPTER 3 : Hardware Components 9-52

3.1 Raspberry Pi (BCM2836) 9


3.1.1 Product Description 10

3.1.2 Specifications

3.1.3 Connectors

3.2 Hardware Layout 13

3.3 Specifications 19

3.4 Brief description of SOC 21

3.5 Accessories 22

3.6 Power Supply 24

3.7 Transformer 25

3.8 Rectifier 26

3.9 Bridge Rectifier

3.9.1 Operation

3.10 Filter 28

3.11 Capacitor Filter 29

3.12 Regulator

3.13 78XX 30

3.14 Liquid Crystal Display

3.14.1 LCD Operation 32


3.14.2 LCD Pin Description

3.15 LCD Interfacing 35

3.16 Camera

3.17 Ultrasonic sensor 36

3.17.1 Introduction 37

3.17.2 Product Features 39

3.18 DC Motor 40

3.19 H - Bridge 43

3.19.1 Basic Theory 44

3.19.2 Implementation 46

3.20 L293D

CHAPTER 4 : Raspberry Pi Software Description 53- 80

4.1 Raspberry pi OS 53

4.1.1 Install raspbian with NOOBS 54

4.1.2 Download NOOBS 56

4.1.3 Download image raspbian directly 57

4.1.4 The first time power on 59

4.1.5 Connecting to WIFI 61


4.1.6 Downloading and installing 62

4.2 IDE Introduction 63

4.2.1 Processing 64

4.2.2 Processing sketch

4.2.3 Respond to mouse 67

4.3 QT creator 69

4.3.1 Introduction

4.3.2 Download and install QT creator 70

4.3.3 Step to create new project 71

4.3.4 Running the application 76

4.4 Python Introduction 78

4.4.1 History of python 79

CHAPTER 5 : Project output images 81-82

CHAPTER 6 : Conclusion 83

CHAPTER 7 : Reference 84
LIST OF FIGURES

Page no’s

Fig 1.1 : Embedded System. 2

Fig 1.2 : Block Diagram 4

Fig 1.3 : Schematic Diagram 6

Fig 3.1(a) : Raspberry Pi (BCM2836) 9

Fig 3.1(b) : Raspberry Pi schematic diagram

Fig 3.2(1) : Processor/SOC 13

Fig 3.2(6) : RCA video connector 16

Fig 3.2(8) : Status LEDs 17

Fig 3.5(2) : Get board(left) & Raspberry pi(Right) 23

Fig 3.6 : Functional block diagram of power supply 24

Fig 3.7 : An Electrical Transformer 25

Fig 3.9 : Bridge rectifier 26

Fig 3.9.1 : Positive half cycle of bridge rectifier 27

Fig 3.9.2 : Negative half cycle of bridge rectifier 27

Fig 3.12 : A Three Terminal Voltage Regulator 29

Fig 3.15 : Interfacing of LCD to a micro controller 35


Fig 3.17.1 : Basic sensor operation principle 37

Fig 3.18 : Block diagram of the DC motor 41

Fig 3.18.1 : Block diagram of the DC motor having two poles 42

Fig 3.18.2 : Block diagram of the DC motor having three poles 42

Fig 3.18.3 : Internal block diagram of the three pole DC motor 43

Fig 3.19 : H-Bridge 44

Fig 3.19.2(1) : H Bridge using four SPST relays 46

Fig 3.19.2(2). : H Bridge using Transistor 48

Fig 3.20. : L293D pin diagram 50

Fig 4.1 : Raspberry pi system 53

Fig 4.1.1 : 2SD card formatter window 55

Fig 4.1.2 : Raspberry pi website home 56

Fig 4.1.2(1) : Raspbian OS download page 56

Fig 4.1.3(2) : Raspbian image download page 57

Fig 4.1.3(4) : Download image file 58

Fig 4.1.3(8) : Burn image file into drive 59

Fig 4.1.4(1) : list of OS window 60

Fig 4.1.4(2) : Raspberry pi home window 60

Fig 4.1.5(1) : Wifi list page 61

Fig 4.1.6(2) : Downloading page 63


Fig 4.2.2 : Processing home. 65

Fig 4.2.2 : Processing output(a) 66

Fig 4.2.2 : Processing output(b) 66

Fig 4.2.3 : Show position of pointer 68

Fig 4.3.2(3) : QT creator home screen 71

Fig 4.3.3 : New project window 71

Fig 4.3.3(a) : Select project type 72

Fig 4.3.3(b) : Select app type 72

Fig 4.3.3(c) : UI text box creation 73

Fig 4.3.4(a) : Run application page 77

Fig 4.3.4(b) : Output window 77

Fig 5(1) : Output image 81

Fig 5(2) : Messages send by GSM module 82

Fig 5(3) : Live streaming in IOT gecko 82

iv
LIST OF TABLES

Page no’s

Table 3.3. : Specifications 19

Table 3.14.2 : Pin description for LCD 32

Table 3.14.3 : LCD Command Codes 34

v
ABBREVIATIONS

PDA : Personal digital assistants

GSM : Global System for mobile communications

GPIO : General Purpose Input Output

DSI. : Display Serial Interface

CSI : Camera Serial Interface

JTAG : Joint Test Action Group

TAP : Test Access Port

HDMI : High Definition Multimedia Interface

SOC : System on Chip

LCD : Liquid crystal Display

vi
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

CHAPTER 1: INTRODUCTION

Nowadays Women Safety is the biggest concern in many parts of the world. There is
still a fear in alone areas for women as well as men. So here we propose a security
patrolling robot using Raspberry PI. The system uses cameras and mic mounted on
robotic vehicle for securing any premises. The robotic vehicle moves at particular
path and is equipped with camera. It uses a predefined line to follow its path while
patrolling. It stops at particular points and moves to next points if image is detected.
The system uses IR based path following system for patrolling assigned area. It
monitors each area to detect any problem using combination of two HD cameras..
Robot starts moving towards on its predefined path. It then scans the area using its
camera to detect any human faces detected. It captures and starts transmitting the
images of the situation immediately to the IOT website. Here we use IOT gecko for
receiving transmitted images and displaying them to user with alert sounds. Thus we
put forward a fully autonomous security robot that operates tirelessly and patrols large
areas on its own to secure the facility.

Hardware Specifications

• Raspberry Pi 3
• HC-SR04 Ultrasonic
• DC Motor
• Robotic Chassis
• IC ,Resistors ,Capacitors ,Transistor Diodes
• PCB – Buy PCB & Breadboards Online LED’s
• Push Button
• switches
Software Specifications
• Python MC Programming Language: C IOTGecko

Page No 1
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

1.1 EMBEDDED SYSTEM

An embedded system is a special-purpose system in which the computer is


completely encapsulated by or dedicated to the device or system it controls. Unlike a
general-purpose computer, such as a personal computer, an embedded system
performs one or a few predefined tasks, usually with very specific requirements. Since
the system is dedicated to specific tasks, design engineers can optimize it, reducing
the size and cost of the product. Embedded systems are often mass- produced,
benefiting from economies of scale.
Personal digital assistants (PDAs) or handheld computers are generally considered
embedded devices because of the nature of their hardware design, even though they
are more expandable in software terms. This line of definition continues to blur as
devices expand. With the introduction of the OQO Model 2 with the Windows XP
operating system and ports such as a USB port — both features usually belong to
"general purpose computers", — the line of nomenclature blurs even more.
Physically, embedded systems ranges from portable devices such as digital watches
and MP3 players, to large stationary installations like traffic lights, factory controllers,
or the systems controlling nuclear power plants.
In terms of complexity embedded systems can range from very simple with a single
micro controller chip, to very complex with multiple units, peripherals and networks
mounted inside a large chassis or enclosure.

Fig 1.1 : Embedded System

Page No 2
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

Examples of Embedded Systems:

• Avionics, such as inertial guidance systems, flight control hardware/software


and other integrated systems in aircraft and missiles
• Cellular telephones and telephone switches 


• Engine controllers and antilock brake controllers for automobiles 


• Home automation products, such as thermostats, air conditioners, sprinklers, 



and security monitoring systems 


• Handheld calculators 


• Handheld computers 


• Household appliances, including microwave ovens, washing machines, 



television sets, DVD players and recorders 


• Medical equipment 


• Personal digital assistant 


• Videogame consoles 


• Computer peripherals such as routers and printers. 


• Industrial controllers for remote machine operation. 


Page No 3
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

1.2 BLOCK DIAGRAM:

Power
supply

IOT
camera

Ultrasonic RPI Micro


sensor Controller
Motor
Drivers

LCD
Display

GSM

Fig 1.2 : BLOCK DIAGRAM

Page No 4
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

1.2.1 BLOCK DIAGRAM DESCRIPTION

Micro controller: This section forms the control unit of the whole project. This
section basically consists of a Micro controller with its associated circuitry like
Crystal with capacitors, Reset circuitry, Pull up resistors (if needed) and so on. The
Micro controller forms the heart of the project because it controls the devices being
interfaced and communicates with the devices according to the program being written.

Driver circuit: L293D is a dual H-bridge motor driver integrated circuit (IC).
Motor drivers act as current amplifiers since they take a low-current control signal
and provide a higher-current signal. This higher current signal is used to drive the
motors.

Motor: motor is an output for this project. And DC motor is connected to micro
controller. And this motor controlled by the micro controller with the respective inputs
given by us. Its speed will be varied according to the speed set by the switches.

Ultrasonic sensor: The ultrasound transmitter TX is emitting ultrasound waves


into sensor ambient space continuously. These waves are reflecting from various
objects and are reaching ultrasound receiver RX. There is a constant interference
figure if no moving objects are in the placement.

LCD Display: This section is basically meant to show up the status of the project.
This project makes use of Liquid Crystal Display to display / prompt for necessary
information.

GSM : GSM (Global System for Mobile communications) is the technology that
underpins most of the world's mobile phone networks. The GSM platform is a hugely
successful wireless technology and an unprecedented story of global achievement and
cooperation.

Page No 5
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

GSM has become the world's fastest growing communications technology of all time
and the leading global mobile standard, spanning 218 countries. GSM is an open,
digital cellular technology used for transmitting mobile voice and data services. GSM
operates in the 900MHz and 1.8GHz bands GSM supports data transfer speeds of up
to 9.6 kbps, allowing the transmission of basic data services such as SMS.

1.3 SHEMATIC DIAGRAM:

1.3.1 SCHEMATIC EXPLANATION :

In this project we required operating voltage for controller board is 5V. Hence the 5V
D.C. power supply is needed for the board . This regulated 5V is generated by
stepping down the voltage from 230V to 18V now the step downed a.c voltage is
being rectified by the Bridge Rectifier using 1N4007 diodes.

Page No 6
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

The rectified a.c voltage is now filtered using a ‘C’ filter. Now the rectified, filtered
D.C. voltage is fed to the Voltage Regulator. This voltage regulator provides/allows us
to have a Regulated constant Voltage which is of +5V. The rectified; filtered and
regulated voltage is again filtered for ripples using an electrolytic capacitor 100µF.
Now the output from this section is fed to microcontroller board to supply operating
voltage.

Page No 7
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

CHAPTER 2 - Existing and Proposed method

2.1 Existed Method :

In the existing system, robot has to control remotely where the person has to monitor
the area using remote but manually controlling and the more Human more is required
to implement this system.

2.2 Proposed Method : 



We can overcome above disadvantage by using our proposed system. It is having face
recognition of persons by using camera interface.. An efficient and accurate embedded
access control system based on face recognition is very important for wide range of
commercial and security application. The proposed system is access control system.
The system identifies presence of the video/image and transfers through an alert SMS
via GSM automatically to owner. It has a variety of features such as energy efficient,
intelligence, low cost, portability and high performance. in this proposed system,
Raspberry pi is installed with the night vision camera which help the system to go for
the automation and help to find the human or any problem detected using the
ultrasonic sensor and capture the image and send it to user using IOT technology.

Page No 8
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

CHAPTER 3 : HARDWARE COMPONENTS

3.1 RASPBERRY PI (BCM2836)

Fig 3.1 : RASPBERRY PI (BCM2836)

Fig 3.1 : RASPBERRY PI SCHEMATIC DIAGRAM

Page No 9
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

3.1.1 Product Description

The Raspberry Pi 2 delivers 6 times the processing capacity of previous models. This
second generation Raspberry Pi has an upgraded BroadcomBCM2836 processor,
which is a powerful ARM Cortex-A7 based quad-core processor that runs at 900MHz.
The board also features an increase in memory capacity to 1Gbyte.

3.1.2 Specifications

Chip. : Broadcom BCM2836 SoC



Core architecture : Quad-core ARM Cortex-A7

CPU : 900 MHz



GPU : Dual Core Video Core IV® Multimedia Co-
Processor

Dimensions Power : 1GB LPDDR2


Memory : Provides Open GL ES 2.0, hardware-
accelerated Open VG, and 1080p30H.264 high-profile decode

Power : Boots from Micro SD card, running a


version of the Linux Micro USB socket 5V, 2A

3.1.3 Connectors

Ethernet : 10/100 Base T Ethernet socket


Video Output : HDMI (rev 1.3 & 1.4)
Audio Output : 3.5mm jack, HDMI
USB : 4 x USB 2.0 Connector

Page No 10
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

GPIO Connector : 40-pin 2.54 mm (100 mil) expansion header: 2x20


strip Providing 27 GPIO pins as well as +3.3 V, +5 V and GND supply lines

Camera Connector : 15-pin MIPI Camera Serial Interface (CSI-2)

JTAG : Not populated

Display Connector : Display Serial Interface (DSI) 15 way flat flex cable
connector with two data lanes and a clock lane

Memory Card Slot. : Micro SDIO

GPIO

BCM283x has in total 54 GPIO lines in 3 separate voltage banks. All GPIO pins have
at least two alternative functions within the SoC. When not used for the alternate
peripheral function, each GPIO pin may be set as an input (optionally as an interrupt)
or an output. The alternate functions are usually peripheral I/Os, and most peripherals
appear twice to allow flexibility on the choice of I/O voltage. On CM1, CM3 and
CM3L bank2 is used on the module to connect to the eMMC device and, on CM3 and
CM3L, for an on-board I2C bus (to talk to the core SMPS and control the special
function pins). On CM3L most of bank 2 is exposed to allow a user to connect their
choice of SD card or eMMC device (if required). Bank0 and 1 GPIOs are available
for general use. GPIO0 to GPIO27 are bank 0 and GPIO28-45 make up bank1.
GPIO0-27 VDD is the power supply for bank0 and GPIO28-45 VDD is the power
supply for bank1. SDX VDD is the supply for bank2 on CM3L. These supplies can be
in the range 1.8V-3.3V (see Table 7) and are not optional; each bank must be
powered, even when none of the GPIOs for that bank are used.

SD/SDIO Interface:

The BCM283x supports two SD card interfaces, SD0 and SD1.

Page No 11
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

The first (SD0) is a proprietary Broadcom controller that does not support SDIO and
is the primaryinterface used to boot and talk to the eMMC or SDX x signals. The
second interface (SD1) is standards compliant and can interface to SD, SDIO and
eMMC devices; for example on a Raspberry Pi 3 it is used to talk to the on-board
BCM43438 WiFi device in SDIO mode. Both interfaces can support speeds up to
50MHz single ended (SD High Speed Mo

CSI (MIPI Serial Camera)

Currently the CSI interface is not openly documented and only CSI camera sensors
supported by the official Raspberry Pi firmware will work with this interface.
Supported sensors are the OmniVision OV5647 and Sony IMX219. It is
recommended to attach other cameras via USB

DSI (MIPI Serial Display)

Currently the DSI interface is not openly documented and only DSI displays
supported by the official Raspberry Pi firmware will work with this interface.

USB

The BCM283x USB port is On-The-Go (OTG) capable. If using either as a fixed
slave or fixed master, please tie the USB OTGID pin to ground. The USB port (Pins
USB DP and USB DM) must be routed as 90 ohm differential PCB traces.

HDMI

BCM283x supports HDMI V1.3a. It is recommended that users follow a similar


arrangement to the Compute Module IO Board circuitry for HDMI output. The HDMI
CK P/N (clock) and D0- D2 P/N (data) pins must each be routed as matched length
100 ohm differential PCB traces. It is also important to make sure that each
differential pair is closely phase matched.

Page No 12
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

3.2 Hardware Layout:

A brief description of the components on the Pi.

1) Processor / SoC (System on Chip):

The Raspberry Pi has a Broadcom BCM2835 System on Chip module. It has a


ARM1176JZF-S processor .The Broadcom SoC used in the Raspberry Pi is equivalent
to a chip used in an old smart phone (Android or iPhone). While operating at 700
MHz by default, the Raspberry Pi provides a real world performance roughly
equivalent to the 0.041 GFLOPS. On the CPU level the performance is similar to a
300 MHz Pentium II of 1997-1999, but the GPU, however, provides 1 Gpixel/s, 1.5
Gtexel/s or 24 GFLOPS of general purpose compute and the graphics capabilities of
the Raspberry Pi are roughly equivalent to the level of performance of the Xbox of
2001. The Raspberry Pi chip operating at 700 MHz by default, will not become hot
enough to need a heatsink or special cooling.

Fig 3.2(1) : Processor/SOC

Page No 13
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

2) Power source: 

The Pi is a device which consumes 700mA or 3W or power. It is powered by a
MicroUSB charger or the GPIO header. Any good smartphone charger will do
the work of powering the Pi. 


3) SD Card : 

The Raspberry Pi does not have any onboard storage available. The operating
system is loaded on a SD card which is inserted on the SD card slot on the
Raspberry Pi. The operating system can be loaded on the card using a card
reader on any computer.

4) GPIO: GPIO –General Purpose Input Output

GPIO pins have no special purpose defined, and go unused by default. The idea is that
sometimes the system designer building a full system that uses the chip might find it
useful to have a handful of additional digital control lines, and having these available
from the chip can save the hassle of having to arrange additional circuitry to provide
them.

GPIO capabilities may include:

• GPIO pins can be configured to be input or output 


• GPIO pins can be enabled/disabled 


• Input values are readable (typically high=1, low=0) 


• Output values are writable/readable 


• Input values can often be used as IRQs (typically for wakeup events) 

The production Raspberry Pi board has a 26-pin 2.54 mm (100 mil) expansion
header, marked as P1, arranged in a 2x13 strip.

Page No 14
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

5) DSI Connector: The Display Serial Interface (DSI) is a specification by the


Mobile Industry Processor Interface (MIPI) Alliance aimed at reducing the
cost of display controllers in a mobile device. It is commonly targeted at LCD
and similar display technologies. It defines a serial bus and a communication
protocol between the host (source of the image data) and the device
(destination of the image data). A DSI compatible LCD screen can be
connected through the DSI connector, although it may require additional
drivers to drive the display.

6) RCA Video: 

RCA Video outputs (PAL and NTSC) are available on all models of Raspberry
Pi. Any television or screen with a RCA jack can be connected with the RPi. 


Page No 15
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

Figure 3.2(6): RCA Video Connector

7) Audio Jack:

A standard 3.5 mm TRS connector is available on the RPi for stereo audio output.
Any headphone or 3.5mm audio cable can be connected directly. Although this jack
cannot be used for taking audio input, USB mics or USB sound cards can be used.

8) Status LEDs:

There are 5 status LEDs on the RPi that show the status of various activities as
follows:

“OK” - SDCard Access (via GPIO16) - labelled as "OK" on Model B Rev1.0 boards
and "ACT" on Model B Rev2.0 and Model A boards

“POWER” - 3.3 V Power - labelled as "PWR" on all boards



“FDX” - Full Duplex (LAN) (Model B) - labelled as "FDX" on all boards “LNK” -
Link/Activity (LAN) (Model B) - labelled as "LNK" on all boards

“10M/100” - 10/100Mbit (LAN) (Model B) - labelled (incorrectly) as "10M" on


Model B Rev1.0 boards and "100" on Model B Rev2.0 and Model A boards

Page No 16
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

Figure 3.2(8): Status LEDs

9) USB 2.0 Port:

USB 2.0 ports are the means to connect accessories such as mouse or keyboard to the
Raspberry Pi. There is 1 port on Model A, 2 on Model B and 4 on Model B+. The
number of ports can be increased by using an external powered USB hub which is
available as a standard Pi accessory.

10) Ethernet:

Ethernet port is available on Model B and B+. It can be connected to a network or


internet using a standard LAN cable on the Ethernet port. The Ethernet ports are

controlled by Microchip LAN9512 LAN controller chip.

Page No 17
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

11)CSI connector:

CSI – Camera Serial Interface is a serial interface designed by MIPI (Mobile Industry
Processor Interface) alliance aimed at interfacing digital cameras with a mobile
processor. The RPi foundation provides a camera specially made for the Pi which can
be connected with the Pi using the CSI connector.

12) JTAG headers:

JTAG is an acronym for ‘Joint Test Action Group', an organisation that started back in
the mid 1980's to address test point access issues on PCB with surface mount devices.

The organisation devised a method of access to device pins via a serial port that
became known as the TAP (Test Access Port). In 1990 the method became a
recognised international standard (IEEE Std 1149.1). Many thousands of devices now
include this standardised port as a feature to allow test and design engineers to access
pins.

13) HDMI:

HDMI – High Definition Multimedia Interface


HDMI 1.3 a type A port is provided on the RPi to connect with HDMI screens.

Page No 18
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

3.3 Specifications:

Model B Model B+
Model A

Target US$25 US$35


price:
Broadcom BCM2835 (CPU, GPU, DSP,
SoC: SDRAM, and single USB port)

700 MHz ARM1176JZF-S core (ARM11


CPU:
family, ARMv6 instruction set)

GPU: Broadcom VideoCore IV @ 250 MHz

Memory 256 MB
512MB (shared with GPU)
(SDRAM) (shared with
as of 15 October 2012
: GPU)

1 (direct
USB 2.0 2 (via the on- 4 (via the on-
from
ports: board 3-port board 5-port
BCM2835
USB hub) USB hub)
chip)
15-pin MIPIcamera interface (CSI)
Video connector, used with the Raspberry Pi
input: Camera Addon.
Composite RCA (PAL and NTSC) –in
Video model B+ via 4-pole 3.5 mm jack, HDMI
outputs: (rev 1.3 & 1.4), raw LCD Panels via DS
3.5 mm jack, HDMI, and, as of revision 2
Audio boards, I2S audio (also potentially for
outputs: audio input)

Onboard SD / MMC / SDIO card


MicroSD
slot (3.3 V card

power support only)


storage:

10/100 Mbit/sEthernet
Onboard None (8P8C) USB adapter on the
network: third/fifth port of the USB
hub
8× GPIO, UART, I2C bus,
Low-level
SPI bus with two chip
peripheral selects, I2S audio +3.3 V,
17× GPIO
s: +5 V, ground

Power 300 mA (1.5 700 mA (3.5 600 mA (3.0


ratings: W) W) W)

Power 5 V via MicroUSB or GPIO header


source:
85.60 mm × 56 mm (3.370 in × 2.205 in)
Size:
– not including protruding connectors

Weight:
45 g (1.6 oz)
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

3.4 Brief description of System on Chip (SoC)

Since smartphones and tablets are basically smaller computers, they require pretty
much the same components we see in desktops and laptops in order to offer us all the
amazing things they can do (apps, music and video playing, 3D gaming support,
advanced wireless features, etc).

But smartphones and tablets do not offer the same amount of internal space as
desktops and laptops for the various components needed such as the logic board, the
processor, the RAM, the graphics card, and others. That means these internal parts
need to be as small as possible, so that device manufacturers can use the remaining
space to fit the device with a long-lasting battery life.

Thanks to the wonders of miniaturization, SoC manufacturers, like Qualcomm,


Nvidia or Texas Instruments, can place some of those components on a single chip,
the System on a Chip that powers smartphones.

A system on a chip or system on chip (SoC or SOC) is an integrated circuit (IC) that
integrates all components of a computer or other electronic system into a single chip.
It may contain digital, analog, mixed-signal, and often radio-frequency functions—all
on a single chip substrate. SoCs are very common in the mobile electronics market
because of their low power consumption. A typical application is in the area of
embedded systems.

The contrast with a micro controller is one of degree. Micro controllers typically have
under 100 kB of RAM (often just a few kilobytes) and often really are single- chip-
systems, whereas the term SoC is typically used for more powerful processors,
capable of running software such as the desktop versions of Windows and Linux,
which need external memory chips (flash, RAM) to be useful, and which are used
with various external peripherals. In short, for larger systems, the term system on a
chip is a hyperbole, indicating technical direction more than reality:

Page No 21
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

increasing chip integration to reduce manufacturing costs and to enable smaller


systems. Many interesting systems are too complex to fit on just one chip built with a
process optimized for just one of the system's tasks.

A typical SoC consists of:

• A micro controller, microprocessor or DSP core(s). Some SoCs—called


multiprocessor system on chip (MPSoC)—include more than one processor core.

• memory blocks including a selection of ROM, RAM, EEPROM and flash memory

• timing sources including oscillators and phase-locked loops

• peripherals including counter-timers, real-time timers and power-on reset


generators

• external interfaces, including industry standards such as USB, FireWire, 



Ethernet, USART, SPI 


• analog interfaces including ADCs and DACs 


• voltage regulators and power management circuits 


• A bus - either proprietary or industry-standard such as the AMBA bus from ARM
Holdings - connects these blocks. DMA controllers route data directly between
external interfaces and memory, bypassing the processor core and thereby
increasing the data throughput of the SoC

3.5 Accessories

. Raspberry Pi being a very cheap computer has attracted millions of users

around the world. Thus it has a large user base. Many enthusiasts have created
accessories and peripherals for the Raspberry Pi.

Page No 22
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

This range from USB hubs, motor controllers to temperature sensors. There are
some official accessories for the RPi as follows: 


1. Camera – On 14 May 2013, the foundation and the distributors RS Components


& Premier Farnell/Element 14 launched the Raspberry Pi camera board
with a firmware update to support it.The Raspberry Pi camera board
contains a 5 MPixel sensor, and connects via a ribbon cable to the CSI
connector on the Raspberry Pi.

2. Gert board – A Raspberry Pi Foundation sanctioned device designed for


educational purposes, and expands the Raspberry Pi's GPIO pins to allow
interface with and control of LEDs, switches, analog signals, sensors and
other devices. It also includes an optional Arduino compatible controller to
interface with the Pi. The Gertboard can be used to control motors,
switches etc. for robotic projects.

Figure 3.5(2) : Gert board(left) & Raspberry Pi(Right)

Page No 23
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

3. USB Hub – Although not an official accessory, it is a highly recommended

accessory for the Pi. A powered USB Hub with 7 extra ports is available at almost all
online stores. It is compulsory to use a USB Hub to connect external hard disks or
other accessories that draw power from the USB

3.6 POWER SUPPLY

The power supply is designed to convert high voltage AC mains electricity to a


suitable low voltage supply for electronic circuits and other devices. A power supply
can by broken down into a series of blocks, each of which performs a particular
function. A D.C. power supply which maintains the output voltage constant
irrespective of a.c mains fluctuations or load variations is known as “Regulated D.C
Power Supply”

For example a 5V regulated power supply system as shown below:

Fig 3.6 : Functional Block Diagram of Power supply

Page No 24
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

3.7 Transformer:

A transformer is an electrical device which is used to convert electrical power from


one electrical circuit to another without change in frequency.

Transformers convert AC electricity from one voltage to another with little loss of
power. Transformers work only with AC and this is one of the reasons why mains
electricity is AC. Step-up transformers increase in output voltage, step-down
transformers decrease in output voltage. The input coil is called the primary and the
output coil is called the secondary. The two lines in the middle of the circuit symbol
represent the core. Transformers waste very little power so the power out is (almost)
equal to the power in. Note that as voltage is stepped down current is stepped up. The
ratio of the number of turns on each coil, called the turn’s ratio, determines the ratio of
the voltages. A step-down transformer has a large number of turns on its primary
(input) coil which is connected to the high voltage mains supply, and a small number
of turns on its secondary (output) coil to give a low output voltage.

Turns ratio = Vp/ VS = Np/NS Power Out= Power In


VS X IS=VP X IP

Vp = primary (input) voltage



Np = number of turns on primary coil Ip = primary (input) current

Fig 3.7 : An Electrical Transformer

Page No 25
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

3.8 Rectifier:
A circuit, which is used to convert a.c to dc, is known as RECTIFIER. The process of
conversion a.c to d.c is called “rectification”

3.9 Bridge Rectifier: A bridge rectifier makes use of four diodes in a bridge
arrangement to achieve full-wave rectification. This is a widely used configuration,
both with individual diodes wired as shown and with single component bridges where
the diode bridge is wired internally.

A bridge rectifier makes use of four diodes in a bridge arrangement as shown in fig(a)
to achieve full-wave rectification. This is a widely used configuration, both with
individual diodes wired as shown and with single component bridges where the diode
bridge is wired internally.

Fig 3.9 : Bridge rectifier

3.9.1 Operation:
During positive half cycle of secondary, the diodes D2 and D3 are in forward biased
while D1 and D4 are in reverse biased as shown in the fig(b). The current flow
direction is shown in the fig (b) with dotted arrows.

Page No 26
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

Fig 3.9.1 : Positive half cycle of bridge rectifier

During negative half cycle of secondary voltage, the diodes D1 and D4 are in forward
biased while D2 and D3 are in reverse biased as shown in the fig(c). The current flow
direction is shown in the fig (c) with dotted arrows.

Fig 3.9.2 : Negative half cycle of bridge rectifier

Page No 27
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

3.10 Filter:

A Filter is a device, which removes the a.c component of rectifier output but allows
the d.c component to reach the load.

3.11 Capacitor Filter:

We have seen that the ripple content in the rectified output of half wave rectifier is
121% or that of full-wave or bridge rectifier or bridge rectifier is 48% such high
percentages of ripples is not acceptable for most of the applications. Ripples can be
removed by one of the following methods of filtering:

(a) A capacitor, in parallel to the load, provides an easier by –pass for the ripples
voltage though it due to low impedance. At ripple frequency and leave the d.c.to
appears the load.

(b) An inductor, in series with the load, prevents the passage of the ripple current
(due to high impedance at ripple frequency) while allowing the d.c (due to low
resistance to d.c)

(c) various combinations of capacitor and inductor, such as L-section filter section
filter, multiple section filter etc. which make use of both the properties mentioned in
(a) and (b) above. Two cases of capacitor filter, one applied on half wave rectifier and
another with full wave rectifier.

Filtering is performed by a large value electrolytic capacitor connected across the DC


supply to act as a reservoir, supplying current to the output when the varying DC
voltage from the rectifier is falling. The capacitor charges quickly near the peak of the
varying DC, and then discharges as it supplies current to the output. Filtering
significantly increases the average DC voltage to almost the peak value (1.4 × RMS
value).

Page No 28
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

To calculate the value of capacitor(C), C = 1⁄4*√3*f*r*Rl

Where,

f = supply frequency,
r = ripple factor, Rl = load resistance
Note: In our circuit we are using 1000microfarads.

3.12 Regulator:

Voltage regulator ICs is available with fixed (typically 5, 12 and 15V) or variable
output voltages. The maximum current they can pass also rates them. Negative
voltage regulators are available, mainly for use in dual supplies. Most regulators
include some automatic protection from excessive current ('overload protection') and
overheating ('thermal protection'). Many of the fixed voltage regulator ICs have 3
leads and look like power transistors, such as the 7805 +5V 1A regulator shown on
the right.

The LM7805 is simple to use. You simply connect the positive lead of your
unregulated DC power supply (anything from 9VDC to 24VDC) to the Input pin,
connect the negative lead to the Common pin and then when you turn on the power,
you get a 5 volt supply from the output pin.

Fig 3.12 : A Three Terminal Voltage Regulator

Page No 29
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

3.13 78XX:

The Bay Linear LM78XX is integrated linear positive regulator with three terminals.
The LM78XX offer several fixed output voltages making them useful in wide range
of applications. When used as a zener diode/resistor combination replacement, the
LM78XX usually results in an effective output impedance improvement of two orders
of magnitude, lower quiescent current. The LM78XX is available in the TO-252,
TO-220 & TO-263packages,

Features:

• Output Voltage Tolerance of 5%



• Internal thermal overload protection

• Internal Short-Circuit Limited

• No External Component

• Output Voltage 5.0V, 6V, 8V, 9V, 10V, 12V, 15V, 18V, 24V • Offer in plastic
TO-252, TO-220 & TO-263

• Direct Replacement for LM78XX

3.14 Liquid crystal display


Liquid crystal displays (LCDs) have materials, which combine the properties of
both liquids and crystals. Rather than having a melting point, they have a temperature
range within which the molecules are almost as mobile as they would be in a liquid,
but are grouped together in an ordered form similar to a crystal.

An LCD consists of two glass panels, with the liquid crystal material sand
witched in between them. The inner surface of the glass plates are coated with
transparent electrodes which define the character, symbols or patterns to be displayed
polymeric layers are present in between the electrodes and the liquid crystal, which
makes the liquid crystal molecules to maintain a defined orientation angle.

Page No 30
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

One each polarisers are pasted outside the two glass panels. These polarisers would
rotate the light rays passing through them to a definite angle, in a particular direction.

When the LCD is in the off state, light rays are rotated by the two polarisers and
the liquid crystal, such that the light rays come out of the LCD without any
orientation, and hence the LCD appears transparent.

When sufficient voltage is applied to the electrodes, the liquid crystal molecules
would be aligned in a specific direction. The light rays passing through the LCD
would be rotated by the polarisers, which would result in activating/ highlighting the
desired characters.

The LCD’s are lightweight with only a few millimeters thickness. Since the LCD’s
consume less power, they are compatible with low power electronic circuits, and can
be powered for long durations.

The LCD’s don’t generate light and so light is needed to read the display. By using
backlighting, reading is possible in the dark. The LCD’s have long life and a wide
operating temperature range.

Changing the display size or the layout size is relatively simple which makes the
LCD’s more customers friendly.

The LCDs used exclusively in watches, calculators and measuring instruments are
the simple seven-segment displays, having a limited amount of numeric data. The
recent advances in technology have resulted in better legibility, more information
displaying capability and a wider temperature range. These have resulted in the LCDs
being extensively used in telecommunications and entertainment electronics. The
LCDs have even started replacing the cathode ray tubes (CRTs) used for the display of
text and graphics, and also in small TV applications.

Page No 31
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

. This section describes the operation modes of LCD’s then describe how to program
and interface an LCD to 8051 using Assembly and C.

3.14.1 LCD operation


In recent years the LCD is finding widespread use replacing LEDs (seven-segment
LEDs or other multi segment LEDs).This is due to the following reasons:
1. The declining prices of LCDs.
2. The ability to display numbers, characters and graphics. This is in contract to
LEDs, which are limited to numbers and a few characters.

3.14.2 LCD PIN DISCRPTION:


The LCD discussed in this section has 14 pins. The function of each pins is given in
table.

TABLE 3.14.2 : Pin description for LCD:

symbol I/O Description


1 Vss -- Ground

2 Vcc --
+5V power
supply
VEE Power supply
3 -- to control
contrast
RS=0 to select
command
4 register
RS I
RS=1 to select
data register

Page No 32
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

R/W=0 for
5 R/W I write R/W=1
for read
6E I/O Enable

7 DB0 The 8-bit data


I/O
bus

8 DB1 The 8-bit data


I/O
bus

9 DB2 The 8-bit data


I/O
bus

10 DB3 The 8-bit data


I/O
bus

The 8-bit data


11 DB4 I/O
bus

The 8-bit data


12 DB5 I/O
bus

13 DB6 The 8-bit data


I/O
bus

14 The 8-bit data


DB7 I/O
bus

Page No 33
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

TABLE 3.14.3 : LCD Command Codes

1C Shift the entire display to the right


80 Force cursor to beginning of 1st line

C0 Force cursor to beginning of 2nd line

38
2 lines and 5x7 matrix

Uses:

The LCDs used exclusively in watches, calculators and measuring instruments are the
simple seven-segment displays, having a limited amount of numeric data.

The recent advances in technology have resulted in better legibility, more information
displaying capability and a wider temperature range.

These have resulted in the LCDs being extensively used in telecommunications and
entertainment electronics.

The LCDs have even started replacing the cathode ray tubes (CRTs) used for the
display of text and graphics, and also in small TV applications.

Page No 34
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

3.15 LCD INTERFACING



Sending commands and data to LCDs with a time delay:

Fig 3.15 : Interfacing of LCD to a micro controller

To send any command from table 2 to the LCD, make pin RS=0. For data, make
RS=1.Then send a high –to-low pulse to the E pin to enable the internal latch of the
LCD.

3.16 CAMERA:

A camera is a video camera that feeds or streams its image in real time to or through a
computer to a

Page No 35
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

computer network. When "captured" by the computer, the video stream may be saved,
viewed or sent on to other networks travelling through systems such as the internet,
and e- mailed as an attachment. When sent to a remote location, the video stream may
be saved, viewed or on sent there. Unlike an IP camera (which connects using
Ethernet or Wi-Fi), a webcam is generally connected by a USB cable, or similar cable,
or built into computer hardware, such as laptops.

The term "webcam" (a clipped compound) may also be used in its original sense of a
video camera connected to the Web continuously for an indefinite time, rather than for
a particular session, generally supplying a view for anyone who visits its web
pageover the Internet. Some of them, for example, those used as online traffic
cameras, are expensive, rugged professional video cameras.

3.17 Ultrasonic sensor:

The sensor is primarily intended to be used in security systems for detection of


moving objects, but can be effectively involved in intelligent children’s toys,
automatic door opening devices, and sports training and contact-less-speed
measurement equipment.

Fig 3.17 : Ultrasonic sensor

Page No 36
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

3.17.1 Introduction

Modern security systems utilize various types of sensors to detect unauthorized object
access attempts. The sensor collection includes infrared, microwave and ultrasound
devices, which are intended to detect moving objects. Each type of sensor is
characterized by its own advantages and drawbacks. Microwave sensors are effective
in large apartments because microwaves pass through dielectric materials. But these
sensors consist of expensive super-high frequency components and their radiation is
unhealthy for living organisms.

Infrared sensors are characterized by high sensitivity, low cost and are widely used.
But, these sensors can generate false alarm signals if heating systems are active or
temperature change speed exceeds some threshold level. Moreover, infrared sensors
appreciably lose sensitivity if small insects penetrate the sensor lens. Ultrasound
motion detection sensors are characterized by small power consumption, suitable cost
and high sensitivity. That is why this kind of sensor is commonly used in home, office
and car security systems. Existing ultrasound sensors consist of multiple passive and
active components and are relatively complicated for production and testing. Sensors
often times require a laborious tuning process.

Page No 37
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

The ultrasound transmitter TX is emitting ultrasound waves into sensor ambient space
continuously. These waves are reflecting from various objects and are reaching
ultrasound receiver RX. There is a constant interference figure if no moving objects
are in the placement.

Any moving object changes the level and phase of the reflected signal, which
modifies the summed received signal level. Most low cost sensors (car security
systems, for instance) perform reflected signal amplitude analysis to detect moving
objects. In spite of implementation simplicity, this detection method is characterized
by a high sensitivity to noise signals. For example, heterogeneous airflows, sensor
vibrations, room window and door deformations, and gusts can change the
interference figure and generate false alarm signals.

Better noise resistance may be obtained if they receive sensor is performing reflected
signal frequency analysis instead of amplitude examination. The reflected signal
spectrum emulates a Doppler Effect. Frequency components of the moving object
speed vector have a component in the direction of ultrasound radiation propagation.
Because ultrasound waves reflect from the windows, walls, furniture etc., the sensor
can detect object movements in any direction. To implement this principle, the sensor
must perform selection and processing of Doppler Effect frequency shift to detect
moving objects.

The air condition systems, heat generators, and refrigerators typically include
movable parts, which can cause device vibrations that generate high-frequency
Doppler components in the reflected ultrasound signal. The heterogeneous variable
temperature airflows are characterized by different ultrasound propagation speed that
can raise low-frequency Doppler components in the reflected signal. That is why the
noise resistant motion detection sensor should limit the Doppler signals’ frequency
range from lower and upper bounds to satisfactory false-alarm free operation.

Page No 38
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

3.17.2 Product features:

Ultrasonic ranging module HC - SR04 provides 2cm - 400cm non-contact


measurement function, the ranging accuracy can reach to 3mm.

The modules includes ultrasonic transmitters, receiver and control circuit. The basic
principle of work:

(1) Using IO trigger for at least 10us high level signal,



(2) The Module automatically sends eight 40 kHz and detect whether there is a pulse
signal back.
(3) IF the signal back, through high level , time of high output IO duration is the time
from sending ultrasonic to returning.
Test distance = (high level time *velocity of sound (340M/S) / 2,

Wire connecting direct as following:

5V Supply
Trigger Pulse Input
Echo Pulse Output
0V Ground

Electric Parameter

Working Voltage DC 5v
Working Current 15mA
Working Frequency 40Hz
Max Range 4m
Min Range 2cm
Measuring Angle 15 degree
Trigger Input Signal 10uS TTL pulse

Page No 39
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

3.18 DC Motor
DC motors are configured in many types and sizes, including brush less, servo and
gear motor types. A motor consists of a rotor and a permanent magnetic field stator.
The magnetic field is maintained using either permanent magnets or electromagnetic
windings.
DC motors are most commonly used in variable speed and torque.
Motion and controls cover a wide range of components that in some way are used to
generate and/or control motion. Areas within this category include bearings and
bushings, clutches and brakes, controls and drives, drive components, encoders and
resolves, Integrated motion control, limit switches, linear actuators, linear and rotary
motion components, linear position sensing, motors (both AC and DC motors),
orientation position sensing, pneumatics and pneumatic components, positioning
stages, slides and guides, power transmission (mechanical), seals, slip rings,
solenoids, springs.

Motors are the devices that provide the actual speed and torque in a drive system. This
family includes AC motor types (single and multiphase motors, universal, servo
motors, induction, synchronous, and gear motor) and DC motors (brush less, servo
motor, and gear motor) as well as linear, stepper and air motors, and motor contactors
and starters.

In any electric motor, operation is based on simple electromagnetism. A current-


carrying conductor generates a magnetic field; when this is then placed in an external
magnetic field, it will experience a force proportional to the current in the conductor,
and to the strength of the external magnetic field. As you are well aware of from
playing with magnets as a kid, opposite (North and South) polarities attract, while like
polarities (North and North, South and South) repel. The internal configuration of a
DC motor is designed to harness the magnetic interaction between a current-carrying
conductor and an external magnetic field to generate rotational motion.

Page No 40
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

Let's start by looking at a simple 2-pole DC electric motor (here red represents a
magnet or winding with a "North" polarization, while green represents a magnet or
winding with a "South" polarization).

Fig 3.18 : Block Diagram of the DC motor

Every DC motor has six basic parts -- axle, rotor (a.k.a., armature), stator,
commutator, field magnet(s), and brushes. In most common DC motors (and all that
Beamers will see), the external magnetic field is produced by high-strength permanent

magnets1. The stator is the stationary part of the motor -- this includes the motor

casing, as well as two or more permanent magnet pole pieces. The rotor (together with
the axle and attached commutator) rotates with respect to the stator. The rotor consists
of windings (generally on a core), the windings being electrically connected to the
commutator. The above diagram shows a common motor layout -- with the rotor
inside the stator (field) magnets.

The geometry of the brushes, commutator contacts, and rotor windings are such that
when power is applied, the polarities of the energized winding and the stator
magnet(s) are misaligned, and the rotor will rotate until it is almost aligned with the
stator's field magnets. As the rotor reaches alignment, the brushes move to the next
commutator contacts, and energize the next winding.

Page No 41
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

In real life, though, DC motors will always have more than two poles (three is a very
common number). In particular, this avoids "dead spots" in the commutator. You can
imagine how with our example two-pole motor, if the rotor is exactly at the middle of
its rotation (perfectly aligned with the field magnets), it will get "stuck" there.
Meanwhile, with a two-pole motor, there is a moment where the commutator shorts
out the power supply (i.e., both brushes touch both commutator contacts
simultaneously). This would be bad for the power supply, waste energy, and damage
motor components as well. Yet another disadvantage of such a simple motor is that it
would exhibit a high amount of torque” ripple" (the amount of torque it could produce
is cyclic with the position of the rotor).

Fig 3.18.1 : Block Diagram of the DC motor having two poles only

So since most small DC motors are of a three-pole design, let's tinker with the
workings of one via an interactive animation (JavaScript required):

Fig 3.18.2 : Block Diagram of the DC motor having Three poles

Page No 42
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

You'll notice a few things from this -- namely, one pole is fully energized at a time
(but two others are "partially" energized). As each brush transitions from one
commutator contact to the next, one coil's field will rapidly collapse, as the next coil's
field will rapidly charge up (this occurs within a few microsecond). We'll see more
about the effects of this later, but in the meantime you can see that this is a direct
result of the coil windings' series wiring:

Fig 3.18.3 : Internal Block Diagram of the Three pole DC motor

There's probably no better way to see how an average dc motor is put together, than
by just opening one up. Unfortunately this is tedious work, as well as requiring the
destruction of a perfectly good motor. This is a basic 3-pole dc motor, with 2 brushes
and three commutator contacts.

3.19 H-BRIDGE:

DC motors are typically controlled by using a transistor configuration called an "H-


bridge". This consists of a minimum of four mechanical or solid-state switches, such
as two NPN and two PNP transistors. One NPN and one PNP transistor are activated

at a time.
Page No 43
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

Fig 3.19 : H-Bridge


Both NPN and PNP transistors can be activated to cause a short across the motor
terminals, which can be useful for slowing down the motor from the back EMF it
creates.

3.19.1 Basic Theory


H-bridge. Sometimes called a "full bridge" the H-bridge is so named because it has
four switching elements at the "corners" of the H and the motor forms the cross bar.
The key fact to note is that there are, in theory, four switching elements within the
bridge. These four elements are often called, high side left, high side right, low side
right, and low side left (when traversing in clockwise order).

The switches are turned on in pairs, either high left and lower right, or lower left and
high right, but never both switches on the same "side" of the bridge. If both switches
on one side of a bridge are turned on it creates a short circuit between the battery plus
and battery minus terminals. If the bridge is sufficiently powerful it will absorb that
load and your batteries will simply drain quickly. Usually however the switches in
question melt.

To power the motor, you turn on two switches that are diagonally opposed. In the
picture to the right, imagine that the high side left and low side right switches are
turned on.

Page No 44
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

The current flows and the motor begins to turn in a "positive" direction. Turn on the
high side right and low side left switches, then Current flows the other direction
through the motor and the motor turns in the opposite direction.

Actually it is just that simple, the tricky part comes in when you decide what to use
for switches. Anything that can carry a current will work, from four SPST switches,
one DPDT switch, relays, transistors, to enhancement mode power MOSFETs.

One more topic in the basic theory section, quadrants. If each switch can be controlled
independently then you can do some interesting things with the bridge, some folks
call such a bridge a "four quadrant device" (4QD get it?). If you built it out of a single
DPDT relay, you can really only control forward or reverse. You can build a small
truth table that tells you for each of the switch's states, what the bridge will do. As
each switch has one of two states, and there are four switches, there are 16 possible
states. However, since any state that turns both switches on one side on is
"bad" (smoke issues forth: P), there are in fact only four useful states (the four
quadrants) where the transistors are turned on.

The last two rows describe a maneuver where you "short circuit" the motor which
causes the motors generator effect to work against itself. The turning motor generates
a voltage which tries to force the motor to turn the opposite direction. This causes the
motor to rapidly stop spinning and is called "braking" on a lot of H-bridge designs.

Of course there is also the state where all the transistors are turned off. In this case the
motor coasts freely if it was spinning and does nothing if it was doing nothing.

Page No 45
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

3.19.2 Implementation
1. Using Relays:

A simple implementation of an H Bridge using four SPST relays is shown. Terminal A


is High Side Left, Terminal B is High Side Right, Terminal C is Low Side Left and
Terminal D is Low Side Right. The logic followed is according to the table above.

Warning: Never turn on A and C or B and D at the same time. This will lead to a short
circuit of the battery and will lead to failure of the relays due to the large current.

Fig 3.19.2(1) : H Bridge using four SPST relays

Page No 46
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

2. Using Transistors:

We can better control our motor by using transistors or Field Effect Transistors
(FETs).Most of what we have discussed about the relays H-Bridge is true of these
circuits. See the diagram showing how they are connected. You should add diodes
across the transistors to catch the back voltage that is generated by the motor's coil
when the power is switched on and off.

This fly back voltage can be many times higher than the supply voltage! For
information on building an H-Bridge using Transistors, have a look here.

Warning: If you don't use diodes, you could burn out your transistors. Also the same
warning as in the diode case. Don't turn on A and C or B and D at the same time.

Transistors, being a semiconductor device, will have some resistance, which causes
them to get hot when conducting much current. This is called not being able to sink or
source very much power, i.e.: Not able to provide much current from ground or from
plus voltage.

Mosfets are much more efficient, they can provide much more current and not get as
hot. They usually have the fly back diodes built in so you don't need the diodes
anymore. This helps guard against fly back voltage frying your ICs.

To use Mosfets in an H-Bridge, you need P-Channel Mosfets on top because they can
"source" power, and N-Channel Mosfets on the bottom because then can "sink"
power.

It is important that the four quadrants of the H-Bridge circuits be turned on and off
properly. When there is a path between the positive and ground side of the H-Bridge,
other than through the motor, a condition exists called "shoot through". This is
basically a direct short of the power supply and can cause semiconductors to become
ballistic, in circuits with large currents flowing.

Page No 47
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

Fig 3.19.2(2) : H Bridge using Transistor

1. Using H-Bridge Devices

The L293 has 2 H-Bridges (actually 4 Half H-Bridges), can provide about 1 amp to
each and occasional peak loads to 2 amps.

The L298 has 2 h-bridges on board, can handle 1amp and peak current draws to about
3amps. The LMD18200 has one h-bridge on board, can handle about 2 or 3 amps and
can handle a peak of about 6 amps. There are several more commercially designed H-
Bridge chips as well.

Once a Half H-bridge is enabled, it truth table is as follows:

So you just give a High level when you want to turn the Half H-Bridge on and Low
level when you want to turn it off. When the Half H-Bridge is on, the voltage at the
output is equal to Vcc2.If you want to make a Full H-Bridge, you connect the motor
(or the load) between the outputs of two Half H-Bridges and the inputs will be the two
inputs of the Half H-Bridges.
Suppose we have connected Half H-Bridges 1 and 2 to form a Full H-Bridge. Now the
truth table is as follows:

Page No 48
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

INPUT
INPUT 1A 2A OUTPU
T 1Y OUTPU Description
T 2Y
Braking (both
L L L L terminals of motor
are Gnd)

L L H Forward Running
H

H L H L Backward Running

H H H
Braking (both
terminals of motor
at Vcc2

3.20 L293D:

The L293 is an integrated circuit motor driver that can be used for simultaneous, bi-
directional control of two small motors. Small means small. The L293 is limited to
600 mA, but in reality can only handle much small currents unless you have done
some serious heat sinking to keep the case temperature down.

Page No 49
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

If it gets too hot to touch, you can't use it with your motor. (Note to ME2011 students:
The L293 should be OK for your small motor but is not OK for your gear motor.)

The L293 comes in a standard 16-pin, dual-in line integrated circuit package. There is
an L293 and an L293D part number. Pick the "D" version because it has built in
flyback diodes to minimize inductive voltage spikes.

The pinout for the L293 in the 16-pin package is shown below in top view. Pin 1 is at
the top left when the notch in the package faces up. Note that the names for pin
functions may be slightly different than what is shown in the following diagrams.

Fig 3.20 : L293D PIN DIAGRAM

Page No 50
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

The following schematic shows how to connect the L293 to your motor and the
Stamp. Each motor takes 3 Stamp pins. If you are only using one motor, leave pins 9,
10, 11, 12, 13, 14, and 15 empty.

Assume you have only one motor connected with the enable tied to Stamp Pin 0, and
the two direction controls tied to Stamp Pins 1 and 2. Here is a table describing the
control pin functions.

Page No 51
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

ENABLE DIRA DIRB Function

H H L Turn right

H L H Turn left

H L/H L/H Fast stop

either Slow stop


L either

And here is a short sample program that exercises the L293.

Advantage:

You can control 2 motors in both directions instead of 4 in only one direction.

Disadvantages:

There is a 1.5V voltage drop within the L293D driver chip.

Page No 52
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

CHAPTER 4 : RASPBERRY PI SOFTWARE


DISCRIPTION

SOFTWARE TOOLS REQUIRED

4.1 Raspberry pi OS

Getting an raspberry pi operating system we have made sure we have all the physical
equipment you need. Now It's time to get yourself an operating system and boot up
your Raspberry Pi.

Fig 4.1 : Raspberry pi system

Page No 53
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

The Raspberry Pi itself doesn’t come with an operating system. For that, you need
NOOBS, short for .New Out of the Box Software. It’s an operating system manager
that makes it easy to download, install, and set up your Raspberry Pi. When you first
boot up NOOBS, you’ll get a selection of OSes to choose from. Which operating
systems are available depends on which model of Raspberry Pi you are using. For this
guide, we’ll stick to the most common OS es operating systems available on the
newest models of the Raspberry Pi. Right now, that’s Raspbian, OSMC, Open ELEC,
Windows IoT Core, and RISC OS.

Raspbian is the “official” operating system of the Raspberry Pi and because of that,
it’s the one most people will want to start with. Raspbian is a version of Linux built
specifically for the Raspberry Pi. It comes packed with all the software you’ll need for
every basic task with a computer. You’ll get Libre Office as an office suite, a web
browser, email program, and some tools to teach programming to kids and adults
alike. Heck, it even includes a special (no longer in development) version of
Minecraft.Raspbian is the backbone for pretty much every DIY project out there, so if
you’re looking to make something, Raspbian is most likely where you want to start.
Because it’s so widely used, it’s also easy to find guides and troubleshooting tips.
The recommended operating system for use with the Raspberry Pi is called Raspbian.
Raspbian is a version of GNU/Linux, designed specifically to work well with the
Raspberry Pi. You have several options when it comes to getting hold of a copy of
Raspbian.

4.1.1 Install raspbian with NOOBS



NOOBS stands for New Out Of Box Software, and if you've never played around
with GNU/Linux before, then it's the best place to start. To begin with, it's always a
good idea to make sure you have formatted your SD card. You'll need to make sure
your computer has a built-in SD card reader, or you can use a USB SD card reader.

Page No 54
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

1. Visit the SD Association’s website and download SD Formatter 4.0 for either
Windows or Mac 


2. Follow the instructions to install the software. 


3. Insert your SD card into the computer or laptop’s SD card reader and make a 

note of the drive letter allocated to it, e.g. F:/ . 


4. In SD Formatter, select the drive letter for your SD card and format it 


Fig. 4.1.1 : 2SD card formatter window

Page No 55
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

4.1.2Download NOOBS

1. Visit the official Raspberry Pi Downloads page.

Fig 4.1.2 : raspberry pi website home

2. Click on NOOBS.

Fig. 4.1.2(1) : Respbian OS download page

Page No 56
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

3. Click on the Download ZIP button under ‘NOOBS (offline and network
install)’, and select a folder to save it to. 


4. Extract the files from the zip. 


5. Once your SD card has been formatted, drag all the files in the extracted 

NOOBS folder and drop them onto the SD card drive. 


6. The necessary files will then be transferred to your SD card. 


7. When this process has finished, safely remove the SD card and insert it into 

your Raspberry Pi. 


4.1.3 Download image rasbian directlyAn alternative to using NOOBS to


install Raspbian is to download and install the image directly. This is a faster
process, and is great if you need to image multiple cards for a workshop or
class.

1. Using a computer with an SD card reader, visit the official Raspberry Pi Downloads
page.

2. Click on Raspbian.

Fig. 4.1.3(2) : Raspbian image download page

Page No 57
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

3. Click on the Download ZIP button under ‘Raspbian Jessie (full desktop
image)’, and select a folder to save it to.

4. Extract the files from the zip. 


Fig 4.1.3 (4): downloaded image file


5. Visit etcher.io and download and install the Etcher SD card image utility. 


6. Run Etcher and select the Raspbian image you unzipped on your computer or
laptop. 


7. Select the SD card drive. Note that the software may have already selected the
right drive. 


8. Finally, click Burn to transfer Raspbian to the SD card. You'll see a progress
bar that tells you how much is left to do. Once complete, the utility will
automatically eject/unmount the SD card so it's safe to remove it from the
computer. 


Page No 58
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

Fig 4.1.3(8): burn image file into drive

4.1.4 The first time power on

If this is the first time your Raspberry Pi and SD card have been used, then you'll have
to select an operating system and configure it.

1. Once you have plugged the power cable into your Raspberry Pi, it will boot. If you
are using NOOBS, a window will appear with a list of different operating systems that
you can install. We recommend that you use Raspbian: tick the box next to Raspbian
and click on Install.

Page No 59
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

Fig 4.1.4(1) : list of OS window

2. Raspbian will then run through its installation process. Please note that this can take
a while.

Fig 4.1.4(2) : raspberry pi home window


Page No 60
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3


3. When the install process has completed, the Raspberry Pi configuration menu
respiconfig will load. Here you can set the time and date for your region, enable a
Raspberry Pi camera board, or even create users. You can exit this menu by using Tab
on your keyboard to move to Finish.

4. If you downloaded Raspbian and imaged it using Etcher rather than NOOBS, then
you will boot directly to the desktop environment of Raspbian and won't need to wait.

4.1.5 Connecting to WIFI

If you want to connect your Raspberry Pi to the internet or local network then you
will need to follow these steps:

1. WiFi connections can be made via the network icon at the right-hand end of
the menu bar. If you are using a Raspberry Pi 3, or an earlier model with a
WiFi dongle plugged in, left-clicking this icon will bring up a list of available
WiFi networks. 


Fig 4.1.5(1): Wifi list page

Page No 61
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

2. If no networks are found, it will show the message "No APs found -

scanning...": just wait a few seconds without closing the menu, and it should
find your network.

3. The icons on the right show whether a network is secured or not, and its signal
strength. Click the network that you want to connect to. If it's secured, a
dialogue box will appear prompting you to enter the network key. 


4. Enter the key and press OK, then wait a couple of seconds. The network icon
will flash briefly to show that a connection is being made. Once it's ready, the
icon stops flashing and shows the signal strength. 


4.1.6 Downloading and installing application on raspberry pi

You can use text commands to download and install extra applications you might
need. In the 'What you will need' section of a Raspberry Pi resource, for example, you
may see a piece of software listed which you will need in order to complete the
activity or project. To download and install extra applications for your Raspberry Pi,
you'll need to be connected to the internet via Ethernet or WiFi.

1. From a terminal window or on the command line, type sudo apt-get install 

<name of software> and press Enter on the keyboard. 


2. After searching for the package and downloading it, you will be asked if you
want to continue with the installation. Press Y or Enter on the keyboard to
continue. 


Page No 62
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

Fig 4.1.6(2) : Downloading Page

4.2 IDE Introduction


An integrated development environment (IDE) is a software suite that consolidates
the basic tools developers need to write and test software. Typically, an IDE contains
a code editor, a compiler or interpreter and a debugger that the developer accesses
through a single graphical user interface (GUI). An IDE may be a standalone
application, or it may be included as part of one or more existing and compatible
applications. An IDE's toolbar looks much like a word processor's toolbar. The tools
in the toolbar facilitate color-coding, source-code formatting, error diagnostics, and
reporting and intelligent code completion. The interface allows the developer to
compile and execute code incrementally and manage changes to source code in a
uniform manner. IDEs are typically designed to integrate with third-party version
control libraries, like GitHub orApache Subversion. Increasingly, IDEs are being
offered through a software-as-a-service (SaaS) delivery model. The benefits of cloud
IDEs include accessibility to software development tools from anywhere in the world,
from any compatible device; minimal to nonexistent download and installation; and
ease of collaboration among geographically dispersed developers.

Page No 63
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

4.2.1 Processing
Processingis an open-source development environment and programming language,
designed for learning how to code. While it's very flexible and powerful, it's mainly
used in the realm of visual arts. Processing was created by Ben Fry and Casey Reas in
2001. With the help of Dan Shiffman, they continue to lead a team of volunteer
developers to enhance and maintain the project. As a participant in Google's Summer
of Code, Gottfried Haider worked on Raspberry Pi support and the GPIO libraries.

1. To start Processing, click on Menu -> Programming -> Processing.

4.2.2 Write first processing sketch


The main Processing window is where you'll type your code, and the Run button is
how you'll execute that code. In the world of Processing, the program you write is
called a sketch. Create your first simple sketch:

Page No 64
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

Fig 4.2.2 : processing home

1. Enter the following code in the window:


line(0, 0, 100, 100);

2.Click on the Run button. A new window should appear with a box and a diagonal
line.

Page No 65
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

Fig 4.2.2 : (a) Processing output

The line function draws a line between two points in the window. It takes four
inputs: x1 and y1 for the start of the line, and x2 and y2 for the end of the line.
Its syntax is: Line(x1,y1,x2,y2);
To understand what this means, you'll need to know that Processing uses a coordinate
system like the one shown below. Note that the numbering begins at 0, not 1. Also, the
origin is in the top-left, rather than the bottom-left as you may be used to.

Fig 4.2.2(b) : Processing output

Page No 66
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

3. Try entering different values into the line function and press Run. Below are a
few ideas to try. Can you guess what the output will look like before you execute the
code?

4. line(0, 50, 100, 50);


5. line(50, 0, 50, 100);

line(90, 10, 10, 90);

6. Processing will execute one line of code at a time, starting at the top of the sketch
and working downward. This is called procedural programming. Try calling the line
function a few different times, with a few different values in a single sketch
7. When you click Run, you'll notice that Processing draws each line you entered on
the window.
Note: Processing will alert you to mistakes or when it can't make sense of a statement
because of a syntax error. It will highlight the line and print out helpful information in
the Message area and Console at the bottom of the window.

4.2.3 Respond to mouse

There are many ways to have a Processing sketch listen to inputs to make it
interactive; the mouse is just one way. In this section, you'll learn how to listen for
mouse clicks and get the position of the mouse.

1. Create a new sketch with the following code: 2. Intx=0;



3. Inty=0;

4. Void setup() {
5. Size(500,500);

6. // set the value of x to be half the width of the window 7. X=width/2;

8. // set the value of y to be half the height of the window 9. Y=height/2;

10. }

Page No 67
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

11. Void draw () { 


12. Background (0, 100, 0) ; 


13.//draw the circle in the position taken from the x and y variable:
14. Ellipse(x,y,50,50);
15.}
16. Void mouse Pressed(){

17. //When the mouse is pressed , update x and y
18. // to contain the current position of the mouse:
19. X= mousex;
20. Y = mousey ;
21.}

The code above uses a few special variables that all processing sketches have built in
height ,width, mouse X, mouse Y .The height and width variable refer to the height
and width of the window .The mouse X, mouse Y contain the position of the mouse
pointer. The code also creates a special function called mouse pressed() that is
executed when either mouse button is pressed.

27. Run the sketch and click anywhere in the window to see the circle move to that
position!

Fig(): Show position of pointer

Page No 68
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

28. Try updating the code to use mouseX, mouseY, and mouse pressedto change the
size or colour of a shape.

4.3 QT creator

4.3.1Introduction
Qt Creator is an integrated development environment (IDE) that provides you with
tools to design and develop applications with the Qt application framework. Qt is
designed for developing applications and user interfaces once and deploying them to
several desktop, embedded, and mobile operating systems. Qt Creator provides you
with tools for accomplishing your tasks throughout the whole application
development life-cycle, from creating a project to deploying the application to the
target platforms.

Managing ProjectsTo be able to build and run applications, Qt Creator needs the same
information as a compiler would need. This information is specified in the project
settings. Setting up a new project in Qt Creator is aided by a wizard that guides you
step-by-step through the project creation process, creates the necessary files, and
specifies settings depending on the choices you make.

Designing User InterfacesQtCreator provides two integrated visual editors, Qt Quick


Designer and Qt Designer. To create intuitive, modern-looking, fluid user interfaces,
you can use Qt Quick. If you need a traditional user interface that is clearly structured
and enforces a platform look and feel, you can use the integrated Qt Designer.

Codlings an IDEQt Creator differs from a text editor in that it knows how to build
and run applications. It understands the C++ and QML languages as code, not just as
plain text. This enables it to provide you with useful features, such as semantic
highlighting, checking code syntax, code completion, and refactoring actions.

Building and Running Qt Creator is integrated with cross-platform systems for build
automation: q make, Qbs, C Make, and Auto tools. In addition, you can import

Page No 69
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

projects as generic projects and fully control the steps and commands used to build
the project.

Qt Creator provides support for building, running, and deploying Qt applications for
desktop environment as well as embedded and mobile devices. Kits, build, run, and
deployment settings allow you to quickly switch between different setups and target
platforms.
TestingQt Creator is integrated to several external native debuggers: GNU Symbolic
Debugger (GDB), Microsoft Console Debugger (CDB), and internal JavaScript
debugger. In theDebugmode, you can inspect the state of your application while
debugging.
The memory and CPU power available on devices are limited and you should use
them carefully. Qt Creator integrates Valgrind code analysis tools for detecting
memory leaks and profiling function execution. In addition, the QML Profiler enables
you to profile Qt Quick applications.
Qt Creator is integrated to the QtTestand Google C++ Testing frameworks for unit
testing applications and libraries.

4.3.2 Download and install QT creator

1. Visit Qt web site download page https://www.qt.io/download-open-source/ and


download the qt application based on system.

2. Open zip file and by double click start the installation follow the step get
installation done.

3. Open qt creator in windows---click on start > click on qtfolder > click on Qtcreator.
ThenQt creator window will open..

Page No 70
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

Fig 4.3.2(3): QT creator home screen

4.3.3 Step to create new project

Startup Qt Creator

Fig 4.3.3 : New project window

Go to File — New File or Project menu entry

Choose QtGui Application and choose a name for it:

Page No 71
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

Fig 4.3.3(a): Select project type

Enter a project name, "firstproject01", say.

Select one or more versions of Qt to target. A desktop build is fine for this tutorial.

Select the base class to be QWidget (leave the class name as Widget which is the
default).

Fig 4.3.3(b):Select app type

Page No 72
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

Check project creation options on summary and click "Finish".


The above will create you a simple project consisting of four files:
• main.cpp

• widget.h

• widget.cpp • widget.ui

Editing the project filesWe will edit the widget.ui file first so.
Click on that and designer will switch to design mode and open up the file. You
should see a blank widget. Now do this.

Fig 4.3.3(c): UI text box creation

Click on the widget background so that both of your new widgets (the label and line
edit) get deselected.

In the toolbar at the top click on the "Lay out Horizontally" button or press Ctrl-H to
add all widgets to a horizontal layout. The layout will take care of resizing your
widgets for you if the parent widget's size changes.

Double click on the Label and it will switch to edit mode. Change the text to "My
name is:"Press Ctrl-S to save the form.

Page No 73
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

Click on the Edit mode button in the left hand panel of creator to switch back to the
text editor. You will probably see the raw xml content of the UI file at this point. Just
close it we are done with it for now.

Page No 74
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

Now open up the widget.h file and edit it so that it


looks like this:
#ifndef WIDGET_H #define WIDGET_H
#include <QWidget> namespaceUi{

class Widget;

}
class Widget :publicQWidget {

Q_OBJECT

public:

explicit Widget(QWidget*parent =0);
~Widget(); voidsetName(constQString&name);
QStringname()const;
private: Ui::Widget*ui;

};

#endif // WIDGET_H
Now edit the corresponding .cpp file to look like this:
#include "widget.h" #include "ui_widget.h"
Widget::Widget(QWidget*parent): QWidget(parent),
ui(newUi::Widget)

{
ui->setupUi(this); }
Widget::~Widget() {

Page No 75
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

deleteui; }
void Widget::setName(constQString&name) {

ui->lineEdit->setText(name);

}
QString Widget::name()const {

returnui->lineEdit->text();

}
Finally edit main.cpp to this:
#include <QApplication> #include "widget.h"
int main(intargc,char*argv[]) {

QApplicationa(argc,argv);
Widget w; w.setName("Slim Shady"); w.show();

returna.exec();

}

4.3.4 running the application

Now build (Hammer icon in lower left or default shortcut of Ctrl-Shift-B) and run the
application (green "play" icon in lower left corner). You will see some compiler
messages go past in the "Compile Output" panel at the bottom whilst building.

Page No 76
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

Fig 4.3.4(a): Run application page

• This is what the application looks like when it is executed:

Fig 4.3.4(b): Output window

Page No 77
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

4.4 Python Introduction

Python is a high-level, interpreted, interactive and object-oriented scripting language.


Python is designed to be highly readable. It uses English keywords frequently where
as other languages use punctuation, and it has fewer syntactical constructions than
other languages. Python iseasy to learnyet powerful and versatile scripting language
which makes it attractive for Application Development. Python's syntax anddynamic
typingwith its interpreted nature, make it an ideal language for scripting and rapid
application development in many areas. Python supports multiple programming
pattern, including object oriented programming, imperative and functional
programming or procedural styles.

We don't need to use data types to declare variable because it is dynamically typed so
we can write a=10 to declare an integer value in a variable. Python makes the
development and debugging fast because there is no compilation step included in
python development and edit-test-debug cycle is very fast.

• Python is interpreted: Python is processed at runtime by the interpreter. You do


not need to compile your program before executing it. This is similar to PERL
and PHP. 


• Python is Interactive: You can actually sit at a Python prompt and interact with
the interpreter directly to write your programs. 


• Python is Object-Oriented: Python supports Object-Oriented style or technique


of programming that encapsulates code within objects. 


Page No 78
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

4.4.1 History of python 


• Python was developed by Guido van Rossum in the late eighties and early
nineties at the National Research Institute for Mathematics and Computer
Science in the Netherlands. 


• Python is derived from many other languages, including ABC, Modula-3, C,


C++, Algol-68, SmallTalk, Unix shell, and other scripting languages. 


• Python is copyrighted. Like Perl, Python source code is now available under
the GNU General Public License (GPL). 


• Python is now maintained by a core development team at the institute,


although Guido van Rossum still holds a vital role in directing its progress. 

Python features 


• Easy-to-learn: Python has few keywords, simple structure, and a clearly


defined syntax. This allows the student to pick up the language quickly. 


• Easy-to-read: Python code is more clearly defined and visible to the eyes. 


• Easy-to-maintain: Python's source code is fairly easy-to-maintain. 


• A broad standard library: Python's bulk of the library is very portable and 

cross-platform compatible on UNIX, Windows, and Macintosh. 


• Interactive Mode: Python has support for an interactive mode which allows 

interactive testing and debugging of snippets of code. 


• Portable: Python can run on a wide variety of hardware platforms and has 

the same interface on all platforms. 


Page No 79
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

• Extendable: You can add low-level modules to the Python interpreter. 



These modules enable programmers to add to or customize their tools to be 

more efficient. 


• Databases: Python provides interfaces to all major commercial databases. 


• GUI Programming: Python supports GUI applications that can be created


and ported to many system calls, libraries, and windows systems, such as
Windows MFC, Macintosh, and the X Window system of Unix. 


• Scalable: Python provides a better structure and support for large programs
than shell scripting. 

Apart from the above-mentioned features, Python has a big list of good
features, few are listed below: 


• IT supports functional and structured programming methods as well as OOP. 


• It can be used as a scripting language or can be compiled to byte-code for 



building large applications. 


• It provides very high-level dynamic data types and supports dynamic type 

checking. 


• IT supports automatic garbage collection. 


• It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java. 


Page No 80
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

CHAPTER 5 : OUTPUT IMAGES

1. Women safety night Patrolling robot the components consist of LCD display,
raspberry pi 3, DC motor, GSM module ,ultra sonic sensors.

Fig 5(1) : OUTPUT IMAGE

Page No 81
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

2.When the robot is moving in a path if any object is detected by ultrasonic sensor the
message will be send to phone through GSM module which is shown below figure.

Fig 5(2) : messages send by GSM module

3. We can see live streaming in IOT Gecko those images are shown below.

Fig 5(3) : Live streaming in IOT gecko

Page No 82
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

CHAPTER 6 : CONCLUSION

CONCLUSION

The project “WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING


RASPBERRY PI 3” has been successfully designed and tested. It has been
developed by

integrating features of all the hardware components used. Presence of every module
has been reasoned out and placed carefully thus contributing to the best working of
the unit.

Page No 83
WOMEN SAFETY NIGHT PATROLLING ROBOT BY USING RASPBERRY PI 3

CHAPTER 7 : REFERENCE

[1] “Review of human detection techniques in night vision” in 2017 International


Conference on Wireless Communications, Signal Processing and Networking
(WiSPNET)
[2] Eun Som Jeon et al., "Human detection based on the generation of a background
image by using a far-infrared light camera", Sensors, vol. 15, no. 3, pp. 6763-6788,
2015.
[3] Dushyant Kumar Singh, Dharmender Singh Kushwaha, "automatic intruder
combat system: a way to smart border surveillance", Defence Science Journal, vol.
67, no. 1, pp. 50-58, 2016.

Page No 84
1
1

S-ar putea să vă placă și