Вы находитесь на странице: 1из 58

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

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

Domain Software Power Supply Applications

: : : :

Embedded Systems, Robotics, Embedded C, Keil V.4, +5V, 500mA Regulated Power Supply industries

BLOCK DIAGRAM

Metal Sensor

Buzzer 8051

[AT89c51] Power supply

Fig 0.1(block diagram for metal sensing)

Electronics & Communications

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

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

o RF encoder and decoder. o Power Supply. BLOCK DIAGRAM: Transmitter: Reciever:

Power Supply RF TX Reset HT12E Crysta l Switch es At89c5 1

Power Supply

RF TX

Reset

HT12D DC motor

Crysta l

At89c5 1

ULN2003 DC motor

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

Domain Software

: :

Embedded Systems, wireless Communication, Embedded C, Kiel v.4, +5V, 500mA Regulated Power Supply : Industries.

Power Supply : Applications POWER SUPPLY:

Step dow n T/F

Bridge Rectifier

Filter Circuit

Regulat or
4

Electronics & Communications

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

LIST OF FIGURES

1. BLOCK DIAGRAM OF METAL DETECTOR 2. BLOCK DIAGRAM OF RF TRANSMISSION 3. MEMORY TYPES 4. CONNECTION FOR 8051 WITH KEYPAD 5. INTERFACING LCD TO 8051 6. POWER SUPPLY PROCESS 7. TRANSFORMER 8. BRIDGE RECTIFIER 9. REGULATOR 10. RS 232 PIN CONFIGURATION 11. INTERFACING FOR 8051 WITH METAL SENSORS 12. DC MOTOR FF-030-PN MOTOR 13. RF COMMUNICATION 14. HT12E & HT12D PIN ASSIGNMENT 15. KEIL FINAL LOOK

----------------------------------------------

02 04 15 27 31 34 35 38 39 40 42 47 50 51 52

Electronics & Communications

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

LIST OF TABLES 1. ADDRESING MODES 2. SETTING THE SERIAL MODE 3. INTERRUPT PRIORITY 4. REGISTER SELECTION 5. INSTRUCTIONS OF LCD 6. RS 232 PIN ASSIGNMENT ------------------20 23 25 30 31 40

Electronics & Communications

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

INDEX S.No
1.

Contents
Introduction of the Project 1.1 System definition 09. 1.2 Software requirement 11. 1.3 ANALYSIS 12.

Pg.No.
09.

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 2.6 Serial Communication 22. 2.7 Interrupts 24. 21.

3. 26.

Keypad Interface 3.1 Interfacing to LCD Display 27.

Electronics & Communications

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION


4. 34. 4.1 Transformer only ! 35. 4.2 Rectifier 37. 4.3 Smoothing 38. 4.4 Regulator 39. 5. 40. 5.1 Overview 40. 6. 41. 6.1 Intro 41. 6.2 How Detector Works 43. 6.3 Discrimination of Different metals 44. 7. DC Motor 7.1 Principles of Operation 45. 8. Radio Frequency (RF) 49. 8.1 Special properties of RF current 8.2 Radio Communication 8.3 Frequencies 8.4 HT12E & HT12D Encoder & Decoder IC 50. 9. Introduction of the KEIL 9.1 What is KEIL Electronics & Communications 52. 52. 8 48. 49. 50. 45. Metal Detector RS 232 Interfacing Power Supply

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION


9.2 The final KEIL program Look 10. Conclusion & Future Scope 11. Bibliography 52. 53. 54.

Electronics & Communications

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 1. Embeds hardware to give computer like functionalities
Electronics & Communications 10

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION 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. Hybrid Real-Time Systems - systems which exhibit both hard and soft constraints on its performance.

Electronics & Communications

11

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

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:


Operating System
Programming Language

:
:

Windows XP/2003 or Linux/Solaris


keil V.4,embedded C

Electronics & Communications

12

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

1.2.4 Hardware requirements:


Processor Hard Disk RAM Metal detector : : : : Pentium IV 40GB 256MB 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 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.

Electronics & Communications

13

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

2 .8051 Hand Book


CONTENT PAGE NO. 2.0 INTRODUCTION TYPES OF MEMORY SFRS 14. 15. 16.

2.1.

2.2.

2.3.

BASIC REGISTERS

18.

2.4.

ADDRESSING MODES

20.

2.5.

TIMERS

21.

2.6.

SERIAL COMMUNICATION

22.

2.7.

INTERRUPTS

23.

Electronics & Communications

14

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

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 applications o Extensive Boolean processing (Single-bit logic) capabilities o 64K Program Memory address space o 64K Data Memory address space o 4K bytes of on-chip Program Memory o 128 bytes of on-chip Data RAM o 32 bidirectional and individually addressable 1/0 lines o Two 16-bit timer/counters o Full duplex UART o 6-source/5-vector interrupt structure with two priority levels o On-chip clock oscillator

fig: pin assignment of mc51

Electronics & Communications

15

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

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.

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

Electronics & Communications

16

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION 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 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 its 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 8051s 32 input/output lines. Another SFR allows a program to read or write to the 8051s serial port. Other SFRs allow the
Electronics & Communications 17

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION user to set the serial baud rate, control and access timers, and configure the 8051s 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 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.

Electronics & Communications

18

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION 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 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 youve worked with any other assembly languages you will be familiar with the concept of an Accumulator register. The Accumulator, as its 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

Electronics & Communications

19

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION 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 8051s 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 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 8051s 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 isnt 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)


