line follwer robot

download line follwer robot

of 32

description

study

Transcript of line follwer robot

AMRITSAR COLLEGE OF ENGINEERING &TECHNOLOGY ( NBA Accredited) six weeks industrial training project report on line follower using ATMEL 89c2051 microcontroller

n.c. COLLEGE OF ENGINEERING

PROJECT REPORTONline follower using ATMEL 89c2051microcontroller

1

Submitted to : Submitted by : SAHIL(1511249) MANNU(1511171)

I hereby certify that the minor project entitle line follower using ATMEL 89C2051 microcontroller which is being submitted in the department of electronics anf communication engineering at Amritsar college of engineering & technology by using a partial fulfillment for the award of degree of bachelor of technology in electronics and communication engineering is a record of my own work carried out under the guidance and supervision of Dr. tanu preet singh prof. &HOD(ECE)SAHIL(1511249)MANNU(1511171)

DECLARATIONCONTENT Introduction to PCB Soldering Introduction to line followerCircuit diagram of line followerATMEL 80C51 microcontroller2*wheel2* IR sensorsCastor (wheel for support)Chassis2* DC motor7V-8V lithium ion batterySoftware detailINTRODUCTION ABOUT PCBPCB: Stands for "Printed Circuit Board." A PCB is a thin board made of fiberglass, composite epoxy, or other laminate material. Conductive pathways are etched or "printed" onto board, connecting different components on the PCB, such as transistors, resistors, andintegrated circuit.Printed circuit boards are used in all but the simplest electronic products.

PCB DESIGNING The apparatus needs to make a PCB is :copper clad sheetNail polish and paintPlastic trayTap water etc

SOLDERINGSolderingis a process in which two or moremetalitems are joined together by melting and flowing afiller metal(solder) into the joint, the filler metal having a lowermelting pointthan the adjoining metal. Soldering differs fromweldingin that soldering does not involve melting the work pieces. Inbrazing, the filler metal melts at a higher temperature, but the work piece metal does not melt. In the past, nearly all solders containedlead, but environmental concerns have increasingly dictated use oflead-free alloys for electronics and plumbing purposes.Applications Soldering is used in plumbing, electronics, and metalwork fromflashingto jewellery.Soldering provides reasonably permanent but reversible connections between copper pipes inplumbingsystems as well as joints in sheet metal objects such as automobileradiators.

Introduction to Line followerA line follower is basically a machine designed to follow a path predetermined by the user. The path maybe as simple as a straight or a curved line or it maybe as complex as a 90 degree turn and junction counting capabilities. In our semester project, we will concentrate on simple tasks.Line follower robot can detect bright light using specific sensors, and define its motion accordingly. Line follower senses the line using its sensors and maneuvers the mechanical structure to stay on course while constantly correcting wrong moves.The correct positioning of the sensors presents a feasible controlling strategy for complex as well as simple tasks. A robot will know when to turn depending on the location of the sensors. Number of sensors determines the smooth movement of the robot. Optimum distance between the sensors depends on number of sensors, width of straight line and the logic applied

Basic principleThe basic principle involved in this is it captures the line position with IRsensorsmounted at front end of the robot.Below is the block diagramof the linefollower robot, when the sensor sense the path, analog signal is given to the op-amp to produce 0s and 1s which are then fed to the microcontroller, then the microcontroller decides thenextmove according to the program. When both thesensorsare indicating low (0) then robot start moving onthe black path, for white if it indicates high (1) then it moves along the path. Microcontroller and driver circuit are used for the control of motors.

BLOCK DIAGRAM

In the line follower we have used 2 pairs of IR sensor.IR reflective sensor have one emitter and one receiver .thus we get variation of voltage that is sensed by comparator IC(L293D) .This gives logical high and low according to input.Comparator is a device which compare two input voltage and gives output high/low L239D is a bipolar moto device IC. ThisisamotordriverIC thatcandrivetwomotorsimultaneously.L293D IC is a dual H-bridge motor driver IC. One H-bridge is capable to drive a dc motor in bidirectional. L293D IC is a current enhancing IC as the output from the sensor is not able to drive motors itself so L293D is used for this purpose. L293D is a 16 pin IC having two enables pins which should always be remain high to enable both the H-bridges. L293B is another IC of L293 series having

Circuit diagram of line follower

Programming detail ORG 000H // origin MOV P1,#00000011B // sets port 1 as input port MOV P0,#00000000B // sets port 0 as output port BACK: MOV P0,#00000011B // starts both motors JB P1.0, LABEL1 // branches to LABEL1 if left sensor is ON CLR P0.0 // stops left motor SETB P0.1 // runs right motor ACALL WAIT1 // calls WAIT1 subroutine SJMP BACK // jumps back to the BACK loop LABEL1: JB P1.1, LABEL2 // branches to LABEL2 if right sensor is ON SETB P0.0 // runs left motor CLR P0.1 // stops right motor ACALL WAIT2 // calls WAIT2 subroutine SJMP BACK // jumps back to the BACK loop LABEL2: SJMP BACK // jumps back to the BACK loop WAIT1:JNB P1.0,WAIT1 // waits until robot is back from rightward deviation RET // returns from WAIT1 subroutine WAIT2:JNB P1.1,WAIT2 // waits until robot is back from leftward deviation RET // returns from WAIT2 subroutine END // end statement13ATMEL 80C51 MICROCONTROLLER80C51 microcontrollers, featuring up to 32-Kbyte FLASH memory with a highly flexible In-system Programming (ISP) capability. The program can be loaded or updated without removing the device from the board, providing a significant flexibility to system designers. 8051 microcontrollersuse two different kinds of memory such as UV- EPROM, Flash and NV-RAM. Hence 8051 will not be seen in the part number even though it is the most popular member of the 8051 family.

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 reg banks.128 user defined software flags.8-bit data bus16-bit address bus32 general purpose registers each of 8 bits16 bit timers (usually 2, but may have more, or less).3 internal and 2 external interrupts.

Pin diagram & description of 8051

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

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 .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.

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 accessPORT 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.

Motor driver IC L293dL293D 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. As a result, the outputs become active and work in phase with their inputs. Similarly, when the enable input is low, that driver is disabled, and their outputs are off and in the high-impedance state.

PINS FUNTIONS OF L293D

DC MOTOR

ADC motorrelies on the fact that like magnet poles repel and unlike magnetic poles attract each other. A coil of wire with a current running through it generates anelectromagnetic field aligned with the center of the coil. By switching the current on or off in a coil its magnetic field can be switched on or off or by switching the direction of the current in the coil the direction of the generated magnetic field can be switched 180. A simpleDC motortypically has a stationary set of magnets in thestatorand anarmaturewith a series of two or more windings of wire wrapped in insulated stack slots around iron pole pieces (called stack teeth) with the ends of the wires terminating on acommutator. The armature includes the mounting bearings that keep it in the center of the motor and the power shaft of the motor and the commutator connections. The winding in the armature continues to loop all the way around the armature and uses either single or parallel conductors (wires), and can circle several times around the stack teeth. The total amount of current sent to the coil, the coil's size and what it's wrapped around dictate the strength of the electromagnetic field created. The sequence of turning a particular coil on or off dictates what direction the effective electromagnetic fields are pointed. By turning on and off coils in sequence a rotating magnetic field can be created. These rotating magnetic fields interact with the magnetic fields of the magnets (permanent orelectromagnets) in the stationary part of the motor (stator) to create a force on the armature which causes it to rotate. In some DC motor designs the stator fields use electromagnets to create their magnetic fields which allow greater control over the motor. At high power levels, DC motors are almost always cooled using forced air.

IR 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).

Types of Infra-Red SensorsThermal infrared sensors These use infrared energy as heat. Their photo sensitivity is independent of wavelength. Thermal detectors do not require cooling; however, they have slow response times and low detection capability.Quantum infrared sensors These provide higher detection performance and faster response speed. Their photo sensitivity is dependent on wavelength. Quantum detectors have to be cooled so as to obtain accurate measurements. The only exception is for detectors that are used in the near infrared region.

Comparator Comparator is a device which compares two input voltages and gives output high/low. In circuit diagramit is normally represented by a triangle having- Inverting (negative) Input (-),Non Inverting (positive) Input(+), Vcc, Ground, Output.

Use of comparator in IR sensorAs 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 that sensor.

LM358The LM358 is a great, easy-to-use dual-channel opamp. LM358 applications include transducer amplifiers, DC gain blocks and all the conventional opamp circuits.

Caster wheelACaster wheelis an undriven, single wheel that is designed to be mounted to the bottom of a larger object so as to enable that object to be easily moved. They are available in various sizes, and are commonly made of rubber, plastic, nylon, aluminum, or stainless steel, etc.

chassisChassis is the base frame of a car, carriage, or other wheeled vehicle.The rectangular, usually steel frame that holds the body and motor of an automotive vehicle.

Software used

The program code acts as the decision-maker embedded in the microcontroller i.e. it decides what will be the outputs for particular set of input combination. Programs for the AT89S52 series of microcontrollers can be written in assembly (ASM) and C. Keil, Flash magic etc. are some free development softwares for programming theAT89S52 Microcontrollers. We are using KEIL for programming. In KEIL we write our C code, after compilation it generates .hex file that is hardware level code.

KEIL UVISIONKeil 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.

Code for line follower#includesbit sensor1=P1^0;sbit sensor2=P1^1;sbit motor1=P0^0;sbit motor2=P0^1;void main(){sensor1=sensor2=0;motor1=motor2=0;while(1){if((sensor1==1)&&(sensor2==0)){motor1=1;

motor2=0;}else if((sensor1==0)&&(sensor2==1)){motor1=0;motor2=1;}else if((sensor1==0)&&(sensor2==0)){motor1=0;motor2=0;}else if((sensor1==1)&&(sensor2==1)){motor1=1;motor2=1;}}IC 7805IC 7805 is a 5V Voltage Regulator that restricts the voltage output to 5V and draws 5V regulated power supply