Vous êtes sur la page 1sur 53

Metal detector & Weapon security system

By

Teuseef (2015-UB-GCB-79532)

M iqtedar khan (2015-UB-GCB-79520)

Kashif zaman (2015-UB-GCB-79526)

Department of Electronics
Government Post Graduate College,
Bannu. SESION 2015-2019

Page | 1
DEDICATION

Dedicated to the Holy Prophet Muhammad

Also dedicated to our Parents for their prayers and love to allow us in our pursue to
become qualified.

Page | 3
Page | 4
CERTIFICATE OF APPROVAL

It is certified that the research work titled ―weapon security system is carried out by tuseef ,
R. No. 07,M iqtedar khan, R. No. 13, kashif zaman , R No. 10 and I under the supervision of
Mr. Asghar Khan, at Government Post Graduate College Bannu, KPK. It is fully adequate, in
scope and in quality, as a report for the degree of Bachelor of Science in Electronics.

Supervisor: —————————
Mr. Asghar Khan
Professor
Department of Electronics
Government Post Graduate College Bannu, KPK.

External Examiner 1: —————————


Abc
Assistant Professor
Department of Electronics
Government Post Graduate College Bannu.

External Examiner 2: —————————

Page | 5
Abc
Assistant Professor
Department of Electronic
Government Post Graduate College Bannu.

HOD: —————————
SHAHID ISLAM
Associate Professor
Department of Electronics
Government Post Graduate College Bannu

Page | 6
ACKNOWLEDGEMENT

First of all, we thank Almighty Allah who has given us awareness, power and understanding to
complete this work.

We would like to express our appreciation to our kind project supervisor Mr. Asghar Khan for
his guidance, support and inspiration. Working with him has been a true honor and great
experience for us. His guidance and counsel has been a great source of motivation for us
throughout the thesis work.

We would like to express honest thanks to Sir. Imran, and Sir Shahid Islam who guided us to
improve this work in many traits. We also pay our gratitude to them who provided us the key
concepts of core theory and helped us in getting out of many difficulties throughout the thesis.
Another prominent personalities to whom we want to mention are that of our Family members
especially, whose earnest and noble help has been a source of great inspiration for us
throughout the degree and project.

We would also like to thank our parents and our family members who freed us for long time to
do this work.

Page | 5
DECLARATION

It is declared that this is an original piece of my own work, except where otherwise
acknowledged in text and references. This work has not been submitted in any form for another degree
or diploma at any university or other institution for tertiary education and shall not be submitted by me
in future for obtaining any degree from this or any other university or institution.

Tauseef R. No 07

Muhammad iqtedar KHAN


R. NO. 13

Kashif zaman
R. NO. 10

Page | 6
Table of contents
Declaration of originality.............................................................................................. II
Acknowledgement....................................................................................................... III
Dedication.................................................................................................................... IV
Abstract................................................................................................................................... V

Chapter 1: Introduction..................................................................................................…... 1
1.1 Background......................................................................................................…...
1.2 Importance of the project........................................................................................
1.3 Project aim........................................................................................................…..
1.4 metal detectors technologies.............................................................................…..
1.4.1 Very low frequency (VLF)......................................................................
1.4.2 Pulse induction (PI)..................................................................................
1.4.3 Beat-frequency oscillation (BFO)............................................................
1.4.4 RF oscillators...........................................................................................

Chapter 2: literature Review...........................................................................................….2


2.1 Introduction........................................................................................................
2.2 History...............................................................................................................
2.2.1 The Pioneer..............................................................................................
2.2.2 The induction balance........................................................................….
2.2.3 Discrimination..........................................................................................
2.3 The wireless age....................................................................................................
2.4 Further refinements...............................................................................................
2.5 principles of operation of metal detectors.............................................................
Chapter 3: Elements of metal detector............................................................................... 3
List of elements
3.2 Search coil.............................................................................................................
3.2.1 Search coil basics...................................................................................
3.2.2 Principles of operation of search coil................................................….
3.2.3 Search coil depth....................................................................................
3.3 Types of search coil.................................................................................
3.3.LM741 IC.............................................................................................
3.4 IR sensors............................................................................................
3.5 DC motor ........................................................................................
3.6 89c51 u-controller......................................................................
3.8 Crystal oscillator 12M Hz..........................................................
3.9 LM748 regulators..........................................................
Power supply............................
DC buzzer 5 V...............................................................................
Resister……………………………………………………
Transistor……………………………………

Page | 7
Color LED ……………………………………………….
Chapter 4 Coding …………………………………..……………………………..

Chapter 5: Discussion &conclusion.....................................................................................


1.1Background
In the 18th century when the industrial revolution began. Factories needs for metal increased due
to the increase of its uses. This increasing demand leads scientists and engineers to think about
inventing a machine that can detect metal to save effort and time wasted in detection of metal. In
1830 metal detectors appeared.
From that time until now the applications of metal detectors have been rapidly increased and
critical applications was included, which has led to variety in types, sizes and applications of
metal detectors. This project will provide a simple design and implementation of metal detectors

Page | 8
1.2 Importance of the project

Page | 9
1.3 Project aim

Page | 10
1.4 Metal detectors technologies
There are many metal detector technologies available [1], such as:
1.4.1 Very low frequency (VLF)
Very low frequency is the most popular detector technology used today. It uses two coils for
detection operation. One of the coils has variable magnetic field across it and the other acts as an
antenna to pick up and amplify frequencies coming from target objects in the ground.
1.4.2 Pulse induction (PI)
It is less common form of metal detectors. It is based on VLF but it uses single coil for detection
operation .The field here comes from current pulses applied on the coil.
1.4.3 Beat-frequency oscillation (BFO)
It is the most basic type of metal detector. This type uses two coils each coil is connected to an
oscillator which generates a steady frequency, with each coil having a slightly different frequency.
This difference in frequencies will cause a steady "beat" which can be picked up by the receiver
in the control box. Any metal or mineral in range of the signal will interfere with the frequency
in the search coil, causing a change in the duration and tone of the beat frequency.
1.4.4 RF oscillators
Resonant-frequency oscillators are the simplest type of metal detector. It uses one coil for the
detection operation. It is the cheapest and simplest technology for building a metal detector.
This technology is used in this project.

Page | 11
Chapter 2: literature Review
2.1 Introduction
A metal detector is a device which responds to metal that may not be readily apparent.
The simplest form of a metal detector consists of an oscillator producing an alternating current
that passes through a coil producing an alternating magnetic field. If a piece of electrically
conductive metal is close to the coil, eddy currents will be induced in the metal, and this
produces an alternating magnetic field of its own. If another coil is used to measure the magnetic
field (acting as a magnetometer), the change in the magnetic field due to the metallic object can
be detected.
A gold metal detector for example is designed to locate gold underground, figure 2.1 shows a
gold detector. There are many types of metal detectors with varying degrees of refinement and
complexity but they all operate on the same basic principle. [2]
2.2 History
2.2.1 The Pioneer
If anyone could be regarded as the inventor of metal detectors, he will be English geologist and
mining engineer R. W. Fox. It was Fox who first discovered that electricity will flow through
metallic ores as well as solid metal objects. He devised a simple metal locator which consisted of
nothing more than a battery, several metal rods and a suitable length of wire.
Chapter 2 literature review
7
His first method of detection was as follows: one metal rod would be driven into the earth where the
suspected vein of ore was located; it was connected to one terminal of the battery, as shown in figure 2.2.
The other battery terminal was connected to a floating wire. Other metal rods were driven into
the ground at several different points and successively touched with the floating wire. Where a
spark occurred, it was an indication that metal was present. Circa 1870, this device was modified
to two rods insulated from each other in a common probe and connected via battery to a bell and
plunged into the earth. When contact was made by metallic ore, nugget or metal pipe, the bell
rang, thus indicating the presence of a conductive object. [3]
2.2.2 The induction balance
In 1879, Professor D.E. Hughes demonstrated to the Royal Society in London his Induction
Balance (I.B.). Its purpose was to study the molecular structure of metals and alloys. However,
Hughes and his instrument maker, William Groves, soon recognized the potential of the I.B. as a
metal locator. The Royal Mint used the Induction Balance for assaying metals and detecting
forgeries, as shown in figure 2.3.
The well- known American inventor George Hopkins modified the I.B. for locating metallic ores,
treasure chests and the like. In fact, the Induction Balance forms the basis of most metal
detectors used today. [3]
Chapter 2 literature review
8
2.2.3 Discrimination
The biggest technical change in detectors was the development of the induction-balance system.
This system involved two coils that were electrically balanced. When metal was introduced to
their vicinity, they would become unbalanced. What allowed detectors to discriminate between
metals was the fact that every metal has a different phase response when exposed to alternating

Page | 12
futures work
There are many updates which could be applied to this detector in the future in order to solve the
limitations of this detector and get detector that can be practically used.
Possible modifications are:
1. Increase the detection region of the detector; this may be done using high power to supply the
circuit.
2. Use LCD or headset as indicator, this also needs increasing the power.
3. Make it portable by using portable supply such as mobile battery.
4. Update this detector and let it determine the type of metal it detects, to do this another
technology is to be used.

Page | 13
1. Basic operation.

Metal detectors work on the principle of transmitting a magnetic field and analyzing
a return signal from the target and environment. The
transmitted magnetic field varies in time, usually at rates of fairly high-pitched
audio signals. The magnetic transmitter is in the form of a
transmit coil with a varying electric current flowing through it produced by transmit
electronics. The receiver is in the form of a receive coil connected to receive and
signal processing electronics
This changing transmitted magnetic field causes electric currents to fl ow in metal
targets. These electric currents are called eddy currents,
which in turn generate a weak magnetic field, but their generated magnetic fi eld is
different from the transmitted magnetic field in shape
and strength. It is the altered shape of this regenerated magnetic fi eld that metal
detectors use to detect metal targets. (The different
“shape” may be in the form of a time delay.)
The regenerated magnetic field from the eddy currents causes an alternating
voltage signal at the receive coil. This is amplified by the
electronics because relatively deeply buried targets produce signals in the receive
coil which can be millions of times weaker than the
signal in the transmit coil, and thus need to be amplified to a reasonable level for
the electronics to be able to process. In summary:
1. Transmit signal from the electronics causes transmit electrical current in transmit
coil.
2. Electrical current in the transmit coil causes a transmitted magnetic field.
3. Transmitted magnetic field causes electrical currents to flow in metal targets
(called eddy currents.)
4. Eddy currents generate a magnetic field. This field is altered compared to the
transmitted field.
5. Receive coil detects the magnetic field generated by eddy currents as a very
small voltage

Page | 14
Circuit Diagram and Working

The figure shows the circuit diagram of metal detector. The 555 IC timer here acts as a square wave
generator and it generate pulses with frequencies audible to human. The capacitor between pin2 and
pin1 should not be changed as it is need to generate audible frequencies.

In the circuit there is an RLC circuit formed by 47K resistor, 2.2µF capacitor, and 150turn inductor. This
RLC circuit is the metal detection part. Now as mentioned earlier in previous section, a metal core
inductor has a high inductance value over a air cored one.

Remember the coil wound here is a air cored one, so when a metal piece is brought near the coil, the
metal piece acts as a core for the air cored inductor. By this metal acting as a core, the inductance of
the coil changes or increases considerably. With this sudden increase in inductance of coil the overall
reactance or impedance of the RLC circuit changes by a considerable amount when compared without
the metal piece.

At first when there is no metal piece the signal fed to speaker causes some audible sound. Now with the
reactance change around the RLC circuit the signal sent to speaker will no longer be the same as before,
because of this the sound produced by the speaker will be of different to the first one.

Page | 15
List Of Elements
1.Search coil
2.LM741 IC .
3.IR sensors
4 .DC motor
5 89c51 u-controller .
6 Crystal oscillator 12M Hz .
7. LM748 regulators
8.Power supply
9. DC buzzer 5 V
10 CD ROM
11 Relay 5V 6pin
12.Step-down Transformer
13.1N4007 diode
14.Vero board (project Board)
15.Capacitor 1000uF
16.CD ROM
17. Power supply cables 220v

Page | 16
Search coil basics
The search coil is a vital part of any metal detector. It is the flat, typically circular disk, which
generates a magnetic field and senses metallic targets in the surrounding environment, figure 3.1
shows a search coil. It is located at the end of the stem and is connected to the control housing
via a cable normally wound around the stem. The size and depth of the magnetic field is
determined by the shape and size of the search coil.

Search coil depth


The detection depth of a search coil, as a rule-of-thumb, will be approximately equal to its
diameter, for a coin-sized object. However, as a search coil’s size increases and its field pattern
becomes larger, the field pattern becomes less concentrated and begins to miss small objects as
shown in figure 3.2. For a coin-sized object, this effect becomes noticeable when using search
coils larger than about 15" in diameter. Since the field generated by a large search coil is larger,
deeper and less concentrated than a small search coil, it is the best choice when hunting for
targets that are usually large and deeply buried, such as caches or relics.

Types of search coil In addition to search coil sizes and shapes, there are also a variety of
search coil configurations available, with each proving to be the best choice depending on
hunting applications and ground conditions. The configuration of a search coil refers to the
arrangement of the TX and RX coils within the search coil shell. There are basically five
configurations: Concentric, Mono, Imaging, Double-D and 2-box.

Page | 17
Factors that affect the choosing of metal detectors
Metal detecting can be divided into two main categories: Gold Prospecting and Coin and Treasure
Hunting, with a sub-division of this, Underwater Detecting.
During the last few years there have been tremendous advances in metal detector technology. With
the use of micro-processors and high-technology surface mount circuitry the metal detector has
evolved with greater depth, improved sensitivity, automatic ground balance and superior
discrimination.
When checking the different metal detectors, there are five main characteristics which can be used to
compare one metal detector with another. These are depth, sensitivity, discrimination, ground balance
and type of coil. Chapter 3 Elements of metal detector 20

Page | 18
IC 7805 | Voltage Regulator

Voltage sources in a circuit may have fluctuations resulting in not providing


fixed voltage outputs. A voltage regulator IC maintains the output voltage at
a constant value. 7805 IC, a member of 78xx series of fixed linear voltage
regulators used to maintain such fluctuations, is a popular voltage regulator
integrated circuit (IC). The xx in 78xx indicates the output voltage it provides.
7805 IC provides +5 volts regulated power supply with provisions to add a
heat sink.

7805 IC Rating
 Input voltage range 7V- 35V

 Current rating Ic = 1A

 Output voltage range VMax=5.2V ,VMin=4.8V

Page | 19
Pin Details of 7805 IC
Pin
Pin Function Description
No.

In this pin of the IC positive


1 INPUT Input voltage (7V-35V) unregulated voltage is given in
regulation.

In this pin where the ground is


2 GROUND Ground (0V) given. This pin is neutral for
equally the input and output.

The output of the regulated 5V


Regulated output; 5V
3 OUTPUT volt is taken out at this pin of
(4.8V-5.2V)
the IC regulator.

As you may have noticed, there is a significant difference between the input
voltage & the output voltage of the voltage regulator. This difference
between the input and output voltage is released as heat. The greater the
difference between the input and output voltage, more the heat generated. If
the regulator does not have a heat sink to dissipate this heat, it can get
destroyed and malfunction. Hence, it is advisable to limit the voltage to a
maximum of 2-3 volts above the output voltage. So, we now have 2 options.
Either design your circuit so that the input voltage going into the regulator is
limited to 2-3 volts above the output regulated voltage or place an
appropriate heatsink, that can efficiently dissipate heat.

What to do with all the heat?

Page | 20
7805 is not very efficient and has drop-out voltage problems. A lot of energy
is wasted in the form of heat. If you are going to be using a heat sink, better
calculate the heat sink size properly. The below formula should help in
determining appropriate heat sink size for such applications.

