0% found this document useful (0 votes)
10 views8 pages

Experiment On Mobile Robot Hardware Involving Sensors (Line Follower Using Firebird V At-Mega 328P)

The document outlines an experiment to create a line-following mobile robot using the Firebird V Atmega328P. It includes software and hardware requirements, a detailed procedure for programming and uploading code, and theoretical insights into the robot's design and capabilities. Additionally, it discusses the specifications, applications, and observations from the experiment, concluding with a successful implementation of the line-following functionality.

Uploaded by

prenesh.2210037
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views8 pages

Experiment On Mobile Robot Hardware Involving Sensors (Line Follower Using Firebird V At-Mega 328P)

The document outlines an experiment to create a line-following mobile robot using the Firebird V Atmega328P. It includes software and hardware requirements, a detailed procedure for programming and uploading code, and theoretical insights into the robot's design and capabilities. Additionally, it discusses the specifications, applications, and observations from the experiment, concluding with a successful implementation of the line-following functionality.

Uploaded by

prenesh.2210037
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Exp.

No: 5 Experiment on Mobile Robot Hardware Involving Sensors


Date: 15.02.2025 (Line Follower using Firebird V At-Mega 328P)

AIM:
Conduct Experiment to follow the line using Firebird V Atmega328P Robot.

SOFTWARE AND HARDWARE REQUIREMENTS:

1. Firebird V Atmega328P

2. Arduino IDE

3. AVR Bootloader

PROCEDURE:
 Open Arduino IDE.
 Write the line follower program in embedded C language.
 Once, the coding has been finished, in Tools > Select board > Arduino 328P.
 Verify the code and find if any error is present.
 If not the temp file is created in the temp folder.
 To navigate to Temp folder, Hold Windows+R > type in %TEMP% > click enter.
 You will be navigated to the temp folder.
 Inside the temp folder a .hex file with the program name would be created, copy that
file, and paste it in desktop.
 Open AVR bootloader.
 Select the port the Firebird V is connected to the system.
 Select the microcontroller to 328P and fix the baud rate to 115200.
 After the initial setup, click on three dots present in AVR bootloader and navigate to
the place you have stored the file.
 Select the file and click on program and wait till the code has been fully uploaded..

THEORY:
FIRE BIRD V will help us get acquainted with the world of robotics and embedded
systems. Thanks to its innovative architecture and adoption of the ‘Open-Source Philosophy’
in its software and hardware design, us will be able to create and contribute too, complex
applications that run on this platform, helping us acquire expertise as us spend more time with
them. Fire Bird V is designed by NEX Robotics and Embedded Real Time Systems lab, CSE
IIT Bombay. As a Robotic Research Platform, the Fire Bird V provides an excellent
environment for experimentation, algorithm development and testing. Its modular architecture
allows us to control it using multiple processors such as 8051, AVR and ARM7 etc. Modular
sensor pods can be mounted on the platform as dictated by intended applications. Precision
position encoders makes it possible to have accurate position control. Platform can be
upgraded to tank drive, Hexapod, or any other desired form very easily. It is powered by high
performance rechargeable NiMH batteries. A 2.4GHz ZigBee module provide secure and
multi-channel wireless communication up to a range of one kilometer line of sight.

Academic Year: 2024 – 2025 (Even Semester) Roll No: 71812210012


20RA277Autonomous Mobile Robots Laboratory/Exp. No: Name: Gowriraj PK
5
SPECIFICATIONS:

Microcontroller:
 Atmel ATMEGA2560 as Master microcontroller
 Atmel ATMEGA8 as Slave microcontroller.

