Tuesday, June 2, 2015

InLinea01: A PID controlled line following robot build on an ATmega 8

InLinea01 is a simple PID controlled line following robot.
This is not speed oriented line follower, this is just a prototype I built to experiment with this type or machines, though it can be the first step to build a faster one.

The goal of a line following robot is follow a line that is draw on the floor, usually this line is a black on white floor line, or a white on black one.
A sensor is needed to detect the line, and mantain the robot over the line.

This follower has two 200rpm @ 6v DC motors, driven by a L9110S H-bridge based controller board.

Detector is build using 8 cheap TCRT5000 reflective sensors. It can detect black on white, or white on black lines. The dection inversion must be decided at compile time.

It uses PID controller to make the robot follow the line smoother.
The PID parameters can be setup via UART using a GUI, the UART connection can be estabilished through a bluetooth adapter like the HC-05, if you use this type of connection, you can setup PID variables leaving cables out of the robot. That's pretty usefull for a line following robot.

The core of the robot is a ATmega8 microcontroller running at 8Mhz with his internal crystal.

A 7.4v LiPo battery powers the robot. Then an LM2596S based DC/DC converter regulated to 6v feed the 2 motors, and a LM7805 voltage regulator all other components.

In a few words, sensor detect the line. In order for the robot to follow the line, it has to be centered over it. To keep the robot in the middle of the line the speed of eveny wheel must be changed. The difference in speed of rotation determines the robot direction. That speed is evaluated by the PID controller depending on the position error.

As example, if the line is detected by the right detectors, then left motor has to spin less than the right one, that way the robot will turn a little on the left, and the line will be again in the center position.
The PID controller prevents robot oscillations and smooth his path.

  • 01c: fixed a typo error on schematics, thanks to Visweswara Rao Kalla for this feedback.
  • 01b: fixed a typo error on schematics, thanks to Abdullbasit AlHaita for this feedback.
  • 01: first release


  • read risk disclaimer
  • excuse my bad english