Pin Configuration

Pin Name Description

VCC Power Supply Input

GND Power Supply Ground

OUT Active High Output

IR Sensor Module Features

 5VDC Operating voltage

 I/O pins are 5V and 3.3V compliant

 Range: Up to 20cm

 Adjustable Sensing range

 Built-in Ambient Light Sensor

 20mA supply current

 Mounting hole

Page | 21
Brief about IR Sensor Module

The IR sensor module consists mainly of the IR Transmitter and Receiver, Opamp, Variable Resistor
(Trimmer pot), output LED in brief.

IR LED Transmitter emits light, in the range of Infrared frequency. IR light is invisible to us as its
wavelength (700nm – 1mm) is much higher than the visible light range. IR LEDs have light emitting angle
of approx. 20-60 degree and range of approx. few centimeters to several feets, it depends upon the type
of IR transmitter and the manufacturer. Some transmitters have the range in kilometers. IR LED white or
transparent in colour, so it can give out amount of maximum light.

Photodiode Receiver

Photodiode acts as the IR receiver as its conducts when light falls on it. Photodiode is a semiconductor
which has a P-N junction, operated in Reverse Bias, means it start conducting the current in reverse
direction when Light falls on it, and the amount of current flow is proportional to the amount of Light.
This property makes it useful for IR detection. Photodiode looks like a LED, with a black colour coating on
its outer side, Black colour absorbs the highest amount of light.

LM358 Opamp

LM358 is an Operational Amplifier (Op-Amp) is used as voltage comparator in the IR sensor. the
comparator will compare the threshold voltage set using the preset (pin2) and the photodiode’s series
resistor voltage (pin3).

Photodiode’s series resistor voltage drop > Threshold voltage = Opamp output is High

Photodiode’s series resistor voltage drop < Threshold voltage = Opamp output is Low

When Opamp's output is high the LED at the Opamp output terminal turns ON (Indicating the detection
of Object).

Variable Resistor

The variable resistor used here is a preset. It is used to calibrate the distance range at which object
should be detected.

Page | 22
Page | 23
DC MOTOR, HOW IT WORKS?

The first DC motor was developed around the 1830’s-1840’s but was commercially unsuccessful. These
motors were primary battery powered. Poor batteries and high costs resulted in no practical markets
around the mid 1800’s. The first commercially viable DC motors entered the market in the late 1800’s
due to inventions to the electrical grid and possibilities to build rechargeable batteries.

Consequently brushed DC motors were continuously improved and are still widely used in many
applications. But also other types of electromotors were developed, like brushless DC motors and
induction motors. As a result in several applications the use of brushed DC motors is limited today.

THE FUNCTION OF A BRUSHED DC MOTOR

Like every electromotor, a brushed DC motor consists of two main parts, the rotor and the stator. The DC
motor contains either permanent magnets (PMDC) or electromagnetic windings (SWDC) on the stator,
which is on the outside of the motor. On the inside, the rotor or “armature” is located. The rotor
contains the coil windings that are powered by DC current. When powered by DC current a magnetic
field is created around the rotor. Rotation is caused by the fact that one side of the rotor is attracted by
the magnetic field in the stator and the other side is repelled.

The rotation continues due to the commutator. Basically, this commutator manages the direction of the
flow of current and thereby the direction of the magnetic field, as shown in the image to the right.
When the rotor turns due to attraction and repulsion and the rotor becomes horizontally aligned, both
brushes will make contact with the opposite side of the commutator. This way the current through the
rotor is reversed. As a consequence, the magnetic field is reversed. This process repeats itself as long as
power is supplied to the DC motor.

DIFFERENT TYPES OF BRUSHED DC MOTORS.

Within the brushed DC motors you have 4 main different types:


1. Permanent Magnet DC motor.
2. Series motor.
3. Shunt motor.
4. Compound motor.

Page | 24
ADVANTAGES OF A BRUSHED DC MOTOR

The brushed DC motor is an electric motor, which is easy to understand and has a simple and cheap drive
design. Basically, for a DC series motor there is a linear relationship between the applied voltage and the
speed, given a certain load. The higher the voltage, the higher the rpm. This means that speed and
torque can simply be controlled by changing the applied voltage. Also it doesn’t need complex
electronics to be controlled. Finally, the DC motor allows for quick start-stop acceleration.

DISADVANTAGES OF A BRUSHED DC MOTOR

The main disadvantage of the brushed DC motor is the presence of brushes. These wear down relatively
quickly which leads to high maintenance costs. Moreover, the motor cannot operate under hazardous
conditions, and sparks might occur due to the brushes. Furthermore, although changing the voltage
gives you control over speed and torque, this control is not sophisticated. So for applications in which
high control is required with a high level of precision, extra complex electronics are needed to provide
the desired level of control.

APPLICATIONS OF A DC MOTOR

It depends on the type of DC motor, which applications are ideal. Generally speaking, the following
applications are common:
• Cranes
• Conveyors
• Pumps
• Fans
• Machine tools
• Air compressors
• Toys
• Motor starters in cars

