Professional Documents
Culture Documents
List of Contents
Pages
1. INTRODUCTION
2. LIST OF FIGURE AND APPENDIX
3. PROJECT DESCRIPTIONS
4. LIST OF HARDWARE, COMPONENTS AND
5
SOFTWARE USE
5. EXPLANATION ON HARDWARE AND
COMPONENTS SELECTION
6. CONTROLLER CIRCUIT DEVELOPMENT
7. SOFTWARE AND PROGRAM
DEVELOPMENT
8. SOP ON HARDWARE AND SOFTWARE
9. EXPECTED RESULT ACHIEVE
10.
DISCUSSION
11.
CONCLUSION
INTRODUCTION
2
3
4
6-8
For the subject Mechatronic System Design (FAB 30503), lectured by Mdm.
Siti Khadijah, students are required to come out with a line following robot.
A line following robot is basically a robot designed to follow a line or
path which already predetermined by the user. This line or path may be as
simple as a physical white line on the floor or as complex path marking
schemes e.g. embedded lines, magnetic markers and laser guide markers.
In order to detect this specific line, various sensing schemes can be
employed. These schemes may vary from simple low cost line sensing
circuit to expensive vision systems. The choice of these schemes would be
dependent upon the sensing accuracy and flexibility required. From the
industrial point of view, line following robot has been implemented in semi
to fully autonomous plants. In this environment, these robots functions as
materials carrier to deliver products from one manufacturing point to
another where rail, conveyor and gantry solutions are not possible. Apart
from the line following capabilities, these robots should also have the
capability to navigate junctions and decide on which junction to turn and
which junction ignore. This would require the robot to have 90 degree turn
and also junction counting capabilities. To add on to the complexity of the
problem, sensor positioning also plays a role in optimizing the robots
performance for the tasks mentioned earlier.
Line-following robots with pick- and- placement capabilities are
commonly used in manufacturing plants. These move on a specified path
to pick the components from specified locations and place them on desired
locations. Basically, a line-following robot is a self-operating robot that
detects and follows a line drawn on the floor. The path to be taken is
indicated by a white line on a black surface. The control system used must
sense the line and manoeuvre the robot to stay on course while constantly
correcting the wrong moves using feedback mechanism, thus forming a
simple yet effective closed- loop system.
Pages
Figure
1
..12
Figure
2
..13
PROJECT DESCRIPTIONS
This project aims at developing a line following robot which is
programmed by using microcontroller AT89C51. The microcontroller has
been used to program the ROBOT to turn in a direction followed by
line.
Secondly, this project, Line Following Robot is based on 8 bit
Microcontroller AT89C51. This robot follows the white line which is drawn
over the black surface .The infrared sensors are used to sense the line.
When the infrared signal falls on the white surface, it gets reflected and if
it falls on the black surface, it is not reflected. This principle is used to scan
the lines for the robot to moves the path.
All the above systems are controlled by the Microcontroller. In our
project we are using the popular 8 bit microcontroller AT89C51. It is a 40
pin microcontroller. The Microcontroller AT89C51 is used to control the
motors. It gets the signals from the infrared sensors and it drives the
motors according to the sensor inputs. Two DC geared motors are used to
drive the robot in forward, left or right direction.
Component
PIC Start-up Kit (SK40A)
Comparator LM324
Motor Driver L293D
LED
IR Receiver
IR Emitter
Resistor 4.7K
Resistor 330R
Trimmer 10K
2510 -05 PCB Connector
2510 -02 PCB Connector
Wrapping Wire
PIC 16F877A
14 Pins IC Socket
16 Pins IC Socket
Rainbow Cable 5 Ways
RC Servo Motor C36S (modified)
Robot Base
Servo Wheel
Screw for Wheel
Castor BTU-720
9V Battery Snap
4AA Battery Holder
Donut Board
Software
MPLABX IDE
Proteus 7 Professional
Optional Item
UIC00A
UIC-s
Unit
1
1
1
4
4
4
4
8
4
2
3
3
1
1
1
1
2
1
2
8
2
1
1
1
Unit
1
1
Unit
1
1
Picture
Comparato
r LM324
Motor
Driver
L293D
LED
IR Sensor
Set (IR
Emitter and
IR Receive)
Explanation
ICSP connector for UIC00B
-simple and fast method to
load program.
Perfect fit for 40 pins PIC16F
and PIC18F.
Operating Voltage Range: 7V 15VDC
2 x programmable switch.
2 x LED indicator.
Exchangeable Crystal.
UART connection to interface
with other controller or even
computer.
Large DC Voltage Gain: 100dB
Input Common Mode Voltage
Range Includes Ground
Large Output Voltage Swing:
0V to VCC -1.5V
Power Drain Suitable for
Battery Operation
Wide Supply-Voltage Range:
4.5 V to 36 V
Separate Input-Logic Supply
Internal
ESD
Protection
Thermal Shutdown
High-Noise-Immunity Inputs
Peak Output Current 2 A Per
Channel (1.2 A for L293D)
Consists of an IR transmitter
and an IR receiver mounted
side by side on a tiny PCB
Minimum interface
5VDC power
2510 -05
PCB
Connector
2510 -02
PCB
Connector
Resistor
4.7K
Resistor
330R
Trimmer
10K
Wrapping
Wire
PIC
16F877A
14 Pins IC
Socket
16 Pins IC
Socket
Rainbow
Cable 5
Ways
RC Servo
Motor C36S
(modified)
Number of contacts: 14
Contact Gender: female
Number of rows: 2
Mounting style: straight
Low profile
Row Centerline: 0.3 inch
Number of contacts: 16
Contact Gender: female
Number of rows: 2
Mounting style: straight
Low profile
Row Centerline: 0.3 inch
5 ways rainbow cable
Plastics gears
Operating Voltage: 4.8 - 6VDC
Speed
at 6.0V(no
load):
0.12 s/60
Torque at 6.0V : 4.4 kg.cm
(~0.431 N.m)
Size: 40.7x20.5x39.5mm
Weight: 43g
Rotation angle: 180 degree
Approximate
Dimensions:
18.8cm x 18.2cm x 3.4cm
(Aluminium Thickness, 1mm)
Robot Base
Servo
Wheel and
Screw for
Wheel
Castor
BTU-720
9V
Battery
Snap
4AA
Battery
Holder
Donut
Board
standard
volt
UIC00A
Use with
battery
UIC-s
/
***************************************************************************
****
* DEVICE CONFIGURATION WORDS
*
***************************************************************************
****/
__CONFIG(HS &
WDTDIS &
PWRTEN &
BORDIS &
LVPDIS);
//
//
//
//
//
/
***************************************************************************
****
* PRIVATE FUNCTION PROTOTYPES
*
***************************************************************************
****/
void
void
void
void
void
void
void
/
***************************************************************************
****
* Global Variables
*
***************************************************************************
****/
char string_buffer[40] = {0};
/
***************************************************************************
****
* MAIN FUNCTION
*
***************************************************************************
****/
int main(void)
{
PORTA=0;
PORTB=0;
PORTC=0;
PORTD=0;
PORTE=0;
TRISA=0;
TRISB=0b00001111;
TRISC=0b00000110;
TRISD=0b00001111;
TRISE=0;
ADCON1=0b00001110;
CCP1CON=0b00000110;
CCP2CON=0b00000110;
T2CON=0b00000101;
PR2=0xFF;
while(1)
{
//start
int counter=0;
while (counter<1)
{
line_follow();
if (COUNTER==0)
{
while (COUNTER==0);
counter++;
//motor
//pwm
//sensor
//pwm1
//PMW2
//5khz
//255
}
}
//first corner
stop();
delay_ms(1000);
turn_right();
delay_ms(1700);
counter=0;
while (counter<2)
{
line_follow();
if (COUNTER==0)
{
while (COUNTER==0);
counter++;
}
}
//second
stop();
delay_ms(1500);
turn_left();
delay_ms(1900);
counter=0;
while (counter<2)
{
line_follow();
if (COUNTER==0)
{
while (COUNTER==0);
counter++;
}
}
//third
stop();
delay_ms(1500);
turn_right();
delay_ms(1900);
counter=0;
while (counter<2)
{
line_follow();
if (COUNTER==0)
{
while (COUNTER==0);
counter++;
}
}
//fourth
stop();
delay_ms(1500);
turn_left();
delay_ms(1900);
counter=0;
while (counter<1)
{
line_follow();
if (COUNTER==0)
{
while (COUNTER==0);
counter++;
}
}
//finish
foward();
delay_ms(1500);
stop();
delay_ms(10000);
}
while(1) continue;
prevent the PIC from reset
}
/
***************************************************************************
****
* PRIVATE FUNCTION: delay_ms
*
* PARAMETERS:
* ~ ui_value
- The period for the delay in miliseconds.
*
* RETURN:
* ~ void
*
* DESCRIPTIONS:
* Delay in miliseconds.
*
***************************************************************************
****/
void delay_ms(unsigned int ui_value)
{
while (ui_value-- > 0)
{
__delay_ms(1);
// must not over 39ms
}
}
/
***************************************************************************
****
* PRIVATE FUNCTION: beep
*
* PARAMETERS:
* ~ uc_count
- How many times we want to beep.
*
* RETURN:
* ~ void
*
* DESCRIPTIONS:
* Beep for the specified number of times.
*
***************************************************************************
****/
/*
void beep(unsigned char uc_count)
{
while (uc_count-- > 0)
{
BUZZER = 1;
delay_ms(50);
BUZZER = 0;
delay_ms(50);
}
}
*/
/
***************************************************************************
****
* PUBLIC FUNCTION: pwm_set_duty_cycle
*
* PARAMETERS:
* ~ ui_duty_cycle - The duty cycle of the PWM, 10 bits.
*
* RETURN:
* ~ void
*
* DESCRIPTIONS:
* Set the duty cycle of the PWM.
*
***************************************************************************
****/
//====================
line
following
functions
=====================
/
***************************************************************************
****
* PUBLIC FUNCTION: fast_line_follow
*
* PARAMETERS:
* ~ void
*
* RETURN:
* ~ void
*
* DESCRIPTIONS:
* perform line following in fast speed. This function must use SPG10-30K
and 46x10mm mini wheel,
* the position of motor to LSS05 is very important.
***************************************************************************
****/
void foward(void)
{
MR_1=1;
MR_2=0;
ML_1=1;
ML_2=0;
}
void turn_right(void)
{
MR_1=0;
MR_2=0;
ML_1=1;
ML_2=0;
}
void turn_left(void)
{
MR_1=1;
MR_2=0;
ML_1=0;
ML_2=0;
}
void stop(void)
{
MR_1=0;
MR_2=0;
ML_1=0;
ML_2=0;
}
void line_follow(void)
{
if ((S_LEFT == 1)&&(S_MIDDLE == 0)&&(S_RIGHT == 1))
//check middle, left and right sensor
//assuming black line, dark ON
{
//
motor(85,85);
MR_1=1;
MR_2=0;
ML_1=1;
ML_2=0;
}
}
if ((S_LEFT == 1)&&(S_MIDDLE == 1)&&(S_RIGHT == 0))
//check middle, left and right sensor
//assuming black line, dark ON
{
MR_1=0;
MR_2=0;
ML_1=1;
ML_2=0;
}
if((S_LEFT==
0)&&(S_MIDDLE
==
0)&&(S_RIGHT
0)&&(COUNTER==1)) //check middle, left and right sensor
//assuming black line, dark ON
{
==
MR_1=1;
MR_2=0;
ML_1=1;
ML_2=0;
}
if((S_LEFT==
0)&&(S_MIDDLE
==
0)&&(S_RIGHT
1)&&(COUNTER==1)) //check middle, left and right sensor
//assuming black line, dark ON
{
==
MR_1=1;
MR_2=0;
ML_1=1;
ML_2=0;
}
if((S_LEFT==
0)&&(S_MIDDLE
==
1)&&(S_RIGHT
0)&&(COUNTER==1)) //check middle, left and right sensor
//assuming black line, dark ON
{
==
MR_1=1;
MR_2=0;
ML_1=1;
ML_2=0;
}
if((S_LEFT==
0)&&(S_MIDDLE
==
1)&&(S_RIGHT
1)&&(COUNTER==1)) //check middle, left and right sensor
//assuming black line, dark ON
{
==
MR_1=1;
MR_2=0;
ML_1=1;
ML_2=0;
}
if((S_LEFT==
1)&&(S_MIDDLE
==
1)&&(S_RIGHT
1)&&(COUNTER==1)) //check middle, left and right sensor
//assuming black line, dark ON
{
MR_1=1;
MR_2=0;
ML_1=1;
ML_2=0;
}
}
==
Software
7.2.1 Creating New Program
1) Open MPLABX IDE software on computer.
2) Select Project Wizard > Next > select Device for PIC and Next >
select HI-TECH Universal ToolSuite and Next > Browse then write
a File Name and Save and Next > Next > Finish
3) Add file .c for Source File and .h for Header File
4) Build and wait until window show Build Successful!
7.2.2 Load Program
1) Plug-in cables to PIC controller, UIC00A and a computer.
2) Open MPLABX IDE software on computer.
3) Switch on the PIC controller.
4) Click Programmer > Select Programmer > select PICkit 2.
5) Click Programmer > Settings and tick all except Output to debug
file, Preserve device EEPROM and set VDO Voltage to:.
6) Click Rebuild and wait until window show PICkit 2 ready.
7) Create or load a program.
8) Click Rebuild and wait until window show PICkit 2 ready.
9) Switch off the PIC controller.
10)
Unplug the cable from PIC controller.
21 | P a g e
Figure
1
Figure 1 - above is the desired line following track. Yellow colored line is the
path which the robot need to move.
22 | P a g e
Figure
2
23 | P a g e
DISCUSSION
1. It can act as maze solver. Basically, it follows a line, therefore it can be
used in mining where the robots are used to find the way out of the
mine.
2. If we implement a robotic arm along with the line follower then it can
be used to pick and place the objects in its way and can be very useful
in our day to day life.
3. Apparatus to control the automatic placing of material along a junction
between surfaces with reference to the form and position of the
junction including a tool controllably movable to deposit material
progressively along the junction in response to a control signal.
4. An imager linked to the movement of the tool to produce an image of
the surfaces.
5. By modifying the position of the sensors, same principle can be used in
obstacle avoidance and edge detection.
24 | P a g e
CONCLUSION
This is the first step of making intelligent robots capable of making their own
decisions on the situations provided. The design, implementation and testing
of a working project proved to be very challenging. The primary objective of
detecting and following a specific colored line proved to be a great learning
experience, as we did not have prior hands-on experience in Embedded
Systems.
The difficulties in project management as well as those brought to light
during experimentation provided an opportunity to work on problem-solving
abilities. Despite many problems encountered, I found this experience a
rewarding and educational one.
This project can have many uses in practical fields, from teenagers
toy cars to robots working in industries and even in wars. It can be further
improved to have more decision taking capabilities by employing varied
types of sensors and thus could be used in big industries for different
applications.
As an ending, we would like to express our gratitude to Mdm. Siti
Khadijah, our lecturer and guider in completing this line following robot.
25 | P a g e
APPENDIX
26 | P a g e