azevedoarthur
Published

Line Follower Robot - Arthur Azevedo - UFMG

Hello, my name is Arthur Azevedo and I've created this line follower robot as a project for my "Industrial Eletronic" class in UFMG-Brazil.

BeginnerShowcase (no instructions)20 hours508
Line Follower Robot - Arthur Azevedo - UFMG

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
Dual H-Bridge motor drivers L298
SparkFun Dual H-Bridge motor drivers L298
×1
DC motor (generic)
×2
TCRT5000 Reflective Optical Sensor Infrared IR Photoelectric Switch
×2
Resistor 10k ohm
Resistor 10k ohm
×2
Resistor 330 ohm
Resistor 330 ohm
×2

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Circuit

Code

TRABALHO_ELETRONICA_FINAL.ino

Arduino
//ARTHUR BENEVENUTO AZEVEDO - AEROESPACE ENGINEERING - FEDERAL UNIVERSITY OF MINAS GERAIS - BRAZIL

// MOTOR ESQUERDA (LEFT MOTOR)
int IN1 = 6;//FRENTE (FRONT)
int IN2 = 7;//TRAS (REAR)

//MOTOR DIREITA (RIGHT  MOTOR)
int IN3 = 8;//FRENTE (FRONT)
int IN4 = 9;//TRAS (REAR)

void setup()
{
 pinMode(IN1, OUTPUT);
 pinMode(IN2, OUTPUT);
 pinMode(IN3, OUTPUT);
 pinMode(IN4, OUTPUT);

 Serial.begin(115200);
}

void loop(){

//SENSOR A0 -> DIREITA (RIGHT SENSOR)
//SENSOR A1 -> ESQUERDA (LEFT SENSOR)

//+/- > 800(A0) / 750(A1) -> COM FITA (WITH TAPE)
//+/- < 800(A0) / 750(A1) -> SEM FITA (WITHOUT TAPE)

//VIRA ESQUERDA (TURN RIGHT)
  if(analogRead(A0)<800) {
 digitalWrite(IN1, LOW);
 digitalWrite(IN2, HIGH);
 digitalWrite(IN3, HIGH);
 digitalWrite(IN4, LOW);
  }

//VIRA DIREITA (TURN LEFT)
  else if(analogRead(A1)<750) {
 digitalWrite(IN1, HIGH);
 digitalWrite(IN2, LOW);
 digitalWrite(IN3, LOW);
 digitalWrite(IN4, HIGH);
  }

//RETO (GO STRAIGHT AHEAD)
  else {
 digitalWrite(IN1, HIGH);
 digitalWrite(IN2, LOW);
 digitalWrite(IN3, HIGH);
 digitalWrite(IN4, LOW);
  }

}

Credits

azevedoarthur

azevedoarthur

1 project • 0 followers

Comments