Docs

84
MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION ABSTRACT METAL DETECTOR Aim: The main aim of this project is to design a metal detector using AT 89c51 micro controller. Description: By using this project we can detect the presents of metal, to detect metal we are using metal sensor. Metal sensors are used to detect metals. Whenever a metal is detected the robot will automatically indicates. here we are using AT 89c51 micro controller ,by using software programming it can be detect the metel. By continuous monitoring for that pulse controller yields the corresponding alert signal. To get alert indication we can use either buzzer or siren or light as per availability. Here this project is coming with Buzzer as alert indicator. Electronics & Communications 1

Transcript of Docs

Page 1: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

ABSTRACT

METAL DETECTOR

Aim:

The main aim of this project is to design a metal detector using AT 89c51 micro

controller.

Description:

By using this project we can detect the presents of metal, to detect metal we

are using metal sensor. Metal sensors are used to detect metals. Whenever a metal

is detected the robot will automatically indicates. here we are using AT 89c51

micro controller ,by using software programming it can be detect the metel.

By continuous monitoring for that pulse controller yields the corresponding

alert signal. To get alert indication we can use either buzzer or siren or light as per

availability. Here this project is coming with Buzzer as alert indicator.

This project uses regulated 5V, 500mA power supply. 7805 three terminal

voltage regulator is used for voltage regulation. Bridge type full wave rectifier is

used to rectify the ac output of secondary of 230/12V step down transformer. 

Components used:

o AT89C51 Controller

o 11.0592 MHz Crystal

o Metal detecting sensor

o Buzzer

Electronics & Communications 1

Page 2: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

Domain : Embedded Systems, Robotics,

Software : Embedded C, Keil V.4,

Power Supply : +5V, 500mA Regulated Power Supply

Applications : industries

BLOCK DIAGRAM

Fig 0.1(block diagram for metal sensing)

Electronics & Communications 2

8051[AT89c51]

Powersupply

BuzzerMetal

Sensor

Page 3: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

ROBOT CONTROL USING RF

AIM:

To design a Robot using RF communication.

DESCRIPTION:

This project deals with the design of a robot using RF communication. In

this project we are using RF transmitter and RF receiver. The board containing RF

transmitter works as remote. Four switches are connected to the transmitter

section. Four switches indicate direction.

DC motors are used as robotic wheels. In this project we use two DC

motors which connected to receiver section through ULN 2003 driver. The motors

will rotate according to the data received at receiver. In transmitter section we use

a RF encoder HT12E and in receiver section we use RF decoder HT12D.This

project uses regulated 5V, 500mA & 12V, 500mA power supply. 7805 and 7812

three terminal voltage regulators are used for voltage regulation. Bridge type full

wave rectifier is used to rectify the ac output of secondary of 230/12V step down

transformer.

Requirements:

o AT89C51 Controller.

o 11.0592 MHz Crystal.

o DC motors

o RF module

Electronics & Communications 3

Page 4: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

o RF encoder and decoder.

o Power Supply.

BLOCK DIAGRAM:

Transmitter: Reciever:

Fig 0.2 (block diagram for Tx/Rx of RF communication)

Domain : Embedded Systems, wireless Communication,

Software : Embedded C, Kiel v.4,

Power Supply : +5V, 500mA Regulated Power Supply

Applications : Industries.

POWER SUPPLY:

Electronics & Communications 4

At89c51

Power

Supply

Reset

Crystal

HT12E

RF TX

At89c51

Switches

Power

Supply

Reset

Crystal

RF TX

HT12D

ULN2003

DC motor

DC motor

Step down

T/F

Bridge Rectifier

Filter Circuit

Regulator

Page 5: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

LIST OF FIGURES

1. BLOCK DIAGRAM OF METAL DETECTOR ---- 02

2. BLOCK DIAGRAM OF RF TRANSMISSION ---- 04

3. MEMORY TYPES ---- 15

4. CONNECTION FOR 8051 WITH KEYPAD ---- 27

5. INTERFACING LCD TO 8051 ---- 31

6. POWER SUPPLY PROCESS ---- 34

7. TRANSFORMER ---- 35

8. BRIDGE RECTIFIER ---- 38

9. REGULATOR ---- 39

10. RS 232 PIN CONFIGURATION ---- 40

11. INTERFACING FOR 8051 WITH METAL SENSORS ---- 42

12. DC MOTOR FF-030-PN MOTOR ---- 47

13. RF COMMUNICATION ---- 50

14. HT12E & HT12D PIN ASSIGNMENT ---- 51

15. KEIL FINAL LOOK ---- 52

Electronics & Communications 5

Page 6: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

LIST OF TABLES

1. ADDRESING MODES ---- 20

2. SETTING THE SERIAL MODE ---- 23

3. INTERRUPT PRIORITY ---- 25

4. REGISTER SELECTION ---- 30

5. INSTRUCTIONS OF LCD ---- 31

6. RS 232 PIN ASSIGNMENT ---- 40

Electronics & Communications 6

Page 7: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

Electronics & Communications 7

Page 8: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

INDEX

S.No Contents Pg.No.

1. Introduction of the Project 09.

1.1 System definition 09.

1.2 Software requirement 11.

1.3 ANALYSIS 12.

2. 8086 Hand Book 14.

2.0 Intro 14.

2.1 Types of memory 15.

2.2 Special function register (SFR) memory 16.

2.3 Basic Register 18.

2.4 Addressing Modes 20.

2.5 Timers 21.

2.6 Serial Communication 22.

2.7 Interrupts 24.

3. Keypad Interface 26.

3.1 Interfacing to LCD Display 27.

4. Power Supply 34.

4.1 Transformer only ! 35.

4.2 Rectifier 37.

4.3 Smoothing 38.

4.4 Regulator 39.

5. RS 232 Interfacing 40.

5.1 Overview 40.

6. Metal Detector 41.

6.1 Intro 41.

6.2 How Detector Works 43.

6.3 Discrimination of Different metals 44.

7. DC Motor 45.

Electronics & Communications 8

Page 9: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

7.1 Principles of Operation 45.

8. Radio Frequency (RF) 49.

8.1 Special properties of RF current 48.

8.2 Radio Communication 49.

8.3 Frequencies 50.

8.4 HT12E & HT12D Encoder & Decoder IC 50.

9. Introduction of the KEIL 52.

9.1 What is KEIL 52.

9.2 The final KEIL program Look 52.

10. Conclusion & Future Scope 53.

11. Bibliography 54.

Electronics & Communications 9

Page 10: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

1.INTRODUCTION OF THE PROJECT

Embedded Technology is now in its prime and the wealth of knowledge available is mind

blowing. However, most embedded systems engineers have a common complaint. There are no

comprehensive resources available over the internet which deal with the various design and

implementation issues of this technology. Intellectual property regulations of many corporations

are partly to blame for this and also the tendency to keep technical know-how within a restricted

group of researchers.

1.1 System Definition:

A way of working, organizing or performing one or many tasks according to a fixed set of rules,

program or plan.

Also an arrangement in which all units assemble and work together according to a program or

plan.

1.1.2 Examples of Systems:

Time display system – A watch

Automatic cloth washing system – A washing machine

1.1.3 EMBEDDED SYSTEM DEFINITION(S):

“An embedded system is a system that has software embedded into computer-hardware,

which makes a system dedicated for an application (s) or specific part of an application or

product or part of a larger system.”

“It is any device that includes a programmable computer but is not itself intended to be a

general purpose computer.” – Wayne Wolf, Ref: 61

–Three main embedded components

Electronics & Communications 10

Page 11: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

1. Embeds hardware to give computer like functionalities

2. Embeds main application software generally into flash or ROM and the application

software performs concurrently the number of tasks.

3. Embeds a real time operating system ( RTOS), which supervises the application software

tasks running on the hardware and organizes the accesses to system resources according to

priorities and timing constraints of tasks in the system.

1.1.4 Why Study Embedded Systems?

Embedded systems are playing important roles in our lives every day, even though they

might not necessarily be visible. Some of the embedded systems we use every day control

the menu system on television, the timer in a microwave oven, a cellphone, an MP3 player

or any other device with some amount of intelligence built-in. In fact, recent poll data

shows that embedded computer systems currently outnumber humans in the USA.

Embedded systems is a rapidly growing industry where growth opportunities are numerous.

1.1.5 What are Embedded Systems Used For?

The uses of embedded systems are virtually limitless, because every day new products are

introduced to the market that utilize embedded computers in novel ways. In recent years,

hardware such as microprocessors, microcontrollers, and FPGA chips have become much

cheaper Examples of such systems are flight control systems of an aircraft, sensor systems in

nuclear reactors and power plants. For these systems, delay in response is a fatal error. A more

relaxed version of Real-Time Systems, is the one where timely response with small delays is

acceptable Real-Time Systems can be classified as

Hard Real-Time Systems - systems with severe constraints on the timeliness of the

response.

Soft Real-Time Systems - systems which tolerate small variations in response times.

Electronics & Communications 11

Page 12: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

Hybrid Real-Time Systems - systems which exhibit both hard and soft constraints on its

performance.

1.2 SOFTWARE REQUIRMENT SPECIFICATION:

1.2.1 INTRODUCTION

A requirements specification for a software system – is a complete description of the behaviour

of a system to be developed. It includes a set of use cases that describe all the interactions the

users will have with the software. In addition to use cases, the SRS also contains non-functional

(or supplementary) requirements. Non-functional requirements are requirements which impose

constraints on the design or implementation (such as performance engineering requirements,

quality standards, or design constraints).

1.2.2 Functional Requirements

Functional requirements may be calculations, technical details, data manipulation and processing

and other specific functionality that define what a system is supposed to accomplish.

The following requirements which are vigorously used by through the application are:

Engineer:

MINES - General knowledge on mines and metal specifications.

ELECTRONICS - complete over and inner view of the project details and working and should be able to rectify any problem if occurred

User:

User should know the projects capabilities and should be able to use it according to the specifications provided i.e should be able to identify differences between metals & mines

1.2.3 Software requirements:

Electronics & Communications 12

Page 13: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

Operating System : Windows XP/2003 or Linux/Solaris

Programming Language : keil V.4,embedded C

1.2.4 Hardware requirements:

Processor : Pentium IV

Hard Disk : 40GB

RAM : 256MB

Metal detector : sensors [SD5491-004]

1.3 ANALYSIS

1.3.1 Feasibility Study

Economic Feasibility

Economic feasibility attempts 2 weigh the costs of developing and implementing a new

system, against the benefits that would accrue from having the new system in place. This

feasibility study gives the top management the economic justification for the new system.

A simple economic analysis which gives the actual comparison of costs and benefits are

much more meaningful in this case. In addition, this proves to be a useful point of reference

to compare actual costs as the project progresses. There could be various types of intangible

benefits on account of automation. These could include increased customer satisfaction,

improvement in product quality better decision making timeliness of information, expediting

activities, improved accuracy of operations, better documentation and record keeping, faster

retrieval of information, better employee morale.

Technical Feasibility

Evaluating the technical feasibility is the trickiest part of a feasibility study. This is because, .at

this point in time, not too many detailed design of the system, making it difficult to access issues

Electronics & Communications 13

Page 14: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

like performance, costs on (on account of the kind of technology to be deployed) etc. A number

of issues have to be considered while doing a technical analysis.

2 .8051 Hand Book

CONTENT PAGE NO.

2.0 INTRODUCTION 14.

2.1. TYPES OF MEMORY 15.

2.2. SFRS 16.

2.3. BASIC REGISTERS 18.

2.4. ADDRESSING MODES 20.

2.5. TIMERS 21.

2.6. SERIAL COMMUNICATION 22.

Electronics & Communications 14

Page 15: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

2.7. INTERRUPTS 23.

2.0 Introduction:

The8051 is the original member of the MCW-51 family, and is the core for allMCS-51 devices. The features of the 8051 core are

o 8-bit CPU optimized for control applicationso Extensive Boolean processing (Single-bit logic) capabilitieso 64K Program Memory address spaceo 64K Data Memory address spaceo 4K bytes of on-chip Program Memoryo 128 bytes of on-chip Data RAMo 32 bidirectional and individually addressable 1/0 lineso Two 16-bit timer/counterso Full duplex UARTo 6-source/5-vector interrupt structure with two priority levelso On-chip clock oscillator

Electronics & Communications 15

Page 16: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

fig: pin assignment of mc51

2.1 Types of Memory:

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.

Electronics & Communications 16

Page 17: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

fig 2.1(memory types)

On-Chip Memory: 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 Code Memory: is code (or program) memory that resides off-chip. This is often in the

form of an external EPROM. External RAM is RAM memory that resides off-chip. This is

often in the form of standard static RAM or flash RAM.

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.

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! What External RAM

loses in speed and flexibility it gains in quantity? While Internal RAM is limited to 128 bytes the

8051 supports External RAM up to 64K.

2.1.1 On -Chip Memory:

As mentioned at the beginning of this chapter, the 8051 includes a certain amount of on chip

memory. On-chip memory is really one of two (SFR) memory. The layout of the 8051's internal

Electronics & Communications 17

Page 18: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

memory is presented in the following memory map:

As is illustrated in this map, the 8051 has a bank of 128 bytes of Internal RAM. This Internal

RAM is found on-chip on the 8051 so it is the fastest RAM available, and it is also the most

flexible in terms of reading, writing, and modifying it’s contents. Internal RAM is volatile, so

when the 8051 is reset this memory is cleared. The 128 bytes of internal ram is subdivided as

shown on the memory map. The first 8 bytes (00h - 07h) are "register bank 0".

2.2 Special Function Register (SFR) Memory:

Special Function Registers (SFRs) are areas of memory that control specific functionality of the

8051 processor. For example, four SFRs permit access to the 8051’s 32 input/output lines.

Another SFR allows a program to read or write to the 8051’s serial port. Other SFRs allow the

user to set the serial baud rate, control and access timers, and configure the 8051’s interrupt

system. When programming, SFRs have the illusion of being Internal Memory.

2.2.1 What Are SFRs?

The 8051 is a flexible microcontroller with a relatively large number of modes of operations.

Your program may inspect and/or change the operating mode of the 8051 by manipulating the

values of the 8051's Special Function Registers (SFRs). SFRs are accessed as if they were

normal Internal RAM. Each SFR has an address (80h through FFh) and a name. The following

Electronics & Communications 18

Page 19: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

chart provides a graphical presentation of the 8051's Rs, their names, and their . `

configuration of some aspect of the 8051.

P0 (Port 0, Address 80h, Bit-Addressable): This is input/output port 0. Each bit of this SFr

corresponds to one of the pins on the microcontroller. For example, bit 0 of port 0 is pin P0.0, bit

7 is pin P0.7. Writing a value of 1 to a bit of this SFR will send a high level on the corresponding

I/O pin whereas a value of 0 will bring it to a low level.own use.

SP (Stack Pointer, Address 81h): This is the stack pointer of the microcontroller. This SFR

indicates where the next value to be taken from the stack will be read from in Internal RAM. If

you push a value onto the stack, the value will be written to the address of SP + 1. That is to say,

if SP holds the value 07h, a PUSH instruction will push the value onto the stack at address 08h.

This SFR is modified by all instructions which modify the stack, such as PUSH, POP, LCALL,

RET, RETI, and whenever interrupts are provoked by the microcontroller.

PCON (Power Control, Addresses 87h): The Power Control SFR is used to control the 8051's

power control modes. Certain operation modes of the 8051 allow the 8051 to go into a type of

"sleep" mode which requires much less power. These modes of operation are controlled through

PCON. Additionally, one of the bits in PCON is used to double the effective baud rate of the

8051's serial port.

P1 (Port 1, Address 90h, Bit-Addressable): This is input/output port 1. Each bit of this SFR

corresponds to one of the pins on the microcontroller. For example, bit 0 of port 1 is pin P1.0, bit

Electronics & Communications 19

Page 20: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

7 is pin P1.7. Writing a value of 1 to a bit of this SFR will send a high level on the corresponding

I/O pin whereas a value of 0 will bring it to a low level.

SCON (Serial Control, Addresses 98h, Bit-Addressable): The Serial Control SFR is used to

configure the behavior of the 8051's on-board serial port. This SFR controls the baud rate of the

serial port, whether the serial port is activated to receive data, and also contains flags that are set

when a byte is successfully sent or received.

P2 (Port 2, Address A0h, Bit-Addressable): This is input/output port 2. Each bit of this SFR

corresponds to one of the pins on the microcontroller. For example, bit 0 of port 2 is pin P2.0, bit

7 is pin P2.7. Writing a value of 1 to a bit of this SFR will send a high level on the corresponding

I/O pin whereas a value of 0 will bring it to a low level.

2.3 Basic Registers:

2.3.1 The Accumulator

If you’ve worked with any other assembly languages you will be familiar with the concept of an

Accumulator register. The Accumulator, as it’s name suggests, is used as a general register to

accumulate the results of a large number of instructions. It can hold an 8-bit (1-byte) value and is

the most versatile register the 8051 has due to the shear number of instructions that make use of

the accumulator. More than half of the 8051’s 255 instructions manipulate or use the

accumulator in some way.

2.3.2 The "R" registers

The "R" registers are a set of eight registers that are named R0, R1, etc. up to and including R7.

These registers are used as auxillary registers in many operations. To continue with the above

example, perhaps you are adding 10 and 20. The original number 10 may be stored in the

Accumulator whereas the value 20 may be stored in, say, register R4.

2.3.3 The "B" Register

The "B" register is very similar to the Accumulator in the sense that it may hold an 8-bit (1-byte)

value . The "B" register is only used by two 8051 instructions: MUL AB and DIV AB. Thus, if

Electronics & Communications 20

Page 21: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

you want to quickly and easily multiply or divide A by another number, you may store the other

number in "B" and make use of these two instructions. Aside from the MUL and DIV

instructions, the "B" register is often used as yet another temporary storage register much like a

ninth "R" register.

2.3.4 The Data Pointer (DPTR)

The Data Pointer (DPTR) is the 8051’s only user-accessable 16-bit (2-byte) register. The

Accumulator, "R" registers, and "B" register are all 1-byte values. DPTR, as the name suggests,

is used to point to data. It is used by a number of commands which allow the 8051 to access

external memory. When the 8051 accesses external memory it will access external memory at

the address indicated by DPTR.

2.3.5 The Program Counter (PC)

The Program Counter (PC) is a 2-byte address which tells the 8051 where the next instruction to

execute is found in memory. When the 8051 is initialized PC always starts at 0000h and is

incremented each time an instruction is executed. It is important to note that PC isn’t always

incremented by one. Since some instructions require 2 or 3 bytes the PC will be incremented by

2 or 3 in these cases.

2.3.6The Stack Pointer (SP)

The Stack Pointer, like all registers except DPTR and PC, may hold an 8-bit (1-byte) value. The

Stack Pointer is used to indicate where the next value to be removed from the stack should be

taken from. When you push a value onto the stack, the 8051 first increments the value of SP and

then stores the value at the resulting memory location.

2.4 Addressing Modes:

An "addressing mode" refers to how you are addressing a given memory location. In summary, the addressing modes are as follows, with an example of each:

Electronics & Communications 21

Page 22: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

Table2.1

2.4.1 Program Flow

When an 8051 is first initialized, it resets the PC to 0000h. The 8051 then begins to execute

instructions sequentially in memory unless a program instruction causes the PC to be otherwise

altered. There are various instructions that can modify the value of the PC; specifically,

conditional branching instructions, direct jumps and calls, and "returns" from subroutines.

Additionally, interrupts, when enabled, can cause the program flow to deviate from it’s otherwise

sequential scheme.

2.4.2 Conditional Branching

The 8051 contains a suite of instructions which, as a group, are referred to as "conditional

branching" instructions. These instructions cause program execution to follow a non-sequential

path if a certain condition is true. Take, for example, the JB instruction. This instruction means

"Jump if Bit Set." An example of the JB instruction might be:

JB 45h,HELLO

NOP

2.4.3 Direct Jumps

While conditional branching is extremely important, it is often necessary to make a direct call to

a given memory location without basing it on a given logical decision. This is equivalent to

saying "Goto" in BASIC. In this case you want the program flow to continue at a given memory

address without considering any conditions. This is accomplished in the 8051 using "Direct

Jump and Call" instructions. As illustrated in the last paragraph, this suite of instructions causes

program flow to change unconditionally.

Consider the example: LJMP NEW_ADDRESS.

2.4.4 Direct Calls

Electronics & Communications 22

Page 23: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

Another operation that will be familiar to seasoned programmers is the LCALL instruction.This

is similar to a "Gosub" command in Basic.When the 8051 executes an LCALLinstruction it

immediately pushes the current Program Counter onto the stack and then continues executing

code at the address indicated by the LCALL instruction.

2.5 Timers:

The 8051 comes equipped with two timers, both of which may be controlled, set, read, and

configured individually. The 8051 timers have three general functions:

1) Keeping time and/or calculating the amount of time between events,

2) Counting the events themselves, or

3) Generating baud rates for the serial port.

The three timer uses are distinct so we will talk about each of them separately. The first two

