Introduction: Line Follower

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

Step 1: Diagram, Scheme and Schetch

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);
}
}

Step 2: Photos for Details

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

Comments

author
Mc2mahon (author)2016-04-16

which are the sensor?

author
robertodelle (author)Mc2mahon2016-04-16

TCRT5000 Infrared Tracking Sensor Module

Sorry

About This Instructable

803views

13favorites

License:

More by robertodelle:Arduino Box Controlled by TV Remote and CODELine FollowerBolly and my kids
Add instructable to: