LINE FOLLOWER ROBOT
What is a robot ?
It
is a machine which performs a variety of tasks, either using manual external
control or intelligent automation.
Types of robot :
- Stationary
- Mobile
- Introduction
- Overview
- Block Diagram
- Material Required
- Circuit Diagram
- Software Requirement
- Microcontroller
- Development board
- Motor Drive
- IR Sensor
- USB AVR Programmer
- Source Code
- Reference
Introduction
Line follower is a machine that can follow a path. The path can be
visible like a black line on a white surface (or vice-versa).
Sensing a line and maneuvering the robot to stay on course, while
constantly correcting wrong moves using feedback mechanism forms a
simple yet effective closed loop system. As a programmer you get an
opportunity to ‘teach’ the robot how to follow the line thus giving it a
human-like property of responding to stimuli.
Practical applications of a line follower: Automated cars running on
roads with embedded magnets; guidance system for industrial robots
moving on shop floor etc.
Overview
In the line follower robot project we have used 2 pairs of IR (infra-red)
emitter/sensor. The sensor on getting blocked or unblocked sends combination of
high/low signals to ATMEGA32 microcontroller which are processed andappropriate signals are sent to L293D (motor driver chip) which switches on/off
the motors so as to keep the robot moving in one direction.
Block Diagram
Material Reqiured
The component list making the robot is as follows :
- Microcontroller - 1 (ATMEGA32)
- Development Board - 1 ( 40 Pin AVR Intermediate Development Board )
- USB AVR Programmer - 1
- Motor Drive - 1 (L293D)
- DC Gear Motor - 2 (60 rpm)
- IR Sensor - 2
- Chassis - 1 (light weight )
- Adapter -1 (12 V, 1 A)
- Connecting Wire / Jumper Wire - as per require
Circuit Diagram
The software for the robot was coded in C, because of
compiler availability, our familiarity with the language, as well as the
greater control of the system offered as compared to other high level
languages. While our microcontroller supports assembly language, it was avoided
because it’s
a difficult to maintain, and varies
greatly from processor to processor.
CodeVision AVR has been used in this project.
- eXtreme Burner - AVR
Microcontroller
A Microcontroller can
be defined as a “Computer-on-Chip”. AVR ATmega32 8-BIT Microcontroller,
In-system Programmable with Flash code storage, re-programmble up to 1000 time.
Features
- 32 K BYTES of In-System Programmable Flash
- 1K BYTES of In-System Programmable EEPROM
- 2 K Bytes SRAM
- Analog Comparator
- 28-bit Timers plus prescale
- 216-bit Timers with prescaler, capture etc.
Development Board
A general purpose 40 pin AVR development board with 16x2
LCD support, power supply circuit, RS232 port for serial interface with
computer and other serial devices, reset switch, power status LED, a 6 pin ISP
header and 4 x general purpose LEDs and Switches.
The
board is compatible with the Atmega16, Atmega32 and other compatible 40 pin AVR
microcontrollers.
Motor Driver
L239D is
a typical Motor driver or Motor Driver IC which allows DC motor to drive on
either direction. L293D is a 16-pin IC which can control a set of two DC motors
simultaneously in any direction. It means that you can control two DC motor
with a single L293D IC.
IR Sensor
IR sensor are also used to distinguish between and white surfaces.White surfaces reflect all types of light while black surfaces absorb them.Therefore,depending on the amount of light reflected back to the IR recevier, the IR sensor can also be used to distinguish between black and white surfaces.
USB AVR Programmer
Programmer is basically used for to burn program in microcontroller.
Source Code
/*****************************************************
This program was produced by the
CodeWizardAVR V2.04.6 Evaluation
Automatic Program Generator
© Copyright 1998-2010 Pavel Haiduc, HP InfoTech s.r.l.
http://www.hpinfotech.com
Project :
Version :
Date : 10-02-2015
Author : Freeware, for evaluation and non-commercial use only
Company :
Comments:
Chip type : ATmega32
Program type : Application
AVR Core Clock frequency: 8.000000 MHz
Memory model : Small
External RAM size : 0
Data Stack size : 512
*****************************************************/
#include <mega32.h>
#include <delay.h>
// Declare your global variables here
void main(void)
{
// Declare your local variables here
// Input/Output Ports initialization
// Port A initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTA=0x00;
DDRA=0x00;
// Port B initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTB=0x00;
DDRB=0x00;
// Port C initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTC=0x00;
DDRC=0x00;
// Port D initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTD=0x00;
DDRD=0x00;
// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: Timer 0 Stopped
// Mode: Normal top=FFh
// OC0 output: Disconnected
TCCR0=0x00;
TCNT0=0x00;
OCR0=0x00;
// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: Timer1 Stopped
// Mode: Normal top=FFFFh
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer1 Overflow Interrupt: Off
// Input Capture Interrupt: Off
// Compare A Match Interrupt: Off
// Compare B Match Interrupt: Off
TCCR1A=0x00;
TCCR1B=0x00;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;
ICR1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;
// Timer/Counter 2 initialization
// Clock source: System Clock
// Clock value: Timer2 Stopped
// Mode: Normal top=FFh
// OC2 output: Disconnected
ASSR=0x00;
TCCR2=0x00;
TCNT2=0x00;
OCR2=0x00;
// External Interrupt(s) initialization
// INT0: Off
// INT1: Off
// INT2: Off
MCUCR=0x00;
MCUCSR=0x00;
// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0x00;
// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0x80;
SFIOR=0x00;
DDRA=0;
DDRD=255;
while (1)
{
if((PINA.0==1)&&(PINA.1==1))
PORTD=0b00001010;
else if((PINA.0==0)&&(PINA.1==1))
PORTD=0b00001001;
else if((PINA.0==1)&&(PINA.1==0))
PORTD=0b00000110;
else
PORTD=0;
delay_ms(20);
}
}
Reference
1) https://www.atmel.com
2) www.8051projects.info/proj.asp?ID=50
3) One of the best sites AVR site www.avrfreaks.net.
4) extremeelectronics.co.in