Friday, March 23, 2012

Follower the Command Line :)


INTRODUCTION

What is a line follower?
            Line follower is a machine that can follow a path. The path can be visible like a black line on a white surface (or vice-verse) or it can be invisible like a magnetic field.

Why build a line follower?
Sensing a line and maneuvering the robot to stay on course, while constantly correcting the wrong moves using feedback mechanism forms a simple yet effective closed loop system. As a programmer you get an opportunity to ‘teach’ the robot how to follow the line thus giving it a human-like property of responding to stimuli.


Practical applications of a line follower: Automated cars running on roads with embedded magnets; guidance system for industrial robots moving on shop floor etc.

 Block Diagram

USING PHOTO-REFLECTORS (IR LED)

To detect a line to be followed, mostly we use two or more number of photo-reflectors. Its output current that proportional to reflection rate of the floor is converted to voltage with a resister and tested it if the line is detected or not. However the threshold voltage cannot be fixed to any level because optical current by ambient light is added to the output current like the image shown below.
Most photo-detecting modules for industrial use are using modulated light to avoid interference by the ambient light. The detected signal is filtered with a band pass filter and disused signals are filtered out. Therefore only the modulated signal from the light emitter can be detected. Of course the detector must not be saturated by ambient light, this is effective when the detector is working in linear region.
In this project, light from IR LED is used to cancel ambient light. This is suitable for arrayed sensors that scanned in sequence to avoid interference from next sensor. The microcontroller starts to scan the sensor status, sample an output voltage, the reflected light is sampled again and the corresponding output voltage is produced. The difference between the two samples is the optical current by LED, output voltage by the ambient light is canceled. The other sensors are also scanned by same procedure in sequence.
 Sensor output Thresholds

PWM

Pulse-width modulation (PWM), or pulse-duration modulation (PDM), is a commonly used technique for controlling power to inertial electrical devices, made practical by modern electronic power switches. The average value of voltage (and current) fed to the load is controlled by turning the switch between supply and load on and off at a fast pace. The longer the switch is on compared to the off periods, the higher the power supplied to the load is.
The PWM switching frequency has to be much faster than what would affect the load, which is to say the device that uses the power. Typically switchings have to be done several times a minute in an electric stove, 120 Hz in a lamp dimmer, from few kilohertz (kHz) to tens of kHz for a motor drive and well into the tens or hundreds of kHz in audio amplifiers and computer power supplies.
PWM Pulses 

 (In the diagram above, V is the voltage through the motor and t is the time of passage)

The term duty cycle describes the proportion of 'on' time to the regular interval or 'period' of time; a low duty cycle corresponds to low power, because the power is off for most of the time. Duty cycle is expressed in percent, 100% being fully on.
The main advantage of PWM is that power loss in the switching devices is very low. When a switch is off there is practically no current, and when it is on, there is almost no voltage drop across the switch. Power loss, being the product of voltage and current, is thus in both cases close to zero. PWM also works well with digital controls, which, because of their on/off nature, can easily set the needed duty cycle.
 
Because the engine speed is greater than needed speed. In the case of propagation over a curved path there requires to get slowdown the speed. For that we use 2 channels PMW (Pulse Width Modulation) at outputs of microcontroller. With PWM method, we can adjust the applied voltage on motor speed so when we adjust the voltage, speed will be changed too. PWM is a method that varies amplitude which is put on motor by modifies of Duty cycle DC. The two outputs CCP1 and CCP2 are connected to the respective ENABLE pins of the Motor Driver IC.

 Algorithm  

LIST OF MATERIALS REQUIRED
  • Caster Wheel and Rear Wheels
  • IR led for Sensing
  • Quad Op-amp LM324
  • Driver L293
  • DC Geared Motors 100rpm each
  • Pic 16F877A Microcontroller
  • A Plastic Box for assembling 
NOTE:

It is clear that the drive train of this robot is differential type, meaning the two rear wheels are responsible of moving the robot forward and backward, but are also used to turn the robot in any required direction depending the difference of speed between the right and left wheels.

          The first thing that need some explanation is the fact that there are only 2 wheels, Well, while not being the best thing to do, a caster wheel can sometimes be replaced with a skid, when the robot weight and size are not important, and when the robot is designed for indoor environment, where the robot can move on relatively smooth surfaces, where friction wont be a serious problem.


CONSTRUCTION DETAILS
 DC Geared Motor One I Used 100RPM 
 CHOOSING A GEARED MOTOR

Choosing a Geared Motor includes the parameters such as speed and Power. If u want is a fastest one u need to choose a motor which has speed as well as the power to lift the heavy robot body ."Torque" is an important stuff we have to consider while designing a moving robot otherwise its not going move anywhere. So i choose a Geared Motor for that which can provide enough Torque.

Attaching Wheel to Motor 


DC Geared Motor <100rpm> with Wheels Connected 

 TO INCREASE SPEED

Use large Wheels in order to get additional speed. Larger the Wheel u use larger will be your robots speed. This is because the distance covered by one rotation of the Wheel is given by, taking the radius of wheel as "R"

                                                           DISTANCE=2 ΠR
                                                                     
 
 Caster Wheel 

Using of Caster Wheels Provide free Movement of the cabin without friction.

 Motors connected to The Cabin Box 
   
Carefully Drill the holes on the cabin and fix the rear motors as shown above.
 
                                                   Caster Wheels Connected to The Cabin
              Fix the Caster Wheels as Shown in the above figure.

 Completed Mechanical Part of Line Follower 

              Fix and Screw The Wheels to the Motor Shaft as Shown and your Mechanical Part is Over.


              CIRCUIT DIAGRAM

  Full Circuit Diagram 

 Power Supply 

              PCB
PCB of Sensor
Supporting Files and Links

Good Luck.

Regards
Sooraj Shenoy 


 

7 comments:

  1. hey could u please put a video to see how it works and also wat is the cost of doing this and if possible could u give me the PCB Schematic of the curcuit

    ReplyDelete
  2. This is really good man, thanks a lot, i'll try to make this project

    ReplyDelete
  3. THANK YOU MAN... ITS REALL COOL..

    ReplyDelete
  4. Do u recommend me this motor?
    http://peshawar.olx.com.pk/dc-gear-motor-wheel-set-iid-498489208

    ReplyDelete
  5. can you kindly inform that which will be the best motor driver for pic 16f887....?

    ReplyDelete