Sei sulla pagina 1di 44

SREENIDHI INSTITUTE OF SCIENCE & TECHNOLOGY

(AUTONOMOUS)
(Affiliated to JNT University Hyderabad, Hyderabad and Approved by AICTE - New
Delhi)
Yamnampet, Ghatkesar, R.R District, Hyderabad – 501301

INTERNSHIP MINI PROJECT REPORT

on

OBSTACLE DETECTION ROBOT USING BLUETOOTH AND IR MODULE

in

BACHELOR OF TECHNOLOGY

Department of

ELECTRONICS &COMMUNICATION ENGINEERING

IInd YR

by

Y.SAI KIRAN REDDY

16311A0493

Under the Guidance of

Mr. V . Rama Krishna Sharma


Associate Professor

1
SREENIDHI INSTITUTE OF SCIENCE & TECHNOLOGY

(AUTONOMOUS)
(Affiliated to JNT University Hyderabad, Hyderabad and Approved by AICTE - New
Delhi)
Yamnampet, Ghatkesar, R.R District, Hyderabad – 501301
Certificate

This is to certify that the Internship Mini Project report entitled “OBSTACLE DETECTION
ROBOT USING BLUETOOTH AND IR MODULE” being submitted by Y.SAI KIRAN
REDDY bearing Roll Nos 16311A0493 in partial fulfillment for the award of the Degree of
BACHELOR OF TECHNOLOGY (II YEAR II SEMESTER )in Electronics and
communication & Engineering to the Jawaharlal Nehru Technological University,
Hyderabad ,is bonafied work carried out by her under the guidance and supervision of
Computer Education Department , ECIL .

Mr . V .Rama Krishna Sharma Dr.S.P.V.Subba Rao

Associate Professor Professor and HOD

2
ACKNOWLEDGEMENT

We take this opportunity to express my sincere gratitude and thanks to all those who have
accompanied us in this lab project especially Mr.V.RamaKrishnaSharma , Project Supervisor
, Department of Electronics and Communication Engineering , Sreenidhi Institute of Science
and Technology , Yamnampet , Ghatkesar, who allowed us to do this project.We are very
grateful for Head of the Department of Electronics and Communication Engineering ,
Dr.S.P.V.SUBBA RAO , Sreenidhi Institute of Science and Technology , for allowing to take
this project.

We are very grateful to Dr.P.Narasimha Reddy,Director and Dr. Siva Reddy ,Principal and
the management of the Sreenidhi Institute of Science and Technology for having provided this
opportunity to us in taking the project.

3
CONTENTS:

a. Abstract - 4
2. Introduction - 6
3. Review Of Literature - 8
4. Components - 9
3.1 Hardware unit - 9
3.2 IR Sensor Unit - 9
3.3 Micrcontroller - 10
3.4 L293D - 16
3.5 Bluetooth - 18
3.6 LED - 21
3.7 LCD - 23
3.8 Power supply - 27
3.9 Voltage Regulator - 32
3.10 DC Motor - 33
5. Software Code - 37
4.1 Obstacle Detection - 37
6. Working Principle - 40
7. Advantages - 42
8. Disadvantages - 42
9. Conclusion - 42
10. Future scope - 42
11. Results - 43
12. Bibliography - 45

4
LIST OF FIGURES:

TOPIC PG.NO

1. Block diagram and Theory - 8


2. IR sensor circuit - 9-10
3. CONTROLLER -1 - 13,15,
4. L293D - 17,18
5. Bluetooth - 21
6. LED - 22
7. LCD - 24,25,26
8. Power Supply - 28,29,30
9. Voltage Regulator - 32
10. DC Motor - 33
11. Working principle - 40
12. Results - 44

5
ABSTRACT

Now day’s many industries are using robots due to their high level of performance and reliability
and which is a great help for human beings. The obstacle avoidance robotics is used for detecting
obstacles and avoiding the collision. This is an autonomous robot. The design of obstacle
avoidance robot requires the integration of many sensors according to their task.
The obstacle detection is primary requirement of this autonomous robot. The robot gets the
information from surrounding area through mounted sensors on the robot. Some sensing devices
used for obstacle detection like bump sensor, infrared sensor, ultrasonic sensor etc. Ultrasonic
sensor is most suitable for obstacle detection and it is of low cost and has high ranging capacity.

6
CHAPTER-1: INTRODUCTION

Robotics is part of Today’s communication. In today’s world ROBOTICS is fast growing and
interesting field. It is simplest way for latest technology modification. Now a day’s
communication is part of advancement of technology, so we decided to work on robotics field,
and design something which will make human life simpler in day today aspect. Thus we are
supporting this cause.

Robotics is the branch of technology that deals with the design, construction, operation,
structural disposition, manufacture and application of robots and computer systems for their
control, sensory feedback, and information processing. Obstacle detection and avoidance robots
are intelligent robots which can perform desired tasks in unstructured environments by finding
and overcoming obstacles in their way without continuous human guidance. In robotics, obstacle
avoidance is the task of satisfying some control objective subject to non-intersection or non-
collision position constraints.

Normally obstacle avoidance is usually implemented as a reactive control law while the other
involves the pre-computation of an obstacle-free path which a controller will then guide a robot
along. A practical real-time system for passive obstacle detection and avoidance is presented.

There are a wide variety of sensors available which are capable of measuring almost anything,
from environmental conditions (distance, light, sound, temperature). The 01 first sensor often
incorporated into a mobile robot is a distance sensor, which is usually in the form of an infrared
or ultrasonic sensor. In both cases, a pulse (of light or sound) is sent and its reflection is timed to
IR LED is used for detecting objects. In this project mainly when ever robot senses any obstacle
it stops on the followed the path. Robot consists of two motors, which control the side pair
wheels of each and help in moving forward and backward direction.

The emitter is typically an LED that emits near-infrared light. Infrared (IR) light is
electromagnetic radiation with a wavelength longer than that of visible light, measured from the

7
nominal edge of visible red light at 0.74 micrometers (µm), and extending conventionally to 300
µm. These wavelengths correspond to a frequency range of approximately 1 to 400 THz, and
include most of the thermal radiation emitted by objects near room temperature. Microscopically,
IR light is typically emitted or absorbed by molecules when they change their rotational-
vibration movements.

