Top Banner
INTRODUCTION The word ‘robot’ was introduced to the public at large by Czech writer Karel Capek in his play R.U.R (Rossum’s Universal Robot), which premiered in 1920. The word ‘robotcame from the word ‘robota’ meaning literally ‘Self Labor’.With the robotic technologies development with each passing day, robot systems have been widely employed in many applications. Now-a-days, robot systems have been applied in factory automation, dangerous environments, hospitals, surgery, entertainment, space exploration, farmland, military, security system, and so on. Recently, more and more research takes interest in the robot which can help people in our daily life, such as service robot, office robot, security robot, and so on. We believe that robots play an important role in our daily lives in the future, especially the security robots. When people give more and more importance to the quality of life, the security and service of our home is important. The security system can identify potential hazards to protect humans. A typical intelligent security system consists of intruders, fire, gas, environment sensors and more variety sensors to be installed, such as intelligent building or intelligent robot. Relative to the intelligent building which is a fixed and passive system; the security robot is an 10
78
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Final Report

INTRODUCTION

The word ‘robot’ was introduced to the public at large by Czech writer Karel Capek

in his play R.U.R (Rossum’s Universal Robot), which premiered in 1920. The word ‘robot’

came from the word ‘robota’ meaning literally ‘Self Labor’.With the robotic technologies

development with each passing day, robot systems have been widely employed in many

applications. Now-a-days, robot systems have been applied in factory automation,

dangerous environments, hospitals, surgery, entertainment, space exploration, farmland,

military, security system, and so on. Recently, more and more research takes interest in the

robot which can help people in our daily life, such as service robot, office robot, security

robot, and so on.

We believe that robots play an important role in our daily lives in the future,

especially the security robots. When people give more and more importance to the quality

of life, the security and service of our home is important. The security system can identify

potential hazards to protect humans. A typical intelligent security system consists of

intruders, fire, gas, environment sensors and more variety sensors to be installed, such as

intelligent building or intelligent robot. Relative to the intelligent building which is a fixed

and passive system; the security robot is an active system. The security robot is more

flexible than the intelligent building.

In the fundamentals, the developed security robot has the following functions to

perform such a security service: autonomous navigation, master-slave operated system,

supervises through Internet, a remotely operated camera vision system and danger detection

and diagnosis system. In the recent, the Internet technology is gaining more and more

importance. But the cost of the security robot is very expensive, and the weight is very

huge. We want to develop a low cost and small weight security robot that meets the basic

requirements.

In the past literatures, many experts have done research in the security robot space.

Some research work addressed at developing target-tracking system of security robot, such

as Hisato Kobayashi et al. proposed a method to detect human being by an autonomous

10

Page 2: Final Report

mobile guard robot.Yoichi Shimosasa et al. developed Autonomous Guard Robot witch

integrate the security and service system to an Autonomous Guard Robot, the robot can

guide visitors in daytime and patrol in the night. D. A. Ciccimaro developed the

autonomous security robot – “ROBART III” which equipped with the non-lethal-response

weapon. Moreover, some research addressed in the robot has the capability of fire fighting.

There are some products that have been published for security robot such as SECON and

SOC in Japanese and International Robotics in USA.

11

Page 3: Final Report

1.1 BLOCK DIAGRAM (Home/ Industrial Security Robot):

Fig.1 BLOCK DIAGRAM

In this block diagram of the digital security system 5v dc supply is used for each IC

for working because every digital logic circuit requires 5v power supply to work and 9v for

running motors. The main blocks of Home/ Industrial Security Robot are

1.2. BLOCK DIAGRAM DESCRIPTION:

1. IR Sensors Module:

A three-Directional sensor is placed in front of the Robot to detect an obstacle. The

sensor used here is IR sensors. Blue or white LEDs (light emitting diodes) are used as

transmitters and Photodiode are used as receivers.

2. Microcontroller P89V51RD2:

Microcontroller here we used is P89V51RD2 a clone to Intel 8051microcontroller

as it has the highest set of instructions available (around 52 instructions). It has on chip 4Kb

ROM in the form flash memory. This is ideal for fast development since flash memory can

12

Page 4: Final Report

be erased in seconds. In the project microcontroller is used to control the operation of servo

motors.

3. Security System:

Robot is installed with several types of inspecting sensors for detecting fire, smoke,

gas and sound for security purpose in order to escape for abnormal or dangerous situation.

4. Servo Motor:

A servomotor (servo) is an electromechanical device in which an electrical input

determines the position of the armature of a motor. The motors themselves are black boxes

which contain a motor, gearbox and decoder electronics. Three wires go into the box: 5V,

ground and signal. A short shaft comes out of the motor which usually has a circular

interface plate attached to it .Most servos will rotate through about 100 degrees in less than

a second according to the signal input. This unit will control up to 4 servo motors

simultaneously. All the work controlling the servos is done in the preprogrammed micro-

controller (uC).

5. Relay Logic:

A relay is an electrically operated switch. Current flowing through the coil of the

relay creates a magnetic field which attracts a lever and changes the switch contacts. The

coil current can be on or off so relays have two switch positions and they are double throw

(changeover) switches. The objective of the relay is to provide complete electrical isolation

between the controlling circuit and controlled circuit (i.e. it disconnects the circuit from the

main supply).

6. Cell Phone:

Upon detection of the dangerous source, the corresponding sensor gives input to the

microcontroller, which in turn invokes the auto-dialing system to initiate a call to the user’s

cell phone.

13

Page 5: Final Report

2. MICROPROCESSOR AND MICROCONTROLLER

2.1. MICROPROCESSOR:

With today's advanced VLSI technologies, microcontrollers are now far

cheaper, faster, lower power, and more powerful than their underpowered predecessors.

Designers now have more choices than yesterday's simple 8 bit microprocessors when

small, low power systems are warranted. The period between 1970 and 1980 saw an

explosion in microprocessor technology. The room-sized computers of the 1950's and

1960's were fast being replaced with vastly smaller and more reliable LSI chips. These 4

and 8 bit microprocessors were a giant step for the computer industry, and their impact is

still being felt today. Following these 4 and 8 bit microprocessors were the vastly more

expensive 16 and 32 bit architectures. Usually reserved for supercomputer and

minicomputer applications, they were high power, high cost devices which required

hundreds of support chips to operate. At the time, all such microprocessors required

support chips such as SRAM, ROM, I/O, and glue logic. The concept of "single-chip"

operation did not exist. These chips had the address/data/control bus structure, and

resultantly could not operate on their own.

Fig 2: Block diagram of a typical microprocessor-based system

Modern microprocessors still retain this RAM/ROM/IO structure along with data and

address busses. This configuration allows the most expandability and allows the highest

performance when designing large systems. However, in the realm of embedded systems,

a new trend in processor design has developed, called the microcontroller.

14

Page 6: Final Report

2.2. MICROCONTROLLER:

WHAT IS A MICROCONTROLLER?

A Microcontroller is an integrated chip with minimum required devices. The

Microcontroller includes a CPU: ALU, PC, SP and registers, RAM, ROM, I/O ports and

timers like a standard computer, but because they are designed to execute only a single

specific task to control a single system, they are much smaller and simplified so that they

can include all the functions required on a single chip.

Fig 3: Microcontroller Block Diagram

Most Microcontrollers will also combine other devices such as:

A Timer module to allow the microcontroller to perform tasks for certain time

periods.

A serial I/O port to allow data to flow between the microcontroller and other

devices such as a PC or another microcontroller.

An ADC to allow the microcontroller to accept analog input data for processing

2.3. CRITERIA FOR CHOOSING A MICROCONTROLLER:

1. The first and foremost criteria fro choosing a microcontroller is that it must meet

task at hands efficiently and cost effectively. In analyzing the need of a microcontroller

based project we must first see whether it is an 8-bit, 16-bit or 32-bit microcontroller and

how best it can handle the computing needs of the task most effectively. The considerations

in this category are:

15

Page 7: Final Report

(a) Speed: The highest speed that the microcontroller supports.

(b) Packaging: Is it 40-pin DIP or QPF or some other packaging format?

This is important in terms of space, assembling and prototyping

the end product.

(c) Power consumption: This is especially critical for battery powered products.

(d) The amount of RAM and ROM on chip.

(e) The number of I/O pins and timers on the chip.

