Line Follower

by robertodelle in Circuits > Arduino

3589 Views, 14 Favorites, 0 Comments

Line Follower

20160408_200039.jpg
20160408_215338.jpg
Line follower by Matteo
20160408_215619.jpg
20160408_194819.jpg
20160408_215603.jpg
20160408_220731.jpg

This project is a line follower robot, but whit a different: motors controller are made with eight NPN transistors. I have build this particular driver because a broke L298N driver. I have only old 2N1711 transistors and my son is very impatient. Then I have devised this method for motors controller

Sensors:

TCRT5000 Infrared Tracking Sensor Module

Diagram, Scheme and Schetch

Line follower NPN.jpeg
schema.jpg
4npn_schem.jpg

I have used dia to draw diagram, and fritzing for schemes

And this is the Arduino's schetch:

#define dxg 11<br>#define dxb 10
#define dxv 9
#define dxr 8
#define sxg 5
#define sxv 4
#define sxb 3
#define sxr 2
void setup() {
pinMode(dxg,OUTPUT);
pinMode(dxb,OUTPUT);
pinMode(dxv,OUTPUT);
pinMode(dxr,OUTPUT);
pinMode(sxg,OUTPUT);
pinMode(sxv,OUTPUT);
pinMode(sxb,OUTPUT);
pinMode(sxr,OUTPUT);
pinMode(6,INPUT);
pinMode(7,INPUT);
}
void loop() {
// dynamic line follower code
int lsensor=digitalRead(6);
int rsensor=digitalRead(7);
if((lsensor==LOW)&&(rsensor==LOW))
{
//both sensors on white
// go forward
digitalWrite(dxg,HIGH);
digitalWrite(dxb,HIGH);
digitalWrite(dxv,LOW);
digitalWrite(dxr,LOW);
digitalWrite(sxg,HIGH);
digitalWrite(sxv,HIGH);
digitalWrite(sxb,LOW);
digitalWrite(sxr,LOW);
}
else if((lsensor==HIGH)&& (rsensor==LOW))
{
//right sensor on black line
// turn right
digitalWrite(dxg,LOW);
digitalWrite(dxb,LOW);
digitalWrite(dxv,HIGH);
digitalWrite(dxr,HIGH);
digitalWrite(sxg,HIGH);
digitalWrite(sxv,HIGH);
digitalWrite(sxb,LOW);
digitalWrite(sxr,LOW);
}
else if((lsensor==LOW)&&(rsensor==HIGH))
{
//left sensor on black line
// turn left
digitalWrite(dxg,HIGH);
digitalWrite(dxb,HIGH);
digitalWrite(dxv,LOW);
digitalWrite(dxr,LOW);
digitalWrite(sxg,LOW);
digitalWrite(sxv,LOW);
digitalWrite(sxb,HIGH);
digitalWrite(sxr,HIGH);
}
else
{
digitalWrite(dxg,LOW);
digitalWrite(dxb,LOW);
digitalWrite(dxv,LOW);
digitalWrite(dxr,LOW);
digitalWrite(sxg,LOW);
digitalWrite(sxv,LOW);
digitalWrite(sxb,LOW);
digitalWrite(sxr,LOW);
}
}

Photos for Details

20160408_200102.jpg
20160408_200254.jpg
20160408_200804.jpg
20160408_200818.jpg
20160408_200828.jpg
20160408_200836.jpg
20160408_200858.jpg
20160408_200901.jpg
20160408_200946.jpg
20160408_200955.jpg
20160408_200923.jpg
20160408_200936.jpg

The leds are connected whit arduino's outputs ( transistors's base) and wired through 220 ohm resistance to GND.