Page | 25
Features
• Compatible with MCS-51™ Products
• 4K Bytes of In-System Reprogrammable Flash Memory
– Endurance: 1,000 Write/Erase Cycles
• Fully Static Operation: 0 Hz to 24 MHz
• Three-level Program Memory Lock
• 128 x 8-bit Internal RAM
• 32 Programmable I/O Lines
• Two 16-bit Timer/Counters
• Six Interrupt Sources
• Programmable Serial Channel
• Low-power Idle and Power-down Modes
Description
The AT89C51 is a low-power, high-performance CMOS 8-bit microcomputer with 4K bytes of Flash
programmable and erasable read only memory (PEROM). The device is manufactured using Atmel’s
high-density nonvolatile memory technology and is compatible with the industry-standard MCS-51
instruction set and pinout. The on-chip Flash allows the program memory to be reprogrammed in-system
or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with Flash
on a monolithic chip, the Atmel AT89C51 is a powerful microcomputer which provides a highly-flexible and
cost-effective solution to many embedded control applications
Pin Configurations

Page | 26
The AT89C51 provides the following standard features: 4Kbytes of Flash, 128 bytes of RAM, 32 I/O lines,
two 16-bittimer/counters, a five vector two-level interrupt architecture,a full duplex serial port, on-chip
oscillator and clock circuitry .In addition, the AT89C51 is designed with static logic for operation down to
zero frequency and supports two software selectable power saving modes. The Idle Modes tops the CPU
while allowing the RAM, timer/counters, serial port and interrupt system to continue functioning. The
Power-down Mode saves the RAM contents but freezes the oscillator disabling all other chip functions
until the next hardware reset.

Pin Description
VCC
Supply voltage.
GND
Ground.
Port 0
Port 0 is an 8-bit open-drain bi-directional I/O port. As an output port, each pin can sink eight TTL inputs.
When 1s are written to port 0 pins, the pins can be used as high impedance inputs. Port 0 may also be
configured to be the multiplexed low order address/data bus during accesses to external program and
data memory. In this mode P0 has internal pull-ups.
Port 0 also receives the code bytes during Flash programming,
and outputs the code bytes during program
verification. External pull-ups are required during program verification.

Port 1
Port 1 is an 8-bit bi-directional I/O port with internal pullups. The Port 1 output buffers can sink/source four
TTL inputs. When 1s are written to Port 1 pins they are pulled high by the internal pullups and can be
used as inputs. As inputs, Port 1 pins that are externally being pulled low will source current (I IL) because
of the internal pullups. Port 1 also receives the low-order address bytes during Flash programming and
verification.

Port 2
Port 2 is an 8-bit bi-directional I/O port with internal pullups. The Port 2 output buffers can sink/source four
TTL inputs. When 1s are written to Port 2 pins they are pulled high by the internal pullups and can be
used as inputs. As inputs Port 2 pins that are externally being pulled low will source
current (IIL) because of the internal pullups. Port 2 emits the high-order address byte during fetches
from external program memory and during accesses to external data memory that use 16-bit addresses
(MOVX @DPTR). In this application, it uses strong internal pullups. when emitting 1s. During accesses to
external data memory that use 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special
Function Register.Port 2 also receives the high-order address bits and some
control signals during Flash programming and verification.

Port 3
Port 3 is an 8-bit bi-directional I/O port with internal pullups. The Port 3 output buffers can sink/source four
TTL inputs. When 1s are written to Port 3 pins they are pulled high by the internal pullups and can be
used as inputs. As inputs,Port 3 pins that are externally being pulled low will source current (I IL) because
of the pullups. Port 3 also serves the functions of various special features
of the AT89C51 as listed below: Port 3 also receives some control signals for Flash programming
and verification.

RST
Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device.

Page | 27
ALE/PROG Address Latch Enable output pulse for latching the low byte of the address during accesses
to external memory. This pin is also the program pulse input (PROG) during Flash
programming. In normal operation ALE is emitted at a constant rate of 1/6 the oscillator frequency, and
may be used for external timing or clocking purposes. Note, however, that one ALE pulse is skipped
during each access to external Data Memory. If desired, ALE operation can be disabled by setting bit 0 of
SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise,
the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in external
execution mode.

PSEN
Program Store Enable is the read strobe to external program memory.
When the AT89C51 is executing code from external program memory, PSEN is activated twice each
machine cycle, except that two PSEN activations are skipped during each access to external data
memory
.
EA/VPP
External Access Enable. EA must be strapped to GND in order to enable the device to fetch code from
external program memory locations starting at 0000H up to FFFFH. Note, however, that if lock bit 1 is
programmed, EA will be internally latched on reset. EA should be strapped to V CC for internal program
executions. This pin also receives the 12-volt programming enable voltage (V PP) during Flash
programming, for parts that require 12-volt VPP.

XTAL1
Input to the inverting oscillator amplifier and input to the internal clock operating circuit.

XTAL2
Output from the inverting oscillator amplifier.

Oscillator Characteristics
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier which can be configured
for use as an on-chip oscillator, as shown in Figure 1. Either a quartz crystal or ceramic resonator may be
used. To drive the device from an external clock source, XTAL2 should be left unconnected while XTAL1
is driven as shown in Figure 2.There are no requirements on the duty cycle of the external clock signal,
since the input to the internal clocking circuitry is through a divide-by-two flip-flop, but minimum and
maximum voltage high and low time specifications must be observed.

Page | 28
Power supply

2.1
What is Step Down Transformer
A Step Down Transformer is a device which converts high primary voltage to
a low secondary voltage. In a Step Down Transformer, the primary winding
of a coil has more turns than the secondary winding. Figure 1 below shows
the winding representation of a typical Step-Down Transformer.

