Showing posts with label ROBOTICS. Show all posts
Showing posts with label ROBOTICS. Show all posts

Wednesday, 10 April 2013

A LIGHT FOLLOWER ROBOT

A LIGHT FOLLOWER ROBOT



The main purpose of this project is to design a robot which would follow the path of higher luminescence across all directions.It is based on the principle that resistance of a LDR changes with the amount of light falling on it.

The light following robot is a mobile machine which is capable of detecting and following the light source on the traveling path. It is developed without the help of a micro-controller for providing easier connections and understanding of the circuit. It requires fewer numbers of electronic components and very cost-effective as well.

The concept of this light following robot is very simple. It includes two photodiodes, one on the right and other on the left. When the light falls on the right photodiode, the robot will move on the right side. Similarly, the robot will move on the left side when the light falls on the left photodiode.



Introduction:


Now the question is, how can we start our project? We need to learn how electronics and mechanical structure work together. We will go forward step by step. If you want to make a Light following robot, you need to have some basic knowledge of the following things:



Electronics:

LDR (Light dependent resistor).
H-Bridge Driver.
L293D ( Motor Driver)
Ardunio Uno (MCU)
Battery

Mechanical:

Wheel.
Robot structure.
Ball caster.
Micro Metal Gear Motor.

For this project we have used Arduino Uno as the main processor unit. It is an 8-bit microcontroller. It has 32 Kbytes of flash memory. Enough memory space to do this kind of project, I think.




CONSTRUCTION AND WORKING

motor driver(L293D) circuit



rectifier circuit
Connect a 9V battery to the breadboard with the help of a battery holder. The positive power supply is passed to the IN of IC 7805 (1), and sent out through the OUT (3). The negative power supply is sent to the GND (2) connection of IC 7805. In between, two capacitors (C1 & C2) are connected to the IN and OUT of IC 7805 respectively. As a result of this process, 5V of current is obtained.

Now, connect an IC LM358 in the breadboard. As it is a voltage comparator, it will predict the output from the photodiodes based on the input voltage. For instance, let us consider that the voltage at 3rd pin is more than or equal to the voltage at 2nd pin. At this time, the 1st pin of IC LM358 will be high or else it will stay low. A 10K resistor is coupled with each photodiodes. Then, place an IC L293D in the breadboard, and join the 2nd and 15th pin of it with 1st pin of IC LM358. In between this connection, include a LED with the 10K resistor.

The four – core wire of left motor is connected to the 3rd & 6th pin of IC L293D, while the right motor is attached with 11th & 14th pin. The two 10cm wheels are mounted with the motors. Acastor wheel is included at the front of the robot for balanced and comfortable movements. A power supply of 5V is applied to the 1st, 7th, 8th, 9th, & 16th pins. The remaining 4th, 5th, 10th, 12th, & 13th pins are connected to the ground.

After finishing all the circuit connections, place the robot in the dark room. Connect the 9V battery and power the robot. Now, show the light in front of the robot, and it will follow the light wherever it goes.

LOCOMOTION


The locomotion system we are using here is the differential drive. It is a basic design with two motors, two wheels and a castor wheel as shown in line follower post. The chassis is a ready-made steel chassis that can be bought from robotics shop.




SENSORS


LDR SENSORS

LDRs or Light Dependent Resistors are very useful especially in light/dark sensor circuits. Normally the resistance of an LDR is very high, sometimes as high as 1000 000 ohms, but when they are illuminated with light resistance drops dramatically.

The above schematic diagram is an example of a light sensor circuit :

When the light level is low the resistance of the LDR is high. This prevents current from flowing to the base of the transistors. Consequently the LED does not light.

However, when light shines onto the LDR its resistance falls and current flows into the base of the first transistor and then the second transistor. The LED lights.

The preset resistor can be turned up or down to increase or decrease resistance, in this way it can make the circuit more or less sensitive.



ldr sensor and its orientation





















This is the most important part of the robot. We have used here a three sensor layout which enables the robot to sense any light source in front of it. Of course, there can be several more different layouts to optimize the performance of the robot. Below is the picture of the sensory circuit mounted on the robot.

Let us mark these sensors as left(L), right(R) and center C) sensors. The ultimate goal of our code is to find which sensor receives maximum intensity and to face the robot in that direction. Below diagram shows the circuitry in the sensor circuits:

Each sensor has to be provided a 5V Vcc supply and a data(D) output has to be taken out from it. Three sensor circuits as shown in fig 2 will complete our sensory part of the robot.

A COMPLETE CIRCUIT DIAGRAM OF LIGHT FOLLOWER









CODES FOR LIGHT FOLLOWER USING ARDUINO UNO





int motorLEFTpin1 = 5;              //define digital output pin no.
int motorLEFTpin2 = 6;              //define digital output pin no.
int motorRIGHTpin1 = 10;
int motorRIGHTpin2 = 11;
      
int ldrs1=A0; 
int ldrs2=A1;
int ldrs3=A2;

int ldrs11=0; 
int ldrs22=0;
int ldrs33=0;


void setup () {
  Serial.begin(9600); 

  pinMode(ldrs1,INPUT);
  pinMode(ldrs2,INPUT);
  pinMode(ldrs3,INPUT);
  
  pinMode(motorLEFTpin1,OUTPUT);        //set pin 5 as output
  pinMode(motorLEFTpin2,OUTPUT);        // set pin 6 as output
  pinMode(motorRIGHTpin1,OUTPUT);       // set pin 10 as output
  pinMode(motorRIGHTpin2,OUTPUT);        // set pin 11 as output
  delay(100);
}        


void loop()

  
         // read the input pin


  Serial.println(ldrs1);
  Serial.println(ldrs2);
  Serial.println(ldrs3);

  Serial.println("\t");
  Serial.println("\t");
  ldrs11 = analogRead(ldrs1);
    ldrs22 = analogRead(ldrs2);
    ldrs33 = analogRead(ldrs3);
   
  
   if ( ldrs33<200 && ldrs22<200 && ldrs11<200 || ldrs22<200 ) {                  //move straight
    
    digitalWrite(motorLEFTpin1,HIGH);
    digitalWrite(motorLEFTpin2,LOW);
    digitalWrite(motorRIGHTpin1,HIGH);
    digitalWrite(motorRIGHTpin2,LOW);
    


else if ( ldrs11<200) {                  //move left
    
    digitalWrite(motorLEFTpin1,LOW);
    digitalWrite(motorLEFTpin2,LOW);
    digitalWrite(motorRIGHTpin1,HIGH);
    digitalWrite(motorRIGHTpin2,LOW);
    delay(200);
  

             
    }
     else if (ldrs33<200 ) {                  //move right
    
             digitalWrite(motorLEFTpin1,HIGH);
             digitalWrite(motorLEFTpin2,LOW);
             digitalWrite(motorRIGHTpin1,LOW);
             digitalWrite(motorRIGHTpin2,LOW);
         
    } 
else if ( ldrs33>800 && ldrs22>800 && ldrs11>800 ) {                 
 //no light, move 360 degree  and search for light
    
    digitalWrite(motorLEFTpin1,HIGH);
    digitalWrite(motorLEFTpin2,LOW);
    digitalWrite(motorRIGHTpin1,LOW);
    digitalWrite(motorRIGHTpin2,HIGH);

  
  }
  
}

Thursday, 28 March 2013

A LINE FOLLOWER ROBOT

A LINE FOLLOWER ROBOT

The purpose of this document is to help you build a Line Following Robot.
Starting with an overview of the system the document would cover implementation
details like circuits and algorithms, followed by some suggestions on improving the
design.



























BACKGROUND:


The present condition in Industry is that they are using the crane system to carry the parcels from one place to another, including harbor’s .Some times the lifting of big weights may cause the breakage of lifting materials and will cause damage to the parcels too.The robot movement depends on the track. Use of this robot is to transport the materials from one place to another place in the industry.


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

Prerequisites:
Knowledge of basic digital and analog electronics.
(A course on Digital Design and Electronic Devices & Circuits would be helpful), C Programming


WORKING PRINCIPLE:

This simple robot is designed to be able to follow a black line on the ground without getting off the line too much. The robot has five sensors installed underneath the front part of the body, and two DC motors drive wheels moving forward. A circuit inside takes an input signal from five sensors and controls the speed of wheels’ rotation. The control is done in such a way that when a sensor senses a black line, the motor slows down . Then the difference of rotation speed makes it possible to make turns. For instance, in the figure on the right, if the sensor somehow senses a black line, the wheel on that side slows down and the robot will make a right turn.

overview of robot











Now we will discuss all blocks in detail..... and i 'll tell you the complete procedure to make all blocks separately and how to assemble them.


  1. SENSOR ARRAY
   
 

We have used IR sensors for making sensor array. IR sensor consists of a transmitter and a receiver as shown in above photo. The transparent led is transmitter while the black one is receiver. IR transmitter will transmit infra-red radiation which will fall on the surface and the reflected radiation will be received by the receiver. The reflection of radiation will depends upon the colour of the surface.as shown in photo below.
the orientation of sensors should be as like as shown in above photo so that robot can detect a sharp as well as curve tuns.

Most of the radiations will be reflected back from white surface but it is just opposite in case of black surfaces as shown in diagram below.

working of ir sensors

circuit diagram of one pair of ir sensor






















This circuit diagram is showing only one ir sensor. we need to make 5 sensors on PCB board as shown in 1st photo of sensor array.