(f) How easy it is to upgrade to higher-performance or lower-power consumption

versions.

(g) Cost per unit: This is important in terms of the final product in which a

microcontroller is used.

2. The second criteria in choosing a microcontroller are how easy it is to develop

products around it. Key considerations include the availability of the assembler, debugger, a

code efficient ‘c’ language compiler, emulator, technical support and both in house and

outside expertise. In many cases third party vendor support for chip is required.

3. The third criterion is choosing a microcontroller is it readily available in needed

quantities both now and in future. For some designers this is even more important than first

two criteria’s. Currently, of leading 8-bit microcontroller, the 89C51 family has the largest

number of diversified (multiple source) suppliers.

Diversities between suppliers mean that a producer besides the originator of

microcontroller. In the case of the 89C51, which was originated by Intel but several

companies are also currently producing the 89C51, e.g.: INTEL, ATMEL. These

companies include PHILIPS, SIEMENS and DALLAS-SEMICONDUCTOR. It should be

noted that Motorola, Zilog and Microchip Technologies have all dedicated massive

resources as to ensure wide and timely availability of their products is stable, mature and

single sourced. In recent years they also began to sell the ASIC library cell of the

microcontroller.

16

Page 8: Final Report

3.1 P89V51RD2 MICRO CONTROLLERIn the present project, P89V51RD2, an 8-bit microcontroller with 80C51 core, is

used. This microcontroller has 64 KB Flash and 1024 bytes of data RAM. A key feature of

the P89V51RD2 is its X2 mode option. The design engineer can choose to run the

application with the conventional 80C51 clock rate (12 clocks per machine cycle) or select

the X2 mode (6 clocks per machine cycle) to achieve twice the throughput at the same

clock frequency. Another way to benefit from this feature is to keep the same performance

by reducing the clock frequency by half, thus dramatically reducing the EMI.

The Flash program memory supports both parallel programming and in serial In-System

Programming (ISP). Parallel programming mode offers gang-programming at high speed,

reducing programming costs and time to market. ISP allows a device to be reprogrammed

in the end product under software control. The capability to field/update the application

firmware makes a wide range of applications possible. The P89V51RD2 is also In-

Application Programmable (IAP), allowing the Flash program memory to be reconfigured

even while the application is running.

Fig.4: ARCHITECTURE OF P89V51RD2

17

Page 9: Final Report

3.2 FEATURES OF P89V51RD2

80C51 CPU

5 V operating voltage from 0 MHz to 40 MHz

16/32/64 kB of on-chip flash user code memory with ISP and IAP

Supports 12-clock (default) or 6-clock mode selection via software or ISP

SPI and enhanced UART

PCA with PWM and capture/compare functions

Four 8-bit I/O ports with three high-current port 1 pins (16 mA each)

Three 16-bit timers/counters

Programmable watchdog timer

Eight interrupt sources with four priority levels

Second DPTR register

Low EMI mode (ALE inhibit)

TTL- and CMOS-compatible logic levels

3.3 CMOS TECHNOLOGY

Low power, high speed CMOS FLASH technology

Fully static design

Wide operating voltage range: 2.0V to 5.5V

Industrial temperature range

Low power consumption:

< 0.6 mA typical @ 3V, 4 MHz

20 µA typical @ 3V, 32 kHz

< 1 µA typical standby current

18

Page 10: Final Report

3.3 PIN CONFIGURATION:

Fig 5: PIN DIAGRAM

3.4. PIN DESCRIPTION:

To use the 8051 microcontroller we need a general idea of what does each pin does.

The following is a brief description of each pin.

1-8: Port 1: Each of these pins can be used as either input or output. Also, pin1 and

pin2 (P1.0 and P1.1) have special functions associated with Timer 2.

9: Reset Signal: High logical state on this input halts the MCU and clears all the

registers. Bringing this pin back to logical state zero starts the program a new as if the

power has just been turned on. In other words, positive voltage impulse on this pin resets

the MCU. Depending on the device’s purpose and environs, this pin is usually connected to

the push button, reset-upon-start circuit or a brown out reset circuit. The image shows one

19

Page 11: Final Report

simple circuit for safe reset upon starting the controller. It is utilized in situations when

power fails to reach its optimal voltage.

Fig 6: RESET CIRCUIT

10-17: Port 3: As with Port 1, each of these pins can be used as universal input or

output. However, each pin of Port 3 has an alternative function:

Pin 10: RXD- Serial input for asynchronous communication or serial

output for synchronous communication.

Pin 11: TXD - Serial output for asynchronous communication or clock

output for synchronous communication

Pin 12: INT0 - Input for interrupt 0.

Pin 13: INT1 - Input for interrupt 1.

Pin 14: T0 - Clock input of counter 0.

Pin 15: T1 - Clock input of counter 1.

Pin 16: WR - Signal for writing to external (add-on) RAM memory.

Pin 17: RD - Signal for reading from external RAM memory

18-19: X2 and X1: Input and output of internal oscillator. Quartz crystal

controlling the frequency commonly connects to these pins. Capacitances within the

oscillator mechanism (see the image) are not critical and are normally about 30pF. Instead

of a quartz crystal, miniature ceramic resonators can be used for dictating the pace. In that

case, manufacturers recommend using somewhat higher capacitances (about 47 pF). New

MCUs work at frequencies from 0Hz to 50MHz.

20

Page 12: Final Report

Fig 7: Clock Circuit

20: GND: Ground.

21- 28: Port 2: If external memory is not present, pins of Port 2 act as

universal input/output. If external memory is present, this is the location of the higher

address byte, i.e. addresses A8 – A15. It is important to note that in cases when not all the 8

bits are used for addressing the memory (i.e. memory is smaller than 64kB), the rest of the

unused bits are not available as input/output.

29: PSEN: MCU activates this bit (brings to low state) upon each reading of byte

(instruction) from program memory. If external ROM is used for storing the program,

PSEN is directly connected to its control pins.

30: ALE: Before each reading of the external memory, MCU sends the lower byte

of the address register (addresses A0 – A7) to port P0 and activates the output ALE.

External register (74HCT373 or 74HCT375 circuits are common), memorizes the state of

port P0 upon receiving a signal from ALE pin, and uses it as part of the address for memory

chip. During the second part of the mechanical MCU cycle, signal on ALE is off, and port

P0 is used as Data Bus. In this way, by adding only one cheap integrated circuit, data from

port can be multiplexed and the port simultaneously used for transferring both addresses

and data.

31: EA; Bringing this pin to the logical state zero (mass) designates the ports P2

and P3 for transferring addresses regardless of the presence of the internal memory. This

means that even if there is a program loaded in the MCU it will not be executed, but the one

from the external ROM will be used instead. Conversely, bringing the pin to the high

logical state causes the controller to use both memories, first the internal, and then the

external (if present).

21

Page 13: Final Report

32-39: Port 0; Similar to Port 2, pins of Port 0 can be used as universal

input/output, if external memory is not used. If external memory is used, P0 behaves as

address output (A0 – A7) when ALE pin is at high logical level, or as data output (Data

Bus) when ALE pin is at low logical level.

40: VCC; Power +5V

Input – Output (I/O) Ports:

Every MCU from 8051 family has 4 I/O ports of 8 bits each. This provides the user

with 32 I/O lines for connecting MCU to the environs.

Port 0:

Port 0 is an 8-bit open-drain bi-directional I/O port. As an output port, each pin can

sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high

impedance inputs.

Port 0 has two fold role: if external memory is used, it contains the lower address

byte (addresses A0-A7), otherwise all bits of the port are either input or output. Another

feature of this port comes to play when it has been designated as output. Unlike other ports,

Port 0 lacks the “pull up” resistor (resistor with +5V on one end). This seemingly

insignificant change has the following consequences:

When designated as input, pin of Port 0 acts as high impedance offering the infinite

input resistance with no “inner” voltage.

When designated as output, pin acts as “open drain”. Clearing a port bit grounds the

appropriate pin on the case (0V). Setting a port bit makes the pin act as high impedance.

Therefore, to get positive logic (5V) at output, external “pull up” resistor needs to

be added for connecting the pin to the positive pole. Therefore, to get one (5V) on the

output, external “pull up” resistor needs to be added for connecting the pin to the positive

pole.

22

Page 14: Final Report

Port 0 also receives the code bytes during Flash programming, and outputs the code

