newproject repprt on dtmf mobile robot-2new

67
1 Technical details of the Projects Origin of the Proposal In most college ragging becomes most popular issue. Various steps are taken by government & college management to stop this cruel activity, but all in vain due to lack of staff members in large space of college campus. Colleges are situated in space of hectares, so it is almost impossible to look after the fresher. Presently, college has made anti ragging squad, but still college campus unable to properly avoid this crucial task. To overcome this problem we get an idea Cellphone-Controlled Robot. It helps to capture culprit candidate who involves in unfair activity. GSM technology provides large range of working areas. Due to this feature we can operate this device over large range of areas in college campus. In Law enforcement and military engagements because of many reasons, Cellphone-Controlled Robot is used. The exposures to hazards are mitigated to the person who operates the vehicle from the location of relative safety. They are used by many police department bomb-squads to defuse or detonate explosives.

Upload: mukku56

Post on 21-Apr-2015

99 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: NEWProject Repprt on DTMF Mobile ROBOT-2new

1

Technical details of the Projects

Origin of the Proposal

In most college ragging becomes most popular issue. Various steps are taken by government & college management to stop this cruel activity, but all in vain due to lack of staff members in large space of college campus. Colleges are situated in space of hectares, so it is almost impossible to look after the fresher.Presently, college has made anti ragging squad, but still college campus unable to properly avoid this crucial task.

To overcome this problem we get an idea Cellphone-Controlled Robot. It helps to capture culprit candidate who involves in unfair activity.GSM technology provides large range of working areas. Due to this feature we can operate this device over large range of areas in college campus.

In Law enforcement and military engagements because of many reasons, Cellphone-Controlled Robot is used.

The exposures to hazards are mitigated to the person who operates the vehicle from the location of relative safety. They are used by many police department bomb-squads to defuse or detonate explosives.

Page 2: NEWProject Repprt on DTMF Mobile ROBOT-2new

2

Objectives

To improve our militants security at LOC by gettinginformation about opponent.

Remote controlled vehicles are used in Law enforcement and military engagements because of many reasons. The exposures to hazards aremitigated to the person who operates the vehicle from the location of relative safety. They are used by many police department bomb-squads to defuse or detonate explosives.Current Unmanned Aerial Vehicles (UAVs) can hover around possible targets until they are positively identified before releasing their pay load of weaponry. Backpack sized UAVs will provide ground troops with over the horizon surveillance capabilities.

To achieve ‘ragging free environment’ in college campus.

Presently, college has made anti ragging squad, but still college campusunable to properly avoid this crucial task.

To insure the safe areas in mines.

With the help of Cellphone-Controlled Robot, we can predict the areas where the explosion can occur, by the application of sound tracking webcam.

Page 3: NEWProject Repprt on DTMF Mobile ROBOT-2new

3

TABLE OF CONTENTS

DECLARATION CERTIFICATE

ACKNOWLEDGEMENT ABSTRACT

LIST OF TABLES AND FIGURES

CHAPTER.1

1.1 INTRODUCTION

CHAPTER.2

2.1 PROJECT OVERVIEW

CHAPTER.3

3.1 CIRCUIT & COMPONENTS DESCRIPTION

3.2 ABOUT MICROCONTROLLER UNIT

3.3 CIRCUIT & INTERFACING DESCRIPTION

3.4 WORKING OF DTMF ROBOT

3.5 SOFTWARE OF DTMF ROBO IN MCU 8051

CHAPTER.4

4.1 PRAPOSED OUTCOME

CHAPTER.5

5.1 UTILIZATION OF OUTCOME OF THE PROJECT

REFERENCES

Page 4: NEWProject Repprt on DTMF Mobile ROBOT-2new

4

Mobile Controlled ROBOT Using DTMF Technology

1.1 Introduction

1.1.1 What is a Mobile controlled DTMF ROBOT?

DTMF Mobile ROBOT is a machine that can be that makes a call to the mobile phone attached to the robot. In the course of a call, if any button is pressed, a tone corresponding to the button pressed is heard at the other end of the call. This tone is called "Dual Tone Multiple-Frequency" (DTMF) tone. The robot perceives this DTMF tone with the help of the phone stacked on the robot. The received tone is processed by the microcontroller with the help of DTMF decoder. The microcontroller then transmits the signal to the motor driver ICs to operate the motors & our robot starts moving

1.1.2 Why build a DTMF ROBOT?

Conventionally, Wireless-controlled robots use rf circuits, which have the drawbacks of limited working range, limited frequency range and the limited control. Use of a mobile phone for robotic control can overcome these limitations. It provides the advantage of robust control, working range as large as the coverage area of the service provider, no interference with other controllers and up to twelve controlles.Although the appearance and the capabilities of robots vary vastly, all robots share the feature of a mechanical, movable structure under some form of control. The Control of robot involves three distinct phases: perception, processing and action. Generally, the preceptors are sensors mounted on the robot , processing is done by the on-board microcontroller or processor, and the task is perfomed using motors or with other actuators.

Page 5: NEWProject Repprt on DTMF Mobile ROBOT-2new

5

POJECT OVERVIEW

In this project the robot, is controlled by a mobile phone that makes call to the mobile phone attached to the robot in the course of the call, if any button is pressed control corresponding to the button pressed is heard at the other end of the call. This tone is called dual tone multi frequency tone (DTMF) robot receives this DTMF tone with the help of phone stacked in the robot. The received tone is processed by the atmega16 microcontroller with the help of DTMF decoder MT8870 the decoder decodes the DTMF tone in to its equivalent binary digit and this binary number is send to the microcontroller, the microcontroller is preprogrammed to take a decision for any give input and outputs its decision to motor drivers in order to drive the motors for forward or backward motion or a turn.The mobile that makes a call to the mobile phone stacked in the robot acts as a remote. So this simple robotic project does not require the construction ofreceiver and transmitter units.DTMF signaling is used for telephone signaling over the line in the voice frequency band to the call switching center. The version of DTMF used for telephone dialing is known as touchtone.DTMF assigns a specific frequency (consisting of two separate tones) to each key s that it can easily be identified by the electronic circuit. The signal generated by the DTMF encoder is the direct al-gebric submission, in real time of the amplitudes of two sine(cosine) waves of different frequencies, i.e. ,pressing 5 will send a tone made by adding 1336hz and 770hz to the other end of the mobile. The tones and assignments in a dtmf system shown below

Fig. 1 Block Diagram of DTMF ROBOT

M I C R O C O N T R O L L O R

MOTOR

DRIVER

LeftMotor

RightMotor

DTMF

Decoder

Monbile

Page 6: NEWProject Repprt on DTMF Mobile ROBOT-2new

6

Figures shows the block diagram and circuit diagram of the microcontroller- based robot. The important components of this robot are DTMF decoder, Microcontroller and motor driver.An MT8870 series DTMF decoder is used here. All types of the mt8870 series use digital counting techniques to detect and decode all the sixteen DTMF tone pairs in to a four bit code output. The built -in dual tone rejection circuit eliminated the need for pre- filtering. When the input signal given at pin2 (IN-) single ended input configuration is recognized to be effective, the correct four bit decode signal of the DTMF tone is transferred to Q1 .The ATMEGA16 is a low power, 8 bit, CMOS microcontroller based on the AVR enhanced RISC architecture. It provides the following feature: 16kb of in system programmable flash memory with read write capabilities, 512bytes of EEPROM, 1KB SRAM, 32 general purpose input/output lines. 32 general purpose working registers. All the 32 registers are directly connected to the arithmetic logic unit, allowing two independent registers to be accessed in one signal instruction executed in one clock cycle. The resulting architecture is more code efficient. Outputs from port pins PD0 through PD3 and PD7 of the microcontroller are fed to inputs IN1 through IN4 and enable pins (EN1 and EN2) of motor driver L293d respectively, to drive geared motors. Switch S1 is used for manual reset.  