2. COMPARATOR

We used comparators(OP_AMPs) to convert the analog signals received from sensors in to digital signals
The op-amp IC we used is LM324 to give square wave as a output by comparing the sensor signal with a reference signal provided by us.



Theory :-
As you all know that in the world of electronics all the microcontrollers and microprocessors works on DIGITAL SIGNAL, but from the sources like battery we get a ANALOG SIGNAL. So in embedded systems it is mandatory to convert the analog signal into digital signal.
So for converting the analog signal into digital signal we use operational amplifiers(OP-AMP). We use operational amplifiers as a voltage comparator . A op-amp is shown in figure below :-




We fix a voltage at negative input with the help of variable resistor of 10k ohm and at the positive input we give our analog signal. If the analog signal is grater than the fix voltage at negative input then we get 1 in output(means +5V) and if the analog signal voltage is less than the voltage at negative input then we get 0 at output(means 0V).
Note :- Set the negative input voltage with the help of variable resistor according to your requirement.
you can see a A to D converter in below fig.




There are several OP-AMP ICs are available like :- lm358, 741, lm324 etc.Here we use LM324 which have 4 op-amps in it.


 The reference voltage will be given to inverting terminal(2,6,9,13) . The value of Vcc will be equal to 5v or 6v so that output of opamp shold be less than 5v only otherwise micro-controller will not read the signal from opamp.

Sensitivity of IR sensor:

The sensitivity of sensor means that how much effectively the sensor senses the change that is
occurring in its surrounding. The sensitivity of the IR sensor is controlled by reference voltage at pin 2
using variable resistor.

· Large value of reference voltage – less sensitive.
· Small value of reference voltage – more sensitive.


3. MICRO-CONTROLLER

I am using ATMEGA 328 with ARDUINO UNO development board. it is very easy to programme and burn the same in to ur arduino.
Microcontroller board used :- ARDUINO UNO

Technical specification:-

Microcontroller:-                                      ATmega328

Operating Voltage                                    5V

Input Voltage (recommended)                7-12V

Input Voltage (limits)                               6-20V

Digital I/O Pins                                        14 (of which 6 provide PWM output)

Analog Input Pins                                     6DC

 Current per I/O Pin                           40 mA

DC Current for 3.3V Pin                         50 mA

Flash Memory                                          32 KB of which 0.5 KB used by bootloader

SRAM                                                       2 KB

EEPROM                                                  1 KB

Clock Speed                                             16 MHz

















4.MOTOR DRIVER

L293D IC is a dual H-bridge motor driver IC. One H-bridge is capable to drive a dc motor in
bidirectional. L293D IC is a current enhancing IC as the output from the sensor is not able to drive
motors itself so L293D is used for this purpose. L293D is a 16 pin IC having two enables pins which
should always be remain high to enable both the H-bridges. L293B is another IC of L293 series having
two main differences with L293D.
PIN DIAGRAM OF LM293D






























CODES FOR LINE FOLLOWER


the following code is left priority code ie if all sensors will detect black line then it will go for left line. you can change the priority order by jst making slight change in code.




int motorLEFTpin1 = 5;              //define digital output pin no.
int motorLEFTpin2 = 6;              //define digital output pin no.
int motorRIGHTpin1 = 10;
int motorRIGHTpin2 = 11;
int irl2=2;
int irl1=4;
int irc=7;
int irr1=8;
int irr2=12;


int il2=0;
int il1=0;
int ic=0;
int ir1=0;
int ir2=0;

void setup () {
  Serial.begin(57600); 
  
  pinMode(irl2,INPUT);
  pinMode(irl1,INPUT);
  pinMode(irc,INPUT);
  pinMode(irr2,INPUT);
  pinMode(irr1,INPUT);
  pinMode(motorLEFTpin1,OUTPUT);        //set pin 5 as output
  pinMode(motorLEFTpin2,OUTPUT);        // set pin 6 as output
  pinMode(motorRIGHTpin1,OUTPUT);       // set pin 10 as output
  pinMode(motorRIGHTpin2,OUTPUT);        // set pin 11 as output
  delay(100);
}        

void loop()
{
  int c=0;
  int r=0;
  

  
  il2=digitalRead(irl2);
  
  il1=digitalRead(irl1);
  
  ic=digitalRead(irc);
  ir2=digitalRead(irr2);
  
  ir1=digitalRead(irr1);
  
  
  Serial.print("Raw Ratel2: ");
  Serial.println(il2);
  Serial.print("Raw Ratel1: ");
  Serial.println(il1);
  Serial.print("Raw Rateic: ");
  Serial.println(ic);
  Serial.print("Raw Rater2: ");
  Serial.println(ir2);
  Serial.print("Raw Rater1: ");
  Serial.println(ir1);
  Serial.println("\t");
  Serial.println("\t");
  

    
  if(ir2==LOW)
    r=1;
    
  if(ir1==LOW)
    r=2;

      if(ic==LOW)
        c=3;
  if(il2==LOW || il1==LOW)
      lft();
    
   else if(c>r)
       st();
          
      else if(r>c)
          rt();
      else if(il1==HIGH && il2==HIGH && ic== HIGH && ir1==HIGH && ir2==HIGH)
        lft();
    
    
    
  
}

