Académique Documents
Professionnel Documents
Culture Documents
By
Teuseef (2015-UB-GCB-79532)
Department of Electronics
Government Post Graduate College,
Bannu. SESION 2015-2019
Page | 1
DEDICATION
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.
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
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...........................................................................................
Page | 7
Color LED ……………………………………………….
Chapter 4 Coding …………………………………..……………………………..
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.
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
7805 IC Rating
Input voltage range 7V- 35V
Current rating Ic = 1A
Page | 19
Pin Details of 7805 IC
Pin
Pin Function Description
No.
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.
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
Range: Up to 20cm
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.
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.
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.
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.
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
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.
Page | 31
Types of 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.
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.
Page | 35
partaken to a step-up transformer, which increases its peak voltage from
few hundred volts to few kilovolts.
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
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.
Page | 39
Diode
Diode is an electrical component that allows the flow of current
in only one direction.
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.
Page | 41
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
Page | 43
The Bi-color LED is a handy little component that
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
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>
Page | 45
sbit led1 = P2^0;//gate open
sbit led2 = P2^1;//gate close
sbit led3 = P2^2;//Metal sensed
sbit led4 = P2^3;
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);
}
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
Page | 51
References
IR sensor working
https://www.elprocus.com › infrared-ir-sensor-circuit-and-working
Page | 52