. IR detectors have a demodulator inside that looks for modulated IR at 38 KHz. Just shining an
IR LED won’t be detected, it has to be PWM blinking at 38KHz. Photocells do not have any sort
of demodulator and can detect any frequency (including DC) within the response speed of the
photocell (which is about 1KHz). IR detectors are digital out - either they detect 38KHz IR
signal and output low (0V) or they do not detect any and output high (5V).

Obstacle sensors are nothing but the IR pair. As the transmitter part travel IR rays from to
receiver here also transmitter send the data receiver but these IR pair are places beside each
other. So whenever an obstacle senor got a obstacle in between its way the IR rays reflects in a
certain angle. As they are placed side by each other . We have used two D.C motors to give
motion to the robot. The construction of the robot circuit is easy and small .The electronics parts
used in the robot circuits are easily available and cheap too.

8
CHAPTER-2: REVIEW OF LITERATURES

A microcontroller of 8051 family is used for this operation. The motors are connected through
motor driver IC to microcontroller. The IR sensor is attached in front of the robot. Whenever the
robot is going on the desired path the IR sensor transmits the IR waves continuously from its
sensor head. Whenever an obstacle comes ahead of it ,IR waves are reflected back from an
object and that information is passed to the microcontroller. The microcontroller controls the
motors left, right, back, front, based on IR signals. In order to control the speed of each motor
pulse width modulation is used (PWM).

IR
SEN
SOR

It has an infrared sensor which is used to sense the obstacles coming in between the path of
robot. It will move in a particular direction and avoid the obstacle which is coming in its path. It
uses IR (Infra Red) sensors and two IR transmitting circuitry. When the obstacle comes in path
of robot IR beam is reflected from the obstacle then sensor gives zero voltage to µc. This zero
voltage is detected then µc decides to avoid the obstacle by taking left or right turn. If the sensor
gives +5v to µc that means there is no obstacle present in its path so it goes straight until any
obstacle is detected. The two IR transmitter circuits are fitted on front and left side of robot. The
two IR sensors are placed near to transmitters’ IR LEDs. The connections can be given from
main circuit to sensors using simple twisted pair cables. Two motors namely right motor and left
motor are connected to driver IC (L293D). L293D is interface with µc. Micro-controller sends
logic 0 & logic 1 as per the programming to driver IC which moves motors forward or reverse
direction.

9
CHAPTER-3.CONSTRUCTION
3.1 Hardware Unit
The hardware part includes the structure of robot that is Electronics and Communication
structure, PCB (printed circut board), blower, and battery. In this unit all the connections are
being made along with the PCB now let us see in brief how it can be done.
3.1.1 Electronics and Communication Connection
In Electronics and Communication connection wheel is connected to base very tightly to avoid
errors in the system. Connection of blower is made with lower part of base and battery is
connected in upper portion of base for power supply to the system which is very important
battery used here is of 6v battery, blower of +5V to +9V. And along with wheel electrical motors
are connected with base having r.p.m of 100 rpm.
3.1.2 PCB Connection
A printed circuit board, or PCB, is used for Electronics and Communication only support and
electrically connect electronic components using conductive pathways, tracks or signal traces
etched from copper sheets laminated onto a nonconductivesubstrate.The PCB is printed circuit
board having circuit made with cooper.

3.2 IR Sensor Circuit


The circuits are designed around the LM339 comparator chip and can use a wide assortment of
matched infrared - emitter / detector pairs. There is also a method that can be used for longer
range across track detection that could be used for yard throats. A detector circuit of this type is
in use at the London Model Railroad Group's club layout and spans seven "O" Scale tracks using
one infrared LED and a lensed phototransistor.LED will turn on when the infrared beam is
broken. The value of the resistor R1 determines the sensitivity of the phototransistor Q1.

10
3.3 Controller Circuit:

Microcontroller (also MCU or µC) is a functional computer system-on-a-chip. It contains a


processor core, memory, and programmable input/output peripherals . Microcontrollers include
an integrated CPU, memory (a small amount of RAM, program memory, or both) and
peripherals capable of input and output.

It emphasizes high integration, in contrast to a microprocessor which only contains a CPU (the
kind used in a PC). In addition to the usual arithmetic and logic elements of a general purpose
microprocessor, the microcontroller integrates additional elements such as read-write memory
for data storage, read-only memory for program storage, Flash memory for permanent data
storage, peripherals, and input/output interfaces. At clock speeds of as little as 32 KHz,
microcontrollers often operate at very low speed compared to microprocessors, but this is
adequate for typical applications. They consume relatively little power (milliwatts), and will
generally have the ability to retain functionality while waiting for an event such as a button press
or interrupt.

. By reducing the size, cost, and power consumption compared to a design using a separate
microprocessor, memory, and input/output devices, microcontrollers make it economical to
electronically control many more processes.The AT89S52 is a low-power, high-performance
CMOS 8-bit microcontroller with 8Kbytes of in-system programmable Flash memory.

3.3.1 Features of 8052/8051

11
1. Compatible with MCS-51® Products.
2. 8K Bytes of In-System Programmable (ISP) Flash Memory.
3. Endurance: 1000 Write/Erase Cycles.
4. 4.0V to 5.5V Operating Range.
5. Fully Static Operation: 0 Hz to 33 MHz.
6. Three-level Program Memory Lock
7. 256 x 8-bit Internal RAM
8. 32 Programmable I/O Lines
9. Three 16-bit Timer/Counters
10. Eight Interrupt Sources
11. Full Duplex UART Serial Channel
12. Low-power Idle and Power-down Modes
13. Interrupt Recovery from Power-down Mode
14. Watchdog Timer
15. Dual Data Pointer
16. Power-off Flag.

They have 3 different types of memories:


-External RAM
-On chip memory
-EPROM
The 8051 uses 8 "R" registers which are used in many of its instructions. These "R" registers are
numbered from 0 through 7 (R0, R1, R2, R3, R4, R5, R6, and R7). These registers are generally
used to assist in manipulating values and moving data from one memory location to another .
3.3.2Bit Memory:

The 8051, being a communications-oriented microcontroller, gives the user the ability to access a
number of bit variables. These variables may be either 1 or 0. There are 128 bit variables
available to the user, numberd 00h through 7Fh. The user may make use of these variables with
commands such as SETB and CLR. For example, to set bit number 24 (hex) to 1 you would
execute the instruction: SETB 24h