bytes during program verification. External pullups are required during program

verification.

Port 1:

Port 1 is an 8-bit bi-directional I/O port with internal pullups.

The Port 1 output buffers can sink/source four TTL inputs. When 1s are written to

Port 1 pins they are pulled high by the internal pullups and can be used as inputs. As inputs,

Port 1 pins that are externally being pulled low will source current (IIL) because of the

internal pullups.

In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count

input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively

Port 1 also receives the low-order address bytes during Flash programming and

verification.

Port 2:

Port 2 is an 8-bit bi-directional I/O port with internal pullups. The Port 2 output

buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins they are pulled

high by the internal pullups and can be used as inputs.

Port 2 pins that are externally being pulled low will source current (IIL) because

of the internal pull-ups. Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses 16-bit

addresses (MOVX @DPTR).

In this application, it uses strong internal pull-ups when emitting 1s. During

accesses to external data memory that uses 8-bit addresses (MOVX @ RI), Port 2 emits the

contents of the P2 Special Function Register.

Port 2 also receives the high-order address bits and some control signals during

Flash programming and verification.

Port 3

Port 3 is an 8-bit bi-directional I/O port with internal pull-ups.

The Port 3 output buffers can sink/source four TTL inputs. When 1s are written to

Port 3 pins they are pulled high by the internal pull-ups and can be used as inputs.

23

Page 15: Final Report

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups.

Port 3 also serves the functions of various special features of the AT89C51 as listed

below:

3.5. Memory in 8051 Microcontroller:

The 8051 microcontroller has three very general types of memory. These memory

types are illustrated in following figure: on-chip memory, External Code Memory and

External RAM.

Fig 8: Memory Block Diagram

On-chip Memory refers to any memory (Code, RAM, or other) that physically exist

on the microcontroller itself. Depending on the purpose this is again classified as Program

Memory and Data Memory. External Code Memory is code (or program) memory that

resides off-chip. This is often in the form of an external EPROM. External RAM is the

RAM memory that resides off-chip. This is often of standard static RAM or flash RAM.

24

Page 16: Final Report

ROM Memory:

Program Memory (ROM) is used for permanent saving program being executed.

New models have built-in ROM, although there are substantial variations. With some

models internal memory cannot be programmed directly by the user. Instead, the user needs

to proceed the program to the manufacturer, so that the MCU can be programmed (masked)

appropriately in the process of fabrication. Obviously, this option is cost-effective only for

large series. Many manufacturers deliver controllers that can be programmed directly by

the user. These come in a ceramic case with an opening (EPROM version) or in a plastic

case without an opening (EEPROM version).

RAM Memory:

Data Memory (RAM) is used for temporarily storing and keeping intermediate

results and variables that are generated during runtime. Apart from that, RAM comprises a

number of registers: hardware counters and timers, I/O ports, buffer for serial connection,

etc. With older versions, RAM spanned 256 locations, while new models feature additional

128 registers. First 256 memory locations form the basis of RAM (addresses 0 – FFh) of

every 8051 MCU. Locations that are available to the user span addresses from 0 to 7Fh, i.e.

first 128 registers, and this part of RAM is split into several blocks as can be seen in the

image below.

Fig 9: RAM Memory

25

Page 17: Final Report

First block comprises 4 “banks” of 8 registers each, marked as R0 - R7. To address

these, the parent bank has to be selected.

Second memory block (range 20h – 2Fh) is bit-addressable, meaning that every

belonging bit has its own address (0 to7Fh). Since the block comprises 16 of these registers,

there is a total of 128 addressable bits. (Bit 0 of byte 20h has bit address 0, while bit 7 of

byte 2Fh has bit address 7Fh).

Third is the group of available registers at addresses 2Fh –7Fh (total of 80 locations)

without special features or a preset purpose.

The main purpose of RAM is to provide synchronization between ROM and CPU so

as to increase the speed of Microcontroller.

Bit Memory:The 8051, being a communication oriented microcontroller, gives the user the

ability to access a number of bit variables. These variables may be either 1or 0. There are

128 bit variables available to the user, numbered 00h through 7Fh.

3.6. Special Function registers:

Special Function registers (SFRs) are a kind of control table used for managing and

monitoring microcontroller’s operating. Any instruction with an address of 80h –FFh refers

to an SRF control register. Each of these registers, even each bit they include, has its name,

address in the scope of RAM and clearly defined purpose ( for example: timer control,

interrupt, serial connection etc.). Even though there are 128 free memory locations intended

for their storage, the basic core, shared by all types of 8051 controllers, has only 21 such

registers.

26

Page 18: Final Report

Fig 10: Special Function registers.

3.7 Timers:

The 8051 microcontrollers is equipped with two timers (T0 and T1), both of them

may be controlled, set, read and configured individually. The main purpose of timer is

divided into three events

To measure time i.e. calculating the time between the events.

Counting external events.

Used for generating clock pulses used in serial communication, i.e. Baud Rate.

Measure time between two events it is nothing but counting up the pulses that are

generated from quartz crystal oscillator between the required two events.

Timer SFRs:

The two timers share two registers TMOD and TCON, which control the timer, and

each timer also has two SFRs dedicated solely to itself (TH0/TL0 and TH1/TL1). An SFR

has a numeric address. It is often useful to know numeric address that corresponds to an

SFR name. The SFRs relating to timers are: when you enter the name of the SFR into

assembler, it internally converts it to a number.

27

Page 19: Final Report

Timer T0:

This timer consists of two registers – TH0 and TL0. The numbers that these

registers include represent a lower and a higher byte of one 16-digit binary number. Since

the timers are virtually 16-bit registers, the greatest value that could be written to them is 65

535. In case of exceeding this value, the timer will be automatically reset and after words

that counting starts from 0. It is called overflow.

TMOD Register (Timer Mode)

This register selects mode of the timers T0 and T1. The lower 4 bits (bit0 - bit3)

refer to the timer 0, while the higher 4 bits (bit4 - bit7) refer to the timer 1. There are in

total of 4 modes.

Bits of this register have the following purpose:

GATE1 starts and stops Timer 1 by means of a signal provided to the pin INT1

(P3.3):

o 1 - Timer 1 operates only if the bit INT1 is set

o 0 - Timer 1 operates regardless of the state of the bit INT 1

C/T1 selects which pulses are to be counted up by the timer/counter 1:

o 1 - Timer counts pulses provided to the pin T1 (P3.5)

o 0 - Timer counts pulses from internal oscillator

T1M1, T1M0: These two bits select the Timer 1 operating mode.

T1M1 T1M0 Mode Description

0 0 0 13-bit timer

0 1 1 16-bit timer

1 0 2 8-bit auto-reload

1 1 3 Split mode

GATE0 starts and stops Timer 1, using a signal provided to the pin INT0 (P3.2):

o 1 - Timer 0 operates only if the bit INT0 is set

o 0 - Timer 0 operates regardless of the state of the bit INT0

28

Page 20: Final Report

C/T0 selects which pulses are to be counted up by the timer/counter 0:

o 1 - Timer counts pulses provided to the pin T0(P3.4)

o 0 - Timer counts pulses from internal oscillator

T0M1, T0M0 These two bits select the Timer 0 operating mode.

T0M1 T0M0 Mode Description

0 0 0 13-bit timer

0 1 1 16-bit timer

1 0 2 8-bit auto-reload

1 1 3 Split mode

TCON - Timer Control Register

This is also one of the registers whose bits directly control timer operating.

Only 4 of all 8 bits this register has are used for timer control, while others are used for

interrupt control.

TF1 This bit is automatically set with the Timer 1 overflow

TR1 This bit turns the Timer 1 on

o 1 - Timer 1 is turned on

o 0 - Timer 1 is turned off

TF0 This bit is automatically set with the Timer 0 overflow.

TR0 This bit turns the timer 0 on

o 1 - Timer 0 is turned on

o 0 - Timer 0 is turned off

Timer 1:

Referring to its characteristics, this timer is “a twin brother” to the Timer 0. This

means that they have the same purpose, their operating is controlled by the same registers

TMOD and TCON and both of them can operate in one of 4 different modes.

29

Page 21: Final Report

4. HARDWARE DESCRIPTION

4.1. Interfaces:The digital I/O ports are the means by which the microcontroller interfaces to the

