Monday 21 May 2012

LINE FOLLOWER ROBOT



Hi friends,
Hi am back once again with basic or let me call as first initaition application of pratical application of ur electronics.
Line follower robot.:
We shall learn it in totaly unconventional way bcoz i strongly believe that conventional way keeps us always stand by mode,u cant be logged on.

NOTE:
FRIENDS I WILL SHOW U SOME MY FIRST BREAD BOARD MADE ROBOT I WILL SAY WHAT MY MISTAKES WHERE WHEN I FIRST WENT FOR A COMPETION ,THEN WE SHALL EAGERLY LEARN THE THINGS






Did u see my bot how bad it looks,bcoz i had a fear of soldering things,i had to make it on bread board.
Do u what happened i eventually lost my race that to i become laughter in the crowd bcoz of SIMPLE ELECTRONICS MISTAKES THAT WE MADE,,,,,,,,,,,
SO IAM SHARING MY VIEWS WITHYOU GUYZ,,,,,,,,,,
I have shg
 WHAT ACTUALLY IS A LINE FOLLOWER COMPETITION:
A line follower is nothing but a simple robot that follows a specified color an a specific background,
most genrally,a white path on black back ground ,or a black path on white background.

SHALL WE ENTER TO THE NEW WAY OF LEARNING ROBOTICS:
FIRST FEW THINGS WE REQUIRE ARE :

WE SHALL USE
1. ATMEGA 8 OR AT89S52
2. DC MOTORS
3.LM 293B
4.LM 324A
5.7805
6.IR LED(TRANSMITTER AND RECIEVER).
7.FEW LED'S OF UR FAVOURITE COLOR .
8.CAPACITORS(0.01UF)
9.RESISTOR (QUARTER WATT BOX)
10.CONNECTING WIRES

DESCRIPTION:

ACTUALLY ITS SIMPLE TO THINK TWO WHEELS AND ONE MICROCONTROLLER WILL DO THE JOB,
.NOTE
1 . BCOZ U CAN SUPPLY ONLY 5 V TO A MICROCONTROLLER,BUT THE VOLTAGE THAT U RECIEVE FROM IR RECIEVR IS FEW 2.5V OR DEPENDS ON SURFACE,IT CANNOT SAY TO MICROCONTROLLER IAM LOGIC ONE,SO INORDER TO AVOID THESE WE USE LM 324

2 . SECONDLY WHY WE NEED LM293B ,U WANT UR MOTORS TO RUN FROM MICROCONTROLLER O/P,BUT PROBLEM IS MICROCONTROLLER CAN PROVIDE ONLY FEW VOLTS CLOSE TO 5V,BUT WE NEED AROUND 9V SUPPLY SO IT CAN BE PROVIDED BY IT.SO WE USE IT AS AN INTERFACE BETWEEN MOTOR AND MICROCONTROLLER.

SO LETS COME TO KNOW WORKING AND IRLED'S WORKING


SO THIS CIRCUITS GENERATES A LIGHT,WHICH IS RECIEVED BY THE RECIEVER AFTER REFLECTION FROM EITHER BLACK OR WHITE SURFACE.



NOW HERE COMES THE USE OF LM32

WE SHALL USE THIS AS A COMPARATOR,LET THE REFERNCE VOLTAGE BE GIVEN TO PIN5(NON INVERTING TERMINAL)
OUR RECIEVER OUTPUT BE GIVEN TO PIN6(INVERTING TERMINAL)
NOW THIS COMAPRATOR COMPARES THEM IT THEY ARE MATCHED OR HIGHER IT GIVES LOGIC ONE(5V) AT O/P ELSE GIVES LOGIC ZERO(OV).

BE CAREFUL BCOZ DIFFERENT SURFACES PROVIDE DIFFERENT VOLTAGES LIKE IF U CHOOSE WHITE SURFACE IT REFLECTS MOST OF THE VOLTAGE  WILL BE HIGH,
IF U CHOOSE BLACK IT ABSORBS MOST LIGHT SO OUTPUT WILL BE SOMEWHAT LOW,

CAUTION:

