59
Indus Institute of Engineering & Technology Affiliated to Kurukshetra University, Kurukshetra (Haryana). Training Report on EMBEDDED SYSTEM Submitted for Partial fulfillment of Summer Training ( Session : July–Aug 2010)

Project Repprt on DTMF Mobile ROBOT-2

Embed Size (px)

Citation preview

Page 1: Project Repprt on DTMF Mobile ROBOT-2

Indus Institute of Engineering & Technology Affiliated to Kurukshetra University, Kurukshetra (Haryana).

Training Report on

EMBEDDED SYSTEM Submitted for Partial fulfillment of Summer Training

( Session : July–Aug 2010)

SUBMITTED TO:- SUBMITTED BY:-

NAME:-ManoJ Sehgal HOD:- Er. Shally Garg ROLL NO:- 5608153

Department of ELECTRONICS & COMMUNICATION ENGINEERING

Page 2: Project Repprt on DTMF Mobile ROBOT-2

ACKNOWLEDGEMENT

The submission of this industrial training report gives us an opportunity to convey our gratitude to all those who have helped us reach a stage where we have immense confidence to launch our career in the competitive world of electronics & communication technology. We have no second thought to admit that it is our respected teachers who have played a significant role in shaping our career and we would be miserable failing in our duty if don’t extend our heart filled gratitude and acknowledgement to our guide …………………………………………………..who has been a source of perpetual inspiration to us, gently guiding and our waves towards a bright career. You were ever willing to give all kind of support and encouragement.

In the end we want to thankful our “Parents”, “Embedded teachers” and Almighty GOD for all the thing that they do to us.

MANOJ SEHGAL Roll No.5605153

Page 3: Project Repprt on DTMF Mobile ROBOT-2

Guidelines for Students regarding Training Seminar & Report:

Students will come in Formal Dress (College Uniform) on the day of seminar.

Training Report must be checked and signed by Class Incharge and HOD otherwise the report will not be accepted and marks will be deducted accordingly. No report will be checked and signed on the day of seminar.

Students will deliver the seminars as per schedule only and the request for change in schedule will not be entertained in any case.

Report & Slides (ppts) of students should not be same if they have done the training from the same institute / company. This may lead to cancellation of seminar.

Students will bring the Original Certificate of Training for verification at the time of seminar and will attach the photocopy in report.

Students will show their Project Work on the day of seminar if they have developed any project during training.

Scanned Reports will be rejected.

Report should be properly justified and should be as per specified font size.

Students will prepare presentation slides for 10-15 minutes seminar. Background and font size of slides should be proper such that these are clearly visible.

Training Report must be of 40 pages with Spiral Binding.

Students will attach a CD with the report at the end containing Soft copy of report and Presentation Slides. CD must be marked with Name, Roll No and Topic of Training of the student.

For any query regarding Training Report / Seminar please contact the undersigned

Er. Abhimanyu & Er. Sunaina

Page 4: Project Repprt on DTMF Mobile ROBOT-2

PREFACE

Summer Training / Industrial Training is very important for engineering students. This training provides them opportunity to be familiar with the industrial / company environment. During this training they can show and can enhance their practical skills and gain practical knowledge and experience for future. This is best way through which the students can learn the latest technologies being used in the companies.

I Manoj Sehgal(5608153.) have undergone through a Summer Training on “embedded system” from “Ducat” This training helped me a lot in learning the technologies of this particular field. I have also done a project “communication kit” during the training. During the project development I gained practical knowledge of the subject.

Industrial Training & Project work were very challenging but as I proceeded things got easier. Practical Summer / Industrial Training was an interesting learning experience for me.

Page 5: Project Repprt on DTMF Mobile ROBOT-2

TRAINING COMPLETION CERTIFICATE

This is to certify that Manoj Sehgal of 2010-2011 year ECE has successfully completed the summer training for the partial fulfilment of requirements of the degree B. Tech. as prescribed by the university.

This report is the record of authentic work carried out by the student during the period of training and is submitted during the Academic Year 2010 – 2011.

Er.Shally Garg (H.O.D ECE)

Page 6: Project Repprt on DTMF Mobile ROBOT-2

TRAINING REPORT

On *EMBEDDED SYSTEMS*

Submitted for partial fulfilment Of B. Tech. in

“ELECTRONICS AND COMMUNICATION ENGINEERING”

Page 7: Project Repprt on DTMF Mobile ROBOT-2

WEEKELY DIARY

weeks Topic signature

1st week C language

2nd week 8051 microcontroller

3rd week 8051 microcontroller

4th week Linux overview

5th week Project

6th week Project

Page 8: Project Repprt on DTMF Mobile ROBOT-2

Contents inThe Project Report

1. INTRODUCTION.

2. PROJECT OVERVIEW.

3. CIRCUIT & COMPONENTS DESCRIPTION.

4. ABOUT MICROCONTROLLER UNIT.

5. CIRCUIT & INTERFACING DESCRIPTION.

6. WORKING OF DTMF ROBO.

7. SOFTWARE OF DTMF ROBO IN MCU 8051.

8. POSSIBLE IMPROVE MENTS.

Page 9: Project Repprt on DTMF Mobile ROBOT-2

Mobile Controlled ROBOT Using DTMF Technology

Introduction

What is a Mobile controlled DTMF ROBOT? DTMF Mobile ROBO is a machine that can be controlled with a mobile . In this project, the robot is controlled by a mobile phone 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

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 some other actuators.

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 tome (DTMF) robot receives this DTMF tone with the help of phone stacked in the robotThe 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 touch tone.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

Page 10: Project Repprt on DTMF Mobile ROBOT-2

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

Figures shows the block diagram and cicuit 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 decodeall the sixteen DTMF tone pairs in to a four bit code output. The built -in dila tone regection 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 (pin11) through Q4(pin14) outputs.The atmega 16 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. 

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

MOTOR

DRIVER

LeftMotor

RightMotor

DTMF

Decoder

Monbile

Page 11: Project Repprt on DTMF Mobile ROBOT-2

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

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/columnfrequencies. 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.

Page 12: Project Repprt on DTMF Mobile ROBOT-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.

Fig. 2 Pin configuration of MT-8870

Its filter section uses switched capacitor technology for both the high and lowgroup filters and for dial tone rejection. Its decoder uses digital counting techniquesto detect and decode all 16 DTMF tone pairs into a 4-bit code. External componentcount is minimized by provision of an on-chip differential input amplifier, clockgenerator, and latched tri-state interface bus. Minimal external components requiredincludes a low-cost 3.579545 MHz color burst crystal, a timing resistor, and a timingcapacitor.The filter section is used for separation of the low-group and high group tones andit is achieved by applying the DTMF signal to the inputs of two sixth order switchedcapacitor band pass filters, the bandwidths of which corresponds to the low and highgroup frequencies. The filter section also incorporates notches at 350 and 440 Hz forexceptional dial tone rejection. Each filter output is followed by a single orderswitched capacitor filter section which smoothes the signals prior to limiting. Limitingis performed by high-gain comparators which are provided with hysteresis to preventdetection of unwanted low-level signals. The outputs of the comparators provide fullrail logic swings at the frequencies of the incoming DTMF signals.Following the filter section is a decoder employing digital counting techniques todetermine the frequencies of the incoming tones and to verify that they correspond tothe standard DTMF frequencies.

Page 13: Project Repprt on DTMF Mobile ROBOT-2

ABOUT MICROCONTROLLER UNIT:

VARIOUS TYPE OF MICROCONTOLLERS:

First microcontroller is ‘8031’

FEATURES:

It is Intel’s product. Neither a microprocessor nor a microcontroller.It is a 8-bit controller.Internally no ROM is provided i.e. code is outside the chip.

Second microcontroller is ‘8051’

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).

Third microcontroller is ‘AT89C51’

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.

Page 14: Project Repprt on DTMF Mobile ROBOT-2

BLOCK DIAGRAM

Fig.13 Internal Diagram of 8051 Micro Controller

ATMEL89C52

Description: The AT89C52 is a low-power, high-performance CMOS 8-bit microcomputer with 8K bytes of Flash programmable and erasable read only memory (PEROM). The deviceis manufactured using Atmel’s high-density nonvolatile memory technology and is compatible with the industry-standard 80C51 and 80C52 instruction set and pinout.

Page 15: Project Repprt on DTMF Mobile ROBOT-2

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 AT89C52 is a powerful microcomputerwhich provides a highly-flexible and cost-effective solution to many embedded control applications.

PIN DISCRIPTION

Fig. 14 Pin description of 8051 Micro Controller

The ATMEL89C52 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 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.

Page 16: Project Repprt on DTMF Mobile ROBOT-2

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

