Wednesday, 23 January 2013

MOBOT (Line Follower Robot)

One of the most exciting engineering projects that has been implemented here at NDDU is the MOBOT. Mobot is basically a line follower robot or also known as a mobile robot that follows a certain path by sensing the track. Students at NDDU competes for the fastest and accurate line follower robot. A race is annually held during the Engineering Exhibit and all engineering students under the microprocessor class are qualified to join this event. This event is one of the most top project controversy for the Engineering department. As for me, I am very excited in making this project and for the competition as well.

Shown below is the schematic diagram of the MOBOT:


Parts Used:

LM324 - operational amplifiers
L298 - H-Bridge (IC)
CNY70 - optocoupler sensors
PIC16f877a - microprocessor
Trimmer/potentiometer - adjustable resistor
LM7805 or LM323 or any regulators that has 3A rating and adjust the voltage to 5V.
(I suggest to use LM323 because it has a 3A current rating)
resistors, capacitors
crystal oscillator- 20MHz
header pins
wires
RC Car

Program Code:

// HARDWARE:
// - PIC16F877A, 20MHz High Speed Oscillator
// - Oscillscope probe --> RC2/CCP1 (PWM1)
// - Oscillscope probe --> RC1/CCP2 (PWM2)

/*


*/




#include <pic.h>
#include "delay.h"

//SENSOR

//#define RIGHT RB0
//#define MIDDLE RB1
//#define LEFT RB2

#define RIGHT RB2
#define MIDDLE RB1
#define LEFT RB0
#define STOPPER RA2

//Configuration bits
__CONFIG(HS & WDTDIS & PWRTDIS & UNPROTECT & LVPDIS);


//Defines
#define normal 0b11000111 //PWM2 Duty Cycle = 90
#define slow 0b10101110 /*value here (PWM Duty Cycle = 80%)*/
#define slowest 0b10101110 /*value here (PWM Duty Cyle= 70%)*/



//Function Prototypes
void PWMInit(void);
unsigned int a=0;

void main()
{
TRISB = 0x0F;
TRISA = 0b00000100;
ADCON1 = 0x06;
PWMInit();

while(1)
{

if(RA2==1)
{
if(LEFT == 1 && MIDDLE == 0 && RIGHT == 1)
{
RA0 = 0;RA1 = 0;CCPR2L=normal;
}
else if(LEFT == 0 && MIDDLE == 0 && RIGHT == 1)
{
RA0 = 1;RA1 = 0;CCPR2L=slow;
}
else if(LEFT == 1 && MIDDLE == 0 && RIGHT == 0)
{
RA0 = 0;RA1 = 1;CCPR2L=slow;
}
else if(LEFT == 0 && MIDDLE == 1 && RIGHT == 1)
{
RA0 = 1;RA1 = 0;CCPR2L=slowest;
}
else if(LEFT == 1 && MIDDLE == 1 && RIGHT == 0)
{
RA0 = 0;RA1 = 1;CCPR2L=slowest;
}

}
else if(RA2==0)
{
CCPR2L=0;
}
}
}

/*----------------------------------------------------------------

PWM PROGRAMMING

----------------------------------------------------------------*/

//Initialize CCP1 & CCP2 for PWM Operation
void PWMInit(void)
{
TMR2 = 0x00; //Clear TMR2 & CPP related registers
T2CON = 0x00;
CCP1CON = 0x00;
CCP2CON = 0x00;
PR2 = 249; //Set PWM freq = 5Khz
CCPR2L = normal; //Set PWM2 Duty Cycle
TRISC1 = 0; //Enable PWM2 output pin
T2CKPS1 = 0; //Prescaler = 4
T2CKPS0 = 1;
CCP2CON = 0x0C; //CCP2 in PWM mode
TMR2ON = 1; //Enable TMR2. PWM signal is generated.
return;
}


For the micro-controller part, I used the PIC16F877A. I utilized this PIC due to the fact that I allocated its PWM pin in order to control the speed of my motor. It really takes time to have an accurate design and codes for this project. There are numerous ways to do this project and this is one of the easiest circuit I have seen. I actually used a CNY70 for the sensors. Based on the circuit given above, the sensor there is the CNY70. To determine the pins, be sure to have the mark point of the CNY70 on your right. 

Here is the output of my MOBOT:

Note: The design is basically up to you on how creative you are.  =)


MOBOT MADE BY:

KIRK BENEDICT P. MACARAEG

2 comments:

  1. HAHA! MERON KANG KULANG KIRK! :D
    D MALAMAN NG VIEWER ANG PARTS NG MOBOT.
    LIKE INGREDIENT , D MALULUTO ANG PAGKAIN KUNG HINDI MO ALAM ANG INGREDIENT :)
    DIBA KIRK ? hAHAHA

    ReplyDelete
  2. Hi can i ask how much cost ng mobot?

    ReplyDelete