Sensors:
 Three white line sensors (extendable to 7)
 Five Sharp GP2D12 IR range sensor (80cm) (One in default configuration.
(Also supports GP2D120 (30cm) and GP2Y0A02 (150cm)Eight analog IR
proximity sensors (20cm)
 Eight analog directional light intensity sensors
 Two position encoders (extendable to four)
 Battery voltage sensing
 Current Sensing (Optional)
 Servo mounted sensor pod (optional)
 Wireless colour camera (optional)
 Ultrasound scanner (optional)
 Gyroscope and Accelerometer (optional)
 Magnetometer (optional)
 GPS receiver (optional)

Indicators:
 2 x 16 Characters LCD
 Indicator LEDs
 Buzzer
 Control
 Autonomous Control
 PC as “Master” and Robot as “Slave” in wired or wireless mode
 Distributed (multi robot) communication.
 Communication
 Wireless ZigBee Communication (2.4GHZ) (Optional)
 USB Communication
 Wired RS232 (serial) communication

APPLICATIONS:
 Learning Embedded systems and robotics
 Mapping and autonomous navigation
 Mobile sensor network
 Real-Time systems Collaborative robotics
 Swarm robotics and other behaviours
 Control system

SCHEMATIC DIAGRAMS:

Academic Year: 2024 – 2025 (Even Semester) Roll No: 71812210012


20RA277Autonomous Mobile Robots Laboratory/Exp. No: Name: Gowriraj PK
5
Firebird V Mobile Robot:

Top View of the Main Board:

Academic Year: 2024 – 2025 (Even Semester) Roll No: 71812210012


20RA277Autonomous Mobile Robots Laboratory/Exp. No: Name: Gowriraj PK
5
Bottom View of the Main Board:

PROGRAM:
#include <avr/interrupt.h>
#include <util/delay.h>
#include <math.h>
#include "lcd.c"
void port_init();
void timer5_init();
void velocity(unsigned char, unsigned char);
void motors_delay();
unsigned char ADC_Conversion(unsigned char);
unsigned char ADC_Value;unsigned char flag= 0;
unsigned char Left_white_line= 0;
unsigned char Center_white_line= 0;
unsigned char Right_white_line= 0;
void lcd_port_config (void) {
DDRC= DDRC | 0xF7;
PORTC= PORTC& 0x80;
}
void adc_pin_config (void) {
DDRF= 0x00;
PORTF= 0x00;
DDRK= 0x00;
PORTK= 0x00;
}
void motion_pin_config (void) {
Academic Year: 2024 – 2025 (Even Semester) Roll No: 71812210012
20RA277Autonomous Mobile Robots Laboratory/Exp. No: Name: Gowriraj PK
5
DDRA= DDRA | 0x0F;
PORTA= PORTA& 0xF0;

DDRL= DDRL | 0x18;


PORTL= PORTL | 0x18;
}
void port_init() {
lcd_port_config();
adc_pin_config();
motion_pin_config(); }
void timer5_init() {
TCCR5B= 0x00;
TCNT5H= 0xFF;
TCNT5L= 0x01;
OCR5AH= 0x00;
OCR5AL= 0xFF;
OCR5BH= 0x00;
OCR5BL= 0xFF;
OCR5CH= 0x00;
OCR5CL= 0xFF;
TCCR5A= 0xA9;
TCCR5B= 0x0B;

}
void adc_init() {
ADCSRA= 0x00;
ADCSRB= 0x00;
ADMUX= 0x20;
ACSR= 0x80;
ADCSRA= 0x86;
}
unsigned char ADC_Conversion(unsigned char Ch) {
unsigned char a;
if(Ch>7) {
ADCSRB= 0x08;

}
Ch= Ch& 0x07;
ADMUX= 0x20| Ch;
ADCSRA= ADCSRA | 0x40;
while((ADCSRA&0x10)==0);
a=ADCH;
ADCSRA= ADCSRA|0x10;

ADCSRB= 0x00;
return a; }
void print_sensor(char row, char coloumn,unsigned charchannel) {
ADC_Value= ADC_Conversion(channel);
lcd_print(row, coloumn, ADC_Value, 3); }
void velocity (unsigned char left_motor, unsigned charright_motor) {
OCR5AL= (unsigned char)left_motor;
OCR5BL= (unsigned char)right_motor;
}
void motion_set (unsigned char Direction) {
Academic Year: 2024 – 2025 (Even Semester) Roll No: 71812210012
20RA277Autonomous Mobile Robots Laboratory/Exp. No: Name: Gowriraj PK
5
unsigned char PortARestore= 0;
Direction &= 0x0F;
PortARestore= PORTA;
PortARestore &= 0xF0;
PortARestore |= Direction;
PORTA= PortARestore;
}
void forward (void)
{motion_set (0x06);}
void stop (void) {
motion_set (0x00); }
void init_devices (void) {
cli();
port_init();
adc_init();
timer5_init();
sei();
}
int main()
{
init_devices();
lcd_set_4bit();
lcd_init();
while(1)
{
Left_white_line = ADC_Conversion(3);
Center_white_line = ADC_Conversion(2);
Right_white_line = ADC_Conversion(1);
flag=0;
print_sensor(1,1,3);
print_sensor(1,5,2);
print_sensor(1,9,1);
if(Center_white_line<0x28)
{
flag=1;
forward();
velocity(150,150);
}
if((Left_white_line>0x28) &&(flag==0))
{
flag=1;
forward();
velocity(130,50);
}
if((Right_white_line>0x28) && (flag==0))
{
flag=1;
forward();
velocity(50,130);
}
if(Center_white_line>0x28&& Left_white_line>0x28&&Right_white_line>0x28)
{
forward();
velocity(0,0); }}}
Academic Year: 2024 – 2025 (Even Semester) Roll No: 71812210012
20RA277Autonomous Mobile Robots Laboratory/Exp. No: Name: Gowriraj PK
5
Viva Questions:

1. What sensors are used in a line follower robot?


A line follower robot primarily uses infrared (IR) sensors to detect the line.
These sensors consist of an IR LED and a photodiode, which help differentiate
between the line and the background.

2. Why do we use IR sensors in a line follower robot?


IR sensors are used because they can detect the difference in reflectivity
between the line (dark surface) and the surrounding area (light surface). The
photodiode receives reflected IR light, allowing the robot to determine the path.

3. What microcontroller is used in Firebird V?


Firebird V uses the ATmega328P microcontroller, which is an 8-bit
microcontroller from the AVR family, commonly used in embedded systems due to its
low power consumption and ease of programming.

4. What motor driver IC is used in Firebird V, and why?


Firebird V uses the L293D motor driver IC to control the DC motors. This IC
allows bidirectional control of motors using low-power control signals from the
microcontroller.

5. Why do we need a motor driver in a line follower robot?


Microcontrollers cannot supply enough current to drive DC motors directly.
The motor driver acts as an interface between the microcontroller and the motors,
providing sufficient current and voltage.

6. How can the performance of a line follower robot be improved?


 Using PID control for better speed and accuracy.
 Calibrating sensor sensitivity for different surface conditions.
 Using high-resolution encoders for precise movement.

Inferences/Observations:

 Gained an understanding of how IR sensors detect the contrast between a line and its
background, enabling autonomous navigation.
 Learned the importance of sensor calibration to ensure accurate detection, as improper
calibration can lead to tracking errors.
 Understood the role of the motor driver (L293D) in controlling the movement of DC
motors based on microcontroller signals.
 Observed that surface quality (e.g., brightness, reflectivity, and texture) significantly
affects sensor readings and robot performance.
 Realized that speed control using PWM is crucial, as excessive speed may cause
overshooting, while slow speeds improve precision but reduce efficiency.
 Noted the challenges in handling sharp turns and intersections, which can be improved
using advanced algorithms like PID control.
 Gained insights into how battery voltage fluctuations impact motor speed and sensor
sensitivity, affecting the robot’s reliability.

Academic Year: 2024 – 2025 (Even Semester) Roll No: 71812210012


20RA277Autonomous Mobile Robots Laboratory/Exp. No: Name: Gowriraj PK
5
OUTPUT:

RESULT:
Thus, the code has been successfully verified and the Line following using Firebird V mobile robot
is done.
Academic Year: 2024 – 2025 (Even Semester) Roll No: 71812210012
20RA277Autonomous Mobile Robots Laboratory/Exp. No: Name: Gowriraj PK
5

You might also like