uses will be discussed in this chapter while the use of timers for baud rate generation will be

discussed in the chapter relating to serial ports.

2.5.1 How does a timer count?

How does a timer count? The answer to this question is very simple: A timer always counts up. It

doesn’t matter whether the timer is being used as a timer, a counter, or a baud rate generator: A

timer is always incremented by the microcontroller.

2.5.2 Timer SFRs:

As mentioned before, the 8051 has two timers which each function essentially the same way.

The SFRs relating to timers are:

2.5.3 The TMOD SFR: The individual bits of TMOD have the following functions:

Electronics & Communications 23

Page 24: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

As you can see in the above chart, four bits (two for each timer) are used to specify a mode of

operation. The modes of operation are:

16-bit Time Mode (mode 1)

Timer mode "1" is a 16-bit timer. This is a very commonly used mode. It functions just like 13-

bit mode except that all 16 bits are used. TLx is incremented from 0 to 255. When TLx is

incremented from 255, it resets to 0 and causes THx to be incremented by 1. Since this is a full

16- bit timer, the timer may contain up to 65536 distinct values. If you set a 16-bit timer to 0, it

will overflow back to 0 after 65,536 machine cycles.

8-bit Time Mode (mode 2)

Timer mode "2" is an 8-bit auto-reload mode.

.

Split Timer Mode (mode 3)

Timer mode "3" is a split-timer mode. Timer 1 as a baud rate generator and use TH0/TL0 as two

separate timers.Upon executing these two instructions timer 0 will immediately begin counting,

being incremented once every machine cycle (every 12 crystal pulses).

2.6 Serial Communication:

One of the 8051’s many powerful features is it’s integrated UART, otherwise known as a serial

port. The fact that the 8051 has an integrated serial port means that you may very easily read and

write values to the serial port. If it were not for the integrated serial port, writing a byte to a serial

Electronics & Communications 24

Page 25: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

line would be a rather tedious process requring turning on and off one of the I/O lines in rapid

succession to properly "clock out" each individual bit, including start bits, stop bits, and parity

bits. However, we do not have to do this. Instead, we simply need to configure the serial port’s operation

mode and baud rate. Once configured, all we have to do is write to an SFR to write a value to the

serial port or read the same SFR to read a value from the serial port. The 8051 will automatically

let us know when it has finished sending the character we wrote and will also let us know

whenever it has received a byte so that we can process it. We do not have to worry about

transmission at the bit level--which saves us quite a bit of coding and processing time.

2.6.1 Setting the Serial Port Mode

The first thing we must do when using the 8051’s integrated serial port is, obviously, configure

it. This lets us tell the 8051 how many data bits we want, the baud rate we will be using, and how

the baud rate will be determined.

Table 2.2

2.6.2 Setting the Serial Port Baud Rate

Once the Serial Port Mode has been configured, as explained above, the program must configure

the serial port’s baud rate. This only applies to Serial Port modes 1 and 3. The Baud Rate is

determined based on the oscillator’s frequency when in mode 0 and 2. In mode 0, the baud rate is

always the oscillator frequency divided by 12. This means if you’re crystal is 11.059 Mhz, mode

0 baud rate will always be 921,583 baud. In mode 2 the baud rate is always the oscillator

frequency divided by 64, so a 11.059Mhz crystal speed will yield a baud rate of 172,797. if we

Electronics & Communications 25

Page 26: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

have an 11.059Mhz crystal and we want to configure the serial port to 19,200 baud we try

plugging it in the first equation:

TH1 = 256 - ((Crystal / 384) / Baud)

TH1 = 256 - ((11059000 / 384) / 19200 )

TH1 = 256 - ((28,799) / 19200)

TH1 = 256 - 1.5 = 254.5

As you can see, to obtain 19,200 baud on a 11.059Mhz crystal we’d have to set TH1 to 254.5. If

we set it to 254 we will have achieved 14,400 baud and if we set it to 255 we will have achieved

28,800 baud. Thus we have:

TH1 = 256 - ((Crystal / 192) / Baud)

TH1 = 256 - ((11059000 / 192) / 19200)

TH1 = 256 - ((57699) / 19200)

TH1 = 256 - 3 = 253

Here we are able to calculate a nice, even TH1 value. Therefore, to obtain 19,200 baud with an

11.059MHz crystal we must:

1) Configure Serial Port mode 1 or 3.

2) Configure Timer 1 to timer mode 2 (8-bit autoreload).

3) Set TH1 to 253 to reflect the correct frequency for 19,200 baud.

4) Set PCON.7 (SMOD) to double the baud rate.

2.7 Interrupts:

As stated earlier, program flow is always sequential, being altered only by those instructions

which expressly cause program flow to deviate in some way. However, interrupts give us a

mechanism to "put on hold" the normal program flow, execute a subroutine, and then resume

normal program flow as if we had never left it. This subroutine, called an interrupt handler, is

only executed when a certain event (interrupt) occurs. The event may be one of the timers

"overflowing," receiving a character via the serial port, transmitting a character via the serial

port, or one of two "external events".

Electronics & Communications 26

Page 27: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

2.7.1 What Events can trigger interrupt, and where do they go?

We can configure the 8051 so that any of the following events will cause an interrupt:

• Timer 0 Overflow.

• Timer 1 Overflow.

• Reception/Transmission of Serial Character.

• External Event 0.

• External Event 1.

2.7.2 Polling Sequence:-

The 8051 automatically evaluates whether an interrupt should occur after every instruction.

When checking for interrupt conditions, it checks them in the following order: External 0

Interrupt, Timer 0 Interrupt, External 1 Interrupt, Timer 1 Interrupt, Serial Interrupt

2.7.3 Interrupt Priorities:-

The 8051 offers two levels of interrupt priority: high and low. By using interrupt priorities you

may assign higher priority to certain interrupt conditions.The IP SFR has the following format:

table 2.3

Electronics & Communications 27

Page 28: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

3. KEYPAD INTERFACING

3.0.1Introduction:

Keypads are a part of HMI or Human Machine Interface and play really important role in a small

embedded system where human interaction or human input is needed. Matrix keypads are well

known for their simple architecture and ease of interfacing with any microcontroller.

3.0.2 Constructing a Matrix Keypad:

Construction of a keypad is really simple. As per the outline shown in the figure below we have

four rows and four columns. In between each overlapping row and column line there is a key.

So keeping this outline we can construct a keypad using simple PST Switch shown below:

Now our keypad is ready, all we have to do is connect the rows and columns to a port of

microcontroller and program the controller to read the input.

3.0.3 Scanning a Matrix Keypad:

There are many methods depending on how you connect your keypad with your controller, but

the basic logic is same. We make the columns as i/p and we drive the rows making them o/p, this

whole procedure of reading the keyboard is called scanning. In order to detect which key is

pressed from the matrix, we make row lines low one by one and read the columns. Let’s say we

first make Row1 low, then read the columns. If any of the key in row1 is pressed will make the

Electronics & Communications 28

Page 29: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

corresponding column as low i.e. if second key is pressed in Row1, then column2 will give low.

So we come to know that key 2 of Row1 is pressed. This is how scanning is done. So to scan the