BEFORE KEEPING UR BOT FOR THE RACE NOTE REFERENCE VOLTAGES WITH UR MULTIMETER ADJUST POTENTIOMETER AND KEEP THE REFERENCE VOLTAGE TO MEASURED VALUE.

HALF WORK IS DONE NOW..............................................................................................
DATASHEET OF  LM 324:
DEPENDING ON THE PRECISION WE INCREASE THE  NO. OF WHEELS AND 
IR TRANSMITTERS AND RECIEVERS.


LETS GIVE THESE PINS TO OUR MICROCONTROLLER.

NEXT BEFORE GOING TO LM293,OFFICIALLY LEARN THE MICROCONTROLLER WORKING HERE,,,,,
 HERE THE MICROCONTROLLER RESPONDS ACCORDING TO THE O/P GIVEN BY THE LM324.

DEPINDING ON THE COMMAND WE GIVE IN CODE,IT TURNS LEFT,RIGHT,FORWARD,ACCORDINGLY,,,,,,,,,,,,,,

NOW WE GET THE SIGNAL FROM THE MICROCONTROLLER TO MOVE ACCORDINGLY,,,,,,,,,
HOW DOES IT ACTUALLY OCCURS................................

MOTOR DRIVING MECHANISM..................
  •  WE WILL NEED A SET OF TWO MOTORS THAT HAVE SAME RPM(revolution/minute)
WE WILL BE USING DIFFERENTIAL DRIVE MECHANISM FOR MANEUVERING OUR BOAT,I,E WIL HAVE THREE WHEELS FOR OUR BOT.TWO FRONT WILL BE POWERED AND THE REAR FREE WHEEL,,,,,
 NOTE:
CASTOR WHEEL OR THIRD WHEEL JUST SUPPORTS THE ROBOT FROM TOPPLING
U CAN OBSERVE JUST REMOVE UR THIRD WHEEL AND OBSERVE U CAN EVEN USE SOFT CAP ALSO.....................
  • WHEN BOAT IS MOVING STRAIGHT MOTORS SHOULD HAVE EQUAL SPEED
  • FOR TURNING,ONE OF THE MOTORS SHOULD SWITCHED OFF.IF WE SWITCH
  • OF THE LEFT MOTOR,THE BOT WIL TURN LEFT AND VICEVERSA.

YOU CAN CHOOSE A MOTOR OF 100RPM AND 12V RATING

H BRIDGE CIRCUIT WILL DO YOU ALL THE ABOUVE PROCESS 
IC FORM WHAT WE CALL IT LM293

THE MICROCONTROLLER SENDS A SIGNAL TO THE H-BRIDGE THAT ACTS AS SWITCH.IF THE SIGNALRECIEVED BY THE H-BRIDGE IS HIGH IT WILL ROTSTE THE MOTOR ELSE IT WON'T DO SO.NOTE THE MICROCONTROLLER ONLY SENDS A SIGNAL TO A SWITCH WHICH GIVES THE VOLTAGE REQUIRED BY THE MOTOR TO ROTATE.HERE WE ARE USING LM293 WHICH CAN BE USED TO CONTROL TWO MOTORS.

PIN CONFIGIRATION OF LM293:


  • EN1&EN2 ARE GIVEN LOGIC1 FROM MICROCONTROLLER OR GIVE 5V FROM OUTSIDE AND ARE USED TO ACTIVATE/DEACTIVATE ONE HALF OF THE H -BRIDGE


  • V IS THE VOLTAGE THAT YOU WANT TO SUPPLY TO THE MOTOR(S):9V OR 12.                                                                     
  • VCC IS THE LOGIC 1 OR 5V.
 GUYS AT LAST THE DESCRIPTION IS FINISHED HOPE U FULLY UNDERSTOOD IT,IF ANY SSMALL DOUBT PLEASE ASK.................
THIS IS THE BLOCK DIAGRAM


