navigation robot document ion
TRANSCRIPT
Navigation Robot
Introduction
Autonomous navigation of a mobile robot is a challenging task. Much work
has been done in indoor navigation in the last decade. Fewer results have been
obtained in outdoor robotics. Since the early 90's, the Global Positioning System
(GPS) has been the main navigation system for ships and aircrafts. In open fields,
satellite navigation gives absolute position accuracy. The absolute heading
information is also obtained by satellite navigation when the mobile robot is in
motion. However, the use of GPS satellite navigation is mainly restricted to open
areas where at least three satellites can be seen. For example, mobile robots working
in underground or deep open mines cannot use satellite navigation at all, and in forest
or city areas, there are serious limitations to its use. It is obvious that the use of
several alternative sensors according to the environment will make the navigation
system more flexible.
The goal of this thesis is to develop a multi sensor navigation system for
unknown outdoor environments. Navigation should be possible in unstructured
outdoors as well as indoor environments. The system should use all available sensor
information and emphasize those that best suit the particular environment. The
sensors considered in this thesis include a temperature sensor, camera sensor and light
dependent resistor. The main contribution of the thesis is a flexible navigation system
developed and tested for performing versatile tasks in an outdoor environment.
Today’s men rely heavily on robotics, which are capable of penetrating areas where
manned vehicles cannot enter while keeping humans out of harm’s way.
Similarly there cannot be lost with impunity; they cannot enter into or create
toxic environments. One must avoid both the purely negative consequences that are
positive for one's enemies (the taking of prisoners of war, hostages and other potential
sources of sensitive information). And also they face severe threat from these
Unmanned Air Vehicles.
Page 1
Navigation Robot
Robots are tremendously flexible devices, and can also be used for a variety
of purposes like navigation of unknown areas, defusing land mines, patrolling at
boarders, etc.
Nowadays, with the advancement of technology, particularly in the field of
computers, micro processors, micro controllers and communications, all the activities
in our day-to-day living have become a part of information and we find computers
and micro controllers at each and every application.
In our project we used micro controllers connected with FM transmitter at
base station to send commands to navigation robot. At vehicle end we used micro
controller connected with FM receiver to receive commands, and to control
movements of the vehicle. Stepper motors are used for driving the vehicle because
they rotate in precise angles, so that we can control the vehicle precisely at required
directions.
We are using total three stepper motors. Two for forward, reverse, left and
right directions. Third one is used for rotating camera position in to different angels. If
the first two motors coupled to wheels, are moving in clock wise direction then the
vehicle moves in forward direction and If they are moving in anti clock wise direction
then the vehicle moves in reverse direction. If left motor is rotating with more speed
and right motor is rotating with less speed, then the vehicle turns towards right
direction. Similarly if right motor is rotating with more speed and left motor is
rotating with less speed, then the vehicle turn towards left direction. If the third motor
moves in clockwise direction then the camera moves towards left and if it moves in
anti clockwise direction then the camera moves towards right.
Page 2
Navigation Robot
Operation principle of Navigation robot vehicle
In the base station we used keys to control the Robot these are connected to
the 8051mc.The 8051mc takes commands from operator using keys and sending serial
data to FM transmitter. The signal is frequency modulated with 100MHz carrier,
which ultimately forms FSK. The signal is radiated using single Arial in to free space.
The FM receiver receives the temperature feedback sent by the FM Tx at the vehicle
section. The data received by the FM Rx is given to the micro controller (AT89C51)
and from it to the LCD display, which displays the temperature. It is also used to
display the commands at the same time its shows the temp. We used a TV, which has
an in built AM Rx. It is used to show the location of robot with the help of camera at
the vehicle section.
In the vehicle section, the FM receiver is constructed using TEA5710 I.C., which
consists, RF amp, mixer, local oscillator, IF amplifiers, voltage limiters and
demodulators. It receives the signals using single Arial and gives demodulated o/p.
This o/p signal is further conditioned using LM324 op-amp. The o/p of the receiver is
very low, so its level is amplified using differential amplifier. The o/p is fed to micro
controller (AT89C51). The micro controller receives the serial data and accordingly
drives the stepper motors. Here we used uni-polar stepper motors, which will have
four windings. Each winding is driven with MOSFET (IRF540) for better switching
and lesser power dissipation. The BC548 transistors are used to drive the MOSFET,
because controller o/p is in the range of +5V and MOSFET is operating in the range
of +12V. Full step mode is used for driving the stepper motor. In this mode, the
rotating angle per step is 1.8º and torque is high. The gear ratio is 20:1 so in order to
rotate the wheel one revolution, the stepper motor will have to move 20 revolutions.
For one revolution of stepper motor we have to send 200 pulses i.e. 200 X 1.8º = 360º.
So these operations are achieved using assembly level programming (ALP). The
program is embedded permanently in to the flash memory of micro controller at the
time of development.
Page 3
Navigation Robot
Block diagram and description
The block diagram and its brief description of the project work are explained
in block wise and this block diagram consists the following blocks.
At The Transmitter End :
1. RF transmitter
2. RF Receiver
3. LCD Display
4. Power supply
5. Micro controller unit
6. TV
At The Receiver End:
1. RF transmitter
2. AM transmitter
3. RF Receiver
4. Signal Amplifier
5. Micro controller unit
6. Motor driver
7. Temperature sensor
8. ADC
9. LDR sensor
10. Camera
11. Motors
12. Battery power supply
Page 4
Navigation Robot
Block diagram of vehicle control Section (transmitter section)
Keys Micro controller RF transmitter
TV LCD Display RF Rx
230V I/P Power Supply +5V
Block diagram of vehicle unit (receiver section)
RF RX Micro Motor 1 Driver MOT1
Controller Motor 2 Driver MOT2
Amplifier Unit Motor 3 Driver MOT3
8051MC
RFTX Camera
ADC 808
AM TX
LM 35
Page 5
Navigation Robot
Voltage regulator +12V
+12V
Battery Voltage regulator +5V
Description of vehicle control Section
F.M. Transmitter
This block generates a continuous frequency of 35MHz, which is used to form
a permanent link between the transmitter and receiver, and this is known as carrier
frequency. The output serial port is fed to this F.M radio transmitter. This is a
frequency modulated radio transmitter. The radiating power of the transmitter is
20mw.
FM Receiver
The FM receiver is designed with IC TEA5710, which is AM/FM Radio
receiver IC, operates at a local oscillator of 88 - 108MHz and is tuned with the
transmitter. This IC consists of built in RF amplifier, a double balanced mixer, local
oscillator, a two stage IF amplifier, a quadrature demodulator for a ceramic filter and
an automatic frequency control. The built in RF amplifier, a part from the
amplification of received RF signal, it also reduces the Noise figure, which could
other wise be a problem because of the large band widths needed for FM. It also
matches the input impedance of the radio receiver with the antenna.
.
LCD Display
Lcd display is used to display the temperature received from the FM RX and
also it is used to display the movement of the keys. The Intersil ICL7106 are high
Page 6
Navigation Robot
performance, low power, 31/2 digit A/D converters. Included are seven segment
decoders, display drivers, a reference, and a clock. The ICL7106 is designed to
interface with a liquid crystal display (LCD) and includes a multiplexed back plane
drive. The ICL7106 bring together a combination of high accuracy, versatility, and
true economy. It features auto zero to less than 10μV, zero drift of less than 1μV/oC,
input bias current of 10pA (Max), and rollover error of less than one count. True
differential inputs and reference are useful in all systems, but give the designer an
uncommon advantage
When measuring load cells, strain gauges and other bridge type transducers. Finally,
the true economy of single power supply operation (ICL7106) enables a high
performance panel meter to be built with the addition of only 10 passive components
and a display.
Features
• Guaranteed Zero Reading for 0V Input on All Scales
• True Polarity at Zero for Precise Null Detection
• 1pA Typical Input Current
• True Differential Input and Reference, Direct Display Drive
- LCD ICL7106
• Low Noise - Less Than 15μVP-P
• On Chip Clock and Reference
• Low Power Dissipation - Typically Less Than 10mW
• No Additional Active Circuits Required
• Enhanced Display Stability
Power supply
Power supply unit provides +5V & +9V regulated power to the system. It
consists of two parts Rectifier and Monolithic IC voltage regulators. The o/p voltage
of the battery is +12V so we give the supply of battery to regulators. The output
voltage of the rectifier then regulated to +5V using LM7805 monolithic IC voltage
regulators and the o/p voltage of LM7809 monolithic IC voltage regulators is
regulated to +9V.
Page 7
Navigation Robot
Description of vehicle unit
F.M. Transmitter
This block generates a continuous frequency of 45MHz, which is used to form
a permanent link between the transmitter and receiver, and this is known as carrier
frequency. The output serial port is fed to this F.M radio transmitter. This is a
frequency modulated radio transmitter. The radiating power of the transmitter is
20mw.This is used to send the temperature from LM35, which is a temp sensor as o/p
from LM35 is analog so we converted it to digital using ADC0808.
FM Receiver
The FM receiver is designed with IC TEA5710, which is AM/FM Radio
receiver IC, operates at a local oscillator of 88 - 108MHz and is tuned with the
transmitter. This IC consists of built in RF amplifier, a double balanced mixer, local
oscillator, a two stage IF amplifier, a quadrature demodulator for a ceramic filter and
an automatic frequency control. The built in RF amplifier, a part from the
amplification of received RF signal, it also reduces the Noise figure, which could
other wise be a problem because of the large band widths needed for FM. It also
matches the input impedance of the radio receiver with the antenna.
Signal Amplifier
Here we are using a differential amplifier in series with a voltage
follower constructed by using LM324 quad op-amps. The low level signal will be
buffered and amplified to TTL level for input of micro controller. The LM324 series
consists of four independent, high gains; internally frequency compensated
operational amplifiers, which were designed specifically to operate from a single
power supply over a wide range of voltages. Operation from split power supplies is
also possible and the low power supply current drain is independent of the magnitude
of the power supply voltage.
Page 8
Navigation Robot
Application areas include transducer amplifiers, DC gain blocks and all the
conventional op amp circuits, which now can be more easily implemented in single
power supply systems. For example, the LM324 series can be directly operated off of
the standard +5V power supply voltage, which is used in digital systems and will
easily provide the required Interface electronics without requiring the additional ±15V
power supplies.
Unique Characteristics
In the linear mode the input common-mode voltage Range includes ground and the
output voltage can also
Swing to ground, even though operated from only a
Single power supply voltage
The unity gain cross frequency is temperature compensated
Eliminates need for dual supplies
Four internally compensated op amps in a single Package
Allows directly sensing near GND and VOUT also goes to GND
Compatible with all forms of logic
Power drain suitable for battery operation
Features
Internally frequency compensated for unity gain
Large DC voltage gain 100 dB
Wide bandwidth (unity gain) 1 MHz (Temperature compensated)
Wide power supply range: Single supply 3V to 32V or dual supplies ±1.5V to ±16V
Very low supply current drain (700 µA)—essentially independent of supply voltage
Low input biasing current 45 nA (Temperature compensated)
Low input offset voltage 2 mV and offset current: 5 nA
Temperature sensor
The LM35 series are precision integrated-circuit temperature sensors, whose
output voltage is linearly proportional to the Celsius (Centigrade) temperature. The
LM35 thus has an advantage over linear temperature sensors calibrated in ß Kelvin, as
the user is not required to subtract a large constant voltage from its output to obtain
Page 9
Navigation Robot
convenient Centigrade scaling. The LM35 does not require any external calibration or
trimming to provide typical accuracies of g (/4ßC at room temperature and g*/4ßC
over a full b55 to a150ßC temperature range. Low cost is assured by trimming and
Calibration at the wafer level. The LM35's low output impedance, linear output, and
precise inherent calibration make interfacing to readout or control circuitry especially
easy. It can be used with single power supplies, or with plus and minus supplies. As it
draws only 60 mA from its supply, it has very low self-heating, less than 0.1ßC in still
air. The LM35 is rated to operate over a b55ß to a150ßC temperature range, while the
LM35C is rated for a b40ß to a110ßC range (b10ß with improved accuracy). The
LM35 series is available packaged in hermetic TO-46 transistor packages, while the
LM35C, LM35CA, and LM35D are also available in the plastic TO-92 transistor
package. The LM35D is also available in an 8-lead surface mount small outline
package and a plastic TO-202 package.
Features
Calibrated directly in ß Celsius (Centigrade)
Linear a 10.0 mV/ßC scale factor
0.5ßC accuracy guarantee able (at a25ßC)
Rated for full b55ß to a150ßC range
Suitable for remote applications
Low cost due to wafer-level trimming
Operates from 4 to 30 volts
Less than 60 mA current drain
Low self-heating, 0.08ßC in still air
No linearity only g (/4ßC typical
Low impedance output, 0.1 X for 1 mA load
Analog to digital converter (ADC)
The ADC0808 is used to convert the analog output of the LM35 to digital
output. The ADC0808 are monolithic CMOS devices with an 8-channel multiplexer,
an 8-bit analog-to-digital (A/D) converter, and microprocessor-compatible control
logic. The 8-channel multiplexer can be controlled by a microprocessor through a 3-
bit address decoder with address load to select any one of eight single-ended analog
Page 10
Navigation Robot
switches connected directly to the comparator. The 8-bit A/D converter uses the
successive-approximation conversion technique featuring a high-impedance threshold
detector, a switched-capacitor array, a sample and- hold, and a successive-
approximation register (SAR). Detailed information on interfacing to most popular
microprocessors is readily available from the factory. The comparison and converting
methods used eliminate the possibility of missing codes, non monotonic, and the need
for zero or full-scale adjustment. Also featured are latched 3-state outputs from the
SAR and latched inputs to the multiplexer address decoder. The single 5-V supply and
low power requirements make the ADC0808 especially useful for a wide variety of
applications. Radiometric conversion is made possible by access to the reference
voltage input terminals. The ADC0808 are characterized for operation from –40C to
85C.
Features
Total Unadjusted Error . . . 0.75 LSB Max for ADC0808 and 1.25 LSB Max for
ADC0809
Resolution of 8 Bits
100-s Conversion Time
Radiometric Conversion
Monotonicity Over the Entire A/D Conversion Range
No Missing Codes
Easy interface with Microprocessors
Latched 3-State Outputs
Latched Address inputs
Single 5-V Supply
Low Power Consumption
Designed to Be Interchangeable With National Semiconductor ADC0808,
ADC0809
Micro controller unit
Page 11
Navigation Robot
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. It consists of 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 Mode stops 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.
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
Motor driver
Page 12
Navigation Robot
For driving of motor coils, we used IRF540 MOSFET, which Utilize advanced
processing techniques to achieve the lowest possible on-resistance per silicon area.
This benefit, Combined with the fast switching speed and ruggedized device design
that HEXFET Power MOSFETs are well Known for, provides the designer with an
extremely efficient device for use in a wide variety of applications. It can operate up
to a temperature up to 175°C Operating Temperature. This MOSFET is driven by
BC548 transistor. For each motor four MOSFET sections are required.
Motors
Unipolar stepper motors are used for moving the vehicle, because the driving
circuit is simpler and yet it works well. It consists four windings and there are two
driving methods are there. One is full step and other is half step. Full step moves 1.8º
and half step moves 0.9º. The torque for full step driving is more compared to half
step driving.
Battery power supply
A +12v, 7Ah Ni – cad, maintenance free battery is used to power the vehicle.
The voltage of the battery is further regulated to +5V & +9V using LM7805 and
LM7809 monolithic IC voltage regulators for I.C. operations.
Page 13
Navigation Robot
Functional description of vehicle control section
F.M. Transmitter
Fig – F.M. transmitter
This block generates a continuous frequency of 35MHz, which is used to form a
permanent link between the transmitter and receiver, and this is known as carrier
frequency. The output of serial port is fed to this F.M radio transmitter. This is a
frequency modulated radio transmitter. The radiating power of the transmitter is
20mw, and it is designed using BC 494 B high frequency switching transistor.
This FM circuit uses a medium power VHF oscillator built around BF494
transistor. The instantaneous frequency of the carrier is varied directly in accordance
with the base band signal by means of a device known as VCO (Voltage Controlled
Oscillator) one of implementing such a device is to use to sinusoidal oscillator having
a relatively high-Q frequency. Determining Network and to control the oscillator by
symmetrical incremental variation of the reactive components. Thus the serial data is
modulated at 100MHz carrier.
A varicap-based circuit is used for good quality frequency modulation. By
varying variable capacitor (trimmer) or by adjusting spacing of coil L1 can alter
operating frequency. Coil L1 consists of five turns of 20 SWG wire, space wound air
core. Antenna tap is taken at one turn from bottom end. By using 70cm single wire
Ariel, range of up to 50 fts may be expected. Using a multi-element ground plane
antenna can extend the range. Length of each pole is 70 cms for 100MHz frequency.
Page 14
12345
Navigation Robot
Vertical pole is the active radiator. All radials are shorted and connected to ground of
PCB.
Power supply
Fig – power supply
Power supply unit provides 5V regulates power supply to the systems. It
consists of two parts namely,
1. Rectifier
2. Monolithic voltage regulator
Rectifier
Here the step down transformer 230-0v/9-0-9 and gives the secondary current
up to 500mA, to the Rectifier. The Transformer secondary is provided with a center
tap. Hence the voltage V1 and V2 are equal and are having a phase difference of
1800. So it is anode of Diode D1 is positive with respect to the center tap, the anode
of the other diode d2 will be negative with respect to the center tap. During the
positive half cycle of the supply D1 conduct’s and current flows through the center
tap D1 and load. During this period D2 will not conduct as its anode is at a negative
potential. During the negative half cycle of the supply voltage, the voltage on the
diode D2 will be positive and hence D2 conducts. The current flows through the
transformer winding, Diode D2 and load. It is to be noted that the current i1 and i2
are flowing in the same direction in load.
The average of the two current i1 and i2 flows through the load producing a
voltage drop, which is the D.C. output voltage of the rectifier. Using capacitor filters
Page 15
Navigation Robot
the ripple in the out waveform can be minimized. The voltage can be regulated by
using monolithic IC voltage regulators.
Monolithic IC voltage regulator:
A voltage regulator is a circuit that supplies a constant voltage regardless of
changes in load currents. Although voltage regulators can be designed using op-amps,
it is quicker and easier to use IC voltage regulators. Furthermore, IC voltage
regulators are versatile and relatively inexpensive and are available with features such
as programmable output, current/voltage boosting, internal short-circuit current
limiting, thermal shutdown and floating operation for high voltage applications
Here we are using 7800 series voltage regulators. The 7800 series consists of
3-terminal +ve voltage regulators with seven voltage options. These ICs are designed
as fixed voltage regulators and with adequate heat sinking can deliver output currents
in excess of 1A. Although these devices do not require external components, such
components can be used to obtain adjustable voltages and currents. For proper
operation a common ground between input and output voltages is required. In
addition, the difference between input and output voltages (Vi – Vo) called drop out
voltage, must be typically 1.5V even during the low point as the input ripple voltage.
Further more, the capacitor Ci is required if the regulator is located an appreciable
distance from a power supply filter. Even though Co is not needed, it may be used to
improve the transient response of the regulator.
Typical performance parameters for voltage regulators are line regulation, load
regulation, temperature stability and ripple rejection. Line regulation is defined as the
change in output voltage for a change in the input voltage and is usually expressed in
milli volts or as a percentage of Vo. Temperature stability or average temperature
coefficient of output voltage (TCVo) is the change in output voltage per unit change in
temperature and is expressed in either milli volts/ºC or parts per million (PPM/ºC).
Ripple rejection is the measure of a regulator’s ability to reject ripple voltage. It is
usually expressed in decibels. The smaller the values of line regulation, load
regulation and temperature stability the better the regulation.
Functional description of vehicle unit
Page 16
Navigation Robot
FM Receiver
The FM receiver is designed with IC CXA1619BM/BS, which is AM/FM
Radio receiver IC, operates at a local oscillator of 88 - 108MHz and is tuned with the
transmitter. This IC consists of built in RF amplifier, a double balanced mixer, local
oscillator, a two stage IF amplifier, a quadrature demodulator for a ceramic filter and
an automatic frequency control. The built in RF amplifier, a part from the
amplification of received RF signal, it also reduces the Noise figure, which could
other wise be a problem because of the large band widths needed for FM. It also
matches the input impedance of the radio receiver with the antenna
Signal buffer and level converter
Fig – signal buffer
In the first stage the output of the op-amp is connected directly to inverting
input so that it acts as a voltage follower or buffer. This will prevent any loading of
signal by the next stage.
In the second stage a variable voltage reference is connected to non-inverting
input and signal is connected to inverting input. If the signal is lower then the
reference the output will go high (+5V), or if the signal is higher then the reference
then the output goes low (0V). Normally the signal level will be 2V for low and 2.5V
for high. After comparator the output will be 0V for high input and +5Vfor low input
i.e. the level is converted.
AM Transmitter
Page 17
Navigation Robot
This circuit is deliberately limited in power output but will provide amplitude
modulation (AM) of picture over the medium wave band.
The circuit is in two half’s, an audio amplifier and an RF oscillator. The
oscillator is built around Q1 and associated components. The tank circuit L1 and VC1
is tunable from about 500kHz to 1600KHz.. Q1 needs regenerative feedback to
oscillate and this is achieved by connecting the base and collector of Q1 to opposite
ends of the tank circuit.
The 1nF capacitor C7, couples signals from the base to the top of L1, and C2,
100pF ensures that the oscillation is passed from collector, to the emitter, and via the
internal base emitter resistance of the transistor, back to the base again. Resistor R2
has an important role in this circuit. It ensures that the oscillation will not be shunted
to ground via the very low internal emitter resistance, re of Q1, and also increases the
input impedance so that the modulation signal will not be shunted. Oscillation
frequency is adjusted with VC1.
Q2 is wired as a common emitter amplifier, C5 decoupling the emitter resistor
and realising full gain of this stage. The microphone is an electrets condenser mic and
Page 18
Navigation Robot
the amount of AM modulation is adjusted with the 4.7k preset resistors P1.
An antenna is not needed, but 30cm of wire may be used at the collector to increase
transmitter range.
Bit micro controller
The Micro controller is used for interface with FM receiver and stepper motors
and it gives proper stepping pulses for vehicle movements, by receiving serial data
from FM receiver.
Introduction
Looking back into the history of microcomputers, one would at first come
across the development of microprocessor i.e. the processing element, and later on the
peripheral devices. The three basic elements-the CPU, I/O devices and memory-have
developed in distinct directions. While the CPU has been the proprietary item, the
memory devices fall into general-purpose category and the I/O devices may be
grouped somewhere in-between.
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.
The AT89C51 provides for 4k EPROM/ROM, 128 byte RAM and 32 I/O
lines. It also includes a universal asynchronous receive-transmit (UART) device, two
16-bit timer/counters and elaborate interrupt logic. Lack of multiply and divide
instructions which had been always felt in 8-bit microprocessors/micro controllers,
has also been taken care of in the 89C51- Thus the 89C51 may be called nearly
equivalent of the following devices on a single chip: 8085 + 8255 + 8251 + 8253 +
2764 + 6116.
Page 19
Navigation Robot
In short, the AT89C51 has the following on-chip facilities:
4k ROM (EPROM on 8751)
128 byte RAM
UART
32 input-output port lines
Two, 16-bit timer/counters
Six interrupt sources and
On-chip clock oscillator and power on reset circuitry
Pin Description Of 8051
Pin Diagram
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 1sare 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
Page 20
Navigation Robot
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 pull-ups. 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 pull-ups and can be used as inputs. As inputs, Port
1 pins that are externally being pulled low will source current (IIL) because of the
internal pull-ups. 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 pull-ups. 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 pull-ups 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 pull-ups. 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 pull-ups 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 pull-ups. 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 pull-ups and can be used as inputs. As inputs, Port
3 pins that are serves the functions of various special features of the AT89C51 as
listed below:
Page 21
Navigation Robot
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.
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 micro controller 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.
Page 22
Navigation Robot
EA/VPP
EA is called as 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 VCC for internal program
executions. This pin also receives the 12-volt programming enable voltage (VPP)
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
This is an Output from the inverting oscillator amplifier.
Page 23
Navigation Robot
Internal Block diagram
Fig – AT89C51 internal block diagram
Silent features
The 89C51 can be configured to bypass, the internal 4k ROM and run solely
with external program memory. For this its external access (EA) pin has to be
grounded, which makes it equivalent to 8031. The program store enable (PSEN) signal
acts as read pulse for program memory. The data memory is external only and a
separate RD* signal is available for reading its contents.
Use of external memory requires that three of its 8-bit ports (out of four) be
configured to provide data/address multiplexed bus. Hi address bus and control
signals related to external memory use. The RXD and TXD ports of UART also
Page 24
Navigation Robot
appear on pins 10 and 11 of 8051 and 8031, respectively. One 8-bit port, which is bit
addressable and, extremely useful for control applications.
The UART utilizes one of the internal timers for generation of baud rate. The
crystal used for generation of CPU clock has therefore to be chosen carefully. The
11.0596 MHz crystals; available abundantly, can provide a baud rate of 9600.
The 256-byte address space is utilized by the internal RAM and special
function registers (SFRs) array, which is separate from external data RAM space of
64k. The 00-7F space is occupied by the RAM and the 80 - FF space by the SFRs.
The 128 byte internal RAM has been utilized in the following fashion:
00-IF: Used for four banks of eight registers of 8-bit each. The four banks may be
selected by software any time during the program.
20-2F: The 16 bytes may be used as 128 bits of individually addressable
locations. These are extremely useful for bit-oriented programs.
30- 7F: This area is used for temporary storage, pointers and stack. On reset,
the stack starts at 08 and gets incremented during use.
The list of special function registers along with their hex addresses is given
Table 5.3 AT89C51 Address register
Addr. Port/Register
80 P0 (Port 0)
81 SP (stack pointer)
82 DPH (data pointer High)
83 DPL (data pointer Low)
88 TCON (timer control)
89 TMOD (timer mode)
8A TLO (timer 0 low byte)
8B TL1 (timer 1 low byte)
8C TH0 (timer 0 high byte)
8D TH1 (timer 1 high byte)
90 P1 (port 1)
98 SCON (serial control)
99 SBUF (serial buffer)
A0 P2 (port 2)
A8 Interrupt enable (IE)
Page 25
Navigation Robot
B0 P3 (port 3)
B8 Interrupt priority (IP)
D0 Processor status word (PSW)
E0 Accumulator (ACC)
F0 B register
Table– AT89C51 SFR
Hardware details
The on chip oscillator of 89C51 can be used to generate system clock.
Depending upon version of the device, crystals from 3.5 to 12 MHz may be used for
this purpose. The system clock is internally divided by 6 and the resultant time period
becomes one processor cycle. The instructions take mostly one or two processor
cycles to execute, and very occasionally three processor cycles. The ALE (address
latch enable) pulse rate is 16th of the system clock, except during access of internal
program memory, and thus can be used for timing purposes.
AT89C51 Serial port pins
PIN ALTERNATE USE SFR
P3.ORXD Serial data input SBUF
P3.ITXD Serial data output SBUF
P3.2INTO External interrupt 0 TCON-1
P3.3INT1 External interrupt 1 TCON- 2
P3.4TO External timer 0 input TMOD
P3.5T1 External timer 1 input TMOD
P3.6WR External memory write pulse ---------
P3.7RD External memory read pulse ----
Table – AT89C51 serial port pins
The two internal timers are wired to the system clock and prescaling factor is
decided by the software, apart from the count stored in the two bytes of the timer
control registers. One of the counters, as mentioned earlier, is used for generation of
Page 26
Navigation Robot
baud rate clock for the UART. It would be of interest to know that the 8052 have a
third timer, which is usually used for generation of baud rate.
The reset input is normally low and taking it high resets the micro controller, in
the present hardware, a separate CMOS circuit has been used for generation of reset
signal so that it could be used to drive external devices as well.
Writing the software
The 89C51 has been specifically developed for control applications. As
mentioned earlier, out of the 128 bytes of internal RAM, 16 bytes have been
organized in such a way that all the 128 bits associated with this group may be
accessed bit wise to facilitate their use for bit set/reset/test applications. These are
therefore extremely useful for programs involving individual logical operations. One
can easily give example of lift for one such application where each one of the floors,
door condition, etc may be depicted by a single hit.
The 89C51 has instructions for bit manipulation and testing. Apart from these,
it has 8-bit multiply and divide instructions, which may be used with advantage. The
89C51 has short branch instructions for 'within page' and conditional jumps, short
jumps and calls within 2k memory space which are very convenient, and as such the
controller seems to favor programs which are less than 2k byte long. Some versions of
8751 EPROM devices have a security bit which can be programmed to lock the
device and then the contents of internal program EPROM cannot be read.
The device has to be erased in full for further alteration, and thus it can only
be reused but not copied. EEPROM and FLASH memory versions of the device are
also available now. The term used in micro controller is:
Memory unit
Memory is part of the micro controller whose function is to store data. The
easiest way to explain it is to describe it as one big closet with lots of drawers. If we
suppose that we marked the drawers in such a way that they cannot be confused, any
of their contents will then be easily accessible. It is enough to know the designation of
the drawer and so its contents will be known to us for sure.
Page 27
Navigation Robot
Memory components are exactly like that. For a certain input we get the
contents of a certain addressed memory location and that’s all. Two new concepts are
brought to us: addressing and memory location. Memory consists of all memory
locations, and addressing is nothing but selecting one of them. This means that we
need to select the desired memory location on one hand, and on the other hand we
need to wait for the contents of that location. Besides reading from a memory
location, memory must also provide for writing onto it. This is done by supplying an
additional line, called control line. We will designate this line as R/W (read/write).
Control line is used in the following way: if r/w=1, reading is done, and if opposite is
true then writing is done on the memory location. Memory is the first element, and we
need a few operation of our micro controller.
Central Processing Unit
Let add 3 more memory locations to a specific block that will have a built in
capability to multiply, divide, subtract, and move its contents from one memory
location onto another. The part we just added in is called “central processing unit”
(CPU). Its memory locations are called registers.
Registers are therefore memory locations whose role is to help with
performing various mathematical operations or any other operations with data
wherever data can be found. Look at the current situation. We have two independent
entities (memory and CPU), which are interconnected, and thus any exchange of data
is hindered, as well as its functionality. If, for example, we wish to add the contents of
two memory locations and return the result again back to memory, we would need a
connection between memory and CPU. Simply stated, we must have some “way”
through data goes from one block to another.
Bus
That “way” is called “bus”. Physically, it represents a group of 8, 16, or more
wires. There are two types of buses: address and data bus. The first one consists of as
many lines as the amount of memory we wish to address, and the other one is as wide
as data, in our case 8 bits or the connection line. First one serves to transmit address
from CPU memory, and the second to connect all blocks inside the micro controller.
Page 28
Navigation Robot
Input-output unit
Those locations we’ve just added are called “ports”. There are several types of
ports: input, output or bi-directional ports. When working with ports, first of all it is
necessary to choose which port we need to work with, and then to send data to, or
take it from the port. When working with it the port acts like a memory location.
Something is simply being written into or read from it, and it could be noticed on the
pins of the micro-controller.
Stepper Motor drives
Fig – stepper motor drive circuit
When the output of the controller is high, the base current Iв flows in to base of the
transistor, thus providing voltage drop more then 0.7V across the Vвe junction, thus
the transistor goes in to saturation mode. So the Ic is maximum and the voltage drop
across the Vce junction is zero. I.e. the input to MOSFET is zero. So the MOSFET
will not conduct and stepper motor coil will not energize.
If the output of the controller is low, the base current Iв is zero, thus providing
voltage drop less then 0.1V across the Vвe junction, thus the transistor goes in to cut-
off mode. So the Ic is minimum and the voltage drop across the Vce junction is
maximum. I.e. the input to MOSFET is almost Vcc. So the MOSFET will conduct
and stepper motor coil get energized.
Is For driving of motor coils, we used IRF540 MOSFET, which are having low
on-state resistance so that the dissipation is less, fast switching and low thermal
Page 29
Navigation Robot
resistance. This MOSFET is driven by BC548 transistor. For each motor four
MOSFET sections are required.
Stepper motors
Introduction
Stepper Motors have several features, which distinguish them from AC Motors, and
DC Servo Motors.
Brush less - Steppers are brush less Motor with contact brushes creates
sparks, undesirable in certain environments. (Space missions, for example.)
Holding Torque - Steppers have very good low speed and holding torque.
Steppers are usually rated in terms of their holding force (oz/in) and can even hold
a position (to a lesser degree) without power applied, using magnetic 'detent'
torque.
Open loop positioning - Perhaps the most valuable and interesting feature of
a stepper is the ability to position the shaft in fine predictable increments, without
need to query the motor as to its position. Steppers can run 'open-loop' without the
need for any kind of encoder to determine the shaft position. Closed loop
systems- systems that feed back position information, are known as servo
systems. Compared to servos, steppers are very easy to control; the position of the
shaft is guaranteed as long as the torque of the motor is sufficient for the load,
under all its operating conditions.
Load Independent - The rotation speed of a stepper is independent of load,
provided it has sufficient torque to overcome slipping. The higher rpm a stepper
motor is driven, the more torque it needs, and so all steppers eventually poop out
at some rpm and start slipping. Slipping is usually a disaster for steppers, because
the position of the shaft becomes unknown. For this reason, software usually
keeps the stepping rate within a maximum top rate. In applications where a
known RPM is needed under a varying load, steppers can be very handy.
Page 30
Navigation Robot
Types of stepper Motors
Stepper Motors come in a variety of sizes, and strengths, from tiny floppy disk
motors, to huge machinery steppers rated over 1000 oz in. There are two basic types
of steppers-- bipolar and unipolar. The bipolar stepper has 4 wires. Unipolar steppers
have 5,6 or 8 wires. This document will discuss control of Unipolar Steppers.
Motor Basics
The Unipolar Stepper motor has 2 coils, simple lengths of wound wire. The
coils are identical and are not electrically connected. Each coil has a center tap - a
wire coming out from the coil that is midway in length between its two terminals.
You can identify the separate coils by touching the terminal wires together-- If the
terminals of a coil are connected, the shaft becomes harder to turn. Because of the
long length of the wound wire, it has a significant resistance (and inductance). You
can identify the center tap by measuring resistance with a suitable ohm-meter (capable
of measuring low resistance <10 ohm) The resistance from a terminal to the center tap
is half the resistance from the two terminals of a coil. Coil resistance of half a coil is
usually stamped on the motor; For example, '5 ohms/phase' indicates the resistance
from center tap to either terminal of a coil. The resistance from terminal to terminal
should be 10 ohms.
Fig – stepper motor coil diagram
Motor Control Circuitry
Fig – magnetic field diagram
Page 31
Navigation Robot
Current flowing through a coil produces a magnet field, which attracts a
permanent magnet rotor, which is connected to the shaft of the motor. The basic
principle of stepper control is to reverse the direction of current through the 2 coils of
a stepper motor, in sequence, in order to influence the rotor. Since there are 2 coils
and 2 directions, that gives us a possible 4-phase sequence. All we need to do is get
the sequencing right and the motor will turn continuously. You may wonder how the
stepper can achieve such fine stepping increments with only a 4-phase sequence. The
internal arrangement of the motor is quite complex- the winding and core repeating
around the perimeter of the motor many times. The rotor is advanced only a small
angle, either forward or reverse, and the 4-phase sequence is repeated many times
before a complete revolution occurs.
Fig – stepper motor basic control diagram
Let us return to the 4-phase sequence of reversing the current though the 2 coils. A
Bipolar stepper controller achieves the current reversal by reversing the polarity at the
two terminals of a coil. The Unipolar controller takes advantage of the center tap to
achieve the current reversal with a clever trick -- The Center tap is tied to the positive
supply, and one of the 2 terminals is grounded to get the current flowing one
direction. The other terminal is grounded to reverse the current. Current can thus flow
in both directions, but only half coils are energized at a time. Both terminals are
never grounded at the same time, which would energize both coils, achieving nothing
but a waste of power.
Page 32
Navigation Robot
Conceptual Model of Unipolar Stepper Motor
Fig– conceptual model of unipolar stepper motor
With center taps of the windings wired to the positive supply, the terminals of
each winding are grounded, in sequence, to attract the rotor, which is indicated by the
arrow in the picture. (Remember that a current through a coil produces a magnetic
field.) This conceptual diagram depicts a 90-degree step per phase.
In a basic "Wave Drive" clockwise sequence, winding 1a is de-activated and
winding 2a activated to advance to the next phase. The rotor is guided in this manner
from one winding to the next, producing a continuous cycle. Note that if two adjacent
windings are activated, the rotor is attracted mid-way between the two windings.
The following table describes 3 useful stepping sequences and their relative
merits. The sequence pattern is represented with 4 bits; a '1' indicates an energized
winding. After the last step in each sequence the sequence repeats. Stepping
backwards through the sequence reverses the direction of the motor.
Page 33
Navigation Robot
Table of Stepping Sequences
Sequence Name Description
0001
0010
0100
1000
Wave
Drive,
One-
Phase
Consumes the least power. Only one phase is
energized at a time. Assures positional accuracy
regardless of any winding imbalance in the
motor.
0011
0110
1100
1001
Hi-
Torque,
Two-
Phase
Hi Torque - This sequence energizes two
adjacent phases, which offers an improved
torque-speed product and greater holding
torque.
0001
0011
0010
0110
0100
1100
1000
1001
Half-Step Half Step - Effectively doubles the stepping
resolution of the motor, but the torque is not
uniform for each step. (Since we are effectively
switching between Wave Drive and Hi-Torque
with each step, torque alternates each step.)
This sequence reduces motor resonance, which
can sometimes cause a motor to stall at a
particular resonant frequency. Note that this
sequence is 8 steps.
Table– Table of stepping sequences
Page 34
Navigation Robot
Identifying Stepper Motors
Fig– stepper motor identification diagram
Stepper motors have numerous wires, 4, 5, 6, or 8. When you turn the shaft
you will usually feel a "notched" movement. Motors with 4 wires are probably
bipolar motors and will not work with a unipolar control circuit. The most common
configurations are pictured above. You can use an ohmmeter to find the center tap -
the resistance between the center and a leg is 1/2 that from leg to leg. Measuring from
one coil to the other will show an open circuit, since the 2 coils are not connected.
(Notice that if you touch all the wires together, with power off, the shaft is difficult to
turn!)
Shortcut for finding the proper wiring sequence
Connect the center tap(s) to the power source (or current-Limiting resistor.)
Connect the remaining 4 wires in any pattern. If it doesn't work, you only need try
these 2 swaps...
1 2 4 8 - (arbitrary first wiring order)
1 2 8 4 - switch end pair
1 8 2 4 - switch middle pair
Page 35
Navigation Robot
You're finished when the motor turns smoothly in either direction. If the motor turns
in the opposite direction from desired, reverse the wires so that ABCD would become
DCBA.
Heat Considerations
Over-heating can be an early indicator of a problem or need for additional heat
sinking. This is true of both the controller and motors. Components can be warm to
the touch, but not so hot that you can't leave your finger on them for a few seconds.
Motors are designed to be mounted in such a way that, heat is drawn away
from the motors. This is usually accomplished with a metal mounting bracket.
Motors that are not yet mounted may require some type of temporary heat sinking.
Motors heat more running at the LOW speeds or in Hold Mode.
If a component or motor is running too hot, try using the Wave Drive stepping
mode only, if it still runs too hot, try heat sinking, and/or a fan. If it still runs too hot,
something is wrong.
Battery power supply
LM7805
C3 +5V
C1
Fig battery power supply
A +12v, 7Ah Ni – cad, maintenance free battery is used to power the vehicle. The
voltage of the battery is further regulated to +5V using LM7805 monolithic IC
voltage regulators for I.C. operations as described
SOFTWARE
Page 36
BATTERY
+12V
IN OUT GND
Navigation Robot
ASSEMBLE LANGUAGE–PROGRAM FOR CONTROL
SECTION
;;>;> TITLE : NAVIGATION ROBOT;> TARGET : AT89C51;> VERSION : VER-01;> STARTED : 15-01-2006;>;;>;> INCLUDES : $MOD51;>;;>;> HARD WARE DETAILS :;> MOTOR CONTROL 1 - P0.0 TO P0.3;> MOTOR CONTROL 2 - P0.4 TO P0.7;> MOTOR CONTROL 3 - P2.0 TO P2.3;> LIGHT CONTROL - P3.3 LCTR BIT P3.3;> A0 OF ADC - P3.7 A0 BIT P3.7;> ALE OF ADC - P3.6 ALE BIT P3.6;> SOC OF ADC - P3.4 SOC BIT P3.4;> EOC OF ADC - P3.5 EOC BIT P3.5;>;;>;> FLAGS : KEY_RLS BIT 00H;>;;>;> VARIABLES : COMMAND DATA 30H STEP_CNT DATA 31H ADC_VAL DATA 32H TMR_VAL1 DATA 33H TMR_VAL2 DATA 34H TMP_VAL DATA 35H CHK_SUM DATA 36H;>
Page 37
Navigation Robot
;;>;> VECTOR ADDRESESS: ORG 0000H ljmp INITIALISATION
ORG 000BH ; T0 interrupt push ACC push PSW lcall T0INT pop PSW pop ACC reti
ORG 0023H ; SERIAL INTERRUPT push ACC push PSW
jbc RI, RECEIVE_DATA ajmp SKIP_CHKS RECEIVE_DATA: mov A, SBUF cjne A, #55H, CHEK_NEXT0 mov R0, #00H cpl P2.0 setb P2.2 ljmp SKIP_CHKS CHEK_NEXT0: cjne R0, #00H, CHEK_NEXT1 cjne A, #0AAH, CHEK_NEXT1 mov R0, #01H ljmp SKIP_CHKS CHEK_NEXT1: cjne R0, #01H, CHEK_NEXT2
mov R0, #02H mov TMP_VAL, A ljmp SKIP_CHKS CHEK_NEXT2: cjne R0, #02H, SKIP_CHKS mov R0, #00H mov CHK_SUM, A mov A, #0AAH xrl A, TMP_VAL cjne A, CHK_SUM, SKIP_CHKS mov COMMAND, TMP_VAL cpl P2.2 SKIP_CHKS: pop PSW
Page 38
Navigation Robot
pop ACC reti
;>;;>INITIALISATION: mov P0, #0FFH mov P1, #0FFH mov P2, #0FFH mov P3, #0FFH mov SP, #65H mov DPTR, #0400H anl PCON, #7FH ; CLR SMOD BIT mov TMOD, #21H ; TIMER 1 IN MODE 2, TIMER 0 IN MODE 1 mov TH1, #0E7H ; SET BAUD RATE AS 1200 mov SCON, #50H ; SERIAL MODE 1 AND RECEIVE ENABLE mov IE, #92H ; ENABLE SERIAL INTERRUPT & TIMER 0 INTERRUPT setb TR1 ; RUN TIMER 1
mov TMR_VAL2, #0E8H mov TMR_VAL1, #00H mov TH0, #0EDH mov TL0, #0FFH setb TR0 ; RUN TIMER 0 mov STEP_CNT, #00h mov COMMAND, #'0';>;;>MAIN: clr A0 lcall READ_ADC
mov SBUF, #055H ; AA IS HEADER FOR TEMPERATURECHAN0: jnb TI, CHAN0 clr TI
lcall SERL_DLY1
mov SBUF, #0AAH ; AA IS HEADER FOR TEMPERATURECHAN1: jnb TI, CHAN1 clr TI
lcall SERL_DLY1
mov SBUF, ADC_VALCHAN2: jnb TI, CHAN2 clr TI
Page 39
Navigation Robot
lcall SERL_DLY1 mov A, #0AAH xrl A, ADC_VAL ; CALUCLATE CHEK SUM
mov SBUF, ACHAN3: jnb TI, CHAN3 clr TI
lcall SERL_DLY
setb A0 lcall READ_ADC mov A, ADC_VAL cjne A, #0B0H, CHEK_LIGHTCHEK_LIGHT: jc SWITCHON_LIGHT setb LCTRSWITCHON_LIGHT: jnc SWITCHOFF_LIGHT clr LCTRSWITCHOFF_LIGHT:ljmp MAIN;>;;>T0INT: mov A, COMMAND cjne A, #'1', SKIP_FOR_MOVE mov DPTR, #STEP_RUN orl P2, #0F0H lcall MOVE_FRWD ajmp SKIP_OFF_MOT SKIP_FOR_MOVE: mov A, COMMAND cjne A, #'2', SKIP_REV_MOVE mov DPTR, #STEP_RUN orl P2, #0F0H lcall MOVE_REV ajmp SKIP_OFF_MOT SKIP_REV_MOVE: mov A, COMMAND cjne A, #'3', SKIP_LEFT_MOVE mov DPTR, #STEP_LEFT orl P2, #0F0H lcall MOVE_LEFT ajmp SKIP_OFF_MOT SKIP_LEFT_MOVE: mov A, COMMAND cjne A, #'4', SKIP_RIGHT_MOVE
Page 40
Navigation Robot
mov DPTR, #STEP_RIGHT orl P2, #0F0H lcall MOVE_RIGHT ajmp SKIP_OFF_MOT SKIP_RIGHT_MOVE: mov A, COMMAND cjne A, #'5', SKIP_CW_MOVE inc TMR_VAL1 mov R1, TMR_VAL1 cjne R1, #02H, SIP_OF_MO mov TMR_VAL1, #00H mov DPTR, #STEP_GUN mov P0, #0FFH lcall MOVE_CW SIP_OF_MO: ajmp SKIP_OFF_MOT SKIP_CW_MOVE: mov A, COMMAND cjne A, #'6', SKIP_CCW_MOVE inc TMR_VAL1 mov R1, TMR_VAL1 cjne R1, #02H, SKIP_OFF_MOT mov TMR_VAL1, #00H mov DPTR, #STEP_GUN mov P0, #0FFH lcall MOVE_CCW ajmp SKIP_OFF_MOT SKIP_CCW_MOVE: mov A, COMMAND cjne A, #'7', SKIP_OFF_MOT SKIP_OFF_MOT: mov A, COMMAND cjne A, #'8', SKIP_OFF_MOT1 mov P0, #0FFH orl P2, #0FFH SKIP_OFF_MOT1: mov TH0, #0B6H mov TL0, #03BH ret;>;;>MOVE_FRWD: mov A, STEP_CNT movc A, @A+dptr mov P0, A inc STEP_CNT mov A, STEP_CNT cjne A, #04h, NOTCH1 mov STEP_CNT, #00h
Page 41
Navigation Robot
NOTCH1: ret;>;;>MOVE_REV: mov A, STEP_CNT movc A, @A+dptr mov P0, A dec STEP_CNT mov A, STEP_CNT cjne A, #0FFh, NOTCH4 mov STEP_CNT, #03hNOTCH4: ret;>;;>MOVE_LEFT: mov A, STEP_CNT movc A, @A+dptr mov P0, A inc STEP_CNT mov A, STEP_CNT cjne A, #08h, NOTCH2 mov STEP_CNT, #00hNOTCH2: ret;>;;>MOVE_RIGHT: mov A, STEP_CNT movc A, @A+dptr mov P0, A inc STEP_CNT mov A, STEP_CNT cjne A, #08h, NOTCH3 mov STEP_CNT, #00hNOTCH3: ret;>;;>MOVE_CW: mov A, STEP_CNT movc A, @A+dptr mov R7, A mov A, P2 anl A, #0FH
Page 42
Navigation Robot
orl A, R7 mov P2, A inc STEP_CNT mov A, STEP_CNT cjne A, #04h, NOTCH7 mov STEP_CNT, #00hNOTCH7: ret;>;;>MOVE_CCW: mov A, STEP_CNT movc A, @A+dptr mov R7, A mov A, P2 anl A, #0FH orl A, R7 mov P2, A dec STEP_CNT mov A, STEP_CNT cjne A, #0FFh, NOTCH8 mov STEP_CNT, #03hNOTCH8: ret;>;;>; ADC reading functionREAD_ADC: setb ALE lcall CLK_DLY setb SOC lcall CLK_DLY clr ALE lcall CLK_DLY clr SOC lcall CLK_DLYEOC_LOOP: jnb EOC, EOC_LOOP lcall ADC_DLY nop nop mov ADC_VAL, P1 nop RET;>;;>; software delay loops
Page 43
Navigation Robot
ADC_DLY: mov R7, #7FHAIN: djnz R7, AIN RET;>;;>; software delay loopsCLK_DLY: mov R7, #1FHCIN: djnz R7, CIN RET;>;;>SERL_DLY: mov R6, #10HSOUT: mov R7, #00HSIN: djnz R7, SIN djnz R6, SOUT RET;>;;>SERL_DLY1: mov R6, #05HSOUT1: mov R7, #10HSIN1: djnz R7, SIN1 djnz R6, SOUT1 RET;>;;>DELAY: mov R7, #2dEXT: mov R6, #10dIN: mov R5, #30dOUT: djnz R5, OUT djnz R6, IN djnz R7, EXT ret;>;;> ORG 0400H
STEP_RUN: db 9AH db 56H db 65H
Page 44
Navigation Robot
db 0A9H STEP_LEFT: db 051H db 069H db 0A8H db 09AH db 052H db 066H db 0A4H db 095H
STEP_RIGHT: db 5AH db 46H db 65H db 29H db 0AAH db 86H db 95H db 19HSTEP_GUN: db 090H db 050H db 060H db 0A0H END
PROGRAM FOR VEHICLE SECTION
;;>;> TITLE : NAVIGATION ROBOT TRANSMITTER;> TARGET : AT89C51;> STARTED : 15-01-2006;>;;>;> INCLUDES : $MOD51;>;;>;> HARD WARE DETAILS :;>;> DISPLAY ENEBLE - P3.5 DEN BIT P3.5;> DISPLAY READ/WRITE - P3.6 DRW BIT P3.6;> DISPLAY REG SELECT - P3.7 DRS BIT P3.7
Page 45
Navigation Robot
;> KEY INPUT 1 - P1.0 KEY1 BIT P1.0;> KEY INPUT 2 - P1.1 KEY2 BIT P1.1;> KEY INPUT 3 - P1.2 KEY3 BIT P1.2;> KEY INPUT 4 - P1.3 KEY4 BIT P1.3;> KEY INPUT 5 - P1.4 KEY5 BIT P1.4;> KEY INPUT 6 - P1.5 KEY6 BIT P1.5;> KEY INPUT 7 - P1.6 KEY7 BIT P1.6;> KEY INPUT 8 - P1.7 KEY8 BIT P1.7;> TRANSMITTER CONTROL - P3.3 TXC BIT P3.3;>;;>;> FLAGS : BUSY_CHEK BIT 00H KEY_RLS BIT 01H SERL_INT BIT 02H READ_TMP BIT 03H;>;;>;> VARIABLES : KEY_PRS DATA 30H TMP_VAL DATA 31H CHK_SUM DATA 32H ADC_VAL DATA 33H TMPR_VAL DATA 34H TMPR_VAH DATA 35H;>;;>;> DEFINITIONS :;> COM EQU 0fch ; command ;display headers DAT EQU 0fdh ; data EOL EQU 0feh ; end of line;>; ;>;> VECTOR ADDRESESS: ORG 0000H ljmp RESET
Page 46
Navigation Robot
ORG 0023H ; SERIAL INTERRUPT push ACC push PSW
jbc RI, RECEIVE_DATA ajmp SKIP_CHKS RECEIVE_DATA: mov A, SBUF cjne A, #55H, CHEK_NEXT0 setb READ_TMP mov R0, #00H ljmp SKIP_CHKS CHEK_NEXT0: cjne R0, #00H, CHEK_NEXT1 cjne A, #0AAH, CHEK_NEXT1 mov R0, #01H ljmp SKIP_CHKS CHEK_NEXT1: cjne R0, #01H, CHEK_NEXT2 mov R0, #02H mov TMP_VAL, A ljmp SKIP_CHKS CHEK_NEXT2: cjne R0, #02H, SKIP_CHKS mov R0, #00H mov CHK_SUM, A mov A, #0AAH xrl A, TMP_VAL cjne A, CHK_SUM, SKIP_CHKS mov ADC_VAL, TMP_VAL setb SERL_INT clr READ_TMP SKIP_CHKS: pop PSW pop ACC reti
;>;;> RESET: mov P2, #0FFH ; move all ports HIGH mov P3, #0FFH mov P1, #0FFH mov P0, #0FFH mov sp, #65H ; init stack pointer clr TXC lcall DLY1
Page 47
Navigation Robot
mov dptr, #INITIALISE lcall MESSAGE mov dptr, #COLLEGE lcall MESSAGE lcall DLY mov dptr, #NAME lcall MESSAGE lcall DLY mov dptr, #CLRSCR lcall MESSAGE mov dptr, #ENTER lcall MESSAGE
mov ADC_VAL, #00H anl PCON, #7FH ; CLR SMOD BIT mov TMOD, #20H ; TIMER 1 IN MODE 2 mov TH1, #0E7H ; SET BAUD RATE AS 1200 mov SCON, #50H ; SERIAL MODE 1 AND RECEIVE ENABLE mov IE, #90H ; ENABLE SERIAL INTERRUPT setb TR1 ; RUN TIMER 1 setb SERL_INT;>;;> MAIN: jnb SERL_INT, DONT_DISP_TMP clr SERL_INT lcall HTOD lcall DISP_TEMP DONT_DISP_TMP:
mov A, P1 cjne A, #0FFH, NO_KEYPRESSED setb TXC lcall SERL_DLY1
mov SBUF, #055H ; 55 IS reset CHAN9: jnb TI, CHAN9 clr TI lcall SERL_DLY1
mov SBUF, #055H ; 55 IS reset CHAN13: jnb TI, CHAN13 clr TI lcall SERL_DLY1
mov SBUF, #055H ; 55 IS reset CHAN11: jnb TI, CHAN11 clr TI lcall SERL_DLY1
Page 48
Navigation Robot
clr TXC lcall SERL_DLY
ljmp MAIN
NO_KEYPRESSED: setb TXC lcall SERL_DLY1
mov SBUF, #055H CHAN12: jnb TI, CHAN12 clr TI lcall SERL_DLY1
mov SBUF, #0AAH ; AA IS HEADER CHAN0: jnb TI, CHAN0 clr TI lcall SERL_DLY1
NO_KEYPRESSED1: jb KEY1, NOT_KEY1 mov dptr, #MOVE_FORD lcall MESSAGE mov A, #'1' mov SBUF, #'1' CHAN1: jnb TI, CHAN1 clr TI NOT_KEY1:
jb KEY2, NOT_KEY2 mov dptr, #MOVE_REV lcall MESSAGE mov A, #'2' mov SBUF, #'2' CHAN2: jnb TI, CHAN2 clr TI NOT_KEY2:
jb KEY3, NOT_KEY3 mov dptr, #MOVE_LEFT lcall MESSAGE mov A, #'3' mov SBUF, #'3' CHAN3: jnb TI, CHAN3 clr TI NOT_KEY3:
jb KEY4, NOT_KEY4 mov dptr, #MOVE_RIGHT lcall MESSAGE
Page 49
Navigation Robot
mov A, #'4' mov SBUF, #'4' CHAN4: jnb TI, CHAN4 clr TI NOT_KEY4:
jb KEY5, NOT_KEY5 mov dptr, #MOVE_CAMCC lcall MESSAGE mov A, #'5' mov SBUF, #'5' CHAN5: jnb TI, CHAN5 clr TI NOT_KEY5:
jb KEY6, NOT_KEY6 mov dptr, #MOVE_CAMCCW lcall MESSAGE mov A, #'6' mov SBUF, #'6' CHAN6: jnb TI, CHAN6 clr TI NOT_KEY6:
jb KEY7, NOT_KEY7 mov dptr, #ENTER lcall MESSAGE mov A, #'8' mov SBUF, #'8' CHAN7: jnb TI, CHAN7 clr TI NOT_KEY7:
jb KEY8, NOT_KEY8 mov dptr, #ENTER lcall MESSAGE mov A, #'8' mov SBUF, #'8' CHAN8: jnb TI, CHAN8 clr TI NOT_KEY8:
lcall SERL_DLY1
xrl A, #0AAH mov SBUF, A CHAN10: jnb TI, CHAN10 clr TI
lcall SERL_DLY1
Page 50
Navigation Robot
clr TXC
lcall SERL_DLY ljmp MAIN;>;;> DISP_LET: lcall READY ; Check weather display is ready setb DRS setb BUSY_CHEK mov P2, R7 ; place the data at port 1 clr DRW nop setb DEN ; send enable strobe clr DEN ret ; return to message;>;;> DISP_COM: lcall READY ; Check weather display is ready clr DRS clr BUSY_CHEK mov P2, R7 ; place the data at port 1 clr DRW nop setb DEN ; send enable strobe clr DEN ret ; return to message;>;;> MESSAGE: ; sub for sending charactors to display push acc MESSAGE1: lcall READY ; Check weather display is ready clr a ; Clr accumulator movc a, @a+dptr ; Load accumulator with the contents of dptr inc dptr ; cjne a, #EOL, COMD ; If the data is not end of line goto comd pop acc ret ; if the data is end of line stop sending
COMD: ; cjne a, #COM, DDATA ; if the data is not command goto data clr DRS ; COMMAND MODE clr BUSY_CHEK sjmp MESSAGE1 ; goto message again
Page 51
Navigation Robot
DDATA: ;
cjne a, #DAT, SENDIT ; if the data is not data to be send goto comd setb DRS ; set DRS to high ( DATA MODE ) setb BUSY_CHEK sjmp MESSAGE1 ; goto message again
SENDIT: ; mov p2, a ; place the data at port 1 clr DRW ; set WRITE MODE nop setb DEN ; send enable strobe clr DEN ; sjmp MESSAGE1 ; goto message again;>;;> READY: ; sub to check display busy
clr DEN ; disable display buffer mov p2, #0ffh ; set port1 in read mode clr DRS ; COMMAND MODE setb DRW ; READ MODE WAIT: ; clr DEN ; send enable strobe setb DEN ; jb p2.7, WAIT ; if display is not send ready signal be in loop clr DEN ; disable display buffer jnb BUSY_CHEK, NO_DRS_SET setb DRS NO_DRS_SET: ret ; return to message;>;;>; converting hex value into decimalHTOD: mov TMPR_VAL, #00H mov TMPR_VAH, #00H mov a, ADC_VAL cjne a, #00h, CHEKDA1 RET ; END SUB CHEKDA1: clr c mov R2, ADC_VAL mov a, #00h mov r1, #00h
Page 52
Navigation Robot
LOOP1: clr c inc a da a jnc CONT1 inc R1 CONT1: djnz R2, LOOP1 mov TMPR_VAL, a mov TMPR_VAH, r1 RET ; END SUB;>;;>DISP_TEMP:
mov R7, #0C0H lcall DISP_COM
mov A, TMPR_VAH anl A, #0Fh add A, #30H mov R7, A lcall DISP_LET
mov A, TMPR_VAL anl A, #0F0h swap A add A, #30H mov R7, A lcall DISP_LET
mov A, TMPR_VAL anl A, #0Fh add A, #30H mov R7, A lcall DISP_LET
mov R7, #223D lcall DISP_LET
mov R7, #'C' lcall DISP_LET
mov R7, #' ' lcall DISP_LET
RET ; END SUB;>;
Page 53
Navigation Robot
;> DLY: mov r4, #1fh GONE: mov r5, #00h OUT: mov r6, #00h IN: djnz r6, IN djnz r5, OUT djnz r4, GONE ret DLY1: mov r4, #03h GONE1: mov r5, #10h OUT1: mov r6, #00h IN1: djnz r6, IN1 djnz r5, OUT1 djnz r4, GONE1 ret;>;;>SERL_DLY: mov R6, #7FHSOUT: mov R7, #00HSIN: djnz R7, SIN djnz R6, SOUT RET;>;;>SERL_DLY1: mov R6, #05HSOUT1: mov R7, #10HSIN1: djnz R7, SIN1 djnz R6, SOUT1 RET;>;;>;> ROM TABLE AREA;> INITIALISE: db COM, 30h, 30h, 30h, 30h, 3ch, 06h, 0ch, 01h, EOL NAME: db COM, 80h, DAT, 'NAVIGATION ROBOT', COM, 0C0H, DAT,'WITH CAMERA F/B', EOL COLLEGE: db COM, 80h, DAT, 'SINDHURA COLLEGE', COM, 0C0H, DAT,'OF ENGG. @ TECH.', EOL ENTER: db COM, 80h, DAT, 'ENTER COMMAND...', EOL
Page 54
Navigation Robot
MOVE_FORD: db COM, 80h, DAT, 'MOVING FORWARD..', EOL MOVE_REV: db COM, 80h, DAT, 'MOVING REVERSE..', EOL MOVE_LEFT: db COM, 80h, DAT, 'MOVING LEFT... ', EOL MOVE_RIGHT: db COM, 80h, DAT, 'MOVING RIGHT... ', EOL MOVE_CAMCC: db COM, 80h, DAT, 'MOVING CAM CW.. ', EOL MOVE_CAMCCW: db COM, 80h, DAT, 'MOVING CAM CCW..', EOL CLRSCR: db COM, 01h, EOL;>;;> END
Discussion of results
Sl. No. Input command
key
Action observed
1 ‘↑’ or ‘1’ Vehicle moved in forward direction
2 ‘↓’ or ‘2’ Vehicle moved in backward direction
3 ‘→’ or ‘3’ Vehicle turned towards right
4 ‘←’ or ‘4’ Vehicle turned towards left
5 ‘L’ or ‘l’ Camera moved left
6 ‘R’ or ‘r’ Camera moved right
7 ‘U’ or ‘u’
8 ‘D’ or ‘d’ Stop
Table – Result table
Page 55
Navigation Robot
CONCLUSIONS AND RECOMMENDATIONS
.
In this project we just introduced wireless control for all operations to
eliminate human interference in the vehicle. The operator can operate this from a
distant place. The camera associated with the vehicle scans the location and the AM
TX sends the scanned picture information which can be seen in TV set at the base
station. Now the operator can see the location in the TV and accordingly commands
are given. We used a light dependent resistor that measures the light intensity and if
the intensity is low the lights automatically will be on. The communication link is two
ways from MC to vehicle. Operator can know the temperature feed back of the
location and also the vehicle movements. The power is provided from battery but
there is no on-site recharging facility. With these features, we can operate this vehicle
in invisible fields like mines, toxic areas and places where man cannot enter.
Page 56
Navigation Robot
FUTURE SCOPE
The flexibility of the navigation system presented here means that a mobile robot can
enter different environments, and the system automatically selects an appropriate set
of sensors for each particular environment. It additionally means that the system can
work without landmarks, but if they exist, they will be used to improve navigation
accuracy. This kind of flexibility in the navigation system is of the utmost importance
when in the near future increasingly mobile robots will move out from structured
indoor environments into unknown outdoor environments.
Page 57
Navigation Robot
BIBILOGRAPHY
1. 8051 programming and applications - by K.J.Ayala
2 Microprocessors and interfacing - by Douglas V.Hall
3. Mastering Serial Communications - Peter W. Gafton
4. Linear Integrated Circuits - By: D. Roy Choudhury,
5. Op-Amps Hand Book - By: MALVIND
6. www.atmel.com
7. www.maxim.com
8. www.robotics.com
9. www.stepperworld.com
Page 58