keypad completely, we need to make rows low one by one and read the columns. If any of the

button is pressed in a row, it will take the corresponding column to a low state which tells us that

a key is pressed in that row. If button 1 of a row is pressed then Column 1 will become low,

3.0.4Keypad Connections with 8051 Microcontroller:

Fig 3.1

3.1 Interfacing to LCD Display

Liquid Crystal Display also called as LCD is very helpful in providing user interface as well as

for debugging purpose. The most common type of LCD controller is HITACHI 44780 which

provides a simple interface between the controller & an LCD. These LCD's are very simple to

interface with the controller as well as are cost effective. The most commonly

used ALPHANUMERIC displays are 1x16 (Single Line & 16 characters),2x16 (Double Line &

16 character per line) &4x20 (four lines & Twenty characters per line). The LCD requires 3

control lines (RS, R/W & EN) & 8 (or 4) data lines. The number on data lines depends on the

Electronics & Communications 29

Page 30: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

mode of operation. If operated in 8-bit mode then 8 data lines + 3 control lines i.e. total 11 lines

are required. And if operated in 4-bit mode then 4 data lines + 3 control lines i.e. 7 lines are

required. How do we decide which mode to use? It’s simple if you have sufficient data lines you

can go for 8 bit mode & if there is a time constrain i.e. display should be faster then we have to

use 8-bit mode because basically 4-bit mode takes twice as more time as compared to 8-bit

mode.Most projects you create with the 8051 CPU require some form of  display.  The most

common way to accomplish this is with the LCD  (Liquid Crystal Display).  LCDs have become

a cheap and easy way to get text display for embedded system Common displays are set up as 16

to 20 characters by 1 to 4 lines .When RS is low (0), the data is to be treated as a command.

When RS is high (1), the data being sent is considered as text data which should be displayed on

the screen .When R/W is low (0), the information on the data bus is being written to the LCD.

When RW is high (1), the program is effectively reading from the LCD. Most of the times there

is no need to read from the LCD so this line can directly be connected to Gnd thus saving one

controller line .The ENABLE pin is used to latch the data present on the data pins. A HIGH -

LOW signal is required to latch the data. The LCD interprets and executes our command at the

instant the EN line is brought low. If you never bring EN low, our instruction will never be

executed.

UNDERSTANDING LCD :

Pin out

• 8 data pins D7:D0

Electronics & Communications 30

Page 31: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

Bi-directional data/command pins.

Alphanumeric characters are sent in ASCII format. 

• RS:  Register Select

RS = 0 -> Command Register is selected

RS = 1 -> Data Register is selected 

• R/W: Read or Write

0 -> Write,  1 -> Read

• E: Enable (Latch data)

Used to latch the data present on the data pins.

A high-to-low edge is needed to latch the data.

 3.1.1 Display Data RAM (DDRAM)

Display data RAM (DDRAM) is where you send the characters (ASCII code) you want to see on

the LCD screen. It stores display data represented in 8-bit character codes. Its capacity is 80

characters (bytes).  Below you see DD RAM address layout of a 2*16 LCD.

In the above memory map, the area shaded in black is the visible display (For 16x2 display) .For

first line addresses for first 15 characters is from 00h to 0Fh. But for second line address of first

character is 40h and so on up to 4Fh for the 16th character. So if you want to display the text at

specific positions of LCD , we require to manipulate address and then to set cursor position

accordingly .

3.1.2 Character Generator RAM (CGRAM)-User defined character RAM

Electronics & Communications 31

Page 32: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

In the character generator RAM, we can define our  own character patterns by program. CG

RAM is 64 bytes ,allowing for eight 5*8 pixel, character patterns to be defined. However how to

define this and use it  is out of scope of this tutorial. So I will not talk any more about CGRAM

Table 3.1

    Register Selection

RS R/W Operation

0 0 IR write as an internal operation (display clear, etc.)

0 1 Read busy flag (DB7) and address counter (DB0 to DB6)

1 0 DR write as an internal operation (DR to DDRAM or CGRAM)

1 1 DR read as an internal operation (DDRAM or CGRAM to DR)

 Busy Flag (BF)

When the busy flag is 1, the LCD  is in the internal operation mode, and the next instruction will

not be accepted. When RS = 0 and R/W = 1 (see the table above), the busy flag is output to DB7

(MSB of LCD data bus). The next instruction must be written after ensuring that the busy flag is

0.LCD Commands 

The LCD’s internal controller accept several commands and modify the display accordingly.

These commands would be things like:

– Clear screen

Electronics & Communications 32

Page 33: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

– Return home

– Shift display right/left

Table 3.2

Instruction Decimal HEX

Function set (8-bit interface, 2 lines, 5*7 Pixels) 56 38

Function set (8-bit interface, 1 line, 5*7 Pixels) 48 30

Function set (4-bit interface, 2 lines, 5*7 Pixels) 40 28

Function set (4-bit interface, 1 line, 5*7 Pixels) 32 20

Entry mode set See Below See Below

Scroll display one character right (all lines) 28 1E

Scroll display one character left (all lines) 24 18

Home (move cursor to top/left character position) 2 2

Move cursor one character left 16 10

Move cursor one character right 20 14

Instruction Decimal HEX

Turn on visible underline cursor 14 0E

Turn on visible blinking-block cursor 15 0F

Electronics & Communications 33

Page 34: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

Make cursor invisible 12 0C

Blank the display (without clearing) 8 08

Restore the display (with cursor hidden) 12 0C

Clear Screen 1 01

Set cursor position (DDRAM address) 128 + addr 80+ addr

Set pointer in character-generator RAM (CG RAM address) 64 + addr 40+ addr

3.1.3 INTERFACING  LCD TO 8051 :

fig 3.1

Electronics & Communications 34

Page 35: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

 The 44780 standard requires 3 control lines as well as either 4 or 8 I/O lines for the data bus.

The user may select whether the LCD is to operate with a 4-bit data bus or an 8-bit data bus.

If a 4-bit data bus is used, the LCD will require a total of 7 data lines.If an 8-bit data bus is used,

the LCD will require a total of 11 data lines.The three control lines are  EN, RS, and RW.

CODE EXAMPLE: 

It is easy (and clean tech. ) to make different subroutines and then call them as we need.

Data write Routine

data:

mov P1, A ;move acc. data to port

setb P3.6 ;RS=1 data

clr P3.5 ;RW=0 for write

setb P3.7 ;H->L pulse on E

clr P3.7

lcall ready

ret

Initialization

mov A, #38H ; Initialize, 2-lines, 5X7 matrix.

lcall  Command

mov A, #0EH ; LCD on, cursor on

lcall  Command

mov A, #01H ; Clear LCD Screen

lcall  Command

mov A, #06H ; Shift cursor right

lcall  Command

Note- As we need to clear the LCD frequently and not the whole initialization , it is better to use

this routine separately.

Electronics & Communications 35

Page 36: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

Displaying "HI"

lcall initialization

lcall clear

mov A,#'H'

acall data

mov A,#'I'

lcall data

Let's now try code for displaying text at specific positions.

I want to display "MAHESH" in message "Hi MAHESH" at the right corner of first line then I

should start from 10th character.

So referring to table 80h+0Ah= 8Ah.