HERE WE ARE USING PINS P1.0 AND P1.4 FOR TAKINGINPUTS FROM THE IR SENSORS AFTER BEING AMPLIFIED BY LM 324.

  • P1.0-INPUT FROM LEFT SENSOR
  • P1.4-INPUT FROM RIGHT SENSOR

 THERE ARE SIX OUTPUTS FROM AT89S52 FROM MICROCONTROLLER TO THE H BRIDGE.



  • PINS P0.0 AND P0.4 ARE CONNECTED TO ENABLE PINS OF THE H-BRIDGE.WE CAN USE THE TO  DEACTIVATE/ACTIVATE THE TWO HALVES BRIDGE I,E.IF PINS ARE SET TO LOGIC 1 THE CORRESPONDING HALF OF THE H BRIDGE WILL BE ACTIVATED.
  • P0.1-WILL DRIVE THE LEFT MOTOR IN FORWARD DIRECTION.
  • P0.2-WILL DRIVE THE LEFT MOTOR IN REVERSE DIRECTION.
  • P0.3-WILL DRIVE THE RIGHT MOTOR IN FORWARD DIRECTION.
  • P0.5-WILL DRIVE THE RIGHT MOTOR IN REVERSE DIRECTION.
PROGRAMMING:
BELOW IS THE CODE IN C FOR THE MICROCONTROLLER.
#include <AT89X52.h>
/*
                Sensors input port - P1
                  P1_0 --------> Left sensor
                  P1_4 --------> Right sensor

                 Motors output port - P0
                 
                  P0_0 --------> Enable pin of the left half of the H-bridge
                  P0_1 --------> will drive the left motor in forward direction
                  P0_2 --------> will drive the left motor in reverse direction
                  P0_3 --------> will drive the right motor in forward direction
                  P0_4 --------> Enable pin of the right half of the H-bridge
                  P0_5 --------> will drive the right motor in reverse direction
*/


/*Delay function runs an idle loop to create a time delay. If the crystal used is of 11.0592 MHz then the argument passed in delay is in 'milliseconds'.*/
void Delay(unsigned int itime)
{
                unsigned int i,j;
                for(i=0;i<itime;i++)
                                for(j=0;j<1275;j++);       //Idle loop
}
void Forward()
{
                P0_1=1;
                P0_2=0;
                P0_3=1;
                P0_5=0;
}

/*Generally for turning we use a pulsated wave so the bOt doesn’t get out of control i.e. we run the motor for sometime then again stop it and this is done very quickly to create an effective pulse. See the function below.*/

void TurnLeft()
{
                P0_1=0; /*Left motor is not running in any direction.*/
                P0_2=0;
                P0_3=1;   /*Right motor is running in forward direction. bOt will eventually turn left*/
                P0_5=0;
                Delay(50); /* Wait for 50 ms*/
                P0_1=0;  /*Motors are not running*/
                P0_2=0;
                P0_3=0;
                P0_5=0;
                Delay(50); /*Delay of another 50 ms*/
               
}

/*So in the above program we have effectively created a pulse of 100ms which is on for 50ms and off for another 50ms. You can change this value to suit your needs*/

/*Similarly we can write a function to turn right*/

void TurnRight()
{
                P0_1=1; /*Left motor running in forward direction.*/
                P0_2=0;
                P0_3=0; /*Right motor is not running.*/
                P0_5=0;
                Delay(50); /*50ms time delay*/
                P0_1=0; /*Motors not running in any direction*/
                P0_2=0;
                P0_3=0;
                P0_5=0;
                Delay(50); /*50ms time delay*/
               
}


void main()
{
/* The pins which are receiving inputs from the sensors should be initially set to logic 1.*/
                P1_0=1; /*Left sensor input*/
                P1_4=1; /*Right sensor input*/
                P0_0=1; /*Enable pin of the left half of the H-bridge*/
                P0_4=1;  /*Enable pin of the right half of the H-bridge*/

               

                //main loop of the program
                while(1)
                {
                                               
                                if((P1_0==0)&&(P1_4==1))
                                                TurnRight();
                                else if((P1_0==1)&&(P1_4==0))
                                                TurnLeft();
                                else
                                                Forward();
                               
                }
}

FRIENDS THIS IS IT THE LINE FOLLOWER IS READY YAAR.
 ANY QUERIES COMMENT IT BELOW..............

HERES MY FAILURE VIDEO:
  • NOW OUR ROBOT WILL LOOK LIKE THIS:




2 comments:

  1. good info regarding the line follower !!!!! expecting much more in the future !!

    ALL THE BEST!!

    ReplyDelete