environment. Digital I/O tends to grouped into byte wide ports (8-digital bits) that can be

configured as either input bits or output bits.

SENSORS:

A sensor is a type of transducer, which changes one form of energy into another

form. A sensors sensitivity indicates how much the sensors output changes when the

measured quantity changes. Sensors can be classified according to the type of energy

transfer that they detect.Types of sensors include Optical radiation, electromagnetic,

chemical, biological and acoustic. Aside from other applications, sensors are heavily used

in medicine, industry and robotics.

REQUIREMENTS OF SENSOR:

In order to act as an effectual sensor, the following guidelines must be met:

the sensor should be sensitive to the measured property

the sensor should be insensitive to any other property

the sensor should not influence the measured property

In theory, when the sensor is working perfectly, the output signal of a sensor is

exactly proportional to the value of the property it is meant to measure.

ERRORS FACTOR IN SENSOR:

When the sensor is not perfect, various deviations can occur, including gain error,

long term drift, and noise. These and other deviations can be classified as systematic or

random errors.

30

Page 22: Final Report

Systematic deviations may be compensated for by means of some kind of

calibration strategy. Noise is an example of a random error that can be reduced by signal

processing, such as filtering, usually at the expense of the dynamic behavior of the sensor.

APPLICATIONS:

A sensor network is a computer network of spatially distributed devices using

sensors to monitor conditions (such as temperature, sound, vibration, pressure, motion or

pollutants) at a variety of locations. Usually the devices are small and inexpensive, allowing

them to be produced and deployed in large numbers; this constrains their resources in terms

of energy, memory, computational speed and bandwidth.

Each device is equipped with a radio transceiver, a small microcontroller, and an

energy source, most commonly a battery. The devices work off each other to deliver data to

the computer which has been set up to monitor the information.

Sensor networks involve three areas: sensing, communications, and computation

(hardware, software, algorithms). They are applied in many areas, such as video

surveillance, traffic monitoring, home monitoring and manufacturing. The smoke and fire

are detected using MOC7811 and Germanium diode etc, obstacles are detected using IR

rays, and Light is sensed by using LDR

4.2. 555 Timer:

The 555 IC is one of the simplest and versatile linear integrated IC's. The 555 timer

IC was first introduced around 1971 by the Signetics Corporations as the SE555/NE555 and

was called “The IC Time Machine” and was also the very first and only commercial timer

IC available. It is a high stable controller capable of producing accurate timing pulses.

Operation 555 Timer/Oscillator:

31

Page 23: Final Report

The three equal resistors R1, R2, R3 arranged in order to serve as internal voltage

divider for the source voltage. Thus one-third of the source voltage appears across each

resistor. The voltage at point’s p1 and p2 serves as reference voltages for the two

comparators.

Fig11: Block Diagram of 555 Timer.

Comparator is a basically an op-amp which changes the state when one of its input

exceeds the reference voltage. The reference voltage for comparator 2 is 1/3Vcc. If a trigger

pulse is applied at the negative input of this comparator drops below +1/3Vcc, it causes a

change in the state. Comparator 1 is referred at voltage +2/3Vcc. The output of each

comparator is fed to the input terminals of a flip-flop.

The flip-flop used in the SE/NE 555 timer IC is a bistable multi. As usual, this flip-

flop changes states according to the voltage value of its input. Thus if the voltage at the

threshold terminal rises above +2/3Vcc, it causes comparator 1 to cause flip-flop to change

its states. On the other hand, if the trigger voltage falls below +1/3Vcc, it causes

comparator 2 to change its state and hence causes flip-flop to change its states. Thus the

output of the flip-flop is controlled by the voltages of the two comparators. A change in

state occurs when the threshold voltage rises above +2/3Vcc or when the trigger voltage

drops below +1/3Vcc.

32

Page 24: Final Report

The output of the flip-flop is used to drive the discharge transistor and the output

stage. A high or positive flip-flop output turns on both the discharge transistor and the

output stage. The discharge transistor becomes conductive and behaves as a low resistance

short circuit to ground. The output stage behaves similarly. When the flip-flop output

assumes the low or zero state, reverse action takes place i.e., the discharge transistor

behaves as an open circuit or infinite impedance. The output stage assumes high or positive

Vcc state. Thus the operational state of the discharge transistor and the output stage

depends on the voltage applied to the threshold and the trigger input terminals.

555 Timer as Monostable Multivibrator:

A monostable multivibrator, often called as one-shot multivibrator, is a pulse

generating circuit in which duration of pulse is determined by one external resistor and one

capacitor. Monostable is used in several timing applications where we need operations to be

last for specified length of time.

Monostable Operation:

In monostable multivibrator, a simple output pulse is generated in response to one

input trigger pulse.

Fig12: Monostable Circuit Fig13: Waveforms of Monostable

33

Page 25: Final Report

Initially when the output is low, i.e. the circuit is in stable state, transistor is ‘ON’

and capacitor C is shorted to ground. When a negative going pulse is applied at trigger

input (pin 2), transistor Q1 is turned ‘OFF’, which releases short circuit across the external

capacitor C1 and drives the output (at pin 3) to go high to +Vcc. The trigger pulse causes

the comparator 2 to drop below its reference voltage +1/3Vcc, and this in turn causes flip-

flop to go to its low state. A negative voltage to the discharge transistor causes resistance to

become infinite. This in turn removes the shunt to ground capacitor C1. Hence the voltage

across capacitor C1 now starts charging up towards Vcc through RA. When the voltage

across capacitor equals 2/3Vcc, comparator 1’s output switches from low to high, which in

turn drives the output to its low state via the output of the flip-flop. At the same time, the

output of the flip-flop turns transistor Q1 on, and hence capacitor C1 rapidly discharges

through the transistor. The output of the monostable remains low until a trigger pulse is

again applied.

4.3. Operational Amplifier (IC 741):

An operational amplifier, often called an op-amp, is a direct coupled high-gain

amplifier consisting of one or more differential amplifiers and followed by a level translator

and an output stage. The output stage is generally a complementary symmetry push-pull

amplifier. Typically the output of the op-amp is controlled either by negative feedback,

which largely determines the magnitude of its output voltage gain, or by positive feedback,

which facilitates regenerative gain and oscillation.

The op-amp is a versatile device that can be used to amplify dc as well ac input

signals. High input impedance at the input terminals and low output impedance are

important typical characteristics. Typical uses of the operational amplifiers are to provide

amplitude changes (amplitude and polarity), oscillations, filter circuits and many types of

instrumentation circuits.

34

Page 26: Final Report

Fig 14: Basic op-amp Fig 15: Pin Diagram of op-amp

BLOCK DIAGRAM OF A TYPICAL OP-AMP:

Since an op-amp is a multistage amplifier, it can be represented by a block

diagram as:

Fig 16: BLOCK DIAGRAM OF A TYPICAL OP-AMP

The input stage is the dual-input, balanced-output differential amplifier. This

stage generally provides most of the voltage gain of the amplifier and also establishes

the input resistance of the op-amp. The intermediate stage is usually another

differential amplifier, which is driven by the output of the first stage. In most

amplifiers the intermediate stage is dual input, unbalanced (single-ended) output.

Because direct coupling is used, the dc voltage at the output of the intermediate stage

is well above ground potential. Therefore, generally, the level translator (shifting)

circuit is used after the intermediate stage downward to zero volts with respect to

ground.

The final stage is usually a push-pull complementary amplifier output. The

output stage increases the output voltage swing and raises the current driving

capability of the op-amp.

35

Page 27: Final Report

OP-AMP CONFIGURATIONS:

When op-amp is connected in open-loop configuration, the op-amp simply

functions as high-gain amplifier. The variations in voltage gain are relatively large in

open-loop, which makes it unsuitable for many linear applications. To overcome this

problem the term feed back is introduced i.e., an output signal is fed back to input

directly or via a network. The three op-amp configurations are:

Inverting amplifier:

In an inverting amplifier or constant gain amplifier, the voltage enters the 741

chip through second pin and comes out of the 741 chip at sixth pin. If the polarity is

positive going into the chip, it will be negative by the time it comes out through pin

six. The polarity will be ‘inverted’.

Fig 17: INVERTING AMPLIFIER

Non-inverting amplifier:

In a non-inverting amplifier or constant-gain multiplier, the voltage enters the

