How to start? [Line Following Robot with PIC 16F877A]

SgtWookie

Joined Jul 17, 2007
22,230
My lecturer give us a project to build a line following robot with the PIC 16F877A. And writing the code using C programming. How should I start?
Have you installed the MPLAB IDE yet?

Have you gone through the demonstration programs that Microchip supplies with the MPLAB IDE?

Those would be a couple of good steps for starters.

Do you have stepper motors already, or do you need to get some?
 

scubasteve_911

Joined Dec 27, 2007
1,203
My best advice would be to build the platform ASAP, then worry about all the programming details. I have been a student for many many years and have seen others take on similar projects, the successful ones had a working platform months in advance in order to fine tune their code.

Steve
 

Reshma

Joined Mar 11, 2007
54
My lecturer give us a project to build a line following robot with the PIC 16F877A. And writing the code using C programming. How should I start?
Have you done programming using PIC microcontrollers? First, you must get familiar with the programming fundamentals. There is a similar project on a "Line following Robot" adeptly described in Mike Predko's "Programming & Customizing the 8051 Microcontroller" with the source code. Once you are comfortable with PIC programming you can modify the program in this book for PIC 16F877A.
 
Well, based on my past experiences, you could first try to read through the data sheet of the particular PIC. Understanding your chip is essential in order to construct your circuit and also to programming it. Well, basically you could find some example of schematic by googling it.

Three major part in constructing a simple mobile robot :-
1. Mechanism
2. Circuit
3. Programming

As a start, you need to decide on the method to control your speed during line following.
You can control with either constant speed or speed involves with acceleration (PWM).
Well during my first try, I was using constant speed since I'm inexperience with PWM although it is nothing that difficult.

Here I share with you some very very basic of line following source code which is really really basic since it only involve if....else statement.

(using 4 sensors to detect the line position)
if( sen1 == 0 && sen2 ==1 && sen3 == 1 && sen4 == 0)
{
forward_speed = 200;
}
else if( .......)

Since I'm using 4 sensors, so there are 16 conditions to be compare. However some of the conditions are unreasonable for example 0101. So you may just ignore it.
Using 'if statement' to compare your position and adjust or control your motor speed as to its current position.

Well, happy constructing your first line following robot.

Vincent
 

Thread Starter

lkwah86

Joined Mar 9, 2007
22
Thx for all the advices...
The first part is doing sensor... I have to build a circuit and programme it... How can it detect the white line or black line?
 
What are the sensor that you are using ? IR sensor, photo reflector ?...

Usually, sensors will produce different output voltage or potential difference when it sense light or dark. So, if you are using an IR sensors (consist of transmitter and receiver), you should connect it with a potentiometer so that you could adjust the level of reference voltage. Of course this involve a comparator (LM324) to compare the produced potential difference from the sensor with the reference voltage.

As for additional information, please use LEDs to test the results you obtained from the sensors.
 

nanovate

Joined May 7, 2007
666
Bro,
Can you do all my work for me? I need schematics, pcb layout, instructions (nevermind I'll just email u if I have q's) also can you just send me a completely built robot-- I need it urgently and I do not have time to do it myself


...just kidding. Great job -- saw the youtube video.
 
Top