the notations are :ic1 - mt8870ic2 - atmega16ic3 - l293dic4 - cd7004r1,r2 - 100k resistancesr3 - 330k resistancesr4-r8 - 10k resistancesc1- 0.47 micro farad capacitorc2,c3,c5,c6 - 22pfarad capacitorc4 - 0.1micro farad capacitorxtal1 - 3.57 MHz crystalxtal2 - 12mhz crystals1 - push to on switchm1,m2 - 6v 50rpm motorbatt- 6v

Page 7: NEWProject Repprt on DTMF Mobile ROBOT-2new

7

2.1 DTMF Tone

The DTMF technique outputs distinct representation of 16 common alphanumeric characters (0-9, A-D, *, #) on the telephone. The lowest frequency used is 697Hz and the highest frequency used is 1633Hz, as shown in Table 1.

Table 1: DTMF Keypad.

FREQUENCY 1209 HZ

1336 HZ

1477 HZ

1633 HZ

697 Hz 1 2 3 A

770 Hz 4 5 6 B

852 Hz 7 8 9 C

941 Hz * 0 # D

The DTMF keypad is arranged such that each row will have its own unique tonefrequency and also each column will have its own unique tone frequency. Above is arepresentation of the typical DTMF keypad and the associated row/column frequencies. By pressing a key, for example 5, will generate a dual tone consisting of770 Hz for the low group and 1336 Hz for the high group.

2.2 DTMF Decoder

The MT-8870 is a DTMF Receiver that integrates both band split filter and decoder functions into a single 18-pin DIP or SOIC package. It is manufactured using CMOS process technology. The MT-8870 offers low power consumption (35 mW max) and precise data handling.

Page 8: NEWProject Repprt on DTMF Mobile ROBOT-2new

8

Fig. 2 Pin configuration of MT-8870

Its filter section uses switched capacitor technology for both the high and low group filters and for dial tone rejection. Its decoder uses digital counting techniques to detect and decode all 16 DTMF tone pairs into a 4-bit code. External component count is minimized by provision of an on-chip differential input amplifier, clock generator, and latched tri-state interface bus. Minimal external components required includes a low-cost 3.579545 MHz color burst crystal, a timing resistor, and a timing capacitor.The filter section is used for separation of the low-group and high group tones and it is achieved by applying the DTMF signal to the inputs of two sixth order switched capacitor band pass filters, the bandwidths of which corresponds to the low and high group frequencies. The filter section also incorporates notches at 350 and 440 Hz for exceptional dial tone rejection. Each filter output is followed by a single order switched capacitor filter section which smoothes the signals prior to limiting. Limiting is performed by high-gain comparators which are provided with hysteresis to prevent detection of unwanted low-level signals. The outputs of the comparators provide full rail logic swings at the frequencies of the incoming DTMF signals.Following the filter section is a decoder employing digital counting techniques to determine the frequencies of the incoming tones and to verify that they correspond to the standard DTMF frequencies .

Features

• Complete DTMF Receiver

• Low power consumption

• Internal gain setting amplifier

• Adjustable guard time

• Central office quality

• Power-down mode

Page 9: NEWProject Repprt on DTMF Mobile ROBOT-2new

9

• Inhibit mode

• Backward compatible with MT8870C/MT8870C-1

Applications

• Receiver system for British Telecom (BT) or CEPT Spec (MT8870D-1) • Paging systems

• Repeater systems/mobile radio

• Credit card systems

• Remote control

• Personal computers

• Telephone answering machine

Description

The MT8870D/MT8870D-1 is a complete DTMF receiver integrating both the bandsplit filter and digital decoder functions. The filter section uses switched capacitor techniques for high and low group filters; the decoder uses digital counting techniques to detect and decode all 16 DTMF tone-pairs into a 4-bit code.

ABOUT MICROCONTROLLER UNIT:

VARIOUS TYPE OF MICROCONTOLLERS:

3.1 First microcontroller is ‘8031’

3.1.1 Features:

It is Intel’s product. Neither a microprocessor nor a microcontroller.It is a 8-bit controller.

Page 10: NEWProject Repprt on DTMF Mobile ROBOT-2new

10

Internally no ROM is provided i.e. code is outside the chip.

3.2.1 Second microcontroller is ‘8051’

3.2.2 Features:

It is a first complete 8-bit microcontroller.It is a name of a family. In which the instruction set, pin configuration, architecture are same, only memory storage capacity is different.Internally PROM (programmable read only memory) is provided so it called one time programmable (OTP).

3.3.1 Third microcontroller is ‘ATMEGA16’

3.3.2 Features:

It is ATMEL’s product.It is a similar to 8051 microcontroller i.e. having same instruction set, pin configuration, architecture.It is a also 8-bit microcontroller. It’s cost is only Rs10 more than 8051.It uses EPROM (erasable programmable read only memory) or FLASH memory.It is Multiple time programmable (MTP) i.e. 1000 times. So it is better than 8051.In ‘AT89C51’, ‘C’ stands for CMOS technology used in the manufacturing of the I.C.

BLOCK DIAGRAM

Fig.3 Internal Diagram of 8051 Micro Controller

Page 11: NEWProject Repprt on DTMF Mobile ROBOT-2new

11

3.4.1 ATMEGA16

Description:

The ATMEGA16 is a low-power, high-performance CMOS 8-bit microcomputer with 8K bytes of Flash programmable and erasable read only memory (PEROM). The deviceis

Page 12: NEWProject Repprt on DTMF Mobile ROBOT-2new

12

manufactured using Atmel’s high-density nonvolatile memory technology and is compatible with the industry-standard 80C51 and 80C52 instruction set and pinout.The on-chip Flash allows the program memory to be reprogrammed in-system or by aconventional nonvolatile memory programmer. By combining a versatile 8-bit CPUwith Flash on a monolithic chip, the Atmel ATMEGA16 is a powerful microcomputerwhich provides a highly-flexible and cost-effective solution to many embedded control applications.

3.4.2 Pin Description

Fig. 4 Pin description of 8051 Micro Controller

The ATMEGA16 have a total of 40 pins that are dedicated for various functions such as I/O, RD, WR, address and interrupts. Out of 40 pins, a total of 32 pins are set aside for the four ports P0, P1, P2, and P3, where each port takes 8 pins. The rest of the pins are designated as Vcc, GND, XTAL1, XTAL, RST, EA, and PSEN. All these pins except

Page 13: NEWProject Repprt on DTMF Mobile ROBOT-2new

13

PSEN and ALE are used by all members of the 8051 and 8031 families. In other words, they must be connected in order for the system to work, regardless of whether the microcontroller is of the 8051 or the 8031 family. The other two pins, PSEN and ALE are used mainly in 8031 based systems.

3.4.3 Vcc Pin 40 provides supply voltage to the chip. The voltage source is +5 V.

3.4.4 GND

Pin 20 is the ground.

3.4.5 XTAL1 and XTAL2

The 8051 have an on-chip oscillator but requires external clock to run it. Most often a quartz crystal oscillator is connected to input XTAL1 (pin 19) and XTAL2 (pin 18). The quartz crystal oscillator connected to XTAL1 and XTAL2 also needs two capacitors of 30 pF value. One side of each capacitor is connected to the ground.

Fig. 5 XTAL1 & XTAL2 Pins Circuit It must be noted that there are various speeds of the 8051 family. Speed refers here is the maximum oscillator frequency connected to the XTAL. For example, a 12 MHz chip must be connected to a crystal with 12 MHz frequency or less. Likewise,20MHz microcontroller requires a crystal frequency of no more than 20 MHz. When the 8051 is connected to crystal oscillator and is powered up, we can observe the frequency on the XTAL2 pin by just using oscilloscope.

3.4.6 RST

Page 14: NEWProject Repprt on DTMF Mobile ROBOT-2new

14

Pin 9 is the reset pin. It is an input and is active high (normally low). Upon applying a high pulse to this pin, the microcontroller will reset and terminate all activities. This is often referred to as a power –on reset. Activating a power-on reset will cause all values in the registers to be lost. Notice that the value of Program Counter is 0000 upon reset, forcing the CPU to fetch the first code from ROM memory location 0000. This means that we must place the first line of source code in ROM location 0000 that is where the CPU wakes up and expects to find the first instruction. In order to RESET input to be effective, it must have a minimum duration of 2 machine cycles. In other words, the high pulse must be high for a minimum of 2 machine cycles before it is allowed to go low.

Fig.6 Circuit Connection of Reset Pin

3.4.7 EA

All the 8051 family members come with on-chip ROM to store programs. In such cases, the EA pin is connected to the Vcc. For family members such as 8031 and 8032 in which there is no on-chip ROM, code is stored on an external ROM and is fetched by the 8031/32. Therefore for the 8031 the EA pin must be connected to ground to indicate that the code is stored externally. EA, which stands for “external access,” is pin number 31 in the DIP packages. It is input pin and must be connected to either Vcc or GND. In other words, it cannot be left unconnected.

3.4.8 PSEN

Page 15: NEWProject Repprt on DTMF Mobile ROBOT-2new

15

This is an output pin. PSEN stands for “program store enable.” It is the read strobe to external program memory. When the microcontroller is executing from external memory, PSEN is activated twice each machine cycle.

3.4.9 ALE

ALE (Address latch enable) is an output pin and is active high. When connecting a microcontroller to external memory, potr 0 provides both address and data. In other words the microcontroller multiplexes address and data through port 0 to save pins. The ALE pin is used for de-multiplexing the address and data by connecting to the G pin of the 74LS373 chip.I/O port pins and their functions The four ports P0, P1, P2, and P3 each use 8 pins, making them 8-bit ports. All the ports upon RESET are configured as output, ready to be used as output ports. To use any of these as input port, it must be programmed.

3.4.10 Port 0

Port 0 occupies a total of 8 pins (pins 32 to 39). It can be used for input or output. To use the pins of port 0 as both input and output ports, each pin must be connected externally to a 10K-ohm pull-up resistor. This is due to fact that port 0 is an open drain, unlike P1, P2 and P3. With external pull-up resistors connected upon reset, port 0 is configured as output port. In order to make port 0 an input, the port must be programmed by writing 1 to all the bits of it. Port 0 is also designated as AD0-AD7, allowing it to be used for both data and address. When connecting a microcontroller to an external memory, port 0 provides both address and data. The microcontroller multiplexes address and data through port 0 to save pins. ALE indicates if P0 has address or data. When ALE=0, it provides data D0-D7, but when ALE=1 it has address A0-A7. Therefore, ALE is used for de-multiplexing address and data with the help of latch 74LS373.

3.4.11 Port 1

Port 1 occupies a total of 8 pins (pins 1 to 8). It can be used as input or output. In contrast to port 0, this port does not require pull-up resistors since it has already pull-up resistors internally. Upon reset, port 1 is configures as an output port. Similar to port 0, port 1 can be used as an input port by writing 1 to all its bits.

3.4.12 Port 2

Port 2 occupies a total of 8 pins (pins 21 to 28). It can be used as input or output. Just like P1, port 2 does not need any pull-up resistors since it has pull-up resistors internally. Upon reset port 2 is configured as output port. To make port 2 input, it must be programmed as such by writing 1s to it.

3.4.13 Port 3

Page 16: NEWProject Repprt on DTMF Mobile ROBOT-2new

16

Port 3 occupies a total of 8 pins (pins 10 to 17). It can be used as input or output. P3 does not need any pull-up resistors, the same as P1 and P2 did not. Although port 3 is configured as output port upon reset, this is not the way it is most commonly used. Port 3 has an additional function of providing some extremely important signals such as interrupts. Some of the alternate functions of P3 are listed below:P3.0 RXD (Serial input)P3.1 TXD (Serial output)P3.2 INT0 (External interrupt 0)P3.3 INT1 (External interrupt 1)P3.4 T0 (Timer 0 external input)P3.5 T1 (Timer 1 external input)P3.6 WR (External memory write strobe)P3.7 RD (External memory read strobe)

3.5 MEMORY SPACE ALLOCATION:

The 8051 has three very general types of memory. To effectively program the 8051 it is

necessary to have a basic understanding of these memory types. The memory types are

illustrated in the following graphic. They are: On-Chip Memory, External Code Memory,

and External RAM.

3.5.1 Onchip ROM

The 89C51 has a 4K bytes of on-chip ROM. This 4K bytes ROM memory has memory addresses of 0000 to 0FFFh. Program addresses higher than 0FFFh, which exceed the internal ROM capacity will cause the microcontroller to automatically fetch code bytes from external memory. Code bytes can also be fetched exclusively from an external memory, addresses 0000h to FFFFh, by connecting the external access pin to ground. The program counter doesn’t care where the code is: the circuit designer decides whether the code is found totally in internal ROM, totally in external ROM or in a combination of internal and external ROM.

3.5.2 Onchip RAM

The 1289 bytes of RAM inside the 8051 are assigned addresses 00 to 7Fh. These 128 bytes can be divided into three different groups as follows: A total of 32 bytes from locations 00 to 1Fh are set aside for register banks and the stack. A total of 16 bytes from locations 20h to 2Fh are set aside for bit addressable read/write memory and instructions. A total of 80 bytes from locations 30h to 7Fh are used for read and write storage, or what is normally called a scratch pad. These 80 locations of RAM are widely used for the purpose of storing data and parameters by 8051 programmers.

Page 17: NEWProject Repprt on DTMF Mobile ROBOT-2new

17

Fig.7 ROM & RAM Memory in The 8051 Micro Controller

3.5.3 External Code Memory

External Code Memory is code (or program) memory that resides off-chip. This is often in

the form of an external EPROM.

3.5.4 External RAM

External RAM is RAM memory that resides off-chip. This is often in the form of standard

static RAM or flash refers to any memory (Code, RAM, or other) that physically exists on

the microcontroller itself. On-chip memory can be of several types, but we'll get into that

shortly. External RAM As an obvious opposite of Internal RAM, the 8051 also supports

what is called External RAM. As the name suggests, External RAM is any random access

memory which is found off-chip. Since the memory is off-chip it is not as flexible in terms

of accessing, and is also slower. For example, to increment an Internal RAM location by 1

requires only 1 instruction and 1 instruction cycle. To increment a 1-byte value stored in

Page 18: NEWProject Repprt on DTMF Mobile ROBOT-2new

18

External RAM requires 4 instructions and 7 instruction cycles. In this case, external

memory is 7 times slower!

3.5.5 Code Memory

Code memory is the memory that holds the actual 8051 program that is to be run. This

memory is limited to 64K and comes in many shapes and sizes: Code memory may be

found on-chip, either burned into the microcontroller as ROM or EPROM. Code may also

be stored completely off-chip in an external ROM or, more commonly, an external

EPROM. Flash RAM is also another popular method of storing a program. Various

combinations of these memory types may also be used--that is to say, it is possible to have

4K of code memory on-chip and 64k of code memory off-chip in an EPROM.

3.6 Registers In the CPU, registers are used to store information temporarily. That information could be a byte of data to be processed, or an address pointing to the data to be fetched. In the 8051 there us only one data type: 8 bits. With an 8- bit data type, any data larger than 8 bits has to be broken into 8-bit chunks before it is processed. The most commonly used registers of the 8051 are A(accumulator), B, R0, R1, R2, R3, R4, R5, R6, R7, DPTR (data pointer) and PC (program counter). All the above registers are 8-bit registers except DPTR and the program counter. The accumulator A is used for all arithmetic and logic instructions.

Page 19: NEWProject Repprt on DTMF Mobile ROBOT-2new

19

Fig 8(a). Some 8051 8-bit registers Fig 8(b). Some 8051 16-bit registers

3.6.1 Program Counter and Data Pointer

The program counter is a 16- bit register and it points to the address of the next instruction to be executed. As the CPU fetches op-code from the program ROM, the program counter is incremented to point to the next instruction. Since the PC is 16 bit wide, it can access program addresses 0000 to FFFFH, a total of 64K bytes of code. However, not all the members of the 8051 have the entire 64K bytes of on-chip ROM installed.The DPTR register is made up of two 8-bit registers, DPH and DPL, which are used to furnish memory addresses for internal and external data access. The DPTR is under the control of program instructions and can be specified by its name, DPTR. DPTR does not have a single internal address, DPH and DPL are assigned an address each.

3.6.2 Flag bits and the PSW Register

Like any other microprocessor, the 8051 have a flag register to indicate arithmetic conditions such as the carry bit. The flag register in the 8051 is called the program status word (PSW) register. The program status word (PSW) register is an 8-bit register. It is also referred as the flag register. Although the PSW register is 8-bit wide, only 6 bits of it are used by the

DPTR

PC

DPH DPL

PC(program conter)

R3

A

B

R0

R1

R2

R4

R5

R6

R7

Page 20: NEWProject Repprt on DTMF Mobile ROBOT-2new

20

microcontroller. The two unused bits are user definable flags. Four of the flags are conditional flags, meaning they indicate some conditions that resulted

after an instruction was executed. These four are CY (carry), AC (auxiliary carry), P (parity), and OV (overflow). The bits of the PSW register are shown below:

CY PSW.7 Carry flagAC PSW.6 Auxiliary carry flag-- PSW.5 Available to the user for general purposeRS1 PSW.6 Register bank selector bit 1RS0 PSW.3 Register bank selector bit 0OV PSW.2 Overflow flagF0 PSW.1 User definable bitP PSW.0 Parity flag

3.6.3 CY, the carry flag

This flag is set whenever there is a carry out from the d7 bit. This flag bit is affected after an 8-bit addition or subtraction. It can also be set to 1 or 0 directly by an instruction such as “SETB C” and “CLR C” where “SETB C” stands for set bit carry and “CLR C” for clear carry.

3.6.4 AC, the auxiliary carry flag

If there is carry from D3 to D4 during an ADD or SUB operation, this bit is set: otherwise cleared. This flag is used by instructions that perform BCD arithmetic.

3.6.5 P, the parity flag The parity flag reflects the number of 1s in the accumulator register only. If the register A contains an odd number of 1s, then P=1. Therefore, P=0 if Ahas an even number of 1s.

3.6.6 OV, the overflow flag This flag is set whenever the result of a signed number operation is too large, causing the high order bit to overflow into the sign bit. In general the carry flags is used to detect errors in unsigned arithmetic operations.

Page 21: NEWProject Repprt on DTMF Mobile ROBOT-2new

21

3.7 CIRCUIT & INTREFACING DESCRIPTION:

Fig. 3 Circuit Diagram

The circuit diagram oh DTMF ROBO is shown in the figure above. In the circuit IC’s MT8870 & 74LS04N form the DTMF decoder section with its all components,where IC MT8870 converts the output of mobile into digital binery signal & IC 74LS04N boosts the output of MT8870 and gives it to MCU . While L293D is motor driver IC which runs the motors, in the ROBO these three IC’S are used beside the MCU. The description of its all subunits is as following on the next page:

3.8 POWER SUPPLY UNIT (+6V)

Power supplies are designed to convert high voltage AC mains electricity to a suitable low voltage supply for electronics circuits and other devices. A power supply can by broken down into a series of blocks, each of which performs a particular function.

For a 6V regulated supply :

Fig. 8

Each of the block has its own function as described below

Page 22: NEWProject Repprt on DTMF Mobile ROBOT-2new

22

Transformer – steps down high voltage AC mains to low voltage AC.Rectifier – converts AC to DC, but the DC output is varying.Smoothing – smooths the DC from varying greatly to a small ripple.Regulator – eliminates ripple by setting DC output to a fixed voltage.

3.8.1 Transformer:

Transformers convert AC electricity from one voltage to another with little loss of power. Transformers work only with AC and this is one of the reasons why mains electricity is AC. The two types of transformersStep-up transformers increase voltage,Step-down transformers reduce voltage.

Fig. 9 Transformer

Most power supplies use a step-down transformer to reduce the dangerously high mains voltage (230V in UK) to a safer low voltage. The input coil is called the primary and the output coil is called the secondary. There is no electrical connection between the two coils, instead they are linked by an alternating magnetic field created in the soft-iron core of the transformer. The two lines in the middle of the circuit symbol represent the core.

Transformers waste very little power so the power out is (almost) equal to the power in. Note that as voltage is stepped down current is stepped up. The ratio of the number of turns on each coil, called the turns ratio, determines the ratio of the voltages. A step-down transformer has a large number of turns on its primary (input) coil which is connected to the high voltage mains supply, and a small number of turns on its secondary (output) coil to give a low output voltage.

Turns ratio = Vp = Np Vs NsAndPower Out = Power In Vs Is Vp Ip

Where

Page 23: NEWProject Repprt on DTMF Mobile ROBOT-2new

23

Vp = primary (input) voltageNp = number of turns on primary coilIp  = primary (input) currentNs = number of turns on secondary coilIs  = secondary (output) currentVs = secondary (output) voltage

3.8.2 Rectifier:

A bridge rectifier can be made using four individual diodes, but it is also available in special packages containing the four diodes required. It is called a full-wave rectifier because it uses all the AC wave (both positive and negative sections). 1.4V is used up in the bridge rectifier because each diode uses 0.7V when conducting and there are always two diodes conducting, as shown in the diagram below. Bridge rectifiers are rated by the maximum current they can pass and the maximum reverse voltage they can withstand (this must be at least three times the supply RMS voltage so the rectifier can withstand the peak voltages). Please see the DIODES page for more details, including pictures of bridge rectifiers. In this alternate pairs of diodes conduct, changing over the connections so the alternating directions of AC are converted to the one direction of DC.

Fig. 10 OUTPUT – Full-wave Varying DC

3.8.3 Smoothing:

Smoothing is performed by a large value electrolytic capacitor connected across the DC supply to act as a reservoir, supplying current to the output when the varying DC voltage from the rectifier is falling. The diagram shows the unsmoothed varying DC (dotted line) and the smoothed DC (solid line). The capacitor charges quickly near the peak of the varying DC, and then discharges as it supplies current to the output.

Page 24: NEWProject Repprt on DTMF Mobile ROBOT-2new

24

Fig. 11 Capacitor VoltageNote that smoothing significantly increases the average DC voltage to almost the peak value (1.4 × RMS value). For example 6V RMS AC is rectified to full wave DC of about 4.6V RMS (1.4V is lost in the bridge rectifier), with smoothing this increases to almost the peak value giving 1.4 × 4.6 = 6.4V smooth DC.Smoothing is not perfect due to the capacitor voltage falling a little as it discharges, giving a small ripple voltage. For many circuits a ripple which is 10% of the supply voltage is satisfactory and the equation below gives the required value for the smoothing capacitor. A larger capacitor will give less ripple. The capacitor value must be doubled when smoothing half-wave DC.

Smoothing capacitor for 10% ripple, C = 5 × Io Vs × fWhere,C  = smoothing capacitance in farads (F)Io  = output current from the supply in amps (A)Vs = supply voltage in volts (V), this is the peak value of the unsmoothed DCf    = frequency of the AC supply in hertz (Hz), 50Hz in the UK

3.8.4 Regulator:

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

Page 25: NEWProject Repprt on DTMF Mobile ROBOT-2new

25

3.8.5 Working Of Power Supply

3.8.5.1 Transformer

Fig. 13 Transformer Output

The low voltage AC output is suitable for lamps, heaters and special AC motors. It is not suitable for electronic circuits unless they include a rectifier and a smoothing capacitor.

3.8.5.2 Transformer + Rectifier

Fig. 14 Rectifier Stage Output

The varying DC output is suitable for lamps, heaters and standard motors. It is not suitable for electronic circuits unless they include a smoothing capacitor.

3.8.5.3 Transformer + Rectifier + Smoothing

Page 26: NEWProject Repprt on DTMF Mobile ROBOT-2new

26

Fig. 15 Filtered Output

The smooth DC output has a small ripple. It is suitable for most electronic circuits.But now also there are very small ripples present there.

3.8.5.4 Transformer + Rectifier + Smoothing + Regulator

D 2

C 1

1000uf

1N4007 +5V

V

L M 7 8 0 5

1 2

3

V I N V O U T

GN

D

J 1

123

D 3

gnd

D 4

D 1

Fig. 16 Power Supply

The regulated DC output is very smooth with no ripple. It is suitable for all electronic circuit

LCD UNIT:

LCD Display:

Page 27: NEWProject Repprt on DTMF Mobile ROBOT-2new

27

Liquid crystal displays (LCD) are widely used in recent years as compares to LEDs. This is due to the declining prices of LCD, the ability to display numbers, characters and graphics, incorporation of a refreshing controller into the LCD, their by relieving the CPU of the task of refreshing the LCD and also the ease of programming for characters and graphics. HD 44780 based LCDs are most commonly used.

LCD pin description:

The LCD discuss in this section has the most common connector used for the Hitatchi 44780 based LCD is 14 pins in a row and modes of operation and how to program and interface with microcontroller is describes in this section.

Vcc

1 61 51 41 31 21 11 098

654321

7

1 61 51 41 31 21 11 0

98

654321

7

D7

E

Vcc

D4

ContrastRS

Gnd

R/W

Gnd

D0

D3

D6D5

13

2

D2D1

Fig.19 LCD Pin Description Diagram

VCC, VSS, VEE:

The voltage VCC and VSS provided by +5V and ground respectively while VEE is used for controlling LCD contrast. Variable voltage between Ground and Vcc is used to specify the contrast (or "darkness") of the characters on the LCD screen.

RS (register select):

There are two important registers inside the LCD. The RS pin is used for their selection as follows. If RS=0, the instruction command code register is selected, then allowing to user to send a command such as clear display, cursor at home etc.. If RS=1, the data register is selected, allowing the user to send data to be displayed on the LCD.

R/W (read/write):

Page 28: NEWProject Repprt on DTMF Mobile ROBOT-2new

28

The R/W (read/write) input allowing the user to write information from it. R/W=1, when it read and R/W=0, when it writing.

EN (enable):

The enable pin is used by the LCD to latch information presented to its data pins. When data is supplied to data pins, a high power, a high-to-low pulse must be applied to this pin in order to for the LCD to latch in the data presented at the data pins.D0-D7 (data lines):

The 8-bit data pins, D0-D7, are used to send information to the LCD or read the contents of the LCD’s internal registers. To displays the letters and numbers, we send ASCII codes for the letters A-Z, a-z, and numbers 0-9 to these pins while making RS =1. There are also command codes that can be sent to clear the display or force the cursor to the home position or blink the cursor.We also use RS =0 to check the busy flag bit to see if the LCD is ready to receive the information. The busy flag is D7 and can be read when R/W =1 and RS =0, as follows: if R/W =1 and RS =0, when D7 =1(busy flag =1), the LCD is busy taking care of internal operations and will not accept any information. When D7 =0, the LCD is ready to receive new information.

INTERFACING OF LCD WITH MICROCONTROLLER:

An intelligent LCD has two lines with 20 characters each line.The display contains two internal byte wide registers, one for commands and second for characters to be displayed. It also contains a user programmed RAM area that can be programmed to generate any desired character that can be formed using a dot matrix. To distinguish between these two data areas, the hex command byte 80 will be used to signify that the display RAM address 00h is chosen.

From diagram Port 1 of microcontroller is used for 8 bit data display on the LCD. Data lines of the LCD Pin no.7 to pin no 14 are connected to the port 1 of the microcontroller. The control pin no.4 register select is connected to P3.5, pin no.5 of LCD for Read/write is connected to P3.6 and the enable pin (6) is connected to microcontroller

Page 29: NEWProject Repprt on DTMF Mobile ROBOT-2new

29

Fig. 20 LCD(JHD162A) interfaced with MCU

Table: 2 LCD pin description:

Pin Symbol I/O Description

1 VSS - Ground

2 VCC - +5V power supply

3 VEE - Power supply to control contrast

4 RS I/O RS=0 to select command register, RS=1 to select data register.

5 R/W I/O R/W=0 for write, R/W=1 for read

6 E I/O Enable

7 DB0 I/O The 8 bit data bus

8 DB1 I/O The 8 bit data bus

9 DB2 I/O The 8 bit data bus

10 DB3 I/O The 8 bit data bus

11 DB4 I/O The 8 bit data bus

12 DB5 I/O The 8 bit data bus

13 DB6 I/O The 8 bit data bus

14 DB7 I/O The 8 bit data bus

Page 30: NEWProject Repprt on DTMF Mobile ROBOT-2new

30

15 VCC I/O +5V power supply

16 VSS I/O Ground

Motor Driver Circuit

L293D is a dual H-Bridge motor driver. So with one IC, two DC motors can be interfaced which can be controlled in both clockwise and counter clockwise directions and its direction of motion can also be fixed. The four I/O’s can be used to connect upto four DC motors. L293D has output current of 600mA and peak output current of 1.2A per channel. Moreover for the protection of the circuit from back EMF, output diodes are included within the IC. The output supply (VCC2) has a wide range from 4.5V to 36V, which has made L293D a best choice for DC motor driver.The name "HıBridge" is derived from the actual shape of the switching circuit which controls the motion of the motor. It is also known as "Full Bridge".By using two motors the robot can be moved in any direction. This Steering mechanism of the robot is called differential drive.

CIRCUIT DIAGRAM

Page 31: NEWProject Repprt on DTMF Mobile ROBOT-2new

31

Fig. 17 MOTORS Interfaced with MCU

MAX-232 Level Converter

Standard serial interfacing of microcontroller (TTL)  with  PC or any  RS232C Standard device , requires TTL to RS232 Level converter . A MAX232 is used for this purpose. It provides 2-channel RS232C port and requires external 10uF capacitors. The driver requires  a single supply of +6V .

Page 32: NEWProject Repprt on DTMF Mobile ROBOT-2new

32

Fig. 18 MAX 232 IC MAX-232  includes a Charge Pump, which generates +10V and -10V from a single 5v supply.

MAX-232 Interfaced With MCU

MAX232 (+5V -> +-12V converter) Serial port male 9 pin connector

(SER)   

Page 33: NEWProject Repprt on DTMF Mobile ROBOT-2new

33

Fig. 19 Interfacing of MAX-232 IC

Setting Serial Port:

SCON

8 bit UART ,RN enabled , TI & RI operated by program. - 50hex Timer 1 CountTH1 = 256 - ((Crystal / 384) / Baud) -PCON.7 is clear.TH1 = 256 - ((Crystal / 192) / Baud)-PCON.7 is set. so with PCON.7 is clear we get timer value = FDhex

Reading & Writing the I/O ports

The ports of Atmega128 microcontroller are bi-directional 8 bit I/O ports with optional internal pull-ups. Each individual pin of the I/O port can be separately configured as input or output pin. Each parallel I/O port has three associated I/O registers: A. Data direction register, DDRxB. Port driver register, PORTxC. Port pins register, PINx

A. Data direction register (DDRx)

The purpose of the data direction register is to determine which bits of the port are used for input and which bits are used for output. If logic one is written to DDRx, then the port pin is

Page 34: NEWProject Repprt on DTMF Mobile ROBOT-2new

34

configured as an output pin. If logic one is written to DDRx, then the port pin is configured as an input pin.DDRA = 0xF0; //sets the 4 MSB bits of portA as output port and

//4 LSB bits as input port

B. Port drive register (PORTx)

If the port is configured as output port, then the PORTx register drives the corresponding value on output pins of the port.DDRA = 0xFF; //set all 8 bits of PORTA as outputPORTA = 0xF0; //output logic high on 4 MSB pins and logic low on 4 LSB pins

For pins configured as input, we can instruct the microcontroller to supply a pull up register by writing a logic 1 to the corresponding bit of the port driver registerDDRA = 0x00; //set all 8 bits of PORTA as inputPORTA = 0xFF; //pull up register is assigned to all the pins;

C. Port pins register (PINx)

Reading from the inputs bits of port is done by reading port pin registerx = PINA; //read all 8 pins of port A

DDRx PORTx I/O Pull-up Comment0 0 Input No Tri-state (Hi-Z)0 1 Input Yes Pin will source current if externally pulled low1 0 Output No Output low (Sink)1 1 Output No Output high (Source)Table: Port Pin ConfigurationExample: Write a code which continuously scans the bump switches connected to Port G (PG0 to PG4) and turns on the buzzer (PB7) if any of the five bump switches is closed. For pin PG0 to PG4 pull up is activated hence in the normal position, when switch is open, input to this pin is high, when the switch is closed input to this pin goes low.

Page 35: NEWProject Repprt on DTMF Mobile ROBOT-2new

35

#include <iom128v.h >#include <macros.h>#include <stdio.h>

void port_init(void){ PORTB = 0x00; DDRB = 0x80; //PB7 is configured as output pin PORTG = 0x1F; //Pull up is assigned to pins PG0- PG4 DDRG = 0x00; //PORTG is configured as input}

void buzzer_on (void){ unsigned char portb_copy = 0; portb_copy =PORTB | 0x80; // setting the MSB to turn on the buzzer PORTB = portb_copy; // executing the command}

void buzzer_off (void){ unsigned char portb_copy = 0; portb_copy = PORTB & 0x7F; // resetting the MSB to turn off the buzzer PORTB = portb_copy; // executing the command}

Page 36: NEWProject Repprt on DTMF Mobile ROBOT-2new

36

void delay(){ unsigned int i,j; for(i=0; i<1000; i++) for(j=0; j<1000; j++);}

void main (void){

port_init( );buzzer_on();delay();buzzer_off();

while(1);

}

Motion control of Robot

Fig: Interface block diagram of microcontroller and dc motoDirection Control

Two DC motors are connected to PortA of the microcontroller. IC L293D is used as a driver between the microcontroller and the DC motors. The L293D has quadruple high-current half-H drivers. The L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages from 4.5 V to 36 V. Drivers are enabled in pairs, with drivers 1 and 2 being enabled by the Enable pin. When an enable

Page 37: NEWProject Repprt on DTMF Mobile ROBOT-2new

37

input is high (1), the associated drivers are enabled and their outputs are active and in phase with their inputs.

Direction of the motor is controlled by asserting one of the inputs to motor to be high (1) and the other to be low (0). To move the motor in opposite direction just interchange the logic applied to the two inputs of the motors. Asserting both inputs to logic high or logic low will stop the motor.

Controlling the velocity of the motor

To control the velocity of the motor, pulse width modulated (PWM) pulses are applied to Enable pins of L293 driver. PWM is the scheme in which the duty cycle of a square wave output from the microcontroller is varied to provide a varying average DC output. What actually happens by applying a PWM pulse is that the motor is switched ON and OFF at a given frequency. In this way, the motor reacts to the time average of the power supply.

Timer3 of the microcontroller is configured to generate PWM with an 8 bit resolution. Timer3 counts from BOTTOM to MAX and then restarts from BOTTOM. The pulse width of the PWM for left and right motors is controlled by OCR3AL and OCR3BL registers of the timer. Timer3 generates a high pulse on PWM pin until the timer reaches the count mentioned in the OCR register and then switches to low until the timer reaches MAX count and then again the timer outputs a high pulse on the PWM pin and restarts counting from the BOTTOM.

Fig: Fast PWM mode timing diagram

The duty cycle of the PWM waveform is controlled by modifying the OCR3 register. The extreme values for the OCR3 register represent special cases when generating a PWM waveform output in the fast PWM mode. If OCR3 is set to BOTTOM, the output will be a narrow spike for each MAX+1 timer clock cycle. Setting OCR3 equal to MAX will result in a constantly high output i.e. the motor is rotating with max velocity.

Page 38: NEWProject Repprt on DTMF Mobile ROBOT-2new

38

Control Registers for PWM generation

Timer/Counter3 Control Register A – (TCCR3A = 0xA1)

Bit Name Value Description 7 COM3A1 1 Compare Output Mode for Channel A

(Clear OC3A pin on compare match)6 COM3A0 0

5 COM3B1 1 Compare Output Mode for Channel B(Clear OC3B pin on compare match)4 COM3B0 0

3 COM3C1 0 Compare Output Mode for Channel C

2 COM3C0 0

1 WGM31 0 Timer/Counter Mode of Operation(Fast PWM, 8-bit)0 WGM30 1

Timer/Counter3 Control Register B – (TCCR3B = 0x0B)

Bit Name Value Description7 ICNC3 0 Input Capture Noise Canceller6 ICES3 0 Input Capture Edge Select5 - 0 -4 WGM33 0 Waveform Generation Mode

(Fast PWM, 8-bit)3 WGM32 1

2 CS32 0 Clock SelectPre-scale factor (CLK /64)

1 CS31 1

0 CS30 1

To configure timer 3 to generate 8 bit fast PWM, set values of following the registers in an initialization functionTCCR3A = 0xA1; //clear OC3A, OC3B pin on match, 8 bit fast PWMTCCR3B = 0x0B; //pre-scalar fclk/64The PWM frequency for the output can be calculated by the following equation:

*256clk

PWM

ff

N

The N variable represents the pre scale factor. It can take a value from the following set {1, 8, 64, 256, or 1024}.

Page 39: NEWProject Repprt on DTMF Mobile ROBOT-2new

39

Position Control of robot using close loop

For precise position control of the robot, position encoders are deployed near the wheels of the robot. Position encoder generates a single pulse after every 2.9083mm distance traveled by the robot. And 115 pulses are generated for 360 degrees rotation that is 3.130 degrees per count. A pulse generated by the position encoder generates a hardware interrupt INT0 (interrupt0) for right wheel and INT1 (interrupt1) for left wheel. Interrupt subroutines are used to measure the number of pulses generated and this number is stored in a register.

Control Registers for setting Interrupt 7

External Interrupt Control Register A – (EICRA = 0x0F)

ISC31, ISC30 – ISC00, ISC00: External Interrupt 3 - 0 Sense Control Bits

ISCn1 ISCn0 Description

0 0 The low level of INTn generates an interrupt request.0 1 Reserved1 0 The falling edge of INTn generates asynchronously an interrupt request.1 1 The rising edge of INTn generates asynchronously an interrupt request.

2. External Interrupt Mask Register – (EIMSK = 0x83)

INT7 – INT0: External Interrupt Request 7 - 0 Enable

To configure the microcontroller to capture rising edge interrupt signals on INT0, INT1 pins load External Interrupt Control Register A with OFH(i.e. EICRA = 0x0F) and set the 0th and 1st bits in the External Interrupt Mask Register (EIMSK = 0x03).

EICRA = 0x0F // INT0, INT1 are triggered on rising edge EIMSK = 0x03; // Enable Interrupt INT0, INT1

EICRA register and EIMSK register are initialized in the init_devices( ) function.

1.1 LCD Interface

Page 40: NEWProject Repprt on DTMF Mobile ROBOT-2new

40

Fig: Microcontroller LCD interface

Interfacing the microcontroller with a LCD requires three control signals and 8 data lines. The three control lines are referred to as EN, RS, and RW. 1. The EN line is called "Enable" and it is connected to PORTA’s 5 th pin. This control line is used to tell the LCD that you have sent data to it or are ready to receive data from it. This is indicated by a high-to-low transition on this line. To send data to the LCD, your program should make sure that this line is low (0) and then set the other two control lines as required and put data on the data bus. When this is done, make EN high (1) and wait for the minimum amount of time as specified by the LCD datasheet, and end by bringing it to low (0) again.

2. The RS line is the "Register Select" line and it is connected to PORTA’s 6 th pin. When RS is low (0), the data is treated as a command or special instruction by the LCD (such as clear screen, position cursor, etc.). When RS is high (1), the data being sent is treated as text data which should be displayed on the screen.

3. The RW line is the "Read/Write" control line and it is connected to PORTA’s 7 th pin. 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 from) the LCD. The data bus is bidirectional, 8 bit wide and is connected to PORTC of the microcontroller. The MSB bit (DB7) of data bus is used as a Busy flag. When the Busy flag is 1, the LCD is in internal operation mode, and the next instruction will not be accepted. When RS = 0 and R/W = 1, the Busy flag is output on DB7. The next instruction must be written after ensuring that the Busy flag is 0.

Page 41: NEWProject Repprt on DTMF Mobile ROBOT-2new

41

Fig: LCD Interface timing diagram

Before we can display any data on the LCD we need to initialize the LCD for proper operation. The first instruction we send must tell the LCD whether we'll be communicating with it using an 8-bit or 4-bit data bus. We also opt to use a 5x8 dot character font(as opposed to a 5x10 dot font). These two options are selected by sending the 38H to the LCD as a command. Remember that the RS line must be low if we are sending a command to the LCD. In the second and third instruction we reset and clear the display of the LCD. The fourth instruction sets the cursor to move in incremental direction. In fifth and sixth instruction we turn ON the display and place the cursor at the start. Check the Init_LCD( ) function to see how all this is put in code.

init_devices ( ) initializes all the devices in the microcontroller. port_init( ) configures the port directions of the microcontroller.LCD_Busy( ) function checks for the completion of the previous data write operation to LCD. LCD_WriteControl( ) function writes a command word to the LCD.LCD_WriteData( ) function writes data to the LCD. Init_LCD( ) function initializes all the control registers of the LCD. LCD_Clear( ) clears the LCD screen.LCD_Home( ) places the cursor at the beginning of the screen.LCD_DisplayCharacter( ) displays a single character at the position of the cursor. LCD_DisplayString( ) displays a character string on the screen. LCD_Cursor( ) places the cursor on the row and column specified.LCD_print_integer( ) displays the content of LCD_value[8] array in integer format.

1.4 Reading analog sensor values (Using Analog to Digital converter of the microcontroller)

The ATmega128 features a 10-bit successive approximation Analog to Digital Converter (ADC). The ADC is connected to an 8-channel Analog Multiplexer which allows 8 single-ended voltage inputs constructed from the pins of Port F. The minimum value represents GND and the maximum value represents the voltage on the AREF pin (5 Volt). The result of ADC is calculated as follows for 8 bit of resolution

Page 42: NEWProject Repprt on DTMF Mobile ROBOT-2new

42

8*2 *256IN IN

REF REF

V VADC

V V

Two registers control the analog to digital converter. The ADC Control and Status Register (ADCSR) controls the functioning of the ADC and the ADC Multiplexer Select Register (ADMUX) controls which of the eight possible inputs is being measured.

ADC Registers

1. ADC control and status register – (ADCSR= 0x8E)

Bit Name Value Description7 ADEN 1 ADC Enable bit6 ADSC 0 ADC Start Conversion bit5 ADFR 0 ADC Free Running Select bit4 ADIF 0 ADC Interrupt Flag (set by hardware at end of conversion)3 ADIE 1 ADC Interrupt Mask bit2 ADPS2 1 ADC Pre-scaler select bit

(CLK /64)1 ADSP1 1

0 ADPS0 0

ADC Multiplexer Selection Register – (ADMUX= 0x20)

Bit Name Value Description7 REFS1 0 Voltage Reference Selection

(AREF pin)6 REFS0 0

5 ADLAR 1 ADC Left Adjust Select bit4 MUX4 0 Analog channel Select bit

(channel 0)3 MUX3 0

2 MUX2 0

1 MUX1 0

0 MUX0 0

Page 43: NEWProject Repprt on DTMF Mobile ROBOT-2new

43

The ADC generates a 10-bit result which is present in the ADC Data Registers,(ADCH and ADCL). By default, the result is presented right-adjusted, (ADCH contain two MSB bits, ADCL contain the 8 LSB bits) but it can be optionally presented left-adjusted (ADCL contain 2 LSB bits, ADCH contain the 8 MSB bits) by setting the 5th bit (ADLAR) in ADMUX register. If the result is left adjusted and no more than 8-bit precision is required, it is sufficient to read ADCH.

3. ADC Data Register – ADCH & ADCL (ADLAR = 1 )

To read ADC data, the microcontroller can be configured to wait until the conversion is completed, or else the ADC has its own interrupt which can be triggered when a conversion completes. To enable interrupt for ADC set ADIE (3rd bit ) of ADSCR to high.

ADMUX = 0x20; //select adc input 0 and left adjust the resultADCSRA = 0x8E; //Enable ADC, Interrupt Enable, Select pre scalar

Before initializing the ADC make sure that PortF is configured as input and the pull up for the port is disabled.PORTF = 0x00; // Pull up for all the port pins is disabledDDRF = 0x00; //PORTF configured as input port

Table below briefs us with the various sensors connected to the ADC port of the microcontroller.

ADC Channel

PORT pins

Description

ADC0 PORT F.0 Battery voltageADC1 PORT F.1 (optional)ADC2 PORT F.2 Front infrared range finderADC3 PORT F.3 Left infrared range finderADC4 PORT F.4 Left white line sensorADC5 PORT F.5 Middle white line sensorADC6 PORT F.6 Right white line sensorADC7 PORT F.7 Right infrared range finderTable: Channel utilization of ADC on microcontroller

1.5 Serial Communication

Page 44: NEWProject Repprt on DTMF Mobile ROBOT-2new

44

Serial Communication with a desktop computer is carried out through PORTD, PD2 (RXD) and PD3 (TXD) pins. The baud rate for serial communication is fixed by adjusting the value of USART Baud Rate Register (UBRR).The 16 bit UBRR register and the down-counter connected to it, function as baud rate generator. The down-counter, running at system clock (fosc), is loaded with the UBRR value each time the counter has counted down to zero or when the UBRRL Register is written. A clock is generated each time the counter reaches zero. The value of UBRR register is set using the formula,

116*

oscfUBRR

BAUD

The USART has to be initialized before any communication can take place. The initialization process normally consists of setting the baud rate, setting frame format and enabling the Transmitter or the Receiver depending on the usage. For interrupt driven USART operation, the global interrupt flag should be cleared (and interrupts globally disabled) during the initialization.

USART Registers

USART Control and Status Register A – UCSR1A

Bit Name Value Description7 RXC1 0 USART Receive Complete6 TXC1 0 USART Transmit Complete5 UDRE1 0 USART Data Register Empty4 FE1 0 Frame Error3 DOR1 0 Data Over Run2 UPE1 0 Parity Error1 U2X1 0 Double the USART Transmission Speed0 MPCM1 0 Multi-Processor Communication Mode

USART Control and Status Register B – (UCSR1B = 0x098)

Bit Name Value Description7 RXCIE1 1 RX Complete Interrupt Enable6 TXCIE1 0 TX Complete Interrupt Enable5 UDRIE1 0 USART Data Register Empty Interrupt Enable4 RXEN1 1 Receiver Enable3 TXEN1 1 Transmitter Enable

Page 45: NEWProject Repprt on DTMF Mobile ROBOT-2new

45

2 UCSZ1 0 Character Size 1 RXB81 0 Receive Data Bit 80 TXB81 0 Transmit Data Bit 8

USART Control and Status Register C – (UCSR1C= 0x06)

Bit Name Value Description6 UMSEL1 0 USART Mode Select ( Asynchronous mode)5 UPM11 0 Parity Mode (Disabled)

4 UPM10 0

3 USBS1 0 Stop bit select (1 bit)2 UCSZ11 1 Character size (8 bit)

1 UCSZ10 1

0 UCPOL1 0 Clock Polarity

USART Baud Rate Registers – (UBRR1L=0x47 and UBRR1H= 0x00)

To configure microcontroller for asynchronous serial communication port with baud rate of 9600 load the following registers.

UCSR1B = 0x098 //RX interrupt, RX enable, TX enable UCSR1C = 0x06 //Asynchronous mode, 1 stop bitUBRR1L = 0x47 // 9600 baud rateUBRR1H = 0x00

The USART Receiver is enabled by setting the Receive Enable (4 th bit in the UCSR1B Register) to one. The baud rate, mode of operation and frame format must be set up before any serial reception can be done. The Receiver starts data reception when it detects a valid start bit. Each bit that follows the start bit will be sampled at baud rate, and shifted into the Receive Shift Register until the stop bit of a frame is received. When the stop bit is received, i.e., a complete serial frame is present in the Receive Shift Register, the contents of the Shift Register will be moved into the receive buffer. The receive buffer can then be read by reading the UDR1 register.

Page 46: NEWProject Repprt on DTMF Mobile ROBOT-2new

46

The USART Transmitter is enabled by setting the Transmit Enable (3 rd bit in the UCSR1B register) to one. A data transmission is initiated by loading the transmit buffer with the data to be transmitted. The CPU can load the transmit buffer by writing to the UDR1 register. The buffered data in the transmit buffer will be moved to the Shift Register when the Shift Register is ready to send a new frame. The Shift Register is loaded with new data if it is in idle state (no ongoing transmission) or immediately after the last stop bit of the previous frame is transmitted. When the Shift Register is loaded with new data, it will transfer one complete frame at the rate given by the baud register.

WORKING OF ROBOT:  In order to control the robot, you have to make a call to the cellphone attached to the robot from any phone & the phone should be in auto answering mode,so that call is attended automaticly. now the call is picked by the phone on the robot through autoanswer mode(which is in the phn, just enable it). now when you press 2 the robot will move forwardwhen you press 4 the robot will move leftwhen you press 8 the robot will move backwardswhen you press 6 the robot will move rightwhen you press 5 the robot will stop.

Now let we know what happens inside the ROBO : when you press 2 the signal tone goes to the mobile hand free ,which is feed to DTMF decoder ,which converts it into the digital form ,then it is given to the booster IC, which after boosting gives it to the MCU. Now MCU checks the input signal and checks the instruction to follow for the input signal. For 2 the instruction says move RONO forward , then our MCU moves the ROBO forward, similarly for in the case : (i). If key pressed 4 ROBO moves Left. (ii). If key pressed 6 ROBO moves Right. (iii). If key pressed 8 ROBO moves Backward. (iv). If key pressed 5 ROBO Stops.

Page 47: NEWProject Repprt on DTMF Mobile ROBOT-2new

47

SOURCE POGRAME

Source program:Robit.c#include <mega16.h>void main(void){unsigned int k, h;DDRA=0x00;DDRD=0XFF;while (1){k =~PINA;h=k & 0x0F;switch (h){case 0x02: //if I/P is 0x02{PORTD=0x89;//O/P 0x89 ie Forwardbreak;}case 0x08: //if I/P is 0x08{PORTD=0x86; //O/P 0x86 ie Backwardbreak;}case 0x04:{PORTD=0x85; // Left turnbreak;}case 0x06:{PORTD=0x8A; // Right turn

Page 48: NEWProject Repprt on DTMF Mobile ROBOT-2new

48

break;}case 0x05:{PORTD=0x00; // Stopbreak;}}}} ?

Page 49: NEWProject Repprt on DTMF Mobile ROBOT-2new

49

PROPOSED OUTCOME/ FINDINGS

Conventionally, wireless-controlled robots use RF circuits, which have the drawbacks of limited working range, limited frequency range and limited control. Use of a mobile phone for robotic control can overcome these limitations. It provides the advantages of robust control, working range as large as the coverage area of the service provider, no interference with other controllers and up to twelve controls. Although the appearance and capabilities of robots vary vastly, all robots share the features of a mechanical, movable structure under some form of control. The control of robot involves three distinct phases: preception, processing and action. Generally, the preceptors are sensors mounted on the robot, processing is done by the on-board microcontroller or processor, and the task (action) is performed using motors or with some other actuators.

Page 50: NEWProject Repprt on DTMF Mobile ROBOT-2new

50

POSSIBLE IMPROVEMENTS

1)-A ROBOTIC Arm can also be attached to it , itcan pick up small things.

2)-A metal detector can also be attached to it & can be used in the borders for disposing hidden land mines

. 3)-General improvements like using a low dropout voltage regulator, lighter chassis etc

