micro-controller 8051 based obstacle avoider robot
Post on 24-Oct-2015
Embed Size (px)
DESCRIPTIONComplete program code and the diagram of this project.
AND DISPLAY OF BLINKING
LEDS AND BUZZER
Class Project Report Subject: Advanced Microcontroller and microprocessor systems
Dr. Veena Sharma, EED NIT-H
Mirza Abdul Waris Beigh, Roll No: 10289
Department of Electrical Engineering
National Institute Of Technology, Hamirpur
Introduction Basic Principle Logic Followed Block Diagram Components used 89V51RD2 Kit by Provotech
IR Sensors 3
USB-Serial Programmer By SILABS
2 line LCD Display. Program Code Used
A view of the Robot
The design and implementation of obstacle avoider robot using
8051 Microcontroller is being done. It is programmed to avoid
running into obstacles and detects the presence of different objects
around it and modifies the motion of the motors appropriately.
The objects are sensed by the IR (Infra Red) sensors. The
microcontroller controls two DC motors of robot to navigate.
Basic Principle: The basic principle involved in this is it captures the obstacle presence
with IR sensors mounted at the three sides of the robot. When the sensor
senses an object, analog signal is given to the op-amp to produce 0s and
1s which are then fed to the microcontroller, then the microcontroller
decides the next move according to the program. Microcontroller and
driver circuit are used for the control of motors.
SENSOR A SENSOR C
Sensor A Sensor B Sensor C Action
0 0 0 FORWARD
0 0 1 LEFT
0 1 0 RIGHT_DIFF
0 1 1 LEFT_DIFF
1 0 0 RIGHT
1 0 1 FORWARD
1 1 0 RIGHT_DIFF
1 1 1 BACK
Mechanical parts: Chassis
Input and Output devices Battery Source
Source: An ideal voltage source is a voltage source that maintains the same
voltage across the source's terminals no matter what current is drawn
from the terminals of the source or what current flows into the terminals.
DC source: Direct current (DC) is the unidirectional flow of electric charge. Direct
current is produced by sources such as batteries, solar cells, and
commutator-type electric machines of the dynamo type, etc.
Sensor IR reflective sensors have one emitter (IR LED) and one receiver
(Phototransistor or photo diode. If we have white surface it reflects the
light and it will sensed by the receiver, similarly if we have black surface
it absorbs the light and receiver can not sense light.
Photo diode has property that if IR light fall on it its electrical resistance
comes down (i.e. it comes down from 150k to 10k if no noise present).
Sample Calculation: Say Receiver has resistance
Rs=150k without light (on black surface) Rs=10k with light (on white surface) The voltage that goes to comparator Without light: (on black surface)
With light: (on white surface)
Thus we get variation of voltage that is sensed by comparator IC
This gives logical high or low according to input.
Comparator Comparator is a device which compares two input voltages and gives
output high/low. In circuit diagram it is normally represented by a
triangle having- Inverting (negative) Input (-),Non Inverting (positive)
Input(+), Vcc, Ground, Output.
Use of comparator in IR sensor
As above we see that two inputs are required for comparator. One input is
from photo-receiver (like photo-diode), other is generated by us using
potentiometer. The second voltage is also called as reference voltage for
LM358 The LM358 is a great, easy-to-use dual-channel opamp. LM358
applications include transducer amplifiers, DC gain blocks and all the
conventional opamp circuits.
Driver IC: L293D is a dual H-bridge motor driver integrated circuit (IC). Motor
drivers act as current amplifiers since they take a low-current control
signal and provide a higher-current signal. This higher current signal is
used to drive the motors. L293D contains two inbuilt H-bridge driver
circuits. In its common mode of operation, two DC motors can be driven
simultaneously, both in forward and reverse direction. The motor
operations of two motors can be controlled by input
logic at pins 2 & 7 and 10 & 15. Input logic 00 or 11 will stop the
corresponding motor. Logic 01 and 10 will rotate it in clockwise and
anticlockwise directions, respectively.
Enable pins 1 and 9 (corresponding to the two motors) must be high for
motors to start operating. When an enable input is high, the associated
driver gets enabled. Similarly, when the enable input is low, that driver is
disabled, and their outputs are off and in the high-impedance state.
Microcontroller: Microcontroller acts as the Brain of robot, which generates desired output
for corresponding inputs. In present days, there are several companies
that manufacture microcontrollers, for example ATMEL, Microchip,
Intel, Motorola, Philips etc. We are using P89V51RD2 microcontroller in
our robot. It is a PHILIPS product.
The NXP (founded by Philips) P89V51RD2 DIP is a 40MHz, 5 Volt
8051-based Microcontroller with 32 I/O lines is an extremely popular
8051 family of microcontroller available in standard 40-pin DIP package.
The microcontroller comes with an on-chip boot loader which makes it
easy to program using the USB-serial Programmer.
LCD display is used to display different strings while program is running
and information regarding buttons to be pressed.
Decription Of Micro-controller board used
Keil C51 is the industry-standard tool chain for all 8051-compatible
devices, it supports classic 8051, Dallas 390, NXP MX, extended 8051
variants, and C251 devices. The Vision IDE/Debugger integrates
complete device simulation, interfaces too many target debug adapters,
and provides various monitor debug solutions.
The programmer used is designed by SILABS and is very easy to use. We
just need to connect the USB cable to a PC and using Flash Magic we can
easily burn the program into the micro controller.
C Program Written:
sbit LED1=P3^0; //LED DEFINITIONS
sbit SW1=P3^2; //SWITCH DEFINITIONS
sbit SW3=P3^6; //SWITCHES ARE ACTIVE LOW (WHEN PRESSED
GIVE LOGIC LOW AT PIN)
// MOTOR PORT = PORT1
#define FORWARD 0x55
#define BACK 0XAA
#define LEFT 0x44
#define RIGHT 0x11
#define LEFT_DIFF 0x66
#define RIGHT_DIFF 0x99
#define STOP 0x00
BUZZER=0; // TURN ON THE BUZZER
BUZZER=1; //TURN OFF THE BUZZER
unsigned char sqnc;
P2=0xFF; //INTIALISE PORT 2 AS INPUT PORT FOR Sensors
P1=0x00; //INTIALISE PORT 1 AS OUTPUT PORT FOR MOTOR
LCD_STRING("SW1 SW2 SW3");
LCD_STRING("LED BUZ Wall-Avoid");
if (SW1==0) //IF SWITCH1 IS PRESSED EXECUTE
RUNNING LED PROGRAM
LCD_STRING("Running LED Disp");
if (SW3==0) //IF SWITCH3 IS PRESSED TEXECUTE
here: if (p1==0 && p2==0 && p3==0)
here0: if (p1==0 && p2==0 && p3==1)