You are on page 1of 38

METAL DETECTING ROBOT

Submitted in the partial fulfillment of the requirement for the degree of


Electrical and Electronics Engineering
PREPARED BY FILMON TESFAHUN
TSEGAY KIDU
FILIMON KIDANE
YOHANNES FISSAHAYE
PROJECT ADVISOR MR. SIRAJ FILUM

DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENEGNEERING


MEKELLE INSTITUTE OF TECHNOLOGY

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


Acknowledgment

We want to express our greatest gratitude for the following people who been very
supportive. Mr. Siraj Filum who is our advisor, he was indeed supporting us more than what
he is expected. We want also to acknowledge our classmate Tadese Hadush who gave us the
components and documents he had. His contribution helped us a lot. Without his help the
project could have taken us a lot of time. Last but not the least, we want to say thank you for
Mr. Daniel Belay lab assistant and all the other lab assistants.

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


Abstract

The objective of this project is to operate the robot for detecting the bombs. This project is
very useful in military applications for detecting the bombs and also used in finding mines.
This project also improves the security performance. More over this is also used to detect a
metal.

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


CONTENTS
Acknowledgment...................................................................................................................................................i
Abstract.................................................................................................................................................................ii
CONTENTS........................................................................................................................................................iii
List of figures........................................................................................................................................................v
List of tables.........................................................................................................................................................v
List of acronyms..................................................................................................................................................v
CHAPTER ONE...................................................................................................................................................1
INTRODUCTION................................................................................................................................................1
1.1 PROBLEM OF STATEMENT...................................................................................................................1
1.2 OBJECTIVE OF THE PROJECT..............................................................................................................1
CHAPTER TWO..................................................................................................................................................2
2.1 Material required........................................................................................................................................2
CHAPTER THREE..............................................................................................................................................2
CIRCIUT DESIGN AND DISCUSSION OF COMPONENT............................................................................2
3.1 Circuit design of the project.......................................................................................................................3
3.2 8051/2 microcontroller...............................................................................................................................4
3.2.1 8051 Microcontroller...........................................................................................................................4
3.2.2 8052 Microcontroller...........................................................................................................................4
3.2.3 Difference between 8051 and 8052.....................................................................................................4
3.2.4 about the 8051......................................................................................................................................4
3.2.5 Typical applications.............................................................................................................................5
3.2.6 Basic Pins of Microcontroller..............................................................................................................5
3.2.7 Ports.....................................................................................................................................................7
3.2.8 Configuring for output.........................................................................................................................8
3.2.9 Configuring for input...........................................................................................................................8
3.2.10 Power Supply for the microcontroller...............................................................................................9
3.2.11 How fast 8051 works?.......................................................................................................................9
3.2.12 Oscillator Circuits............................................................................................................................10
3.2.13 Program Start Address.....................................................................................................................10
3.2.14 Special Function Register................................................................................................................11
3.2.15 General Purpose Registers...............................................................................................................11
3.2.16 A and B Registers.............................................................................................................................11
3.2.17 Data and Program Memory..............................................................................................................11
3.2.16 Internal Architecture..........................................................................................................................12
CHAPTER THREE............................................................................................................................................13
Metal detector.....................................................................................................................................................13
3.3.1 Operation of metal detector:..............................................................................................................13
Fig. metal detector while detecting for metal...........................................................................................15
3.3.2 Uses of metal detector.......................................................................................................................15
3. 4 why we Use of motor driver....................................................................................................................15
3.4.1 Motor driver IC L293D.....................................................................................................................15
3.4.2 Introduction to L293D IC..................................................................................................................16
3.4.3 L293D Connections...........................................................................................................................17
CHAPTER FOUR..............................................................................................................................................19
DC MOTOR.......................................................................................................................................................19
[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


4.1 Dc motor operation...............................................................................................................................19
4.2 Why dc motors?....................................................................................................................................24
4.3 Why two dc motors?.............................................................................................................................24
CHAPTER FIVE................................................................................................................................................25
5.1 How to program the robot.............................................................................................................................25
5.2 How the robot moves................................................................................................................................27
CHAPTER FIVE................................................................................................................................................28
5.1 Result and Discussion...................................................................................................................................28
5.2 Limitation and Recommendation.............................................................................................................28
CHAPTER SIX...................................................................................................................................................29
Reference used....................................................................................................................................................29
CHAPTER SEVEN............................................................................................................................................30
Appendix.............................................................................................................................................................30
CHAPTER EIGHT.............................................................................................................................................32
PCB DESIGN.....................................................................................................................................................32

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


List of figures

Fig 3.1: Block diagram representation of the circuit of the project


Fig 3.2 reset of pin of the microcontroller
Fig 3.3 Pin diagram of the 8051 DIP
Fig 3.4 Power supply to the microcontroller
Fig 3.5 Crystal frequency to the microcontroller
Fig 3.6 Internal Architecture of 8051 mc
Fig 3.7 metal detector
Fig 3.8 metal detector while detecting for metal
Fig 3.9 L293D motor driver
Fig 3.10 Connection of L293D with dc motor

List of tables
Table 3.1 Controlling of the robot using motor driver IC

Table 4.1 movement of the robot

List of acronyms

DIP : Dual in-line package


µf : microfarad
MU : Microcontroller
IC : Integrate circuit
EA : Enable
PSEA : Program store enable
EFROM : Electrical erasable Rom
UART : Universal asynchronous receiver and transmitter
2N3904 : NPN transistor
TTL : Transistor -Transistor logic

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


CHAPTER ONE
INTRODUCTION

1.1 PROBLEM OF STATEMENT

How do we detect if a fatal bomb or any metal?


Metal detector robot is a kind of simple device which is useful in detecting metal placed some
meters away from the detector.
When the robot moves around it generates a magnetic field through some circuits added to it.
The magnetic field it generate when it is near any metal it creates a magnetic attraction which
intern closes a switch connected to alarm circuit. Thus the alarm will produce a sound which
notifies us there is a metal around.

Bomb detector is just a metal detector which detects any metal in the required areas.
Bombs are made up of metal elements thus when a metal detector is near a bomb it will detect
it. The bomb detector is attached in the topside of the robot. Robot movements are controlled
by using keypad or switch.

The keypad is the set of keys in which each one controls the robot in a direction such as
forward, reverse, left and right. When any one key is pressed the corresponding signals are
encoded by the microcontroller and the microcontroller then instructs the driver to drive the dc
motors to the desired direction.

Driver circuit controls the motor, by which the robot movement is controlled. If any object
related to metal is there, bomb detecting mechanism finds that one and gives the signal to
micro controller. Now the micro controller activates the alarm driver circuits. So the alarm
makes sound for indication.

Once we are alarmed we have to take other measurements to safeguard our safety. The
most important thing is detecting its existence.

1.2 OBJECTIVE OF THE PROJECT


The main objective of the project

 To locate mines in the ground


[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


 To locate bomb in the battle field

 To secure lives and make safe civilians

CHAPTER TWO
2.1 Material required

For our project we have used the following components:

 5v Voltage regulator IC 7805 and


 DC motor
 Microcontroller 8052
 12v Motor driver IC LM293D
Metal detector components are listed below.
2 coils
9v voltage source
Capacitors:
2 of 220 µf16v electrolytic.
5 of 0.01 µf polyester.
5 of 0.01µf polyester.
Resistors:
All resistors 1/4 watt
6 of 10k
1 of 1K
1 of 2.2m ===== 2.2 Mega ohm
2 of 39k
Transistors:
6 transistors type 2N3904 or 2N2222A. .
Audio output:
8 ohm speaker will work but headphones or earpiece are preferable the higher the impedance
the better.

CHAPTER THREE

CIRCIUT DESIGN AND DISCUSSION OF COMPONENT

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


3.1 Circuit design of the project

Fig 3.1: Block diagram representation of the circuit of the project

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


3.2 8051/2 microcontroller

3.2.1 8051 Microcontroller

The Intel 8051 microcontroller is one of the most popular general purpose microcontrollers
in use today. The success of the Intel 8051 spawned a number of clones which are collectively
referred to as the MCS-51 family of microcontrollers, which includes chips from vendors such
as Atmel, Philips, Infineon, and Texas Instruments.

3.2.2 8052 Microcontroller

An 8052 microcontroller, generally speaking, is any microcontroller that has an instruction


set compatible with the MCS-51 standard. Intel made the original 8052 microcontroller back
in 1980. Since then, dozens of semiconductor firms have chosen the MCS-51 standard for
their lines of microcontrollers. When we speak of "8052" we are not just speaking of the Intel
8052, but also any other microcontroller that is compatible with the 8052 (it's faster then
writing 8052-compatible every time we make reference to it).

3.2.3 Difference between 8051 and 8052

8051 was the original microcontroller by Intel (based on the older, but slightly different
8048-family (MCS48)). 8052 is an enhanced version of 8051, adding extra 128 bytes of
internal RAM (only indirectly addressable) to 128 bytes present already in 8051 (both directly
and indirectly addressable), adding a third timer (Timer2, which has also 16-bit reload mode
and various other features), and in version with ROM/EPROM, twice as much ROM/EPROM
(8kB) as was in 8051 (4kB).
However, today, both "8051" and "8052" are often used interchangeably as a generic name
for the whole family.

3.2.4 about the 8051

The Intel 8051 is an 8-bit microcontroller which means that most available operations are
limited to 8 bits. There are 3 basic "sizes" of the 8051: Short, Standard, and Extended. The
Short and Standard chips are often available in DIP (dual in-line package) form, but the
Extended 8051 models often have a different form factor, and are not "drop-in compatible".

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


All these things are called 8051 because they can all be programmed using 8051 assembly
language, and they all share certain features (although the different models all have their own
special features).

Some of the features that have made the 8051 popular are:

 4 KB on chip program memory.


 128 bytes on chip data memory (RAM).
 4 register banks.
 128 user defined software flags.
 8-bit data bus
 16-bit address bus
 32 general purpose registers each of 8 bits
 16 bit timers (usually 2, but may have more, or less).
 3 internal and 2 external interrupts.
 Bit as well as byte addressable RAM area of 16 bytes.
 Four 8-bit ports, (short models have two 8-bit ports).
 16-bit program counter and data pointer.
 1 Microsecond instruction cycle with 12 MHz Crystal.

8051 models may also have a number of special, model-specific features, such as UARTs,
ADC, Operational amplifier, etc...

3.2.5 Typical applications

8051 chips are used in a wide variety of control systems, telecom applications, and robotics as
well as in the automotive industry. By some estimation, 8051 family chips make up over 50%
of the embedded chip market.

3.2.6 Basic Pins of Microcontroller

PIN 9: PIN 9 is the reset pin which is used to reset the microcontroller’s internal registers and
ports upon starting up. (Pin should be held high for 2 machine cycles.)

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


Fig 3.2 reset of pin of the microcontroller

PINS 18 & 19: The 8051 has a built-in oscillator amplifier hence we need to only connect a
crystal at these pins to provide clock pulses to the circuit.

PIN 40 and 20: Pins 40 and 20 are VCC and ground respectively. The 8051 chip needs +5V
500mA to function properly, although there are lower powered versions like the Atmel 2051
which is a scaled down version of the 8051 which runs on +3V.

PINS 29, 30 & 31: As described in the features of the 8051, this chip contains a built-in flash
memory. In order to program this we need to supply a voltage of +12V at pin 31. If external
memory is connected then PIN 31, also called EA/VPP, should be connected to ground to
indicate the presence of external memory. PIN 30 is called ALE (address latch enable), which
is used when multiple memory chips are connected to the controller and only one of them
needs to be selected. We will deal with this in depth in the later chapters. PIN 29 is called
PSEN. This is "program store enable". In order to use the external memory it is required to
provide the low voltage (0) on both PSEN and EA pins.

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


Fig 3.3 Pin diagram of the 8051 DIP

3.2.7 Ports
There are 4 8-bit ports: P0, P1, P2 and P3.

PORT P1 (Pins 1 to 8): The port P1 is a general purpose input/output port which can be used
for a variety of interfacing tasks. The other ports P0, P2 and P3 have dual roles or additional
functions associated with them based upon the context of their usage. The port 1 output
buffers can sink/source four TTL inputs. When 1s are written to portn1 pins are pulled high by
the internal pull-ups and can be used as inputs.

PORT P3 (Pins 10 to 17): PORT P3 acts as a normal IO port, but Port P3 has additional
functions such as, serial transmit and receive pins, 2 external interrupt pins, 2 external counter
inputs, read and write pins for memory access.

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


PORT P2 (pins 21 to 28): PORT P2 can also be used as a general purpose 8 bit port when no
external memory is present, but if external memory access is required then PORT P2 will act
as an address bus in conjunction with PORT P0 to access external memory. PORT P2 acts as
A8-A15, as can be seen from fig 1.1

PORT P0 (pins 32 to 39) PORT P0 can be used as a general purpose 8 bit port when no
external memory is present, but if external memory access is required then PORT P0 acts as a
multiplexed address and data bus that can be used to access external memory in conjunction
with PORT P2. P0 acts as AD0-AD7, as can be seen from fig 1.1

PORT P10: asynchronous communication input or Serial synchronous communication output.

3.2.8 Configuring for output


P0 is open drain.
– Has to be pulled high by external 10K resistors.
– Not needed if P0 is used for address lines

Writing to a port pin loads data into a port latch that drives a FET connected to the port pin.

P0: Note that the pull-up is absent on Port 0 except when functioning as the external
address/data bus. When a "0" is written to a bit in port 0, the pin is pulled low. But when a "1"
is written to it, it is in high impedance (disconnected) state. So when using port 0 for output,
an external pull-up resistor is needed, depending on the input characteristics of the device
driven by the port pin

P1, P2, P3 have internal pull-ups: When a "0" is written to a bit in these port , the pin is
pulled low ( FET-ON) ,also when 1 is written to a bit in these port pin becomes high (FET-
OFF) thus using port P1,P2,P3 is simple.

3.2.9 Configuring for input


At power-on all are output ports by default
To configure any port for input, write all 1’s (0xFF) to the port
Latch bit=1, FET=OFF, Read Pin asserted by read instruction

You can use a port for output any time. But for input, the FET must be off. Otherwise, you
will be reading your own latch rather than the signal coming from the outside. Therefore, a "1"
should be written to the pin if you want to use it as input, especially when you have used it for
output before. If you don't do these input high voltage will get grounded through FET so you
will read pin as low and not as high. An external device cannot easily drive it high

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


So, you should not tide a port high directly without any resistor. Otherwise, the FET would
burn.

3.2.10 Power Supply for the microcontroller

C1-1000 mf, C2-100 mf

The 78L05 is a 5V regulator. The input voltage ranges from 7V to 35V and the output voltage
is about 5V.

Fig 3.4 Power supply to the microcontroller

3.2.11 How fast 8051 works?

A cycle is, in reality, 12 pulses of the crystal. That is to say, if an instruction takes one
machine cycle to execute, it will take 12 pulses of the crystal to execute. Since we know the
crystal is pulsing 11,059,000 times per second and that one machine cycle is 12 pulses, we can
calculate how many instruction cycles the 8051 can execute per second:

11,059,000 / 12 = 921,583

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


3.2.12 Oscillator Circuits

The 8051 requires an external oscillator circuit. The oscillator circuit usually runs around
12MHz, although the 8051 (depending on which specific model) is capable of running at a
maximum of 40MHz. Each machine cycle in the 8051 is 12 clock cycles, giving an effective
cycle rate at 1MHz (for a 12MHz clock) to 3.33MHz (for the maximum 40MHz clock). The
oscillator circuit generates the clock pulses so that all internal operations are synchronized.

3.2.12.1 Why is such an oddball crystal frequency?

11.0592 MHz crystals are often used because it can be divided to give you exact clock rates
for most of the common baud rates for the UART, especially for the higher speeds (9600,
19200). Despite the "oddball" value, these crystals are readily available and commonly used.

Fig 3.5 Crystal frequency to the microcontroller

3.2.13 Program Start Address

The 8051 starts executing program instructions from address 0000 in the program memory.
The A register is located in the SFR memory location 0xE0. The A register works in a similar
fashion to the AX register of x86 processors. The A register is called the accumulator, and by
default it receives the result of all arithmetic operations.

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


3.2.14 Special Function Register

The Special Function Register (SFR) is the upper area of addressable memory, from
address 0x80 to 0xFF. A, B, PSW, DPTR are called SFR. This area of memory cannot be used
for data or program storage, but is instead a series of memory-mapped ports and registers. All
port input and output can therefore be performed by memory mov operations on specified
addresses in the SFR. Also, different status registers are mapped into the SFR, for use in
checking the status of the 8051, and changing some operational parameters of the 8051.

3.2.15 General Purpose Registers

The 8051 has 4 selectable banks of 8 addressable 8-bit registers, R0 to R7. This means that
there are essentially 32 available general purpose registers, although only 8 (one bank) can be
directly accessed at a time. To access the other banks, we need to change the current bank
number in the flag status register.

3.2.16 A and B Registers

The A register is located in the SFR memory location 0xE0. The A register works in a
similar fashion to the AX register of x86 processors. The A register is called the accumulator,
and by default it receives the result of all arithmetic operations. The B register is used in a
similar manner, except that it can receive the extended answers from the multiply and divide
operations. When not being used for multiplication and Division, the B register is available as
an extra general-purpose register

3.2.17 Data and Program Memory

The 8051 Microcontroller can be programmed in PL/M, 8051 Assembly, C and a number
of other high-level languages. Many compilers even have support for compiling C++ for an
8051.Program memory in the 8051 is read-only, while the data memory is considered to be
read/write accessible. When stored on EEPROM or Flash, the program memory can be
rewritten when the microcontroller is in the special programmer circuit.

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


3.2.16 Internal Architecture

Fig 3.6 Internal Architecture of 8051 mc

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


CHAPTER THREE
Metal detector
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 electric field of its own. If another coil is used to measure the electric
field, the change in the magnetic failed due to the metallic object can be detected.

3.3.1 Operation of metal detector:

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. The transmit coil and receive coil are sometimes the same coil.

This changing transmitted magnetic field causes electric currents to flow in metal targets.
These electric currents are called eddy currents, which in turn generate a weak magnetic field,
but their generated magnetic field is different from the transmitted magnetic field in shape and
strength. It is the altered shape of this regenerated magnetic field 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.

What make a metal detector buzz when you sweep it over buried treasure? Why is it important
to keep the detector moving?

1. A battery or power source in the top of the metal detector passes electricity to the
transmitter coil at the bottom.
2. When electricity flows through the transmitter coil, it creates a magnetic field all around
the coil.
[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


3. If you sweep the detector above a metal object, the magnetic field penetrates right
through it.
4. The magnetic field creates an electric field inside the object.
5. This electric field creates another magnetic field all around the object. The magnetic
field cuts through the receiver coil moving about up above it. The magnetic field makes
electricity flow around the receiver coil and up through the receiver circuit to a
loudspeaker that beeps to alert you you've found something in addition to the loud
speaker flashing LED can also be added in series with the loud speaker to give another
option for the users in case they fail to hear to sound.

The metal detector is triggered and you've found something! The closer you move the
transmitter coil to the piece of metal, the stronger the magnetic field the transmitter coil
creates in it, the stronger the magnetic field the metal creates in the receiver coil, the more
current that flows in the loudspeaker and the louder the noise.

Metal detector works based on James clerk Maxwell’s theory. So thank you, James Clerk
Maxwell, for helping us see how metal detectors work—by using electricity to create
magnetism, which creates more electricity somewhere else.

Coil A: Searching coil, Coil B: Reference coil, B+ and B- 9V Terminal battery


Fig 3.7 metal detector

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


Fig 3.8 metal detector while detecting for metal

3.3.2 Uses of metal detector

Metal detectors aren't just used to find coins on the beach. You can see them in walk-through scanners at
airports (designed to stop people carrying guns and knives onto airplanes or into other secure places such as
prisons and hospitals) and in many kinds of scientific research.

3. 4 why we Use of motor driver


From microcontroller we can’t connect a motor directly because microcontroller can’t give
sufficient current to drive the DC motors. Motor driver is a current enhancing device; it can
also act as a switching device. Thus we insert motor driver between the motor and
microcontroller.
Motor driver takes the input signals from microcontroller and generates corresponding output
for motor.

3.4.1 Motor driver IC L293D

Motor driver is basically a current amplifier which takes a low-current signal from the
microcontroller and gives out a proportionally higher current signal which can control and
drive a motor.

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


3.4.2 Introduction to L293D IC

L293D IC generally comes as a standard 16-pin DIP (dual-in line package). This motor driver
IC can simultaneously control two small motors in either direction; forward and reverse with
just 4 microcontroller pins (if you do not use enable pins). Some of the features (and
drawbacks) of this IC are:

1. Output current capability is limited to 600mA per channel with peak output current
limited to 1.2A (non-repetitive). This means you cannot drive bigger motors with this
IC. However, most small motors used in hobby robotics should work. If you are unsure
whether the IC can handle a particular motor, connect the IC to its circuit and run the
motor with your finger on the IC. If it gets really hot, then beware... Also note the words
"non-repetitive"; if the current output repeatedly reaches 1.2A, it might destroy the
drive transistors.
2. Supply voltage can be as large as 36 Volts. This means you do not have to worry much
about voltage regulation.
3. L293D has an enable facility which helps you enable the IC output pins. If an enable
pin is set to logic high, then state of the inputs match the state of the outputs. If you pull
this low, then the outputs will be turned off regardless of the input states
4. The datasheet also mentions an "over temperature protection" built into the IC. This
means an internal sensor senses its internal temperature and stops driving the motors if
the temperature crosses a set point
5. Another major feature of L293D is its internal clamp diodes. This fly back diode helps
protect the driver IC from voltage spikes that occur when the motor coil is turned on
and off (mostly when turned off)
6. The logical low in the IC is set to 1.5V. This means the pin is set high only if the voltage
across the pin crosses 1.5V which makes it suitable for use in high frequency
applications like switching applications (up to 5KHz)
7. Lastly, this integrated circuit not only drives DC motors, but can also be used to drive
relay solenoids, stepper motors etc.

Fig 3.9 L293Dmotor driver

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


3.4.3 L293D Connections

The circuit shown to the right is the most basic implementation of L293D IC. There are 16
pins sticking out of this IC and we have to understand the functionality of each pin before
implementing this in a circuit.

1. Pin1 and Pin9 are "Enable" pins. They should be connected to +5V for the drivers to
function. If they pulled low (GND), then the outputs will be turned off regardless of the
input states, stopping the motors. If you have two spare pins in your microcontroller,
connect these pins to the microcontroller, or just connect them to regulated positive 5
Volts.
2. Pin4, Pin5, Pin12 and Pin13 are ground pins which should ideally be connected to
microcontroller's ground.
3. Pin2, Pin7, Pin10 and Pin15 are logic input pins. These are control pins which should
be connected to microcontroller pins. Pin2 and Pin7 control the first motor (left); Pin10
and Pin15 control the second motor (right).
4. Pin3, Pin6, Pin11, and Pin14 are output pins. Tie Pin3 and Pin6 to the first motor, Pin11
and Pin14 to second motor
5. Pin16 powers the IC and it should be connected to regulated +5Volts
6. Pin8 powers the two motors and should be connected to positive lead of a secondary
battery.

Fig 3.10 connection of


DC motor and motor driver IC

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


Truth table

How do we control the direction of these motors? Let us take an example:

Suppose you need to control the left motor which is connected to Pin3 (O1) and Pin6 (O2).
As mentioned above, we require three pins to control this motor - Pin1 (E1), Pin2 (I1) and
Pin7 (I2). Here is the truth table representing the functionality of this motor driver.

Pin 1 Pin 2 Pin 7 Function

high High low Motor move forward

high Low high Motor move reverse

high High high stop

high Low low stop

low X X stop

Table 3.1 Controlling of the robot using motor driver IC

NB. X= it doesn’t matter whether it is high or low, High ~+5V, Low ~0V

The above table works the same way for the other motor connected at pin 10 & 15.

In the above truth table you can observe that if Pin1 (E1) is low then the motor stops,
irrespective of the states on Pin2 and Pin7. Hence it is essential to hold E1 high for the driver
to function, or simply connect enable pins to positive 5 volts.

With Pin1 high, if Pin2 is set high and Pin7 are pulled low, then current flows from Pin2 to
Pin7 driving the motor in anti-clockwise direction? If the states of Pin2 and Pin7 are flipped,
then current flows from Pin7 to Pin2 driving the motor in clockwise direction.

The above concept holds true for other side of the IC too. Connect your motor to Pin11 and
Pin14; Pin10 and Pin15 are input pins, and Pin9 (E2) enables the driver.

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


CHAPTER FOUR
DC MOTOR
A DC motor is an electric motor that runs on direct current electricity. DC motors were used
to run machinery, often eliminating the need for a local steam engine or internal combustion
engine. DC motors can operate directly from rechargeable batteries, providing the motive
power for the first electric vehicles.

4.1 Dc motor operation


Current carrying conductor tends to move at the right angle to flux lines when it is located
between two magnets because of the interaction between magnetic fields of the wire and main
field.

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


When the conductor moves out of the main field the wire stops because there is no longer any
interaction between the flux lines and no force is created.
Since a motor produces a continuous rotary motion, the conductor that placed in side of the
main field, between two magnets, must be in the shape of the loop.

When the loop is connected to dc supply, electron current flow from point A to B point of the
loop, and from point C to D on the other side of the loop .Because the current flows through
the segment of the loop that are opposite each other, the segment of the one side pushes
upward while the segment on the side pushes downward.

Fig. 4.1

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


Because the loop is design to pivot on its axis, the combined forces create a twisted action
called torque.

When the loop reaches a position perpendicular to the main field, there is no interaction
between the flux lines to cause the loop to rotate. This position is called neutral plane.
Due to inertia the loop continues to rotate counter clock wise (CCW).

However, since the direction of current flow through the loop doesn’t change the interaction
between the conductor segments and the main field develops a force in the opposite direction.
Instead of continuing in the CCW direction, the loop stops and changes direction. an
oscillating motion is produced until the armature settles in the normal plane.

The continuous motion of the rotor is achieved by reversing the direction of current through
the loop as it passes the neutral plane, a switching device, called a commutator, achieves the
current change.

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


The commutator is shaped like a ring that is split in to two segments.
Each segment is connected to an end of the loop. The commutator and wire loop rotate
together, and are referred to as the armature.
As the armature turns, the commutator makes contact with carbon brushes that supply current
to the wire loop. Each brush is connected to a DC power supply.

Here is how the switching action of the brushes and commutator reverses current flow to
cause the armature to rotate in one direction. This swinging action is called commutation.
Position 1.In this position current enters the loop through the negative brush and exits through
the positive brush.

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


Position 2
When the rotor aligns with the neutral plane, the brushes make contact with both commutator
segments. The rotor loop shorts out, and current flows from one brush to the other through the
commutator segments.

The result is no torque is produced but the inertia causes the rotor to continue turning past the
neutral position.

Position 3
As the rotor turns in to the main field the switching action of the commutator reverses the
direction of current flow. This causes the current to flow in to the rotor section closest to the
South Pole of the magnet, as it did in position 1.

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


The torque that is developed causes the rotor to continue twisting in the CCW direction.
Position 4
As the rotor turns out of the main field, it aligns with the neutral plane position.
Inertia will cause the rotor to continue turning into main field, causing the rotation cycle to be
repeated.

The rotation of the armature continues in one direction because the commentator keeps
reversing the direction that current flows through the loop every half turn (180º).
In this way, the magnetic field of the rotor always interacts the same way with the main field
to main field to main field to maintain a continuous torque in one direction.

4.2 Why dc motors?


Dc motors are most easy to control. One dc motor requires only 2 signals for its operation. If
we want to change its direction just reverse the polarity of power across it. We can vary the
speed by varying the voltage across the motor.
4.3 Why two dc motors?
By using two dc motors we can move the robot in any direction.

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


CHAPTER FIVE

5.1 How to program the robot

The robot is programmed using microcontroller program. The program written is used to
send controlling signals for the motor driver IC which are connected to specific pins of the
microcontroller. By managing signals of the mc pins we can control the signals direction to
the DC motors which enable the motors to move in different directions.
The flowchart of the program is as follow.

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


Fig flowchart of the program

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


5.2 How the robot moves

The robot moves by the action of the two DC motors. Terminals of the DC motor are
connected to the pins of motor driver IC. Based on the states of the switch input to the ports of
microcontroller, the microcontroller is programmed in such a way that it gives an output of 5
volt in the ports that are connected to the motor driver IC.
Then the Motor driver IC drives the two DC motors in any of the 4 directions: right, left,
forward and backward.
If the two DC motors get 12v on their positive terminal and 0v on their negative terminals
the motor moves forward direction.
If the two DC motors get 0v on their positive terminal and 12v on their negative terminals
the motor moves backward direction.
If the two DC motors get 12v on their positive terminal and 12v on their negative or 0v on
both of their terminals the motors stops.
If the right side DC motors get a potential difference on its terminal the motor turns to the
left.
If the left side DC motors get a potential difference on its terminal the motor turns to the right.

Table of robot movement


Left motor Right motor Robot movement
straight straight Straight(forward)
stop straight left
Reverse straight Sharp left
straight stop right
straight reverse Sharp right
Reverse reverse Reverse(backward)

Table 4.1: movement of the robot

While the robot moves the metal detector sends magnetic field to detect a metal and when it
detects any metal element it activates an alarm.

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


CHAPTER FIVE
5.1 Result and Discussion
After we built the robot and operate the switches we saw the robot moving in all the four
directions; right, left, forward and backward directions. It continues moving until we change
its direction by changing the state of the any one the 4 switches. The switches from left to
right will be used to move the robot forward, backward, right and left directions respectively.
To stop the robot we can make two or switches on or we can turn the power supply off.
As the robot moves the metal detector searches for any metal element nearby.

5.2 Limitation and Recommendation

While we were doing our project we have come up with the following limitations.
 We were planning to control the direction of the movement of robot by designing RF
remote control but we ended up by replacing it by switch. Though switch works well it
is not convenient to handle it.
 We were also planning to use solar power as a source of power for the robot
We didn’t use it because we think that it will add weight to the robot.

Thus we recommend any follow students to add the solar panel and RF remote control to
what we have done.

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


CHAPTER SIX
Reference used
1. http://en.wikibooks.org/w/index.php?title=Embedded_Systems/8051_Microcontroller&oldi
d=2313606
2. http://www.wisc-online.com/Objects/ViewObject.aspx?ID=IAU13208
3. http://www.scribd.com/doc/4473227/Line-Follower-Robot

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


CHAPTER SEVEN
Appendix
Program to drive DC motor of the robot

#include<reg52.h>
sbit sw1=P1^0;
sbit sw2=P1^1;
sbit sw3=P1^2;
sbit sw4=P1^3;
sbit A=P2^0;
sbit b=P2^1;
sbit C=P2^2;
sbit D=P2^3;
void delay(unsigned char);
void main()
{
unsigned char Z;
P1=0XFF; // make p1 input
P2=0X00; // make p2 as output
while(1)
{
Z=P1;
Z=Z&0X0F;// mask the upper 4 bits
switch(Z)
{
case(0):
{
A=0;b=0;
C=0;D=0;
delay(250);
break;
}
case(1):// move forward =>1=0001 which is the 3rd switch
{
A=1;b=0;
C=1;D=0;
delay(2);
[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


break;
}
case(2):// move backward =>2=0010 which is the 2rd switch
{
A=0;b=1;
C=0;D=1;
delay(2);
break;
}

case(4):// move to the right =>4=0100 which is the 3rd switch


{
A=1;b=0;
C=0;D=0;
delay(2);
break;
}

case(8):// move to the left =>8=1000 which is the 4rd switch


{
A=0;b=0;
C=1;D=0;
delay(2);
break;
}

default: // otherwise stop the motor


{
A=0;b=0;
C=0;D=0;
delay(2);
break;
}
}
}
[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1


}
void delay(unsigned char x)
{
unsigned char i,j;
for(i=0;i<x;i++)
for(j=0;j<=100;j++);
for(j=0;j<=100;j++);
}

CHAPTER EIGHT
PCB DESIGN

[ Ty p e t h e c o m p a n y a d d r e s s ]

MEKELLE INSTITUTE OF TECHNOLOGY (EIT-M) 1

You might also like