void st()
{
   digitalWrite(motorLEFTpin1,HIGH);
   digitalWrite(motorLEFTpin2,LOW);
   digitalWrite(motorRIGHTpin1,HIGH);
   digitalWrite(motorRIGHTpin2,LOW);
}

void rt()
{
  digitalWrite(motorLEFTpin1,HIGH);
  digitalWrite(motorLEFTpin2,LOW);
  digitalWrite(motorRIGHTpin1,LOW);
  digitalWrite(motorRIGHTpin2,LOW);
}

void lft()
{
   digitalWrite(motorLEFTpin1,LOW);
   digitalWrite(motorLEFTpin2,LOW);
   digitalWrite(motorRIGHTpin1,HIGH);
   digitalWrite(motorRIGHTpin2,LOW);
}




ALL THE BEST GUYS..... IF YOU FIND ANY ISSUE, LET ME KNOW.

Saturday, 23 March 2013

A SELF BALANCING ROBOT



CONCEPT: If we are talking about how a robot can balance itself ?  then every person know the answer . confused! now i am explaining how you balance your self and robot balance itself. When someone trying to push you then what actually you are doing is walking in the direction of the force  this is how you balance yourself and robot balance itself. When you move in any direction then you applying a force against  that direction and this force is equal to the force applying on you. If you are not moving in that direction then you will fall towards the plane


This is all about the action we take but before taking an action we should sensing  that in which direction we are leaning this sensing can be done by our eyes and neurons system. But the robot sense this motion by various sensors for example: IR sensor, Tilt sensors etc. The motors play the role of actuator or movement of the robot.



COMPONENT'S REQUIRED: The component's required for making a self balancing robot are very common and are easy available in the market. 
WORKING OF IR SENSORS



SENSOR : For making a self balancing robot we can use IR sensors and tilt sensors. I am using the IR sensor's. IR consist of  led pair one is IR Receiver and IR Transmitter. We arrange the IR pair in this manner when the IR transmitter transmits the infrared rays then they are reflected back to the IR receiver. when receiver receives the infrared it will shows the voltage variation at the receiver terminal this output is then goes to the comparator.

 The circuit of the IR sensor is show into the figure. we  can see that we use two resistors one with transmitter and another wit the receiver. The values of the resistors we use are 10k and 330 ohm. 

SENSOR CIRCUIT
OP-AMP: The Op-Amp is use to make a decision based on the input comes from the IR sensor whenever the IR sensor detects the surface then the output signal is low and whenever their is an absence of surface then output signal becomes high. So, we place two IR sensor on both side of the robot. It will detects the surface and generate a two bits data which is further use to operate the two motors. When the robot is leaning in a direction then the sensor of that side will detects the surface and change its value and motors will moving in that direction.

Here the Op-Amp is  work in the comparator mode. The figure shows the characteristic of the Op-Amp in the comparator mode.As shown in the figure below.
PIN DIAGRAM OF LM324

 The characteristics of the Op-Amp in the configuration of comparator can be describe as.we can say that when the (v2 is the non inverting terminal voltage and v1 is inverting terminal voltage) v2>v1 then the output voltage will tends to +Vcc and whenever the v2<v1 then output voltage will tends to -Vcc. The output is tends to Vcc but not exactly the Vcc. The output will  goes to saturation voltage.The Ic which we are using is LM324 and having the four Op-Amp.This Ic is easy available in the market.


MOTOR DRIVER(L293D):
 The IC-l293d  is well known driving the motor these motor are basically work on different voltages so to drive these motor by the signals from Op-Amp we use these motor driver IC. Their are many motor driver Ic in the market but we use the L293D because it is easily available in market. The figure of L293D can be shown. Also the pin description is very important to understand the configuration of the IC. here M1 and M2 are use to show the motors  used in the robot.M1-A or M1-B is use to run the motor in forward direction or in the reverse direction.

FINAL CIRCUIT: The final circuit can be shown in the figure below.


PROJECT PHOTOS: Images of the projects are here.








GOOD LUCK FRIENDS............... TRY TO BUILD THIS EASIEST ONE...... AND LET ME KNOW ABOUT UR PROBLEMS IF YOU R GETTING ANY.....
THANKYOU