GND Pin 20 is the ground.

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. 15 XTAL1 & XTAL2 Pins Circuit It must be noted that there are various speeds of the 8051 family. Speed refers to 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, a 20 MHz microcontroller requires a crystal frequency of no more than 20 MHz. When the 8051 is connected to a crystal oscillator and is powered up, we can observe the frequency on the XTAL2 pin using oscilloscope.

RST 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

Page 17: Project Repprt on DTMF Mobile ROBOT-2

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. 16 Circuit Connection of Reset PinEAAll 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.PSEN 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.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.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

Page 18: Project Repprt on DTMF Mobile ROBOT-2

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.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.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.

Port 3 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)

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.

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

Page 19: Project Repprt on DTMF Mobile ROBOT-2

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.

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.

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

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.

Page 20: Project Repprt on DTMF Mobile ROBOT-2

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 External RAM requires 4 instructions and 7 instruction cycles. In

this case, external memory is 7 times slower!

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.

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 21: Project Repprt on DTMF Mobile ROBOT-2

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

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.

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.

DPTR

PC

DPH DPL

PC(program conter)

R3

A

B

R0

R1

R2

R4

R5

R6

R7

Page 22: Project Repprt on DTMF Mobile ROBOT-2

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 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

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.

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.

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.

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.

CIRCUIT & INTREFACING DESCRIPTION:

Page 23: Project Repprt on DTMF Mobile ROBOT-2

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:

POWER SUPPLY UNIT (+5V) 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.

Page 24: Project Repprt on DTMF Mobile ROBOT-2

For a 5V regulated supply :

Fig. 4

Each of the block has its own function as described belowTransformer – 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.

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. 5 TransformerMost 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 Ns

Page 25: Project Repprt on DTMF Mobile ROBOT-2

AndPower Out = Power In Vs Is Vp Ip

Where

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

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. 6 OUTPUT – Full-wave Varying DC

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.

Fig. 7 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

Page 26: Project Repprt on DTMF Mobile ROBOT-2

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

REGULATOR:

Fig. 8 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.

Working Of Power Supply

Transformer

Fig. 9 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.

Transformer + Rectifier

Page 27: Project Repprt on DTMF Mobile ROBOT-2

Fig. 10 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.

Transformer + Rectifier + Smoothing

Fig. 11 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.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. 12 Power SupplyThe regulated DC output is very smooth with no ripple. It is suitable for all electronic circuits.

LCD UNIT:

Page 28: Project Repprt on DTMF Mobile ROBOT-2

LCD Display: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):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):

Page 29: Project Repprt on DTMF Mobile ROBOT-2

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

Fig. 20 LCD(JHD162A) interfaced with MCU Table: 2 LCD pin description:

Page 30: Project Repprt on DTMF Mobile ROBOT-2

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

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 of1.2A per channel. Moreover for the protection of the circuit from back EMF, outputdiodes are included within the IC. The output supply (VCC2) has a wide range from4.5V to 36V, which has made L293D a best choice for DC motor driver.

Page 31: Project Repprt on DTMF Mobile ROBOT-2

The name "HıBridge" is derived from the actual shape of the switching circuitwhich 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

Fig. 21 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 +5V .

Page 32: Project Repprt on DTMF Mobile ROBOT-2

Fig. 22 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: Project Repprt on DTMF Mobile ROBOT-2

Fig. 23 Interfacing of MAX-232 IC

SETTING SERIAL PORT.

SCON8 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 WORKING OF ROBO:  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.

Software of DTMF Robot in Microcontroller 8051:

Software for write to AT89C2051 is robot1.hex ,which was written by C-language ,the source code is robot1.c compiled by using MIDE-51.

;//hardware decleration//

lcdport equ p0

rs bit p3.2

Page 34: Project Repprt on DTMF Mobile ROBOT-2

en bit p3.3

mot1_a bit p2.0

mot1_b bit p2.1

mot2_a bit p2.2

mot2_b bit p2.3

;////////////////////

mov p2,#0ffh

mov p1,#0

acall stop

welcome:

acall lcd_line1

mov dptr,#600h

mov r4,#16

acall display

check:

mov a,p1

anl a,#00001101b

cjne a,#00001101b,check2

acall fun1

sjmp check

check2:

Page 35: Project Repprt on DTMF Mobile ROBOT-2

mov a,p1

anl a,#00001011b

cjne a,#00001011b,check3

acall fun2

sjmp check

check3:

mov a,p1

anl a,#00001001b

cjne a,#00001001b,check4