Fig 1: Representation of Windings in Step Down Transformer

Page | 29
Working Principle of Step Down Transformer
Transformer work on the principle of “Faraday’s law of electromagnetic
induction”. Mutual induction between the windings is responsible for
transmission action in a transformer.

Faraday’s law states that “when the magnetic flux linking a circuit changes,
an electromotive force is induced in the circuit proportional to the rate of
change of the flux linkage”.

The emf (Electro Motive Force) induced between the two windings is
determined by the number of turns in primary and secondary winding
respectively. This ratio is called as Turns Ratio.
The voltage reduction capability of step down transformers depends on the
turn ratio of the primary and secondary coil. As the number of windings in
secondary coil is less as compared to the number of windings in primary coil,
so the amount of flux linkage to the secondary coil of the transformer will
also be less compared to the primary coil.

Accordingly, the emf induced will be less in the secondary coil. Due to this,
the voltage reduces at the secondary winding compared to primary winding

Step Down Transformer Equation


The formula used to design a Step Down Transformer is

Where,
 Ns = number of turns in secondary
 Np = number of turns in primary
 Vs = Voltage in secondary
 Vp = Voltage in primary

Page | 30
The number of turns in secondary winding should always be less than the
number of turns in the primary winding of the transformer i.e Np>Ns to
work transformer as “Step-Down Transformer”.
As the number of turns will be less in secondary winding, so will be total
induced emf and hence the output voltage in the secondary will also be less
than the primary input voltage.

Let’s understand by considering the situation of Step-Down Transformer in


which the secondary turns [Ns] are 250, primary turns [Np] are 5000 and
the input voltage [Vp] is 240. Then the voltage at the secondary [Vs] can be
calculated by using the formula:

Buy rearranging the equation we get:

Hence, the voltage at the secondary winding of the transformer is 12V,


which is less than that at the primary winding. Therefore, the transformer in
said to be a Step-Down Transformer.

Page | 31
Types of Step Down Transformer

Step Down Transformers can be classified into three categories based on


tapings in secondary coil. They are:

 Single Phase Step Down Transformer


 Center Tapped Step Down Transformer
 Multi Tapped Step Down Transformer

Single Phase Step Down Transformer


Used to step down the current ratings and input voltage, and it gives low
voltage and current output.

Ex: 12V AC.

Fig. 2 – Symbol and Physical View of Single Phase Step Down


Transformer

Page | 32
Center Tapped Step Down Transformer
This type of Step Down Transformers will be having one primary winding and
a center split in the secondary winding, by which it gives the output voltage
with the center pint.

Ex: 12v-0-12v.

Fig. 3 – Symbol and Physical View of Center Tapped Step Down


Transformer
Multi Tapped Step Down transformer
This type of Step Down Transformers have multiple tapping in Secondary
coil. Multiple Tapping are used to get the desired varied output with
secondary coils.

Ex: 0-12v, 0-18v.

Page | 33
Fig. 4 – Symbol and Physical View of Multi Tapped Step Down
Transformer
Applications of Step Down Transformer
The various applications of Step Down Transformers includes:

 In main adapters and chargers for cell phones, stereos and CD players
 To step down the voltage level in transmission line
 In welding machines by reducing voltage and increasing current.
 In televisions, voltage stabilizers, inverters, etc.

Advantages of Step Down Transformer

The advantages of Step Down Transformers are as follows:

 Useful in stepping down the voltage, thereby making transmission


power easier and cheaper
 More than 99% of efficiency
 Provides varied voltage requirements
 Low Cost
 High Reliability
 High Durability

Disadvantages of Step Down Transformer


Page | 34
The disadvantages of Step Down Transformers are as follows:

 Requires a lot of maintenance failing which can damage the


transformer
 Volatility in feedstock costs
 Fault rectification takes more time

Role of Step Down Transformer in Voltage


Transmission

Fig. 5 – Voltage Distribution Chain using Transformer

In power stations, an AC electricity is generated at a nearly low peak voltage


around 440v. A general end user uses a voltage of 220V to 240V for
household and business. The generated voltage output of power station is

Page | 35
partaken to a step-up transformer, which increases its peak voltage from
few hundred volts to few kilovolts.

The step-up transformer output is given to a high tension transmission line


which transports the power/electricity over the miles. This is done to reduce
voltage drop. Once this power reaches its consumption point/ end sub
station, then with the help of step-down transformer, it is reduced to the
desired value i.e. 220V-240V.

Page | 36
DC BUZZER
Define:

Description
Working of a DC buzzer. Buzzers are those devices which produce a sound between 1 and
8Khz with vibrating a piezo element or a small speaker with a metal diaphragm. Basically there
are two types of Buzzers. One with a bult in oscillator to produce an audible sound, other
without the Oscillator.

Page | 37
Resistor
A resistor is an electrical component that limits or regulates the
flow of electrical current in an electronic circuit. Resistors can
also be used to provide a specific voltage for a device or
component such as a transistor etc. The current through a
resistor is inversely proportional to its resistance, and directly
proportional to the voltage across it. This is the well-known

Ohm's LAW.

Capacitor

A device to store an electronic charge for a short period of time


that consists of two metallic plates separated by a dielectric. A
capacitor is charged when electrons from a power source, such
as a battery, flow to one of the two plates. Because the
electrons cannot pass through the insulating layer, they build
up on the first plate, giving it a negative charge.

An electrical device consisting of two conducting plates


separated by an electrical insulator (the dielectric), designed to
hold an electric charge. Charge builds up when a voltage is

Page | 38
applied across the plates, creating an electric field between
them. Current can flow through a capacitor only as the voltage
across it is changing, not when it is constant. Capacitors are
used in power supplies, amplifiers, signal processors,
oscillators, and logic gates.

Somewhat Like a Battery Capacitors act like tiny storage


batteries that charge and discharge rapidly.

Page | 39
Diode
Diode is an electrical component that allows the flow of current
in only one direction.

The most common type of diode uses a p-n junction. In this


type of diode, one material (n) in which electrons are charge
carriers abuts a second material (p) in which holes (places
depleted of electrons that act as positively charged particles)
act as charge carriers. At their interface, a depletion region is
formed across which electrons diffuse to fill holes in the p-side.
This stops the further flow of electrons. When this junction is
forward biased (that is, a positive voltage is applied to the p-
side), electrons can easily move across the junction to fill the
holes, and a current flows through the diode.

Diode:

Transistor
A transistor is a device that regulates current or voltage flow
and acts as a switch or gate for electronic signals. Transistors

Page | 40
consist of three layers of a semiconductor material, each
capable of carrying a current.

The transistor was invented by three scientists at the Bell


Laboratories in 1947, and it rapidly replaced the vacuum tube as
an electronic signal regulator.

A transistor regulates current or voltage flow and acts as a switch


or gate for electronic signals. A transistor consists of three layers
of a semiconductor material.

The semiconductor material is given special properties by a


chemical process called doping. The doping results in a
material that either adds extra electrons to the material (which
is then called N-type for the extra negative charge carriers) or
creates "holes" in the material's crystal structure (which is then
called P-type because it results in more positive charge
carriers). The transistor's three-layer structure contains an N-
type semiconductor layer sandwiched between P-type layers (a
PNP configuration) or a P-type layer between N-type layers (an
NPN configuration).

Page | 41
2SA1015 Bipolar Transistor

Characteristics of the 2SA1015 bipolar transistor

 Type - PNP
 Collector-Emitter Voltage: -50 V
 Collector-Base Voltage: -50 V
 Emitter-Base Voltage: -5 V
 Collector Current: -0.15 A
 Collector Dissipation - 0.4 W

Page | 42
 DC Current Gain (hfe) - 70 to 400
 Transition Frequency - 80 MHz
 Noise Figure - 1 dB
 Operating and Storage Junction Temperature Range -55 to +150 °C
 Package - TO-92

Pin configuration (Pin out) of the 2SA1015The 2SA1015 is


manufactured in a plastic TO-92 case. When looking at the flat
side with the leads pointed downward, the three leads emerging
from the transistor are, from left to right, the emitter, collector, and
base leads.

Red/Green LED FIG

The Red/Green LED Guide

Page | 43
The Bi-color LED is a handy little component that

allows two colors (red and green) in a single LED while


only having two pins (cathode and anode). The color of
the LED depends on the polarity of the connection only
allowing one color at a time. Similar LED's that provide
two or even three colors usually have three or four pins
allowing for a wide range of mixed colors. One would
think having two pins is a disadvantage; not so. This LED
can easily be applied to a circuit to visually indicate
polarity direction. Or in my case it can save me an extra
i/o pin on a forthcoming arduino project.

Step 1: Straight Out of the Package

The first thing you'll notice is that this looks like any
other common LED, but with a white diffused lens. It has
a short negative lead (cathode), and a long positive lead
(anode). On the inside there are two LED's in parallel to
each other, one forward and one reverse. The package
included with the LED from radio shack provides a
similar looking schematic to the one I provided above.

Page | 44
Step 2:n

Using circuitlab.com I made this simple schematic. I


actually used 3 86R resistors in the demo video so don't
worry too much about getting the resistor values exact
(Resistor's Here). Just try not to go any lower than that.

In this design you will see exactly how the bi-color LED
operates. When the button is open the LED shine one
color, either red or green. When the button is closed the
other color will light up. So if the LED was green when
the button was open, it will change to red when the
button is closed. Simple enough.
Attachments
 The Red/Green LED Guide - Step #2

coding
#include <At89x52.h>

sbit row1 = P1^0; //


sbit row2 = P1^1; //
sbit row3 = P1^2;//
sbit row4 = P1^3;//

sbit col1 = P1^4;//


sbit col2 = P1^5;//
sbit col3 = P1^6; //
bit gnd;

sbit btn1 = P3^1;//Metal


sbit btn2 = P3^2;//1st Sensor
sbit btn3 = P3^3;//2nd Sensor

Page | 45
sbit led1 = P2^0;//gate open
sbit led2 = P2^1;//gate close
sbit led3 = P2^2;//Metal sensed
sbit led4 = P2^3;

unsigned char Code[3];


///////////////////////////////////////
void wait()
{
unsigned int i, j;
for(i = 0; i < 4; i++)//..... Door Delay
{
for(j = 0; j < 30000UL;)
{
j++;
}
}
}

void waitmetal()
{
unsigned int i, j;
for(i = 0; i < 4; i++) //..... Metal Detector Delay i < 4, 5, 6
{
for(j = 0; j < 30000UL;)
{
j++;
}
}
}

void Delay()
{
unsigned int i;
for(i = 0; i < 10000UL;) //Delay for keypad digits
{
i++;
}//end for i
}//end Delay

void main()
{
bit bFlag = 0;
while(1)
{
if(btn2 & btn1 & !bFlag)
{
led1 = 0;
wait();
led1 = 1;
while(btn2);
}

Page | 46
if(btn3 & btn1 & !bFlag)
{
led2 = 0;
wait();
led2 = 1;
while(btn3);
}

if(!btn1 & !bFlag)


{
led3 = 0;
waitmetal();
led3 = 1;
}
//========================================================================
=========
//========================================================================
=========
col1 = gnd;
if (!col1 && !row1)
{
led4 = 0;
Code[0] = Code[1];
Code[1] = Code[2];
Code[2] = '1';
while(!row1)
row1 = 1;
Delay();
led4 = 1;
}

if (!col1 && !row2)


{
led4 = 0;
Code[0] = Code[1];
Code[1] = Code[2];
Code[2] = '4';
while(!row2)
row2 = 1;
Delay();
led4 = 1;
}
if (!col1 && !row3)
{
led4 = 0;
Code[0] = Code[1];
Code[1] = Code[2];
Code[2] = '7';
while(!row3)
row3 = 1;
Delay();
led4 = 1;
}
col1 = 1;

Page | 47
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++

col2 = gnd;
if (!col2 && !row1)
{
led4 = 0;
Code[0] = Code[1];
Code[1] = Code[2];
Code[2] = '2';
while(!row1)
row1 = 1;
Delay();
led4 = 1;
}
if (!col2 && !row2)
{
led4 = 0;
Code[0] = Code[1];
Code[1] = Code[2];
Code[2] = '5';
while(!row2)
row2 = 1;
Delay();
led4 = 1;
}
if (!col2 && !row3)
{
led4 = 0;
Code[0] = Code[1];
Code[1] = Code[2];
Code[2] = '8';
while(!row3)
row3 = 1;
Delay();
led4 = 1;
}
if (!col2 && !row4)
{
led4 = 0;
Code[0] = Code[1];
Code[1] = Code[2];
Code[2] = '0';
while(!row4)
row4 = 1;
Delay();
led4 = 1;
}
col2 = 1;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++
col3 = gnd;
if (!col3 && !row1)

Page | 48
{
led4 = 0;
Code[0] = Code[1];
Code[1] = Code[2];
Code[2] = '3';
while(!row1)
row1 = 1;
Delay();
led4 = 1;
}
if (!col3 && !row2)
{
led4 = 0;
Code[0] = Code[1];
Code[1] = Code[2];
Code[2] = '6';
while(!row2)
row2 = 1;
Delay();
led4 = 1;
}
if (!col3 && !row3)
{
led4 = 0;
Code[0] = Code[1];
Code[1] = Code[2];
Code[2] = '9';
while(!row3)
row3 = 1;
Delay();
led4 = 1;
}
if (!col3 && !row4)
//# Enter
{
led4 = 0;
if(Code[0] == '1' && Code[1] == '2' && Code[2] == '3')
{
led1 = 0;
wait();
// wait();
// wait();
// wait();
// wait();
// wait();
// wait();
// wait();
// wait();
// wait();
// wait();
// wait();
// wait();
// wait();
// wait();

Page | 49
// wait();
// wait();
// wait();

// led1 = 1;
bFlag = 1;
}
if(Code[0] == '4' && Code[1] == '5' && Code[2] == '6')
{
// led2 = 0;
wait();
led1 = 1;
bFlag = 0;
}
while(!row4)
row4 = 1;
Delay();
led4 = 1;
}
col3 = 1;

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++

}//while
}

Page | 50
Discussion
When testing the constructed metal detector it was found that:
The LED is ON when there is no metal near to the search coil.
The LED's light intensity decreases when a metallic object comes near to the search coil and the
LED becomes OFF when the object gets very closer from the search coil i.e. the circuit field
decreases.
This is an agreement with principles of electromagnetic.
The field of the search coil is more concentrated at its center and decreases with the distance
from it.
It is found that the effect of metallic objects increase as the size of this object increase, also
the effect of the metallic objects increase as the distance between it and the center of the search
coil decrease; this because the field becomes more concentrated.
In general the suitable size of the search coil is about 9.5''-11.5'' diameter However the
search coil used in this project is smaller than this size; this because the power is small and to use
larger search coils higher power is needed. The size of the search coil used was determined after
performing several experiments.

5.2 Conclusion
A metal detector was successfully constructed.
The limitations of this detector are:
1. It cannot distinguish between several types of metals.
2. Its detection region is small.
3. This metal detector is not portable

5.3 futures work


There are many updates which could be applied to this detector in the future in order to solve the
limitations of this detector and get detector that can be practically used.
Possible modifications are:
1. Increase the detection region of the detector; this may be done using high power to supply the
circuit.
2. Use LCD or headset as indicator, this also needs increasing the power.
3. Make it portable by using portable supply such as mobile battery.
4. Update this detector and let it determine the type of metal it detects, to do this another
technology is to be used.

Page | 51
References

IR sensor working
https://www.elprocus.com › infrared-ir-sensor-circuit-and-working

IR sensor based security system:


https://www.circuitspedia.com/category/security-alarm/

Page | 52

Vous aimerez peut-être aussi