12
It is important to note that Bit Memory is really a part of Internal RAM. In fact, the 128 bit
variables occupy the 16 bytes of Internal RAM from 20h through 2Fh. Thus, if you write the
value FFh to Internal RAM address 20h youve effectively set bits 00h through 07h. That is to say
that: MOV 20h,#0FFh is equivalent to:

SETB 00h
SETB 01h
SETB 02h
SETB 03h
SETB 04h
SETB 05h
SETB 06h
SETB07h

As illustrated above, bit memory isnt really a new type of memory. Its really just a subset of
Internal RAM. But since the 8051 provides special instructions to access these 16 bytes of
memory on a bit by bit basis it is useful to think of it as a separate type of memory. However,
always keep in mind that it is just a subset of Internal RAM--and that operations performed on
Internal RAM can change the values of the bit variables.

Note:- If your program does not use bit variables, you may use Internal RAM locations 20h
through 2Fh for your own use. But if you plan to use bit variables, be very careful about using
addresses from 20h through 2Fh as you may end up overwriting the value of your bits!

Bit variables 00h through 7Fh are for user-defined functions in their programs. However, bit
variables 80h and above are actually used to access certain SFRs on a bit-by-bit basis. For
example, if output lines P0.0 through P0.7 are all clear (0) and you want to turn on the P0.0
output line you may either execute: MOV P0,#01h or you may execute: SETB 80h Both these
instructions accomplish the same thing. However, using the SETB command will turn on the
P0.0 line without effecting the status of any of the other P0 output lines. The MOV command
effectively turns off all the other output lines which, in some cases, may not be acceptable.

13
Note:- default, the 8051 initializes the Stack Pointer (SP) to 07h when the microcontroller is
booted. This means that the stack will start at address 08h and expand upwards. If you will be
using the alternate register banks (banks 1, 2 or 3) you must initialize the stack pointer to an
address above the highest register bank you will be using, otherwise the stack will overwrite your
alternate register banks. Similarly, if you will be using bit variables it is usually a good idea to
initialize the stack pointer to some value greater than 2Fh to guarantee that your bit variables are
protected from the stack.

3.3.3 Pin Description:

PIN 9: PIN 9 is the reset pin which is used to reset the microcontroller’s internal registers and
ports upon starting up. (Pin should be held high for 2 machine cycles.)

PINS 18 & 19: The 8051 has a built-in oscillator amplifier hence we need to only connect a
crystal at these pins to provide clock pulses to the circuit.

PIN 40 and 20: Pins 40 and 20 are VCC and ground respectively. The 8051 chip needs +5V
500mA to function properly, although there are lower powered versions like the Atmel 2051
which is a scaled down version of the 8051 which runs on +3V.

PINS 29, 30 & 31: As described in the features of the 8051, this chip contains a built-in flash
memory. In order to program this we need to supply a voltage of +12V at pin 31. If external
memory is connected then PIN 31, also called EA/VPP, should be connected to ground to
indicate the presence of external memory. PIN 30 is called ALE (address latch enable), which is
used when multiple memory chips are connected to the controller and only one of them needs to

14
be selected.We will deal with this in depth in the later chapters. PIN 29 is called PSEN. This is
"program store enable". In order to use the external memory it is required to provide the low
voltage (0) on both PSEN and EA pins.

Pin 29: If we uses an external ROM then it should have a logic 0 which indicates Micro
controller to read data from memory.

Pin 30: This Pin is used for ALE that is Address Latch Enable. If we use multiple memory chips
then this pin is used to distinguish between them.It is activated periodically with a constant rate
of 1/6th of oscillator frequency. This Pin also gives program pulse input during programming of
EPROM.

Pin 31: If we have to use multiple memories then by applying logic 1 to this pin instructs Micro
controller to read data from both memories first internal and afterwards external.

There are 4 8-bit ports: P0, P1, P2 and P3.

PORT P1 (Pins 1 to 8): The port P1 is a general purpose input/output port which can be used for
a variety of interfacing tasks. The other ports P0, P2 and P3 have dual roles or additional
functions associated with them based upon the context of their usage.The port 1 output buffers
can sink/source four TTL inputs. When 1s are written to portn1 pins are pulled high by the
internal pull-ups and can be used as inputs.

PORT P3 (Pins 10 to 17): PORT P3 acts as a normal IO port, but Port P3 has additional
functions such as, serial transmit and receive pins, 2 external interrupt pins, 2 external counter
inputs, read and write pins for memory access.

PORT P2 (pins 21 to 28): PORT P2 can also be used as a general purpose 8 bit port when no
external memory is present, but if external memory access is required then PORT P2 will act as
an address bus in conjunction with PORT P0 to access external memory. PORT P2 acts as A8-
A15, as can be seen from fig 1.1

PORT P0 (pins 32 to 39) PORT P0 can be used as a general purpose 8 bit port when no external
memory is present, but if external memory access is required then PORT P0 acts as a
multiplexed address and data bus that can be used to access external memory in conjunction with
PORT P2. P0 acts as AD0-AD7, as can be seen from fig 1.1

PORT P10: asynchronous communication input or Serial synchronous communication output.


15
PIN 11: Serial Asynchronous Communication Output or Serial Synchronous Communication
clock Output.

Oscillator Circuits