4)-Instead of 12-v motor, low voltage motors can be used

Page 51: NEWProject Repprt on DTMF Mobile ROBOT-2new

51

DETAILS OF FACILITIES PROVIDED BY THE INSTITUTION

1) Laboratory for working on the project

2) PCB Fabrication

3) Testing and Debugging

4) Various software needed

5) Some basic components

6) An experienced guide to help us throughout the project

Page 52: NEWProject Repprt on DTMF Mobile ROBOT-2new

52

UTILIZATION OF OUTCOME OF PROJECT

Scientific

Remote control vehicles have a various scientific uses including hazardous environments, working in the deep ocean , and space exploration. The majority of the probes to the other planets in our solar system have been remote control vehicles, although some of the more recent ones were partially autonomous. The sophistication of these devices has fueled greater debate on the need for manned space flights and exploration. The voyager I spacecraft is the first craft of any kind to leave the solar system. The Martian explorers Spirit and Opportunity have provided continuous data about the surface of Mars.

Military and Law Enforcement

Remote controlled vehicles are used in Law enforcement and military engagements because of many reasons. The exposures to hazards are mitigated to the person who operates the vehicle from the location of relative safety. They are used by many police department bomb-squads to defuse or detonate explosives.Current Unmanned Aerial Vehicles (UAVs) can hover around possible targets until they are positively identified before releasing their pay load of weaponry. Backpack sized UAVs will provide ground troops with over the horizon surveillance capabilities.