741 chip through third pin and leaves the 741 chip through pin six. This time if it is

positive going into the 741 then it is still positive coming out. Polarity remains the

same.

36

Page 28: Final Report

Fig 18: NON INVERTING AMPLIFIER

Differential amplifier:

In a differential amplifier the voltage is applied to both second and third pin of

IC 741. This time the op-amp amplifies the difference between the two input voltages.

Fig 19: DIFFERENTIAL AMPLIFIER

OP-AMP SPECIFICATIONS-DC OFFSET PARAMETERS:

If we use op amp circuits at moderate gain and frequency, there will be very

good agreement between actual performance and ideal performance. As gain and/or

frequency are increased, certain op amp limitations come into play that effect circuit

performance. We should be familiar with some of these parameters used to define the

operation of the unit. These specifications include both dc and transient or frequency

operating features:

Offset Current and Voltages:

When the input to op-amp is 0v, then output should be 0v. But in actual

operation there will be some offset voltage at the output. Since we connect the

37

Page 29: Final Report

amplifier circuit for various gain and polarity operations, manufacturer specifies an

input offset voltage and the gain of the amplifier.

The offset voltage cab is affected by two separate conditions. These are: (1) an

input offset voltage, Vio and (2) an offset current due to difference in current resulting

at the non-inverting and inverting terminals.

Input Offset Voltage, VIO:

Input offset voltage, VIO, is defined as "the voltage that must be applied

between the two input terminals to force quiescent DC output voltage to zero or some

other level, if specified". If the input stage was perfectly symmetrical and the

transistors were perfectly matched, VIO = 0. Because of process variations, geometry

and doping are never exact to the last detail. All op amps require a small voltage

between their inverting and non-inverting inputs to balance the mismatches. To

determine the effect of this input voltage on the output, we should consider the

following connections:

38

Page 30: Final Report

Output Offset Voltage due to Input Offset Current, Iio:

An output offset voltage will also result in dc bias currents at both inputs.

Since the two input transistors are never exactly matched, each will operate at a

slightly different current. For a typical op-amp connection, such as that an output

offset voltage can be determined. Replacing the bias currents through the input

resistor by the voltage drop that each development, we can determine the expression

for resulting output voltage.

Fig 20: Op-amp Connection with Fig 21: Op-amp with Input Bias currents

Input Bias currents through Input resistors

for a total output offset voltage of

Since the main consideration is the difference between the input bias currents rather

than each value, we define the offset current IIO by

Since the compensating resistance Rc is usually approximately equal to the value of

R1, using RC=R1, we can write as

resulting in

Page 31: Final Report

TOTAL OFFSET DUE TO VIO AND IIO:

Since the op-amp output may have an output offset voltage due to both factors

covered above, the total output offset voltage can be expressed as

OP-AMP SPECIFICATIONS – FRQUENCY PARAMETERS: At high frequencies, the performance of an op-amp is affected by two

parameters. These two parameters are the gain-bandwidth product (GBP) and the slew rate.

Gain-bandwidth product:

The gain, G is defined as the gain of the op-amp when a signal is fed

differentially into the amplifier and no feedback loop is present. This gain is ideally

infinite, but in reality is finite, and also depends on the frequency. At low frequency

this gain is maximum, decreases linearly with increasing frequency, and has a value

of one at the frequency commonly referred to as the cut-off frequency (in equation

form, Gfc = 1). For the 741 op-amp, fc is given as 1 MHz, and the open-loop gain at

this frequency is simply one. Gf is defined as the gain-bandwidth product, and for all

frequencies this product must be a constant equal to fc.

Gf = (AVD) fc

Slew Rate:

The ideal op-amp has an infinite frequency response. This means that no

matter how fast the input changes, the output will be able to keep up. In real op-amps,

this is not the case, and when the input changes too fast the output is not able to keep

up. The specification known as slew rate defines the maximum rate at which the

output voltage can change with time. It is generally given in V/μs., and for the 741

op-amp is something close to 1v/μs.

Page 32: Final Report

4.4. LM 358:The LM358 series consists of two independent, high gain, internally frequency

compensated operational amplifiers which were designed specifically to operate from

a single power supply over a wide range of voltages. Operation from split power

supplies is also possible and the low power supply current drain is independent of the

magnitude of the power supply voltage. Application areas include transducer

amplifiers, dc gain blocks and all the conventional op amp circuits which now can be

more easily implemented in single power supply systems.

Fig 22: LM 358

Features:

Internally frequency compensated for unity gain.

Large dc voltage gain: 100 dB.

Wide bandwidth (unity gain): 1 MHz (temperature compensated).

Wide power supply range:

o Single supply: 3V to 32V

o or dual supplies: ±1.5V to ±16V

Very low supply current drain (500 μA) - essentially independent of

supply voltage.

Low input offset voltage: 2 mV.

Input common-mode voltage range includes ground.

Differential input voltage range equal to the power supply voltage.

Large output voltage swing: 0V to V+− 1.5V.

Page 33: Final Report

4.5. Light Emitting Diodes:

The function of Light emitting diodes, commonly called LEDs, is to

emit light when an electric current passes through them. LEDs must be connected in

the correct way round, the diagram may be labelled ‘a’ or ‘+’ for anode and ‘k’ or ‘-’

for cathode. The cathode is the short lead and large lead is anode.

These LEDs are available in red, orange, amber,

Yellow, green, blue and white. They do different jobs andare found in all kinds of devices. They form the numberson the digital clocks, transmit information from remotecontrols, light up the watches.Collected together,they can

form images on a jumbo television screen or illuminate a traffic light. Basically, LEDs are just tiny light bulbs that

easily fit into an electrical circuit. But unlike ordinary incandescent bulbs, they don't have a filament that will burn out, and they don't get especially hot. They are illuminated solely by the movement of electrons in a semiconductor material, and they last just as long as a standard transistor.

In the case of LEDs, the conductor material is typically aluminum-gallium-arsenide (AlGaAs). In pure aluminum-gallium-arsenide, all of the atoms bond perfectly to their neighbors, leaving no free electrons (negatively-charged particles) to conduct electric current. In doped material, additional atoms change the balance, either adding free electrons or creating holes where electrons can go. Either of these additions makes the material more conductive.

Page 34: Final Report

Light is a form of energy that can be released by an atom. It is made up of many small particle-like packets that have energy and momentum but no mass. These particles, called photons, are the most basic units of light. Photons are released as a result of moving electrons. In an atom, electrons move in orbital around the nucleus. Electrons in different orbital have different amounts of energy. Generally speaking, electrons with greater energy move in orbitals farther away from the nucleus. For an electron to jump from a lower orbital to a higher orbital, something has to boost its energy level. Conversely, an electron releases energy when it drops from a higher orbital to a lower one. This energy is released in the form of a photon. A greater energy drop releases a higher-energy photon, which is characterized by a higher frequency.

Free electrons moving across a diode can fall into empty holes from the P-type layer. This involves a drop from the conduction band to a lower orbital, so the electrons release energy in the form of photons. This happens in any diode, but you can only see the photons when the diode is composed of certain material. The atoms in a standard silicon diode, for example, are arranged in such a way that the electron drops a relatively short distance. As a result, the photon's frequency is so low that it is invisible to the human eye, it is in the infrared portion of the light spectrum. Infrared LEDs are ideal for remote controls, among other things. Revisable light-emitting diodes (VLEDs), such as the ones that light up numbers in a digital clock, are made of materials characterized by a wider gap between the conduction band and the lower orbital. The size of the gap determines the frequency of the photon, in other words, it determines the color of the light.

While all diodes release light, most don't do it very effectively. In an ordinary diode, the semiconductor material itself ends up

Page 35: Final Report

absorbing a lot of the light energy. LEDs are specially constructed to release a large number of photons outward. Additionally, they are housed in a plastic bulb that concentrates the light in a particular direction. As you can see in the diagram, most of the light from the diode bounces off the sides of the bulb, traveling on through the rounded end.

4.6. Light Dependent Resistor:

One of the easiest ways to sense light electronically is to use a LDR (Light

Dependent Resistor), as its name suggests, the resistance of the device is proportional

to the amount of light hitting it. As the light level increases the resistance of the

device falls. It is made from cadmium sulphide (CdS).

Fig 23: LDR and its circuit symbol

