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
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
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
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
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:
Fig 0.2 (block diagram for Tx/Rx of RF communication)
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
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
MINE/METAL DETECTION ROBOT WITH RF COMMUNICATION
Electronics & Communications 7
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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).
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.
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.
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
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
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