acall fun3

sjmp check

check4:

mov a,p1

anl a,#00000111b

cjne a,#00000111b,check5

acall fun4

sjmp check

check5:

mov a,p1

anl a,#00001010b

Page 36: Project Repprt on DTMF Mobile ROBOT-2

cjne a,#00001010b,check

acall fun5

sjmp check

fun0:

acall no_sig

ret

fun1:

acall sig

acall forword

acall lcd_line2

mov lcdport,#'2'

acall dat

acall delay

acall lcd_line1

mov dptr,#1000h

mov r4,#13

acall display

acall delay

ret

fun2:

acall sig

Page 37: Project Repprt on DTMF Mobile ROBOT-2

acall left

acall lcd_line2

mov lcdport,#'4'

acall dat

acall delay

acall lcd_line1

mov dptr,#1200h

mov r4,#10

acall display

acall delay

ret

fun3:

acall sig

acall right

acall lcd_line2

mov lcdport,#'6'

acall dat

acall delay

acall lcd_line1

mov dptr,#1100h

mov r4,#11

acall display

acall delay

ret

Page 38: Project Repprt on DTMF Mobile ROBOT-2

fun4:

acall sig

acall back

acall lcd_line2

mov lcdport,#'8'

acall dat

acall lcd_line1

mov dptr,#1300h

mov r4,#10

acall display

acall delay

ret

fun5:

acall sig

acall stop

acall lcd_line2

mov lcdport,#'5'

acall dat

acall delay

acall lcd_line1

mov dptr,#1400h

mov r4,#10

acall display

Page 39: Project Repprt on DTMF Mobile ROBOT-2

acall delay

ret

forword:

setb mot1_a

clr mot1_b

setb mot2_a

clr mot2_b

ret

right:

clr mot1_a

clr mot1_b

setb mot2_a

clr mot2_b

ret

left:

setb mot1_a

clr mot1_b

clr mot2_a

clr mot2_b

Page 40: Project Repprt on DTMF Mobile ROBOT-2

ret

back:

clr mot1_a

setb mot1_b

clr mot2_a

setb mot2_b

ret

stop:

clr mot1_a

clr mot1_b

clr mot2_a

clr mot2_b

ret

sig:

acall lcd_line1

mov dptr,#700h

mov r4,#15

acall display

ret

no_sig:

Page 41: Project Repprt on DTMF Mobile ROBOT-2

acall lcd_line1

mov dptr,#900h

mov r4,#9

acall display

ret

lcd_line1:

mov lcdport,#38h

acall command

acall delay

mov lcdport,#01h

acall command

acall delay

mov lcdport,#0ch

acall command

acall delay

mov lcdport,#80h

acall command

acall delay

ret

lcd_line2:

mov lcdport,#38h

acall command

Page 42: Project Repprt on DTMF Mobile ROBOT-2

acall delay

mov lcdport,#0ch

acall command

acall delay

mov lcdport,#0c0h

acall command

acall delay

ret

display:

clr a

movc a,@a+dptr

mov lcdport,a

acall dat

nop

nop

nop

nop

acall delay

inc dptr

djnz r4,display

ret

Page 43: Project Repprt on DTMF Mobile ROBOT-2

command:

clr rs

setb en

nop

nop

nop

nop

clr en

ret

dat:

setb rs

setb en

nop

nop

nop

nop

clr en

ret

delay:

mov r0,#10

goo:

mov r1,#50

Page 44: Project Repprt on DTMF Mobile ROBOT-2

go11:

mov r2,#50

go22:

djnz r2,go22

djnz r1,go11

djnz r0,goo

ret

org 600h

db 'DTMF MOBILE ROBO'

org 700h

db 'SIGNAL DETECTED'

org 900h

db 'NO-SIGNAL'

org 1000h

db 'ROBOT FORWARD'

org 1100h

db 'ROBOT RIGHT'

org 1200h

db 'ROBOT LEFT'

org 1300h

db 'ROBOT BACK'

org 1400h

db 'ROBOT STOP'

Page 45: Project Repprt on DTMF Mobile ROBOT-2

Possible Improvements:

-Use of 3G mobile cam change it into a spy cam also-A ROBOTIC Arm can also be attached to it , itcan pick up small things.-A metal detector can also be attached to it & can be used in the borders for disposing hidden land mines. -General improvements like using a low dropout voltage regulator, lighter chassis etc -Instead of 12-v motor, low voltage motors can be used