The typical results for a standard LDR:

Darkness: maximum resistance, about 1M .

Very bright light: minimum resistance, about 100 . LDR is a semiconductor photo device whose resistance decreases as light

intensity increases. This is due to the electrons and holes produced in a semiconductor

Page 36: Final Report

by the photoelectric effect, and the response in therefore quite linear. All photo

devices operate very similar to a variable resistor. When they are receiving no

illumination, they have a HIGH resistance. When the illumination is bright, they

exhibit between the device and the load resistor.

Page 37: Final Report

4.7. RELAYS:

A relay is a device that opens or closes an auxiliary circuit under predetermined

condition in the main circuit. The objective of the relay is to provide complete electrical

isolation between the controlling circuit and controlled circuit (i.e. it disconnects the circuit

from the main supply). To increase the growth of power, both in size and complexity, and to

maintain the system stability, relays are used. Relays are divided based on sensitive to

condition of voltage, current, temperature and frequency. While choosing a relay, the following

points are taken into consideration.

Type of operation

Type of duty

Durability

Economy

Relays are basically of two types

Electromagnetic type relays

Solid State relays

In our circuit we employed an electromagnetic type relay.

There are different types of relays, which in practice referred to as

Voltage operated

Current operated

Sensitive

Marginal

In our circuit, a voltage-operated electromagnetic type relay, this means that it has high

resistance coil and is connected in parallel with the supply voltage in a circuit. They draw a

very little current from source to supply. Any change in the coil voltage energizes or de-

energizes the relay.

46

Page 38: Final Report

Construction:

In our circuit an electromagnetic type relay is employed. This is a common type of relay

and has one unique feature (i.e. a hinged armature) that is attracted to a force when the core is

magnetized by a current in the coil or wound around the core. The construction of typical

clapper type of relay is shown in the figure.

Working:

It contains a core surrounded by a coil of wire. The core is mounted on a metal frame.

The movable part of the relay is called armature. When the voltage is applied to the coil

produces a magnetic field in the core. In other words core acts as an electromagnet and attracts

metal armature. When the armature is attracted by the core the magnetic path is from the core

to the armature through frame and back to the core while on removing the voltage and the

armature returns to its original position due to spring tension which is attracted to

armature to the other end. When no current flows through the relay coil, the contact or pole

that is mounted on the armature along with the contact assembly moves downwards, so that the

contact touches the bottom where bottom contact are connected to required circuit. The main

purpose of relay frame is to provide a way to mount the ports and the important things is to

form a part of the complete magnetic path between the armature and the core. The core, frame

and armature are made with magnetic material such as soft iron. In the energized position of

the relay if the armature touches the core of the electromagnet, it may stick there because

of the permanent magnetism in the core. The spring may not be able to pull back the

armature. To prevent this, a minimum air gap between the core and the armature is maintained.

Operating speed:

When an energizing voltage is applied to the coil of the relay, the relay does not pick up

instantaneously because of coil inductance. The current in the coil grow slowly and hence the

magnetic field due to that current. Also the armature takes time to movie from one position to

another. These periods are very small (of the order of few milli seconds). Operate and release

times are not necessarily equal. The operating characteristics are shown in the diagram. The

gradual build up from A to B is due to the initial position to the current flow by the

self inductance decreases which causes the opposition of the current built up. So that’s why

the characteristic just drops at C. After this happens the current build up more slowly to a

maximum at time D. The heat produced by the current through the relay coil will increase the

47

Page 39: Final Report

coil reactance which results decrease in current between times E and F. At time G the current

through the relay coil is turned off and the armature drops out at the H opening the relay

contacts. In other words the fall in voltage of a relay is higher than its drop out voltage. The

difference of these drops is called hysterics. It prevents false triggering and chattering.

Generally relays are made for voltages 6, 12, 18, 24, 48, 110, 240 volts D.C. or A.C.

According to the present circuit, a coil of 300 ohms are used which operates at +5 volts D.C.

and has 5/300 amps and the power dissipated in the coil is 5*5/300 watts.

Causes for the failure of a relay:

Improper control voltage

Losses connections

Bending of moving parts

Improper spring tension

Dirt, Reese or gum on contact or on moving parts.

Input and Output characteristics of a Relay:Input characteristics:

Operating power: several hundred milli watts to several watts

Operating voltage: + or –10% of rated voltage

Output characteristics:

Contact configuration – multiple contacts:

Power --- permits wide range

Voltage—permits wide range

Ambient characteristics:Resistance to vibration—errors during operation

Temperature --- not much affected

Humidity --- insulation may deteriorate

Operational noise --- produces audible noise.

Characteristics of the Time relays:Time range – on, off or cycle

Time range – 0.1 sec to 60 minutes

Repeat accuracy – 0.5% to 2%

Contact ratings – 6 amp to 240 volts a.c/24 volt d.c

Power consumption – 3 to 5 VA.

48

Page 40: Final Report

4.8. Servo Motor Control module:

Servos are DC motors with built in gearing and feedback control loop circuitry. Servos

are extremely popular with robot, RC plane, and RC boat builders. All servos have three wires:

the red wire is usually connected to the power supply, the black or brown wire is usually

connected to the ground and Yellow/Orange or White is the signal wire connected to the

controlling signal. Servos can operate under a range of voltages. Typical operation is from 4.8V

to 6V. There are a few micro sized servos that can operate at less, and now a few Hitec servos

that operate at much more. The reason for this standard range is because most microcontrollers

and RC receivers operate near this voltage. If we have a battery voltage/current/power

limitation, we should operate at 6V. This is simply because DC motors have higher torque at

higher voltages.

Power Spikes is a special case for DC motors that change directions. To reverse the

direction of the motor, we must also reverse the voltage. However the motor has a built up

inductance and momentum which resists this voltage change. So for the short period of time it

takes for the motor to reverse direction, there is a large power spike. The voltage will spike

double the operating voltage. The current will go to around stall current.

4 .9 DC MOTORS:

From the start, DC motors seem quite simple. Apply a voltage to both terminals, and

it spins. But what if you want to control which direction the motor spins? Correct, you reverse

the wires. Now what if you want the motor to spin at half that speed? You would use less

voltage. But how would you get a robot to do those things autonomously? How would you

know what voltage a motor should get? Why not 50V instead of 12V? What about motor

overheating? Operating motors can be much more complicated than you think.

Voltage:

You probably know that DC motors are non-polarized - meaning that you can reverse

voltage without any bad things happening. Typical DC motors are rated from about 6V-12V.

The larger ones are often 24V or more. But for the purposes of a robot, you probably will stay

in the 6V-12V range. So why do motors operate at different voltages? As we all know (or

49

Page 41: Final Report

should), voltage is directly related to motor torque. More voltage, higher the torque. But don't

go running your motor at 100V cause that’s just not nice. A DC motor is rated at the voltage it

is most efficient at running. If you apply too few volts, it just wont work. If you apply too

much, it will overheat and the coils will melt. So the general rule is, try to apply as close to the

rated voltage of the motor as you can. Also, although a 24V motor might be stronger, do you

really want your robot to carry a 24V battery (which is heavier and bigger) around? My

recommendation is do not surpass 12V motors unless you really really need the torque.

Current: As with all circuitry, you must pay attention to current. Too little, and it just won't

work. Too much, and you have meltdown. When buying a motor, there are two current ratings

you should pay attention to. The first is operating current. This is the average amount of current

the motor is expected to draw under a typical torque. Multiply this number by the rated voltage

and you will get the average power draw required to run the motor. The other current rating

which you need to pay attention to is the stall current. This is when you power up the motor,

but you put enough torque on it to force it to stop rotating. This is the maximum amount of

current the motor will ever draw, and hence the maximum amount of power too. So you must

design all control circuitry capable of handling this stall current. Also, if you plan to constantly

run your motor, or run it higher than the rated voltage, it is wise to heat sink your motor to keep

the coils from melting.

Power Rating:

How high of a voltage can you over apply to a motor? Well, all motors are (or at least

should be) rated at a certain wattage. Wattage is energy. Inefficiency of energy conversion

directly relates to heat output. Too much heat, the motor coils melt. So the manufacturers of

[higher quality] motors know how much wattage will cause motor failure, and post this on the

motor spec sheets. Do experimental tests to see how much current your motor will draw at a

