Line follower using the pic16f877

preeste

preeste

@preeste-Q3d5XK Oct 21, 2024
hey there....i am looking to build a line follower using the pic16f877.....i plan on using red leds and phototransistors for my sensors and also want to use the whole concept of differential drive for moving my motors using only 2 wheels. can anyone please help me.....i dont know how to start, dont know what components i will need etc....please help.....does anyone have a schematic available for such a project? please help....am desperate.....thanks a lot in advance

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • preeste

    preeste

    @preeste-Q3d5XK Nov 1, 2007

    oh yeas....i want to also use geared motors, 5 sensors using thered leds and OP505B phototransistors.......furthermore i want to use the L293D h-bridge to control motor....can someone help me with a design for the line follower with all the above requirements......i will be so greatful......please its urgent....like i need it if its possible in the next two days maximum....thanks again
  • preeste

    preeste

    @preeste-Q3d5XK Nov 3, 2007

    Can someone please help? 4 days and no help! 😔
  • Kaustubh Katdare

    Kaustubh Katdare

    @thebigk Nov 4, 2007

    preeste
    Can someone please help? 4 days and no help! 😔
    Replies will take some time. You will have to be bit patient!

    -The Big K-
  • John Connor

    John Connor

    @john-connor-U8snPq Nov 28, 2007

    look this link

    #-Link-Snipped-#

    replace the pic for the 16f877

    and configure this code in the pic


    DEFINE LOADER_USED 1
    J VAR BYTE
    SYMBOL ENAL = PORTB.0
    SYMBOL ENAR = PORTB.1
    SYMBOL LAMOT = PORTB.2
    SYMBOL LBMOT = PORTB.3
    SYMBOL RAMOT = PORTB.4
    SYMBOL RBMOT = PORTB.5
    RIR0 VAR BYTE
    RIR1 VAR BYTE
    RIR2 VAR BYTE
    RIR3 VAR BYTE
    TRISB = 0
    ADCON1 = $00
    J = 240
    INI:
    ADCIN 0,RIR0
    ADCIN 1,RIR1
    ADCIN 2,RIR2
    ADCIN 3,RIR3
    INICIO:
    IF RIR0 > J AND RIR1 > J AND RIR2 > J AND RIR3 > J THEN INI
    IF RIR0 <= J AND RIR1 <= J AND RIR2 <= J AND RIR3 <= J THEN INI
    IF RIR0 > J AND RIR1 > J AND RIR2 <= J AND RIR3 <= J THEN FORWARD
    IF RIR0 > J AND RIR1 > J AND RIR2 > J AND RIR3 > J THEN FORWARD
    IF RIR0 > J AND RIR1 <= J AND RIR2 <= J AND RIR3 <= J THEN BACK
    IF RIR0 <= J AND RIR1 > J OR RIR2 > J OR RIR3 > J THEN BACK
    IF RIR0 > J AND RIR1 > J AND RIR2 > J AND RIR3 <= J THEN LEFT
    IF RIR0 <= J AND RIR1 > J AND RIR2 > J AND RIR3 <= J THEN LEFT
    IF RIR0 > J AND RIR1 > J AND RIR2 <= J AND RIR3 > J THEN RIGHT
    IF RIR0 <= J AND RIR1 > J AND RIR2 <= J AND RIR3 > J THEN RIGHT
    IF RIR0 > J AND RIR1 <= J AND RIR2 > J AND RIR3 <= J THEN MAXLEFT
    IF RIR0 <= J AND RIR1 <= J AND RIR2 > J AND RIR3 <= J THEN MAXLEFT
    IF RIR0 > J AND RIR1 <= J AND RIR2 <= J AND RIR3 > J THEN MAXRIGHT
    IF RIR0 <= J AND RIR1 <= J AND RIR2 <= J AND RIR3 > J THEN MAXRIGHT
    goto INI
    FORWARD:
    ENAL = 1
    ENAR = 1
    LAMOT = 1
    LBMOT = 0
    RAMOT = 0
    RBMOT = 1
    GOTO INI

    BACK:
    ENAL = 1
    ENAR = 1
    LAMOT = 0
    LBMOT = 1
    RAMOT = 1
    RBMOT = 0
    GOTO INI

    LEFT:
    ENAL = 1
    ENAR = 0
    LAMOT = 1
    LBMOT = 0
    RAMOT = 1
    RBMOT = 0
    GOTO INI

    RIGHT:
    ENAL = 0
    ENAR = 1
    LAMOT = 0
    LBMOT = 1
    RAMOT = 0
    RBMOT = 1
    GOTO INI

    MAXLEFT:
    ENAL = 1
    ENAR = 1
    LAMOT = 1
    LBMOT = 0
    RAMOT = 1
    RBMOT = 0
    GOTO INI

    MAXRIGHT:
    ENAL = 1
    ENAR = 1
    LAMOT = 0
    LBMOT = 1
    RAMOT = 0
    RBMOT = 1
    GOTO INI

    END

    TAKE CARE

    ATT

    JOHN CONNOR
  • jmn

    jmn

    @jmn-H5FsIf Dec 24, 2007

    I am building a line follower. I use a pic16f877a to read the sensors and to control the motors. To drive the motors I use a l298, line sensors: CNY70, differential drive with tamiya gearbox.

    This is the robot if this can help you..
    <a href="https://www.flickr.com/photos/11711916@N06/" target="_blank" rel="nofollow noopener noreferrer">pic16f690 | Flickr</a>

    I am testing now the pcb and programming the pic. Tamiya gearbox is a good way to build the differential drive, it is cheap an fast.