3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Ligth Follower Arduino Based Robot

Ligth Follower Arduino Based Robot
«
  • 01.jpg
  • 07.jpg
  • 08.jpg
  • 09.jpg
  • 10.jpg
  • 11.jpg
  • 20.jpg
  • 21.jpg
  • 22.jpg
  • 23.jpg
  • Driver L293b.jpg
  • PCB Alpha.JPG
  • 12.jpg
  • 13.jpg
  • 14.jpg
  • 15.jpg
  • 16.jpg
  • 17.jpg
  • 18.jpg
  • 19.jpg
  • last photo ←
»
This is my very first robot, a ligth follower Robot

1. Tamiya caterpillar kit
2. Tamiya twin gearbox
3. Arduino Diecimila
4. H bridge L293e
5. 8 Diodes
6. Bread board
7. 2 Photo resistance
8 lot of wires

the Source Code:

int pinMotorL1=2;
int pinMotorL2=3;
int pinMotorR1=8;
int pinMotorR2=9;
int pinEnableL = 4;
int pinEnableR = 5;
int valPWM = 175;

void setup()
{
// begin the serial communication
Serial.begin(9600);
pinMode(pinMotorL1, OUTPUT);
pinMode(pinMotorL2, OUTPUT);
pinMode(pinMotorR1, OUTPUT);
pinMode(pinMotorR2, OUTPUT);
pinMode(pinEnableL, OUTPUT);
pinMode(pinEnableR, OUTPUT);
}

void ForwardR(){
digitalWrite(pinEnableR,valPWM);
digitalWrite(pinMotorR1,HIGH);
digitalWrite(pinMotorR2,LOW);
}
void ForwardL(){
digitalWrite(pinEnableL,valPWM);
digitalWrite(pinMotorL1,HIGH);
digitalWrite(pinMotorL2,LOW);

}
void BackwardR(){
digitalWrite(pinEnableR,valPWM);
digitalWrite(pinMotorR1,LOW);
digitalWrite(pinMotorR2,HIGH);

}
void BackwardL(){
digitalWrite(pinEnableL,valPWM);
digitalWrite(pinMotorL1,LOW);
digitalWrite(pinMotorL2,HIGH);
}
void StopR(){
digitalWrite(pinEnableR,valPWM);
digitalWrite(pinMotorR1,HIGH);
digitalWrite(pinMotorR2,HIGH);

}
void StopL(){
digitalWrite(pinEnableL,valPWM);
digitalWrite(pinMotorL1,HIGH);
digitalWrite(pinMotorL2,HIGH);
}

void StopAll(){
StopR();
StopL();
}

void goForward(){
ForwardR();
ForwardL();
}

void goBackward(){
BackwardR();
BackwardL();
}

void TurnR(){
ForwardL();
BackwardR();
}
void TurnL(){
ForwardR();
BackwardL();
}

void move(byte val){
if(val==0){
// Serial.println("Caso 0-Adelante");

goForward();
delay(1000);
StopAll();

}else
if(val==1){
// Serial.println("Caso 1-Atras");

goBackward();
delay(1000);
StopAll();
}else
if(val==2){
// Serial.println("Caso 2-Derecha");

TurnR();
delay(1000);
StopAll();

}else
if(val==3){
//Serial.println("Caso 3-Izquierda");

TurnL();
delay(1000);
StopAll();

}
else{
//Serial.println("no valido ninguno");
goForward();
delay(1000);
StopAll();
}
}

void loop()
{
float ojoDerecho = analogRead(1);
float ojoIzquierdo = analogRead(0);

//adelante
move(0);
//Derecha
if(ojoDerecho > ojoIzquierdo){
move(2);
}
//Izquierda
else if(ojoIzquierdo > ojoDerecho){
move(3);
}

}
21 comments
Feb 1, 2009. 8:47 AMamando96 says:
that was nice, waiting for the video! i'm trying to make a minibot with two 555's that follows light :) in theory it will work... i just have to see in reality xD
May 8, 2010. 2:29 PMChowmix12 says:
i have seen a photovore(light seeking) with only one 555 timer. what is the nned for 2?
Jun 2, 2010. 8:09 PMChowmix12 says:
i also made a very similar light seeking robot, except, mine uses a 555 timer chip instead of arduino.. it also has a reverse relay.. for a lot cheaper...
Apr 17, 2011. 11:27 AMmnova says:
Is there an instructable for this?
Apr 17, 2011. 12:54 PMChowmix12 says:
Check out my I'ble on an Arduino based Light Seeker.
Apr 17, 2011. 1:31 PMmnova says:
I do not have a Arduino board. I was trying to do this with just a 555 timer and LDRs.
Apr 17, 2011. 7:00 PMChowmix12 says:
Check out this video.
Apr 17, 2011. 1:36 PMChowmix12 says:
Then there isn't much to it than just the circuit above.
Jun 28, 2010. 5:34 PMs.gosiaco says:
I tried to make that with a pot to fine tune it and it doesn't work. Can you please help me.
Jun 28, 2010. 5:51 PMChowmix12 says:
what seems to be the problem? are the motors running?
Jul 3, 2010. 11:09 AMs.gosiaco says:
It won't follow the light
Jul 3, 2010. 4:51 PMChowmix12 says:
very discriptive... are the motors reacting to the sensors at all? if yes, try crossing the CdS cells. . if no, then try removing the potentiometer, and use the schematic above...
May 28, 2009. 7:37 AMhelloworld1 says:
what do the 555's (the timers right?) actually do, and could i make a digital clock with one of them?
May 28, 2009. 8:36 AMamando96 says:
they time intervals sort of, and no you couldnt because you can never get an interval that is equal to one second, it would become wrong in like 5 minutes... you can use an RTC wich is a real time clock, that counts second, minutes, hours etc... every computer has one in the motherboard, thats why it has that small coin cell there :D they are cheap, so get one!! :D
May 29, 2009. 8:48 AMhelloworld1 says:
oh cool, do you have any idea how you would wire that up to an lcd and some sort of microcontroller to be able to set it?
May 29, 2009. 12:32 PMamando96 says:
actually i do, i know a tutorial online, but its in portuguese, you can translate it on that google thingy though...

here .
http://lusorobotica.com/index.php/topic,681.msg6091.html#msg6091

good luck, i havent tryed it yet, but my arduino has little memory.....
Jul 31, 2009. 1:08 PMhelloworld1 says:
ok thanks
Apr 9, 2010. 7:10 AMedson04 says:
Hi, which diode you use? and i bought the H brige l293e but its not the same i have 20 pin and in yours you have 16 pin and when i make the circuit with the diode i got a short court .. need some help please
Jan 2, 2009. 9:24 PMAlcreion says:
can you upload i a video?

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
2
Followers
2
Author:kurtbadelt