desired voltage.

The equation is:

Power (watts) = Voltage * Current

Increase voltage and measure current until the power is about ~90% below the given power

rating.

50

Page 42: Final Report

Power Spikes:

There is a special case for DC motors that change directions. To reverse the direction

of the motor, you must also reverse the voltage. However the motor has a built up inductance

and momentum which resists this voltage change. So for the short period of time it takes for the

motor to reverse direction, there is a large power spike. The voltage will spike double the

operating voltage. The current will go to around stall current. The moral of this is design your

robot power regulation circuitry properly to handle any voltage spikes.

Torque:

When buying a DC motor, there are two torque value ratings which you must pay attention

to. The first is operating torque. This is the torque the motor was designed to give. Usually it is

the listed torque value. The other rated value is stall torque. This is the torque required to stop

the motor from rotating. You normally would want to design using only the operating torque

value, but there are occasions when you want to know how far you can push your motor. If you

are designing a wheeled robot, good torque means good acceleration. My personal rule is if you

have 2 motors on your robot, make sure the stall torque on each is enough to lift the weight of

your entire robot times your wheel radius. Always favor torque over velocity. Remember, as

stated above, your torque ratings can change depending on the voltage applied. So if you need a

little more torque to crush that cute kitten, going 20% above the rated motor voltage value is

fairly safe (for you, not the kitten). Just remember that this is less efficient, and that you should

heat sink your motor.

Velocity:

Velocity is very complex when it comes to DC motors. The general rule is, motors run

the most efficient when run at the highest possible speeds. Obviously however this is not

possible. There are times we want our robot to run slowly. So first you want gearing - this way

the motor can run fast, yet you can still get good torque out of it. Unfortunately gearing

automatically reduces efficiency no higher than about 90%. So include a 90% speed and torque

reduction for every gear meshing when you calculate gearing. For example, if you have 3 spur

gears, therefore meshing together twice, you will get a 90% x 90% = 81% efficiency. The

voltage and applied torque resistance obviously also affects speed.

51

Page 43: Final Report

Control Methods:

The most important of DC motor control techniques is the H-Bridge. After you have

your H-Bridge hooked up to your motor, to determine your wheel velocity position you must

use an encoder. And lastly, you should read up on good DC Motor Braking methods.

VOLTAGE REGULATORS:

A voltage regulator is one, which is used to control the voltage. A regulator IC mainly

consists of reference source, comparator amplifier and control voltage and over load protection

all in a single IC. The power supply can be built using a transformer connected to the ac supply

can be built using a transformer connected to the ac supply to step the ac built using a

transformer connected to the ac supply to step the ac voltage to desired amplitude then

rectifying that ac voltage filtering with a capacitor and RC filter. The regulators can be selected

for operation with load currents from hundreds of mille amperes to tens of amperes

corresponding to power ratings from mille watts to tens of watts. The series 78 regulators

provides fixed regulated voltages from 5 to 24 volt. The 7812 are connected to provide voltage

regulation with output from this unit of +12v, which is filtered by capacitor C. The output and

minimum voltages from 7805 and 7812 is +5v, 7.3 and +12v, 14.6v. The ac line voltage is

stepped down to 18v rms across each half of the center-tapped transformer. A full wave

rectifier and capacitor filter then provides an unregulated dc voltage with an ac ripple of a few

volts as input to the voltage regulator. The 7812 IC then provides an output that is regulated

+12v dc.

Features:

• Output Current up to 1A

• Output Voltage of 5V

• Thermal Overload Protection

• Short Circuit Protection

• Output Transistor Safe Operating Area Protection

Fig 24: Voltage regulator

52

Page 44: Final Report

5.1. Fire Detection Module:

Fig 25: Fire Detection Module

Circuit Description:

In the fire section the main heart is the 555 timer. In the above figure when there is no

temperature, diode offers high resistance hence the voltage drop the transistor hence the voltage

drop across it will be maximum. Because of the voltage drop the transistor drives the base and

transistor reaches saturation and grounds pin 4 No pulse is generated a pin 3. This is off

condition.

When fire occur, diode resistance decrease and voltage between base and emitter is

reduced, making the 555 circuit operate in monostable mode. Pin 2&6 are shorted. The timing

resistor is now split into two sections 1K and 47Ω. Pin 7 of discharging transistor (555) Q1 is

connected, to the junction of 1K and 47Ω.when the power supply Vcc is connected, the

external timing capacitor (100μl) charges towards with a time constant (1K+47Ω) 100μf.

During set S=1 and this combines, makes Q bar=0 which has unchanged the capacitor (100μf).

When the capacitor voltage equals (to be precise is just greater than), Vcc the upper

comparator triggers the control shift top so that Q bar=1, that in turn makes transistor Q1 ‘on’

and capacitor 100μf starts discharging towards ground. Though with a time 47Ω and transistor

Q1 with a time constant 47ΩX100μf neglecting the forward resistance of Q1. During the

maximum current through ‘on’ transistor and during the discharge of the timing capacitor as it

searches to be precise is just less than Vcc/3 the lower comparator is triggered and at this stage

s=1, R=0 which turns Q bar=0 now Q bar=0 unclamps the external timing capacitor .

53

Page 45: Final Report

The capacitor 100μf, periodically charges and discharges between 2/3 t0 1/3 Vcc

respectively. The capacitor voltages for a low pass RC circuit subjected to a step output of Vcc

volts is given by.

Vcc volts is given by

Vc =Vcc (1-e-f/RC)

T1 taken by the circuit to charge from 1to 2/3Vcc is

(2/3) Vcc= Vcc (1 –exponential of (-t1)/RC), t1=6.09 RC

T2 to charge from 1/3 Vcc is, R=1KΩ +47Ω

1/3 Vcc = Vcc (1 –exponential of (-t2)/RC), t2=0.405RC

1/3 Vcc to Vcc is

T high = 1.09RC – 0.405 RC=0.69RC

T= 1.69(Ra+Rb) C, Ra=1K, Rb=47Ω

F= 1/t= 1.45/1KΩ +2X47Ω

This output is given to the mobile.

GERMANIUM DIODES:

Early semiconductor developments used germanium as the commercial, semiconductor

material. Due to its ease of processing and more stable temperature characteristics, silicon

became the semiconductor of choice and as a consequence of that, most early germanium

semiconductors were replaced with silicon became the semiconductor of choice.

However, germanium diodes have the advantage of an intrinsically low forward voltage

drop, typically 0.3 volts; this low forward voltage drop results in a low power loss and more

efficient diode, making it superior in many ways to the silicon diode. A silicon diode forward

voltage drop, by comparison, is typically 0.7 volts. This lower voltage drop with germanium

becomes important in very lower signal environments (signal detection from audio to FM

frequencies) and in low level digital circuits. With this increased interest, certain general

germanium characteristics should be understood. First and most important is that of an

increased leakage current for germanium at a reverse voltage. This is mitigated to some degree

by the fact that in low level circuits the reverse voltage applied to a germanium diode is also

usually very low, resulting in a low reverse leakage current (leakage current is directly

54

Page 46: Final Report

proportional to reverse voltage). However the leakage current is still larger than with silicon. A

properly designed circuit can lessen this factor.

Germanium diodes (for example, the IN34A) have a forward voltage drop of about o.1

volt. Germanium diodes, though, are typically much more expensive than silicon diodes.

Luckily, they’re salvageable from lots of circuit boards. To test whether or not a diode

is Germanium, get out your m put on diode test, and measure the diodes forward voltage drop

directly. A Germanium diode will less than 0.3, silicon will read above 0.5.

5.2. Smoke Detection Module:

Smoke emission occurs during the early stages of a fire. So, smoke detectors provide

early warning and enable emergency action in the event of a fire. They are inexpensive, easy to

install and unobtrusive.

There are two main types of smoke detectors: ionization detectors and photoelectric

detectors. The devices may be powered by a 9-volt battery, lithium battery, or 120-volt house

wiring.

Ionization detectors have an ionization chamber and a source of ionizing radiation.

Alpha particles constantly released by the americium knock electrons off of the atoms in the

air, ionizing the oxygen and nitrogen atoms in the chamber. The positively-charged oxygen and

nitrogen atoms are attracted to the negative plate and the electrons are attracted to the positive

plate, generating a small, continuous electric current. When smoke enters the ionization