Search and Rescue

UAVs play an increased role in search and rescue all over the world. This was demonstrated by the successful use of UAVs hurricanes that struck Louisiana and Texas in US.

Recreation and Hobby

Small scale remote control vehicles span a wide range in terms of price and sophistication. There are many types like on-road cars, off-road truck, boats, aero planes and helicopters. Radio-controlled submarine also exist.

Page 53: NEWProject Repprt on DTMF Mobile ROBOT-2new

53

REFERENCE

Analog Edge, “A Quick Sine Wave Generator,” http://www.national.com/nationaledge/jun04/article.html

Dallas Semiconductor, “Digitally Controlled Sine-Wave Generator, http://www.maxim-ic.com/appnotes.cfm/appnote_number/2081

Instructions, Parts List, and Schematic. Operational Amplifier Function Generator, CK103 –Opamp Function Generator, October 2005.

http://electronickits.com/kit/complete/meas/ck102.pdf

Datasheet, UAF42AP, Burr-Brown (Texas Instruments) Universal Active Filter, http://focus.ti.com/lit/ds/symlink/uaf42.pdf.

Burr-Brown Corporation, Texas Instruments, Inc. (1991, 2001). Filter42 [Computer program]. UAF42 Design Program. Tucson, AZ: Applications Engineering. (Application Program No. AB-035)

http://focus.ti.com/docs/toolsw/folders/print/filter42.html

http://en.wikipedia.org/wiki/Dual-tone_multi-frequency

http://en.wikipedia.org