So below is code and I don's think that you will need explanation comments.

ASSEMBLY LANGUAGE

lcall Initialization

lcall clear

mov a,#'H'

lcall data

mov a,#'I'

lcall data

mov a,#8ah

lcall command

mov a,#'M'

lcall data

mov a,#'A'

lcall data

mov a,#'H'

lcall data

Electronics & Communications 36

Page 37: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

4. Power Supply

There are many types of power supply. Most 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 example a 5V regulated supply:

Fig 4.1(process)

Each of the blocks is described in more detail below:

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.

Power supplies made from these blocks are described below with a circuit diagram and a graph

of their output:

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Electronics & Communications 37

Page 38: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

Dual Supplies

Some electronic circuits require a power supply with positive and negative outputs as well as

zero volts (0V). This is called a 'dual supply' because it is like two ordinary supplies connected

together as shown in the diagram.

Dual supplies have three outputs, for example a ±9V supply has +9V, 0V and -9V outputs.

4.1 Transformer only:-

Fig 4.2

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.

4.1.2 Transformer + Rectifier

Electronics & Communications 38

Page 39: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

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.

4.1.3 Transformer + Rectifier + Smoothing

T

he smooth DC output has a small ripple. It is suitable for most electronic circuits.

4.1.4 Transformer + Rectifier + Smoothing + Regulator

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

Transformer:-

Electronics & Communications 39

Page 40: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

Transformers convert AC electricity from one voltage to another with little loss of power.

Transformers work only with AC and this is one of the reasons why mains electricity is AC.

Step-up transformers increase voltage, step-down transformers reduce voltage. 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.

4.2 Rectifier:-

There are several ways of connecting diodes to make a rectifier to convert AC to DC. The

bridge   rectifier is the most important and it produces full-wave varying DC. A full-wave rectifier

can also be made from just two diodes if a centre-tap transformer is used, but this method is

Electronics & Communications 40

Vp = primary (input) voltage

Np = number of turns on

primary coil

Ip  = primary (input) current

   

Vs = secondary (output) voltage

Ns = number of turns on

secondary coil

Is  = secondary (output) current

Page 41: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

rarely used now that diodes are cheaper. A single   diode can be used as a rectifier but it only uses

the positive (+) parts of the AC wave to produce half-wave varying DC.

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

