0% found this document useful (0 votes)
118 views

Repaort Line Follower Robot

This document describes a line follower robot that uses two IR sensors and an ATMega16 microcontroller to follow a black line on a white surface. The robot uses the IR sensors to detect the line and determine whether to move forward, left, or right. The document provides sample code to control the robot's movement and display sensor readings on an LCD screen. It also explains the hardware components and programming process to run the line follower robot.

Uploaded by

parveshtext
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
118 views

Repaort Line Follower Robot

This document describes a line follower robot that uses two IR sensors and an ATMega16 microcontroller to follow a black line on a white surface. The robot uses the IR sensors to detect the line and determine whether to move forward, left, or right. The document provides sample code to control the robot's movement and display sensor readings on an LCD screen. It also explains the hardware components and programming process to run the line follower robot.

Uploaded by

parveshtext
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Line Follower Robot

Description

This Robot is programmed to follow a black line on a white background. The path is made with black electrical tape or black paint on a white surface. LFR constantly correcting wrong moves using feedback mechanism forms a simple yet effective closed loop system using IR Sensor pair. 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.

Hardware

In the circuit two IR sensors, one LCD display and two DC geared motors are connected to the ATMega16. The robot uses IR sensors to sense the line an array of 2 IR LEDs (Tx) and sensors (Rx), facing the ground has been used in this setup. The output of the sensors is an analog signal which depends on the amount of light reflected back. By comparing this analog signal microcontroller decides the next move according to the algorithm.

TOP VIEW OF LINE FOLLOWER ROBOT

Sample Code: Line Follower Robot without LCD


#include <avr/io.h> #include <util/delay.h> #include "adc_lib.h" #include "lcd_lib.h" #include<stdio.h> int main() { char A[20]= " "; int s1,s2; DDRD=255; ADCinit(); LCDinit(); LCDclr(); while(1) { s1=read_adc(0); s2=read_adc(1); if(s1<600&s2<600) /// change the value according the sensor value

PORTD=0b10010000;// forward when both sensor are in white surface if(s1>600&s2<600) PORTD=0b10100000;// right when one sensor in black & one sensor in white surface if(s1<600&s2>600) PORTD=0b01010000; // left when one sensor in white & one sensor in black surface if(s1>600&s2>600) PORTD=0b10010000;// forward when both sensor are in black surface sprintf(A, " s1=%d s2=%d ", s1,s2); LCDGotoXY(0,0); LCDstring(A,16); } }

Process:
Connect LCD and IR sensor & motor on the kit. Run Eclipse in your computer. Make your own project. Copy lcd_lib.h & lcd_lib.c from BRiCS CD to your project. Copy adc_lib.h & adc_lib.c from BRiCS CD to your project. Write the above code in main.c Compile the code. If successful, transfer it to your hardware.

Sample Code: Line Follower Robot with LCD


#include <avr/io.h> #include <util/delay.h> #include "adc_lib.h" #include "lcd_lib.h" #include<stdio.h> int main() { char A[20]= " "; int s1,s2; DDRD=255; ADCinit(); LCDinit(); LCDclr(); while(1) { s1=read_adc(0); s2=read_adc(1); if(s1<600&s2<600) /// change the value according the sensor value PORTD=0b10010000;// forward when both sensor are in white surface

if(s1>600&s2<600) PORTD=0b10100000; // right when one sensor in black & one sensor in white surface if(s1<600&s2>600) PORTD=0b01010000; // left when one sensor in white & one sensor in black surface if(s1>600&s2>600) PORTD=0b10010000;// forward when both sensor are in black surface sprintf(A, " s1=%d s2=%d ", s1,s2); LCDGotoXY(0,0); LCDstring(A,16); } }

Process:
Connect LCD and IR sensor & motor on the kit. Run Eclipse in your computer. Make your own project. Copy lcd_lib.h & lcd_lib.c from BRiCS CD to your project. Copy adc_lib.h & adc_lib.c from BRiCS CD to your project. Write the above code in main.c Compile the code. If successful, transfer it to your hardware.

You might also like