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

Discussion in 'Embedded Systems and Microcontrollers' started by lkwah86, Jul 28, 2008.

  1. lkwah86

    Thread Starter Member

    Mar 9, 2007
    22
    1
    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?
     
    RRITESH KAKKAR likes this.
  2. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    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?
     
  3. bertus

    Administrator

    Apr 5, 2008
    15,648
    2,347
  4. scubasteve_911

    Senior Member

    Dec 27, 2007
    1,202
    1
    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
     
  5. Reshma

    Active Member

    Mar 11, 2007
    54
    0
    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.
     
  6. nanovate

    Distinguished Member

    May 7, 2007
    665
    1
    Mike Predko also has a book specifically on PICs
     
  7. EnginiusXIII

    Member

    Oct 2, 2007
    21
    0
    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
     
  8. lkwah86

    Thread Starter Member

    Mar 9, 2007
    22
    1
    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?
     
  9. EnginiusXIII

    Member

    Oct 2, 2007
    21
    0
    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.
     
  10. lkwah86

    Thread Starter Member

    Mar 9, 2007
    22
    1
  11. lkwah86

    Thread Starter Member

    Mar 9, 2007
    22
    1
    Schematic and coding...
     
  12. distortionless

    New Member

    Jan 17, 2009
    1
    0
    bro.. can u mail me some pics on the hardware part of your robo? thanks bro..
     
  13. dongkoy

    New Member

    Jan 23, 2009
    1
    0
    can i have the schematics?
     
  14. Hardin Avishek

    New Member

    Apr 9, 2009
    1
    0
    Bro can i hav the Schematics for your robot
     
  15. lkwah86

    Thread Starter Member

    Mar 9, 2007
    22
    1
    Hope can help
     
  16. lkwah86

    Thread Starter Member

    Mar 9, 2007
    22
    1
  17. nanovate

    Distinguished Member

    May 7, 2007
    665
    1
    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.
     
  18. huey120907

    New Member

    Sep 6, 2009
    1
    0
    this is amazing can you send me more actual pictures we have a project it will be passed 2 week from now nice one
     
  19. amitie

    New Member

    Jan 29, 2010
    3
    0
    where to input the sensor.which pin in the pic plsssssssssssss....
     
  20. amitie

    New Member

    Jan 29, 2010
    3
    0
    plssss.send to my email <snip> I'm in need for my project design
     
    Last edited by a moderator: Feb 5, 2010
Loading...