Paul Exp6
Paul Exp6
AIM:
Conduct Experiment to follow the line using Firebird V Atmega328P Robot.
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.
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
PROGRAM:
#include <avr/interrupt.h>
}
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) {
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);
Academic Year: 2024 – 2025 (Even Semester) RollNo:71812210031
20RA277Autonomous Mobile Robots Laboratory/Exp. No: 6 Name: Paul Dhayanidhi D
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);
}}} Viva
Questions:
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.