The 8051 requires an external oscillator circuit. The oscillator circuit usually runs around
12 MHz, although the 8051 (depending on which specific model) is capable of running at a
maximum of 40 MHz. Each machine cycle in the 8051 is 12 clock cycles, giving an effective
cycle rate at 1 MHz (for a 12 MHz clock) to 3.33 MHz (for the maximum 40 MHz clock). The
oscillator circuit generates the clock pulses so that all internal operations are synchronized.One
machine cycle has 6 states. One state is 2 T-states. Therefore one machine cycle is 12 T-states.
Time to execute an instruction is found by multiplying C by 12 and dividing product by Crystal
frequency. T=(C*1PIN 9: PIN 9 is the reset pin which is used to reset the microcontroller’s
internal registers and ports upon starting up. (Pin should be held high for 2 machine cycles.)

Data and Program Memory

The 8051 Microcontroller can be programmed in PL/M, 8051 Assembly, C and a number of
other high-level languages. Some compilers even have support for compiling C++ for an 8051.

Program memory in the 8051 is read-only, while the data memory is considered to be read/write
accessible. When stored on EEPROM or Flash, the program memory can be rewritten when the
microcontroller is in the special programmer circuit or, if not using a 8031, through a preinstalled
bootloader.

16
Program Start Address

The 8051 starts executing program instructions from address 0000 in the program memory. The
A register is located in the SFR memory location 0xE0. The A register works in a similar fashion
to the AX register of x86 processors. The A register is called the accumulator, and by default it
receives the result of all arithmetic operations.

3.4 L293D:
The L293 and L293D are quadruple high-current half-H drivers. The L293 is designed to provide
bidirectional drive currents of up to 1 A at voltages from 4.5 V to 36 V. The L293D is designed
to provide bidirectional drive currents of up to 600-mA at voltages from 4.5 V to 36 V. Both
devices are designed to drive inductive loads such as relays, solenoids, dc and bipolar stepping
motors, as well as other high-current/high-voltage loads in positive-supply applications. All
inputs are TTL compatible. Each output is a complete totem-pole drive circuit, with a Darlington
transistor sink and a pseudo- Darlington source. Drivers are enabled in pairs, with drivers 1 and 2
enabled by 1,2EN and drivers 3 and 4 enabled by 3,4EN. When an enable input is high, the
associated drivers are enabled, and their outputs are active and in phase with their inputs. When
the enable input is low, those drivers are disabled, and their outputs are off and in the high-
impedance state. With the proper data inputs, each pair of drivers forms a full-H (or bridge)
reversible drive suitable for solenoid or motor applications.

3.4.1Features:

 Featuring Unitrode L293 and L293D Products Now From Texas Instruments
 Wide Supply-Voltage Range: 4.5 V to 36 V
 Separate Input-Logic Supply
 Internal ESD Protection
 Thermal Shutdown
 High-Noise-Immunity Inputs
 Functionally Similar to SGS L293 and SGS L293D
 Output Current 1 A Per Channel (600 mA for L293D)
 Peak Output Current 2 A Per Channel (1.2 A for L293D)

17
 Output Clamp Diodes for Inductive Transient Suppression (L293D)
3.4.2Pin diagram:

3.4.3 Description:

On the L293, external high-speed output clamp diodes should be used for inductive transient
suppression. A VCC1 terminal, separate from VCC2, is provided for the logic inputs to minimize
device power dissipation. The L293and L293D are characterized for operation from 0°C to 70°C.

3.4.4 Block diagram:

18
3.4.5 Logic diagram:

3.5 Bluetooth:

Bluetooth is a wireless protocol utilizing short-range communications technology facilitating


data transmission over short distances from fixed and/or mobile devices, creating wireless
personal area networks (PANs). The intent behind the development of Bluetooth was the creation
of a single digital wireless protocol, capable of connecting multiple devices and overcoming
issues arising from synchronization of these devices. Bluetooth uses a very robust radio
technology called frequency hopping spread spectrum. It chops up the data being sent and
transmits chunks of it on up to 75 different frequencies. In its basic mode, the modulation is
Gaussian frequency shift keying (GFSK). It can achieve a gross data rate of 1 Mb/s. Bluetooth
provides a way to connect and exchange information between devices such as mobile phones,
telephones, laptops, personal computers, printers, GPS receivers, digital cameras, and video

19
game consoles over a secure, globally unlicensed Industrial, Scientific, and Medical (ISM) 2.4
GHz short-range radio frequency bandwidth. The Bluetooth specifications are developed and
licensed by the Bluetooth Special Interest Group (SIG). The Bluetooth SIG consists of
companies in the areas of telecommunication, computing, networking, and consumer electronics.

Bluetooth is a standard and communications protocol primarily designed for low power
consumption, with a short range (power-class-dependent: 1 meter, 10 meters, 100 meters) based
on low-cost transceiver microchips in each device. Bluetooth enables these devices to
communicate with each other when they are in range. The devices use a radio communications
system, so they do not have to be in line of sight of each other, and can even be in other rooms,
as long as the received transmission is powerful enough. Bluetooth device class indicates the
type of device and the supported services of which the information is transmitted during the
discovery process. The bluetooth module used is HC05.

3.5.1 HC05:

It can be operated in both Master and slave mode

Master role: It has no function to remember the last paired salve device. It can be made paired
to any slave device. In other words, just set AT+CMODE=1 when out of factory. If you want
HC-05 to remember the last paired slave device address like HC-06, you can set AT+CMODE=0
after paired with the other device.

3.5.1.1 Pairing: Master device searches and make pair with the slave device automatically.
Typical method: On some specific conditions, master and slave device can make pair with each
other automatically. Multi-device communication: There is only point to point communication
for modules, but the adapter can communicate with multi-modules.
AT Mode 1: After power on, it can enter the AT mode by triggering PIN34 with high level. Then
the baud rate for setting AT command is equal to the baud rate in communication, for example:
9600.
AT mode 2: First set the PIN34 as high level, or while on powering the module set the PIN34 to
be high level, the Baud rate used here is 38400 bps.

20
Notice: All AT commands can be operated only AT Mode: Before paired, it is at the AT mode.
After paired it’s at transparent communication. when the PIN34 is at high level. Only part of the
AT commands can be used if PIN34 doesn’t keep the high level after entering to the AT mode.
Through this kind of designing, set permissions for the module is left to the user’s external
control circuit, that makes the application of HC-05 is very flexible. During the process of
communication, the module can enter to AT mode by setting PIN34 to be high level. By
releasing PIN34, the module can go back to communication mode in which user can inquire
some information dynamically. For example, to inquire the pairing is finished or not. During the
communication mode, the module can’t enter to the AT mode. Default communication baud rate:
9600, 4800-1.3M are settable.
KEY: PIN34, for entering to the AT mode. KEY: PIN26, for master abandons memory.
LED1: PIN31, indicator of Bluetooth mode. Slow flicker (1Hz) represents entering to the AT
mode2, while fast flicker(2Hz) represents entering to the AT mode1 or during the
communication pairing. Double flicker per second represents pairing is finished, the module is
communicable. LED2: PIN32, before pairing is at low level, after the pairing is at high level.
The using method of master and slaver’s indicator is the same.
Notice: The PIN of LED1 and LED2 are connected with LED+ LED: The flicker frequency of
slave device is 102ms. If master device already has the memory of slave device, the flicker
frequency during the pairing is 110ms/s. If not, or master has emptied the memory, then the
flicker frequency is 750m/s. After pairing, no matter it’s a master or slave device, the LED PIN
Is at high level. Notice: The LED PIN connects to LED+ PIN. During the pairing, the current is
Consumption: During the pairing, the current is fluctuant in the range of 30-40mA. The mean
current is about 25mA. After paring, no matter processing communication or not, the current is
8mA. There is no sleep mode. This parameter is same for all the Bluetooth modules. fluctuant in
the range of 30-40 m. The mean current is about 25mA. After paring, no matter processing
communication or not, the current is 8mA. There is no sleep mode. This parameter is same for all
the Bluetooth modules.
Reset: PIN11, active if it’s input low level. It can be suspended in using.
Reset: PIN11, active if it’s input low level. It can be suspended in using.
HC-05 serial product is recommended.

21
3.5.1.2 Information of Package:
The PIN definitions of HC-03, HC-04, HC-05 and HC-06 are kind of different, but the package
size is the same: 28mm * 15mm * 2.35mm.

3.6 LED(LIGHT EMITTING DIODE):

A light-emitting diode (LED) is a semiconductor diode that emits light when an electrical current
is applied in the forward direction of the device, as in the simple LED circuit. The effect is a
form of electroluminescence , where incoherent and narrow-spectrum light is emitted from the p-
n junction.

LEDs are widely used as indicator lights on electronic devices and increasingly in higher power
applications such as flashlights and area lighting. An LED is usually a small area (less than 1
mm2) light source, often with optics added to the chip to shape its radiation pattern and assist in
reflection . The color of the emitted light depends on the composition and condition of the semi
conducting material used, and can be infrared, visible, or ultraviolet. Besides lighting, interesting
applications include using UV-LEDs for sterilization of water and disinfection of devices , and
as a grow light to enhance photosynthesis in plants.

3.6.1 Basic principle:

Like a normal diode, the LED consists of a chip of semi conducting material impregnated, or
doped, with impurities to create a p-n junction. As in other diodes, current flows easily from the
p-side, or anode, to the n-side, or cathode, but not in the reverse direction. Charge-carriers
electrons and holes flow into the junction from electrodes with different voltages. When an

22
electron meets a hole, it falls into a lower energy level, and releases energy in the form of a
photon.

The wavelength of the light emitted, and therefore its color, depends on the band gap energy of
the materials forming the p-n junction. In silicon or germanium diodes, the electrons and holes
recombine by a non-radiative transition which produces no optical emission, because these are
indirect band gap materials.

The materials used for the LED have a direct band gap with energies corresponding to near-
infrared, visible or near-ultraviolet light. LED development began with infrared and red devices
made with gallium arsenide. Advances in materials science have made possible the production of
devices with ever-shorter wavelengths, producing light in a variety of colors. LEDs are usually
built on an n-type substrate, with an electrode attached to the p-type layer deposited on its
surface. P-type substrates, while less common, occur as well. Many commercial LEDs,
especially GaN/InGaN, also use sapphire substrate

3.6.2 LED Display types:

 Bar graph
 Seven segment
 Star burst
 Dot matrix

23
3.7 LCD (Liquid Cristal Display)

A Liquid Crystal display (LCD) is a thin, flat display device made up of any number of color or
monochrome pixels arrayed in front of a light source or reflector. Each pixel consists of a
column of liquid crystal molecules suspended between two transparent electrodes, and two
polarizing filters, the axes of polarity of which are perpendicular to each other.

Without the liquid crystals between them, light passing through one would be blocked by the
other. The liquid crystal twists the polarization of light entering one filter to allow it to pass
through the other.

A program must interact with the outside world using input and output devices that
communicate directly with a human being. One of the most common devices attached to an
controller is an LCD display. Some of the most common LCDs connected to the contollers are
16X1, 16x2 and 20x2 displays. This means 16 characters per line by 1 line 16 characters per line
by 2 lines and 20 characters per line by 2 lines, respectively.

Many microcontroller devices use 'smart LCD' displays to output visual information. LCD
displays designed around LCD NT-C1611 module, are inexpensive, easy to use, and it is even
possible to produce a readout using the 5X7 dots plus cursor of the display. They have a
standard ASCII set of characters and mathematical symbols. For an 8-bit data bus, the display
requires a +5V supply plus 10 I/O lines (RS RW D7 D6 D5 D4 D3 D2 D1 D0). For a 4-bit data
bus it only requires the supply lines plus 6 extra lines(RS RW D7 D6 D5 D4). When the LCD
display is not enabled, data lines are tri-state and they do not interfere with the operation of the
microcontroller.

3.7.1 Features:

 Interface with either 4-bit or 8-bit microprocessor.


 Display data RAM
 80x 8 bits (80 characters).
 Character generator ROM
 160 different 5 7 dot-matrix character patterns.

24
 Character generator RAM
 8 different user programmed 5 7 dot-matrix patterns.
 Display data RAM and character generator RAM may be Accessed by the
microprocessor.
 Numerous instructions
 Clear Display, Cursor Home, Display ON/OFF, Cursor ON/OFF , Blink Character, Cursor
Shift, Display Shift.
 Built-in reset circuit is triggered at power ON.
 Built-in oscillator.
 Data can be placed at any location on the LCD. For 16×1 LCD, the address locations are:

3.7.2 Shapes and sizes:

Even limited to character based modules,there is still a wide variety of shapes and sizes
available. Line lenghs of 8,16,20,24,32 and 40 charecters are all standard, in one, two and four
line versions. Several different LC technologies exists. “supertwist” types, for example, offer
Improved contrast and viewing angle over the older “twisted nematic” types. Some modules are
available with back lighting, so so that they can be viewed in dimly-lit conditions. The back
lighting may be either “electro-luminescent”, requiring a high voltage inverter circuit, or simple
LED illumination.

25
3.7. 3 Blockdiagram:

3.7.4 Power supply for lcd driving:

3.7.5 PIN DESCRIPTION:

Most LCDs with 1 controller has 14 Pins and LCDs with 2 controller has 16 Pins (two pins are
extra in both for back-light LED connections).

26
3.7.6 CONTROL LINES:

3.7.6.1 EN: Line is called "Enable." This control line is used to tell the LCD that you are
sending it data. To send data to the LCD, your program should make sure this line is low (0) and
then set the other two control lines and/or put data on the data bus. When the other lines are
completely ready, bring EN high (1) and wait for the minimum amount of time required by the
LCD datasheet (this varies from LCD to LCD), and end by bringing it low (0) again.

3.7.6.2 RS: Line is the "Register Select" line. When RS is low (0), the data is to be treated as a
command or special instruction (such as clear screen, position cursor, etc.). When RS is high (1),
the data being sent is text data which sould be displayed on the screen. For example, to display
the letter "T" on the screen you would set RS high.

3.7.6.3 RW: Line is the "Read/Write" control line. When RW is low (0), the information on the
data bus is being written to the LCD. When RW is high (1), the program is effectively querying
(or reading) the LCD. Only one instruction ("Get LCD status") is a read command. All others are
write commands, so RW will almost always be low. Finally, the data bus consists of 4 or 8 lines
(depending on the mode of operation selected by the user). In the case of an 8-bit data bus, the
lines are referred to as DB0, DB1, DB2, DB3, DB4, DB5, DB6, and DB7.

3.7.6.4 Logic status on control lines:

• E - 0 Access to LCD disabled

- 1 Access to LCD enabled

27
• R/W - 0 Writing data to LCD

-1 Reading data from LCD

• RS - 0 Instructions

-1 Character
3.7.6.4Entering Text: To enter characters and commands in hexadecimal rather than binary ( The
switches must be the type where On = 0, so that when they are turned to the zero position, all four
outputs are shorted to the common pin, and in position “F”, all four outputs are open circuit.

Codes associated with the characters are quoted in binary and hexadecimal, most significant bits
(“left-hand” four bits) across the top, and least significant bits (“right-hand” four bits) down the
left.Most characters conform to the ASCII standard. To enter a few characters onto the display,
both letters and numbers. The RS switch (S10) must be “up” (logic 1) when sending the
characters, and switch E (S9) must be pressed for each of them. Thus the operational order is: set
RS high, enter character, trigger E, leave RS high, enter another character, trigger E, and so on.

3.8 Power Supply:

Power supply is a reference to a source of electrical power. A device or system that supplies
electrical or other types of energy to an output load or group of loads is called a power supply
unit or PSU. The term is most commonly applied to electrical energy supplies, less often to
mechanical ones, and rarely to others This power supply section is required to convert AC signal
to DC signal and also to reduce the amplitude of the signal. The available voltage signal from the
mains is 230V/50Hz which is an AC voltage, but the required is DC voltage(no frequency) with
the amplitude of +5V and +12V for various applications. In this section we have Transformer,
Bridge rectifier, are connected serially and voltage regulators for +5V and +12V (7805 and
7812) via a capacitor (1000µF) in parallel are connected parallel as shown in the circuit diagram
below. Each voltage regulator output is again is connected to the capacitors of values (100µF,
10µF, 1 µF, 0.1 µF) are connected parallel through which the corresponding output(+5V or
+12V) are taken into consideration.

28
3.8.1 Circuit Explanation:

3.8.1.1 Transformer: A transformer is a device that transfers electrical energy from one circuit
to another through inductively coupled electrical conductors. A changing current in the first
circuit (the primary) creates a changing magnetic field; in turn, this magnetic 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, of an ideal transformer, is scaled from the primary VP
by a factor equal to the ratio of the number of turns of wire in their respective windings:

3.8.1.1.1 Basic principle: The transformer is based on two principles: firstly, that an electric
current can produce a magnetic field (electromagnetism) and secondly 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, it changes the strength of its magnetic
field; since the changing magnetic field extends into the secondary coil, a voltage is induced
across the secondary.

29
3.8.1.1.2 Detailed operation

Models of an ideal transformer typically assume a core of negligible reluctance with two
windings of zero resistance. When a voltage is applied to the primary winding, a small current
flows, driving flux around the magnetic circuit of the core. The current required to create the flux
is termed the magnetizing current; since the ideal core has been assumed to have near-zero
reluctance, the magnetizing current is negligible, although still required to create the magnetic
field.

The changing magnetic field induces an electromotive force (EMF) across each winding. Since
the ideal windings have no impedance, they have no associated voltage drop, and so the voltages
VP and VS measured at the terminals of the transformer, are equal to the corresponding EMFs.
The primary EMF, acting as it does in opposition to the primary voltage, is sometimes termed the
"back EMF". This is due to Lenz's law which states that the induction of EMF would always be
such that it will oppose development of any such change in magnetic field.

3.8.1.2 Bridge Rectifier:

A diode bridge or bridge rectifier is an arrangement of four diodes in a bridge configuration that
provides the same polarity of output voltage for any polarity of input voltage. When used in its
most common application, for conversion of alternating current (AC) input into 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 center-tapped
transformer design, but has two diode drops rather than one, thus exhibiting reduced efficiency
over a center-tapped design for the same output voltage.

3.8.1.2.1 Basic Operation

When the input connected at the left corner of the diamond is positive with respect to the one
connected at the right hand corner, current flows to the right along the upper colored path to the

30
output, and returns to the input supply via the lower one.

When the right hand corner is positive relative to the left hand corner, current flows along the
upper colored path and returns to the supply via the lower colored path.

In each case, the upper right output remains positive with respect to the lower right one. Since
this is true whether the input is AC or DC, this circuit not only produces DC power when
supplied with AC power: it also can provide what is sometimes called "reverse polarity
protection". That is, it permits normal functioning when batteries are installed backwards or DC
input-power supply wiring "has its wires crossed" (and protects the circuitry it powers against
damage that might occur without this circuit in place).

Output smoothing is done by using capacitor . For many applications, especially with single
phase AC where the full-wave bridge serves to convert an AC input into a DC output, the

31
addition of a capacitor may be important because the bridge alone supplies an output voltage of
fixed polarity but pulsating magnitude .

The function of this capacitor, known as a reservoir capacitor (aka smoothing capacitor) is to
lessen the variation in (or 'smooth') the rectified AC output voltage waveform from the bridge.
One explanation of 'smoothing' is that the capacitor provides a low impedance path to the AC
component of the output, reducing the AC voltage across, and AC current through, the resistive
load. In less technical terms, any drop in the output voltage and current of the bridge tends to be
cancelled by loss of charge in the capacitor. This charge flows out as additional current through
the load.

If supplying a dangerous voltage, a practical circuit should include a reliable way to safely
discharge the capacitor. If the normal load can not be guaranteed to perform this function,
perhaps because it can be disconnected, the circuit should include a bleeder resistor connected as
close as practical across the capacitor. This resistor should consume a current large enough to
discharge the capacitor in a reasonable time, but small enough to avoid unnecessary power
waste.

Because a bleeder sets a minimum current drain, the regulation of the circuit, defined as
percentage voltage change from minimum to maximum load, is improved. However in many
cases the improvement is of insignificant magnitude. The capacitor and the load resistance have
a typical time constant τ = RC where C and R are the capacitance and load resistance
respectively. As long as the load resistor is large enough so that this time constant is much longer
than the time of one ripple cycle, the above configuration will produce a smoothed DC voltage
across the load. In some designs, a series resistor at the load side of the capacitor is added. The
smoothing can then be improved by adding additional stages of capacitor–resistor pairs, often

32
done only for sub-supplies to critical high-gain circuits that tend to be sensitive to supply voltage
noise.

The idealized waveforms shown above are seen for both voltage and current when the load on
the bridge is resistive. When the load includes a smoothing capacitor, both the voltage and the
current waveforms will be greatly changed. While the voltage is smoothed, as described above,
current will flow through the bridge only during the time when the input voltage is greater than
the capacitor voltage.

In a practical circuit, when a capacitor is directly connected to the output of a bridge, the bridge
diodes must be sized to withstand the current surge that occurs when the power is turned on at
the peak of the AC voltage and the capacitor is fully discharged. Sometimes a small series
resistor is included before the capacitor to limit this current, though in most applications the
power supply transformer's resistance is already sufficient.

Output can also be smoothed using a choke and second capacitor. The choke tends to keep the
current (rather than the voltage) more constant. Due to the relatively high cost of an effective
choke compared to a resistor and capacitor this is not employed in modern equipment.

3.9 Voltage Regulator :

A voltage regulator is an electrical regulator designed to automatically maintain a constant


voltage level. The 78xx (also sometimes known as LM78xx) series of devices is a family of self-
contained fixed linear voltage regulator integrated circuits. The 78xx family is a very popular
choice for many electronic circuits which require a regulated power supply, due to their ease of
use and relative cheapness. When specifying individual ICs within this family, the xx is replaced
with a two-digit number, which indicates the output voltage the particular device is designed to
provide (for example, the 7805 has a 5 volt output, while 7812 gives 12 volts).

The 78xx line is positive voltage regulators, meaning that they are designed to produce a voltage
that is positive relative to a common ground. There is a related line of 79xx devices which are
complementary negative voltage regulators. 78xx and 79xx ICs can be used in combination to
provide both positive and negative supply voltages in the same circuit, if necessary.

33
78xx ICs have three terminals and are most commonly found in the TO220 form factor, although
smaller surface-mount and larger TrO3 packages are also available from some manufacturers.
These devices typically support an input voltage which can be anywhere from a

couple of volts over the intended output voltage, up to a maximum of 35 or 40 volts, and can
typically provide up to around 1 or 1.5 amps of current (though smaller or larger packages may
have a lower or higher current rating).

3.10 DC MOTOR:

3.10.1 Introduction:

A DC motor is designed to run on DC electric power. Two examples of pure DC designs are
Michael Faraday's homopolar motor (which is uncommon), and the ball bearin motor, which is
(so far) a novelty. By far the most common DC motor types are the brushed and brushless types,
which use internal and external commutation respectively to create an oscillating AC current
from the DC source -- so they are not purely DC machines in a strict sense.

34
3.10.2 Types of dcmotors:

 Brushed DC Motors
 Brushless DC motors

 Coreless DC motors

3.10.2.1 Brushed DC motors:

The classic DC motor design generates an oscillating current in a wound rotor with a split ring
commutator, and either a wound or permanent magnet stator. A rotor consists of a coil wound
around a rotor which is then powered by any type of battery.

Many of the limitations of the classic commutator DC motor are due to the need for brushes to
press against the commutator. This creates friction. At higher speeds, brushes have increasing
difficulty in maintaining contact. Brushes may bounce off the irregularities in the commutator
surface, creating sparks. This limits the maximum speed of the machine. The current density per
unit area of the brushes limits the output of the motor. The imperfect electric contact also causes
electrical noise. Brushes eventually wear out and require replacement, and the commutator itself
is subject to wear and maintenance. The commutator assembly on a large machine is a costly
element, requiring precision assembly of many parts.

3.10.2.2 Brushless DC motors:

Some of the problems of the brushed DC motor are eliminated in the brushless design. In this
motor, the mechanical "rotating switch" or commutator/brushgear assembly is replaced by an
external electronic switch synchronised to the rotor's position. Brushless motors are typically 85-
90% efficient, whereas DC motors with brushgear are typically 75-80% efficient.

Midway between ordinary DC motors and stepper motors lies the realm of the brushless DC
motor. Built in a fashion very similar to stepper motors, these often use a permanent magnet
external rotor, three phases of driving coils, one or more Hall effect sensors to sense the position
of the rotor, and the associated drive electronics. The coils are activated, one phase after the
other, by the drive electronics as cued by the signals from the Hall effect sensors. In effect, they

35
act as three-phase synchronous motors containing their own variable-frequency drive electronics.
A specialized class of brushless DC motor controllers utilize EMF feedback through the main
phase connections instead of Hall effect sensors to determine position and velocity. These motors
are used extensively in electric radio-controlled vehicles. When configured with the magnets on
the outside, these are referred to by modelists as outrunner motors.

The same Hall effect sensors that provide the commutation can also provide a convenient
tachometer signal for closed-loop control (servo-controlled) applications. In fans, the tachometer
signal can be used to derive a "fan OK" signal.

The motor can be easily synchronized to an internal or external clock, leading to precise speed
control.

Brushless motors have no chance of sparking, unlike brushed motors, making them better suited
to environments with volatile chemicals and fuels. Also, sparking generates ozone which can
accumulate in poorly ventilated buildings risking harm to occupants' health.

Brushless motors are usually used in small equipment such as computers and are generally used
to get rid of unwanted heat.

They are also very quiet motors which is an advantage if being used in equipment that is affected
by vibrations.

Modern DC brushless motors range in power from a fraction of a watt to many kilowatts. Larger
brushless motors up to about 100 kW rating are used in electric vehicles. They also find
significant use in high-performance electric model aircraft.

3.10.2.3 Coreless DC motors:

Nothing in the design of any of the motors described above requires that the iron (steel) portions
of the rotor actually rotate; torque is exerted only on the windings of the electromagnets. Taking
advantage of this fact is the coreless DC motor, a specialized form of a brush or brushless DC
motor. Optimized for rapid acceleration, these motors have a rotor that is constructed without
any iron core. The rotor can take the form of a winding-filled cylinder inside the stator magnets,

36
a basket surrounding the stator magnets, or a flat pancake (possibly formed on a printed wiring
board) running between upper and lower stator magnets. The windings are typically stabilized by
being impregnated with Electrical epoxy potting systems. Filled epoxies that have moderate
mixed viscosity and a long gel time.

Because the rotor is much lighter in weight (mass) than a conventional rotor formed from copper
windings on steel laminations, the rotor can accelerate much more rapidly, often achieving a
mechanical time constant under 1 ms. This is especially true if the windings use aluminum rather
than the heavier copper. But because there is no metal mass in the rotor to act as a heat sink, even
small coreless motors must often be cooled by forced air.

These motors were commonly used to drive the capstan(s) of magnetic tape drives and are still
widely used in high-performance servo-controlled systems, like radio-controlled
vehicles/aircraft, humanoid robotic systems, industrial automation, medical devices, etc.

37
CHAPTER 4-SOFTWARE CODE:

#include <AFMotor.h> //import your motor shield library

#define trigPin 12 // define the pins of your sensor

#define echoPin 13

AF_DCMotor motor1(1,MOTOR12_64KHZ); // set up motors.

AF_DCMotor motor2(2, MOTOR12_8KHZ);

void setup()

Serial.begin(9600); // begin serial communitication

Serial.println("Motor test!");

pinMode(trigPin, OUTPUT);// set the trig pin to output (Send sound waves)

pinMode(echoPin, INPUT);// set the echo pin to input (recieve sound waves)

motor1.setSpeed(105); //set the speed of the motors, between 0-255

38
motor2.setSpeed (105);

void loop()

long duration, distance; // start the scan

digitalWrite(trigPin, LOW);

delayMicroseconds(2); // delays are required for a succesful sensor operation.

digitalWrite(trigPin, HIGH);

delayMicroseconds(10); //this delay is required as well!

digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

distance = (duration/2) / 29.1;// convert the distance to centimeters.

if (distance < 25)/*if there's an obstacle 25 centimers, ahead, do the following: */ {

Serial.println ("Close Obstacle detected!" );

Serial.println ("Obstacle Details:");

Serial.print ("Distance From Robot is " );

Serial.print ( distance);

Serial.print ( " CM”);

Serial.println (" The obstacle is declared a threat due to close distance. ");

Serial.println (" Turning !");

motor1.run(FORWARD);

39
motor2.run (BACKWARD);

else {

Serial.println ("No obstacle detected. going forward");

delay (15);

motor1.run(FORWARD);

motor2.run(FORWARD);

40
CHAPTER 4. WORKING PRINCIPLE:

The obstacle avoidance robotic vehicle uses IR sensors for its movements. A microcontroller of
8051 family is used to achieve the desired operation. The motors are connected through motor
driver IC to microcontroller. The ultrasonic sensor is attached in front of the robot.
Whenever the robot is going on the desired path the ultrasonic sensor transmits the ultrasonic
waves continuously from its sensor head. Whenever an obstacle comes ahead of it the ultrasonic
waves are reflected back from an object and that information is passed to the microcontroller.
The microcontroller controls the motors left, right, back, front, based on ultrasonic signals. In
order to control the speed of each motor pulse width modulation is used (PWM).

4.1 Obstacle detection (IR sensor):

The IR sensors are used for obstacle detection .The sensor output signal send to the
microcontroller. The microcontroller controls the vehicle (forward/back/stop) by using the DC
motor which is placed in vehicle. If any obstacle placed in line the IR sensor fails to receive the
light rays and gives signals to the microcontroller. The microcontroller will stop the vehicle
immediately and siren will on. After one minute the robot will be check the path status, if
obstacle is removed the robot move far word else the robot will return back to move starting
place. The sensor detects objects by emitting a short ultrasonic burst and then listening for the
eco. Under control of a host microcontroller, the sensor emits a short 40 KHz explosion. This
explosion ventures or travels through the air, hits an article and after that bounces once again to
the sensor. The sensor provides an output pulse to the host that will terminate when the echo is
detected; hence the width of one pulse to the next is taken into calculation by a program to
provide result in distance of the object.

41
CHAPTER 5: ADVANTAGES:

 They are mainly used in the accident prevention by detecting an obstacle.


 They change their direction automatically when obstacle is detected

CHAPTER 6:DISADVANTAGES:

 When an ultrasonic sensor is used instead of an IR ,the expenditure of the project


increases.

CHAPTER 7:CONCLUSION:

An obstacle is detected when the IR rays transmitted are stooped from propagating and are
reflected back such that there is detection of obstacle by the sensor which causes the vehicle to
stop by giving input to the controller as a result it gives the output to the motor driver and last to
the wheels which will at last change the vehicle’s direction of motion. This indeed helps in
prevention of the accidents on the roads. It will help in saving a lot of peoples life.

CHAPTER 8 FUTURE SCOPE:

It will be installed in all the automobiles such that there will prevention of loss of life of the
people and protecting the property from the damage. It will prevent all the mishaps that may
happen on the road and result it will not have lot money in going waste .

42
CHAPTER 10.0 RESULTS:

WITH NO INPUT:

WITH INPUT GIVEN:

43
CHAPTER 10:Bibliography:

The 8051 Micro controller and Embedded Systems


Muhammad Ali Mazidi
Janice Gillispie Mazidi
The 8051 Micro controller Architecture, Programming & Applications
Kenneth J.Ayala
Fundamentals of Micro processors and Micro computers
B.Ram
Micro processor Architecture, Programming & Applications
Ramesh S.Gaonkar
Electronic Components
D.V.Prasad

References on the Web:

www.national.com
www.atmel.com
www.microsoftsearch.com
www.geocities.com
www.circuitstoday.com
www.electronicshub.com

44

Potrebbero piacerti anche