ROBOTICS HACKATHON (jan 2023) - Line Follower

Ten hours line follower hackathon as part of the final project for Introduction In Robotics 3rd year course.

Task: The robot must follow the line as accurate as possible in order to finish the track. The robot has 3 tries to get the best time.

Team: R2D2

Members:

Electronic setup 🔌


Components list

image

  1.Arduino Uno
  2.Zip-ties
  3.Power source - LiPo battery
  4.2 Wheels
  5.Wires set for the line sensor (female - male)
  6.QTR-8A reflectance sensor, along with screws
  7.Ball caster
  8.Extra wires from the rest of components (male - male)
  9.3D printed Chassis
  10.Breadboard - medium (400pts)
  11.L293D motor driver
  12.2 DC motors

Driver Connection table

image

image

Motors and Sensor Connection scheme

image

Code details 💻


PID

First it is better to start by changing just kp value.

  Increase the value if the robot can not do a turn;
  
  Decrease the value if the robot do not follow the line becouse of overshooting

After finding a resonable kp value, next step is to change kd value by

  Increasing till the robot doesn't wobble to much and also takes better turns.

The final values for PID control

  float kp = 140; 
  float ki = 0;
  float kd = 180; 

Other tries

  BEST CASES
  //Case 1:  follow the linie roughly, slow
  baseSpeed = 150;
  
  float kp = 5; 
  float ki = 0;
  float kd = 0;
  
  //Case 2:  follow the linie roughly, slow
  baseSpeed = 170;
  
  float kp = 7; 
  float ki = 0;
  float kd = 2;
  
  WORST CASES
  //Case 3:  not follow the linie
  baseSpeed = 160;
  
  float kp = 6; 
  float ki = 0;
  float kd = 0;

  //Case 4:  not follow the linie
  baseSpeed = 200;
  
  float kp = 5; 
  float ki = 0;
  float kd = 1;
  
  //Case 5:  not follow the linie
  baseSpeed = 160;
  
  float kp = 5; 
  float ki = 0;
  float kd = 0;

Calibration(with millis)

   For CALIBRATION it is used autoCalibrate function where the robot moves left and right
   in order to understand the difference between black and white. 

He first goes to the right, then to the left and so on.

Calibration covers all sensors.

  • For the right move, the robot will have the following motor speeds:

    • right motor: -200

    • left motor: 200

  • For the left move, the robot will have the following motor speeds:

    • right motor: 250

    • left motor: -250

These values were chosen after several attempts.

🏆 Best time: 48'

🎥 Watch the robot on the circuit in the final round: youtube video here

Final track

Setup