`

fig 4.3(bridge rectifier)

Bridge rectifier

Alternate pairs of diodes conduct, changing over

the connections so the alternating directions of

AC are converted to the one direction of DC.

Output: full-wave varying DC

(using all the AC wave)

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

Electronics & Communications 41

Page 42: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

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

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 DC

f    = frequency of the AC supply in hertz (Hz), 50Hz in the UK

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

Fig 4.4

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

Electronics & Communications 42

There is more information

about smoothing on the

Electronics   in   Meccano

website.

Page 43: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

necessary. Please see the Electronics   in   Meccano website for more

information about voltage regulator ICs.

Zener diode regulator

For low current power supplies a simple voltage regulator can be

made with a resistor and a zener diode connected in reverse as

shown in the diagram. Zener diodes are rated by their breakdown

voltage Vz and maximum power Pz (typically 400mW or 1.3W). The resistor limits the current

(like an LED resistor). The current through the resistor is constant, so when there is no output

current all the current flows through the zener diode and its power rating Pz must be large

enough to withstand this.

Please see the Diodes page for more information about zener diodes.

Choosing a zener diode and resistor:

1. The zener voltage Vz is the output voltage required

2. The input voltage Vs must be a few volts greater than Vz

(this is to allow for small fluctuations in Vs due to ripple)

5. RS 232 INTERFACE

5.1 OVERVIEW:

Table 5.1

RS232 Pin Assignments (DE9 PC signal set)

Pin 1 Received Line Signal Detector (Data Carrier Detect)

Electronics & Communications 43

zener diode

a = anode, k = cathode

Page 44: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

Pin 2 Received Data

Pin 3 Transmit Data

Pin 4 Data Terminal Ready

Pin 5 Signal Ground

Pin 6 Data Set Ready

Pin 7 Request To Send

Pin 8 Clear To Send

Pin 9 Ring Indicator

3. The connector on the PC has male pins, therefore the matingcable needs to terminate in a DE9/F (Female pin) connector.

fig 5.1

Wiring up something nice and simple, for instance a plain old "dumb terminal", is just a matter of connecting Tx, Rx and Ground, right?

4. Usually Not. While the normal PC hardware might well run with just Tx, Rx and Ground

connected, most driver software will wait forever for one of the handshaking lines to go

to the correct level.

Handshake looping a PC serial connector

Electronics & Communications 44

Page 45: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

5. When the lines are handshake looped, the RTS output from the PC immediately activates

the CTS input - so the PC effectively controls its own handshaking.

6. RS232 DE9 PC Loopback test plug

The PC loopback plug is a useful diagnostic tool. The loopback plug connects serial inputs to serial outputs so that the port may be tested. There is more than one way to wire up a loopback plug - but this is the most common.

6. Metal Detector

6.1 Introduction to Metal Detectors:

Metal detector is a device that can detect metal, the basics can make a sound when it is near

some metal, and the more advanced can tell what kind of metal and how deep it is down, they are

using different detecting principles. We got the assignment to built a detector there could detect a

10kr coin at 5cm. The device had to be battery operated and transportable. We used these

principles:

6.1.1 BFO Detector:

The basic way the Beat Frequency Oscillator (Later only BFO) works, when the detector coil is

above some metal, it will change the frequency in the detector oscillator, which has the detector

coil in the frequency depended circuit. The detected frequency is compared to a reference

oscillator in a mixer, so there will be both the different and the sum of the 2 frequencies. The

Electronics & Communications 45

Page 46: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

detector we has made isn’t really a real BFO, while the reference is internal in a Micro Controller

(Later only μC) and the signal from the detector oscillator is connected directly to the μC’s

external timer pin In the code for the μC there is implemented an average function, so if the

ground has high magnetic fields it will compensate for it after some seconds. The output is

indicated by Light Emitted Diodes (Later only LED) and by a sound in different locked

frequencies.

6.1.2 PI Detector:

The Pulse Induction (Later only PI) uses a totally different way of sensing the metal, it sends out

a very short magnetic pulse. Just after the pulse is finished the coil makes a spark (Later

Reflected pulse). The reflected pulse is changing shape when metal comes near the coil. A part

of the reflected pulse is amplified and put into some kind of a pulse detector.

Fig 6.1 (interfacing)

6.1.3 Conclusion for PI:

Electronics & Communications 46

Page 47: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

The Project elapsed great, the timetable was almost true, only approximate 1 day later with the

finished design than we planned. The project was a little more difficult than I expected from the

beginning, but already when we got the assignment I had an idea to solve the problem, but after

some hour’s work, and no positive result, I was almost quitting the idea. After a little time more

we got the detector part to work so it was sensitive enough. The frequency detector was mounted

and it worked great even the average part. We tried to make another detector to see if it could be

more sensitive, and if the first failed, we had another horse to carry on with. Actually it ended up

with almost 2 different working detectors, the second wasn’t finished when we need to stop and

finish the report. But since it is an analogue project I decided to describe the second detector

also.Our team worked out the project without big conflicts. But if the knowledge of designing

circuits and build circuit was almost at the same level in the group, the time used to make the

product could be reduced. I mean one in the group maybe would have gained more if he had

joined the basic level.

6.2 How Metal Detectors Work:

6.2.1 Detection of Metal:

When some metal is moving close to a coil the magnetic

field around the coil is changed and the coil inducts some energy, called Eddie current. The same

principle is true, if there is putted some energy in the coil it changes the magnetic field around

the Coil. The way is also used in loudspeakers, when it is playing, the energy is conducted to the

speaker, and if there is measured on the speaker and pushes a little to the membrane, the speaker

generates some energy. If the terminals on the speaker are shorted, the membrane is hard to push,

the coil can’t make the energy, and the coil is locked. But the difference between the speakers

and the earth is that the speakers have big magnetic part to help the membrane to move,

otherwise in the metal detector it is normally not a magnetic object there has to be detected, so

the coil has to produce it own magnetic field. When the detectors magnetic beams are reaching a

Electronics & Communications 47

Page 48: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

metal, the metal start to induct the fields, and reply the magnetic field in another direction / time,

this change can be seen in the frequency / pulse response of the coil. There are big different

6.2.2 Detection Method:

There are 2 major groups of detectors:

Passive

detector uses the detector coil in a frequency depended part of a circuit, example a Oscillator

where the inductance of the coil and the capacitive of a capacitor are making a oscillation, when

these parts have positive feedback, and the amplifier a gain of 1, it will continue oscillating.

When some metal is coming close to the alternating magnetic field, the metal changing the field,

and the inductance in the coil changes a little, and then the frequency. Example: BFO

Positive:

Easy to build

Cheap

Easy discrimination of Ferro / non Ferro metals

Low Current / Voltage

Negative:

Sensitive to electro magnetic noise

Difficult to make working on “long” distance

Difficult to get the frequency change big

Sensitive to high magnetic fields in the earth / water

Active

detectors uses the coil to transmit a pulse or a continually waveform, some uses the same coil to

receive with, and others have 1 or 2 receiving coils. The PI loads the coil with some current in a

narrow pulse, and when it releases the coil it make a reflective pulse the duration of the reflected

pulse is only a few μS, and the pulse can be several 100v high. When some metal are coming

close to the coil the amplitude of the reflective pulse is getting little lower and the duration of the

Electronics & Communications 48

Page 49: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

pulse a little longer, almost like the metal behaves like a capacitor for magnetic energy, in the top

of the reflective the metal collect magnetic energy, and when the pulse is falling in voltage it

returns the energy slowly. Different metal, have different reaction time. Just after the normal

duration time of a spike, the measurement has to be done, like in Figure 2 illustrates, the pulse

will rise a little when some metal comes near. The sampled signal has to be amplified up to a

signal that can be used.

Positive:

Not sensitive to electro magnetic noise

“Long” distance detect

Detection near wires / high magnetic fields in the earth / water

Negative:

High Current / Voltage

6.3 Discrimination of different metal:

Expensive metal detectors can show which kind of metal there is registered, and even be setup to

discriminate between them, so there wont be any kind of detection it comes near an old can, but

if it is gold or other nonferrous metal it shows some result.

7. DC MOTOR

7.1 Principles of operation: In any electric motor, operation is based on simple

electromagnetism. A current-carrying conductor generates a magnetic field; when this is then

placed in an external magnetic field, it will experience a force proportional to the current in the

conductor, and to the strength of the external magnetic field. As you are well aware of from

playing with magnets as a kid, opposite (North and South) polarities attract, while like polarities

(North and North, South and South) repel. The internal configuration of a DC motor is designed

to harness the magnetic interaction between a current-carrying conductor and an external

magnetic field to generate rotational Motion.Let's start by looking at a simple 2-pole DC electric

motor (here red represents a magnet or winding with a "North" polarization, while green

represents a magnet or winding with a "South" polarization).

Electronics & Communications 49

Page 50: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

Every DC motor has six basic parts -- axle, rotor (a.k.a., armature), stator, commutator, field

magnet(s), and brushes. In most common DC motors (and all that BEAMers will see), the

external magnetic field is produced by high-strength permanent magnets1. The stator is the

stationary part of the motor -- this includes the motor casing, as well as two or more permanent

magnet pole pieces. The rotor (together with the axle and attached commutator) rotate with

respect to the stator. The rotor consists of windings (generally on a core), the windings being

electrically connected to the commutator. The above diagram shows a common motor layout --

with the rotor inside the stator (field) magnets.The geometry of the brushes, commutator

contacts, and rotor windings are such that when power is

applied, the polarities of the energized winding and the stator

magnet(s) are misaligned, and the rotor will rotate until it is

almost aligned with the stator's field magnets. As the rotor

reaches alignment, the brushes move to the next commutator

contacts, and energize the next winding. Given our example

two-pole motor, the rotation reverses the direction of current

through the rotor winding, leading to a "flip" of the rotor's

magnetic field, driving it to continue rotating.

In real life, though, DC motors will always have more than two poles (three is a very common

number). In particular, this avoids "dead spots" in the commutator. You can imagine how with

our example two-pole motor, if the rotor is exactly at the middle of its rotation (perfectly

aligned with the field magnets), it will get "stuck" there. Meanwhile, with a two-pole motor,

there is a moment where the commutator shorts out the power supply (i.e., both brushes touch

both commutator contacts simultaneously). This would be bad for the power supply, waste

energy, and damage motor components as well. Yet another disadvantage of such a simple motor

Electronics & Communications 50

Page 51: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

is that it would exhibit a high amount of torque "ripple" (the amount of torque it could produce is

cyclic with the position of the rotor).

So since most small DC motors are of a three-pole design, let's tinker with the workings of one

via an interactive animation (JavaScript required):

You'll notice a few things from this -- namely, one pole is fully energized at a time (but two

others are "partially" energized). As each brush transitions from one commutator contact to the

next, one coil's field will rapidly collapse, as the next coil's field will rapidly charge up (this

occurs within a few microsecond direct result of the coil windings' series wiring:

Fig 7.1

There's probably no better way to see how an average DC motor is

put together, than by just opening one up. Unfortunately this is

tedious work, as well as requiring the destruction of a perfectly

good motor. Luckily for you, I've gone ahead and done this in

your stead. The guts of a disassembled Mabuchi FF-030-PN motor

(the same model that Solarbotics sells) are available for you to see

here (on 10 lines / cm graph paper). This is a basic 3-pole DC

motor, with 2 brushes and three commutator contacts.

Electronics & Communications 51

Page 52: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

The use of an iron core armature (as in the Mabuchi, above) is quite common, and has a number

of advantages2. First off, the iron core provides a strong, rigid support for the windings -- a

particularly important consideration for high-torque motors. The core also conducts heat away

from the rotor windings, allowing the motor to be driven harder than might otherwise be the

case. Iron core construction is also relatively inexpensive compared with other construction

types.

But iron core construction also has several disadvantages. The iron armature has a relatively high

inertia which limits motor acceleration. This construction also results in high winding

inductances which limit brush and commutator life.

In small motors, an alternative design is often used which features a 'coreless' armature winding.

This design depends upon the coil wire itself for structural integrity. As a result, the armature is

hollow, and the permanent magnet can be mounted inside the rotor coil. Coreless DC motors

have much lower armature inductance than iron-core motors of comparable size, extending brush

and commutator life.

The coreless design also allows manufacturers to build smaller motors; meanwhile, due to the

lack of iron in their rotors, coreless motors are somewhat prone to overheating. As a result, this

design is generally used just in small, low-power motors. BEAMers will most often see coreless

DC motors in the form of pager motors.

Electronics & Communications 52

Page 53: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

Again, disassembling a coreless motor can be instructive -- in

this case, my hapless victim was a cheap pager vibrator motor.

The guts of this disassembled motor are available for you to see

here (on 10 lines / cm graph paper).

8. Radio frequency (RF)

It is a rate of oscillation in the range of about 3 kHz to 300 GHz, which corresponds to the frequency of radio waves, and the alternating currents which carry radio signals. RF usually refers to electrical rather than mechanical oscillations, although mechanical RF systems do exist (see mechanical filter and RF MEMS).

8.1 Special properties of RF current

Electric currents that oscillate at radio frequencies have special properties not shared by direct current or alternating current of lower frequencies. The energy in an RF current can radiate off a conductor into space as electromagnetic waves (radio waves); this is the basis of radio technology. RF current does not penetrate deeply into electrical conductors but flows along their surfaces; this is known as the skin effect. For this reason, when the human body comes in contact with high power RF currents it can cause superficial but serious burns called RF burns. RF current can easily ionize air, creating a conductive path through it. This property is exploited by "high frequency" units used in electric arc welding, which use currents at higher frequencies than power distribution uses. Another property is the ability to appear to flow through paths that contain insulating material, like the dielectric insulator of a capacitor. When conducted by an ordinary electric cable, RF current has a tendency to reflect from discontinuities in the cable such as connectors and travel back down the cable toward the source, causing a condition called standing waves, so RF current must be carried by specialized types of cable called transmission line.

8.2 Radio communication

Electronics & Communications 53

Page 54: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

In order to receive radio signals an antenna must be used. However, since the antenna will pick up thousands of radio signals at a time, a radio tuner is necessary to tune in to a particular frequency (or frequency range).[1] This is typically done via a resonator – in its simplest form, a circuit with a capacitor and an inductor forming a tuned circuit. The resonator amplifies oscillations within a particular frequency band, while reducing oscillations at other frequencies outside the band.

8.3 Frequencies

Main article: Radio spectrum

Frequency Designation Abbreviation

3 - 30 Hz Extremely low frequency ELF

30 - 300 Hz Super low frequency SLF

300 - 3000 Hz Ultra low frequency ULF

3 - 30 kHz Very low frequency VLF

30 - 300 kHz Low frequency LF

300 kHz - 3 MHz Medium frequency MF

3 - 30 MHz High frequency HF

30 - 300 MHz Very high frequency VHF

300 MHz - 3 GHz Ultra high frequency UHF

3 - 30 GHz Super high frequency SHF

30 - 300 GHz Extremely high frequency EHF

Electronics & Communications 54

Page 55: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

Fig 8.1(RF communication)

8.4 HT12E & HT12D Encoder and Decoder IC

8.4.1HT12E: - Encoder

18 PIN DIP Operating Voltage : 2.4V ~ 12V

Low Power and High Noise Immunity CMOS Technology

Low Standby Current and Minimum Transmission Word

Built-in Oscillator needs only 5% Resistor

Easy Interface with and RF or an Infrared transmission medium

General Description

The 212 encoders are a series of CMOS LSIs for remote control system applications. They are capable of encoding information which consists of N address bits and 12_N data bits The HT 12E Encoder ICs are series of CMOS LSIs for Remote Control system applications. They are capable of Encoding 12 bit of information which consists of N address bits and 12-N data bits. The HT 12D ICs are series of CMOS LSIs for remote control system applications. This ICs are paired with each other. For proper operation a pair of encoder/decoder with the same number of address and data format should be selected.

8.4.2 HT12D:- Decoder

Electronics & Communications 55

Page 56: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

18 PIN DIP, Operating Voltage : 2.4V ~ 12.0V Low Power and High Noise Immunity, CMOS Technology

Low Stand by Current, Trinary address setting

Capable of Decoding 12 bits of Information

8 ~ 12 Address Pins and 0 ~ 4 Data Pins

Received Data are checked 2 times, Built in Oscillator needs only 5% resistor

VT goes high during a valid transmission

Easy Interface with an RF of IR transmission medium

Minimal External Components

Fig 8.2(ht12e & ht12d)

.

9. INTRODUCTION OF THE “KEIL”

9.1 What is KEIL:-

Electronics & Communications 56

Page 57: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

KEIL was founded in 1986 to market add-on products for the development tools provided by many of the silicon vendors. Keil implemented the first C compiler designed from the ground-up specifically for the 8051 microcontroller.

Keil provides a broad range of development tools like ANSI C compiler, macro assemblers, debuggers and simulators, linkers, IDE, library managers, real-time operating systems and evaluation boards for 8051, 251, ARM, and XC16x/C16x/ST10 families.

In October 2005, KEIL (KEIL Elektronik GmbH in Munich, Germany, and KEIL Software, Inc. in Plano, Texas) was acquired by ARM

9.2The final KEIL program look:

Fig a.2 (output)

Electronics & Communications 57

Page 58: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

10. CONCLUSION AND FUTURE SCOPE

10.1 CONCLUSION

The METALDETECTOR is a tech-based application for primarily providing training to

the employees who provide customized solutions to meet organizational needs.

This embedded system has been computed successfully and was also tested successfully

by taking “test cases”. It is user friendly, and has required options, which can be utilized by the

user to perform the desired operations.

The software is developed using Keil as front end and Proload as back end in Windows

environment. The goals that are achieved by the software are:

Instant access.

Improved productivity.

Optimum utilization of resources.

Efficient management of records.

Simplification of the operations.

Less processing time and getting required information.

User friendly.

Portable and flexible for further enhancement.

10.2 Future Enhancements:

It is not possible to develop a system that makes all the requirements of the user. User

requirements keep changing as the system is being used. Some of the future enhancements that

can be done to this system are:

Electronics & Communications 58

Page 59: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

As the technology emerges, it is possible to upgrade the system and can be adaptable to

desired environment.

Because it is based on object-oriented design, any further changes can be easily adaptable

like activating GPS system into it.

Based on the future security issues, security can be improved using emerging

technologies.

marking module and location module can be added

BIBLIOGRAPHY

Books

Microprocessors & interfacing [pgno.326] – douglas v hall

Embedded systems [pg 1-10 intro] _ Conti, M.; Orcioni

The µc idea book [article no.26] _ Jan Axelson

Web Sites

www.atmel.com/dyn/resources/prod_documents/doc4316.pdf

www.wikibooks.org

www.howstuffworks.com

www.karlselectronics.com

www.instructables.com

Electronics & Communications 59

Page 60: Docs

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

Electronics & Communications 60