chamber, the smoke particles attach to the ions and neutralize them, so they do not reach the

plate. The drop in current between the plates triggers the alarm. These detectors produce

radioactive emission due to ionization principle involved. Hence they are rarely used.

Ionization detectors respond more quickly to flaming fires with smaller combustion particles.

The present day safety system uses detectors of its counter part, photoelectric smoke

detector, which avoids dangerous radioactive emission by solely depending on principle of

photo electricity. Photoelectric smoke detector is based upon the scattering of light caused

when smoke particles enters the light beam. Photoelectric detectors respond more quickly to

smoldering fires.

55

Page 47: Final Report

CIRUIT DIAGRAM:

Fig 26: Smoke Detection Module

CIRUIT DESCRIPTION:

We use 555 timer as a monostable multivibrator. Here the output at pin-3 of the timer

depends on amplitude of the trigger pulse applied to the pin-2. Here we tune the 50kΩ

potentiometer either to ground or towards +Vcc.

The optointerrupter is in working mode. When the smoke is present it detect the smoke so

that it get interrupted then the phototransistor stops conducting and trigger at pin-2 and the

output goes low so that LED glows and it indicates smoke is present in the surrounding area.

Photoelectric smoke detector is based upon the scattering of light caused when smoke

particles enters the light beam.

The sensor circuit consists of

LED - to transmit the light signal

LDR - to receive the light signal

555 Timer - to transmit a 0v or 5v based on a threshold value.

Sensor circuit operates in the bistable mode. Whenever light from led falls on the LDR,

the net resistance is active and greater than Vcc/3, so output is low, whenever any object gets

interfered between the LED and LDR, the voltage is the decrease (i.e. <Vcc/3) then output state

changes. So whenever object is obstructed, the light output state is high otherwise it is low.

56

Page 48: Final Report

5.3. Gas Detection Module:

Fig 27: Gas Detection Module

.

The gas detection module consists of an optointerrupt which upon sensing the gas(LPG)

generates the required response signal which in turn is fed to the pin2 of the 555 timer.

57

Page 49: Final Report

5.4. Obstacle Detection Module:

The IR sensing circuit is used to sense an obstacle which is in front of robot in this

case. We made use of LM 393 an operational amplifier with greater current ratings to compares

the two voltages fed as inputs.

Fig 28: IR detection Module

When sufficient biasing is applied to IR Led it emits IR rays of certain wavelength. The

arrangement of IR transmitter and IR receiver are made such that the reflected ray must fall on

the receiver. In a series network, the current is constant and the voltage is proportional to

resistance. As the IR receiver (photo diode) connected here is reverse-biased it offers large

amount of resistance. When light is fallen on the junction of PN photo diode, some of the

covalent bonds breaks resulting increase in minority charge carriers. Hence the diode goes to

active state and starts conducting. As a result, the voltage across the receiver is high. Here for

LM358 we take the inputs from the IR receiver and the variable voltage. Hence certain voltage

is provided at the 3rd terminal of IC LM358. Here LM 358 acts as comparator. 1M variable

resistor is provided for adjusting the difference between 2 and 3 terminals. This is taken as a

reference voltage.

When the receiver is in OFF state, its voltage is greater than the preset voltage thereby

the output of the comparator will go high and this output is taken at pin no.1. So, such high

voltage is considered as logically high i.e., logic1 and is connected to micro controller.

58

Page 50: Final Report

Due to the existence of the potential difference across the LED it glows.

As soon as it receives the IR rays the receiver goes into ON state and the potential

across the receiver is decreased to (0.71V) which is less than the preset voltage. So the output

of the comparator is low.

We can see that there is no potential difference across LED and it is in OFF state.

Here we used white LED instead of the IR emitter as it has certain advantages like

The working of the LED is visible whereas the IR rays are invisible to the human eye

Sensitivity of the detection is greater for the visible light than the IR rays since they have

greater wavelength.

In this way the white and black colors the distinguished and this is fed to the

microcontroller and the remaining function is done by it.

59

Page 51: Final Report

P89V51RD2 Assembly language:

6.1. Introduction: Assembly language programming is one of the most powerful methods of programming a

computer. It works one step above the level of the computer. That is, instead of writing a program

that says "print this character on the screen when such and such a condition is met" you write a

program that says "put the number $A6 at address $E510 when the flag at $1023 becomes a one."

Actually, this isn't entirely true. Which addresses and numbers are appropriate varies wildly from

computer to computer (or, microcontroller to microcontroller. The actual semantics of whether to

say computer or microcontroller are just that -- semantics. Generally, microcontrollers are used

with devices and computers are used for number-crunching).

Assembly programs generally use numbers in base 16, also known as hexadecimal, due to the

fact that the physical structure of most computers is based on grouping the individual switches in

groups of 8. Thus it is very easy to go from the switch patterns to the hexadecimal numbers. The

commands are very short, and the computer does exactly what you tell it. The advantage to this is

that the executables are extremely small and fast. To give you an idea of the speed gains, an

assembly program will generally run 2 to 4 times faster than a comparable C/C++ program, and

orders of magnitude faster than many other languages.

One of the disadvantages of assembly is, the computer does exactly what you tell it. That is,

if you think you're telling it one thing, and you're actually telling it another, the results are going to

be quite different than what you expect. Usually, they're dramatically different, and nine times out of

ten they involve an infinite loop somewhere you didn't expect it. This brings us to the second

disadvantage. Due to the short and direct nature of the syntax, debugging your own program can be

difficult. Even trying to figure out what someone else's program is attempting to do can take so much

time that it's often easier to start from scratch. And the slightest mistake will mean the program won't

work properly. Only very rarely will it even do anything close. This is simply because of the direct

nature of the commands. The only way around this is to document the program far more than one

would deem necessary; every line if possible. Thus assembly language can be considered an

extremely fast, powerful, and efficient language. But one should be alert for the potential difficulties

assembly language can present.

60

Page 52: Final Report

6.2. Assembling and running an 8051 program:

ASM language is a low level programming language. It takes tons of time to

develop embedded programs. Now even 8 bit microcontrollers aren’t as small as they were

earlier. The program memories are climbing to megabyte(s). Program structure becoming more

complicated because of bigger functionality demand. This is why it is better to use higher level

programming languages like C.

By using C language you are not overwhelmed by details. You don’t have always to

think about hardware logic to be able to program its restricted tasks. It is better to give this

work to C compiler which helps you to avoid bugs in silicon level. Another C language

benefit against ASM language is portability. Let’s say you work on one embedded system

architecture and decide to move to other maybe more advanced. If your previous program were

written in ASM language, then you will need to rewrite (modify) this code from scratch. Using

C language you are able to run program on different microcontroller without significant

modifications. This also reduces the costs of your project upgrade. Continuing the thought it is

good to mention, that using C it is easy to save specific hardware routines to libraries which are

convenient to use in other projects. Using C library functions and headers ensures that

application source can be recompiled for different MCU targets. And the most important thing

in using higher level programming language is that you can focus on algorithm design and

spend less time on implementing. C is a high level language. It enables to write embedded

programs more quickly and easy. One C line can stand for several ASM lines.

ASM language is used in critical parts of programs, but again C compilers are improving

and sometimes program written in C may be more efficient then written in ASM. It depends

more on programmer than a programming language.

61

Page 53: Final Report

CONCLUSION:

In this project, a home security robot that detects abnormal and dangerous situations

like smoke, fire accident, gas leakage has been designed.

The relevant circuit to achieve the above objectives was fabricated in modules. The

design of the obstruction sensor was the first one which was later followed by the fire, smoke

and gas sensors.

A program was code in ‘C’ language and is burned into the microcontroller. A Cell

Phone has been linked to the microcontroller. This cell phone is setup with auto-dialing to the

user’s cell phone number.

This project work can be extended to develop an industrial security robot by embedding

additional sensor circuitry such as temperature and pressure sensors.

62

Page 54: Final Report

BIBILOGRAPHY:

8051 Microcontroller Architecture, Programming & Applications

-Kenneth J. Ayala

8051 Microcontroller & Embedded systems

- MUHAMMAD ALIMAZDI

-JANICE GILLISPIE MAZDI

WEBSITES:

http://en.wikibooks.org/wiki/Embedded_Systems/8051-Microcontroller/8051_Programming

63