Electronics & Communications 20

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION 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:

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

Electronics & Communications

21

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

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


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

Electronics & Communications

22

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

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:
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 13bit 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)

Electronics & Communications

23

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION 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 8051s many powerful features is its 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 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 ports 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 8051s 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
Electronics & Communications 24

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

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 ports baud rate. This only applies to Serial Port modes 1 and 3. The Baud Rate is determined based on the oscillators frequency when in mode 0 and 2. In mode 0, the baud rate is always the oscillator frequency divided by 12. This means if youre 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 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 wed 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
Electronics & Communications 25

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION 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".

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

Electronics & Communications

26

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION 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

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.

Electronics & Communications

27

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION 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. Lets say we first make Row1 low, then read the columns. If any of the key in row1 is pressed will make the 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:

Electronics & Communications

28

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION


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

Electronics & Communications

29

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION 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


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)

Electronics & Communications

30

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION 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


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

RS

Register Selection R/W Operation

Electronics & Communications

31

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

0 0 1 1

0 1 0 1

IR write as an internal operation (display clear, etc.) Read busy flag (DB7) and address counter (DB0 to DB6) DR write as an internal operation (DR to DDRAM or CGRAM) 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 LCDs internal controller accept several commands and modify the display accordingly. These commands would be things like: Clear screen Return home Shift display right/left
Table 3.2

Instruction Function set (8-bit interface, 2 lines, 5*7 Pixels) Function set (8-bit interface, 1 line, 5*7 Pixels) Function set (4-bit interface, 2 lines, 5*7 Pixels) Function set (4-bit interface, 1 line, 5*7 Pixels) Entry mode set Scroll display one character right (all lines) Scroll display one character left (all lines) Home (move cursor to top/left character position) Move cursor one character left Move cursor one character right Instruction Turn on visible underline cursor Turn on visible blinking-block cursor Make cursor invisible
Electronics & Communications

Decimal 56 48 40 32 See Below 28 24 2 16 20 Decimal 14 15 12

HEX 38 30 28 20 See Below 1E 18 2 10 14 HEX 0E 0F 0C


32

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

Blank the display (without clearing) Restore the display (with cursor hidden) Clear Screen Set cursor position (DDRAM address) Set pointer in character-generator RAM (CG RAM address)

8 12 1 128 + addr 64 + addr

08 0C 01 80+ addr 40+ addr

3.1.3 INTERFACING LCD TO 8051 :

fig 3.1

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.

Electronics & Communications

33

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION 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. 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.
Electronics & Communications 34

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION 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 lcall mov lcall mov lcall mov lcall mov lcall mov lcall mov lcall data Initialization clear a,#'H' data a,#'I' data a,#8ah command a,#'M' data a,#'A' data a,#'H'

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)

Electronics & Communications

35

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

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

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:Electronics & Communications 36

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION


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

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

Electronics & Communications

37

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

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: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)
Electronics & Communications 38

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION 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 stepdown 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.

Vp = primary (input) voltage Np = number of turns on primary Ip = primary (input) current coil

Vs = secondary (output) voltage Ns = number of turns on coil secondary

Is = secondary (output) current

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

Electronics & Communications

39

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

fig 4.3(bridge rectifier) Bridge rectifier the connections so the alternating directions of AC are converted to the one direction of DC. 4.3 Smoothing:-

Output: full-wave varying DC

Alternate pairs of diodes conduct, changing over (using all the AC wave)

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 required value for the smoothing capacitor. A larger capacitor will give less ripple. The capacitor There is more information about smoothing on the Electronics in Meccano website. value must be doubled when smoothing half-wave DC.

Smoothing capacitor for 10% ripple, C = C = smoothing capacitance in farads (F)

5 Io Vs f

Io = output current from the supply in amps (A) Electronics & Communications 40

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION


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

regulators

include

some

automatic

protection from excessive current ('overload protection') and overheating ('thermal protection').

zener diode a = anode, k = cathode

Electronics & Communications

41

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION


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) Received Line Pin 1 (Data Carrier Detect) 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

Signal

Detector

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

the

mating

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?

Electronics & Communications

42

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION


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

Electronics & Communications

43

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION 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 detector we has made isnt 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 Cs 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)

Electronics & Communications

44

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

6.1.3 Conclusion for PI:


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

Electronics & Communications

45

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION 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 cant 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 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

Electronics & Communications

46

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION 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 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
Electronics & Communications 47

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION 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

48

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

Electronics & Communications

49

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION 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:

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

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.

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.

Electronics & Communications

50

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION 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. 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
Electronics & Communications 51

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

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 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 3 - 30 Hz 30 - 300 Hz 300 - 3000 Hz 3 - 30 kHz 30 - 300 kHz 300 kHz - 3 MHz 3 - 30 MHz

Designation Extremely low frequency Super low frequency Ultra low frequency Very low frequency Low frequency Medium frequency High frequency

Abbreviation ELF SLF ULF VLF LF MF HF


52

Electronics & Communications

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

30 - 300 MHz 300 MHz - 3 GHz 3 - 30 GHz 30 - 300 GHz

Very high frequency VHF Ultra high frequency UHF Super high frequency SHF Extremely high frequency EHF

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 53

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

Electronics & Communications

54

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION 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

55

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 56

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] Embedded systems [pg 1-10 intro] Orcioni The c idea book [article no.26]

douglas v hall Conti, M.;

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

57

MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION

Electronics & Communications

58