Reading Time: 4 minutes

In the following write-up I’m going to tell you all my experiences while I had made my own line follower and will explain all the problems that I had faced along with some tricks to tackle them.

So basically making a line follower can help you in learning simple as well as advanced micro-controller applications that’s why I would advise all the beginners who want to learn micro-controller, your first project should be making an advanced line follower (advanced in the sense that it should be able it to traverse a track of any complication and its functioning should be very smooth). Now I would suggest that all the new learners should have the PDFs of the following essential books:

  • The AVR Micro-controller & Embedded System – Mazidi
  • Atmega32 data sheet (since that is the controller I have used)

(You can get these easily on the internet and also can use the link to my drive where you can find all the things that you’ll require in this project of yours )

First of all I would suggest some things from my experience:

  • Don’t use Arduino development board as a learner because once if you have learned how to use any basic micro-controller you will get to know things at grass root level and then afterwards you may find Arduino a cakewalk.
  • Also don’t use development board available for the Atmega32 micro-controller. Make your own circuit on a General-purpose Circuit Board (GCB). In this way you will learn how to design a circuit and get practice for soldering.
  • Make your own chassis as well. You need to learn some very basic fabrication also.
  • Start using simulation software (like Proteus) along with your coding as this will help a lot in verifying your codes. You can’t afford to always burn the code on your micro-controller for checking its validity. In such a situation if you simulate it on the pc then it will be much time-consuming.

Now, the essential things required for a making line follower are Atmega32 MCU, 12V battery, DC motors, chassis, L293D motor driver, LM7805 voltage regulator (5V), Analogue or Digital IR Sensors, laptop, USB-ASP programmer.
7805 voltage regulatorL293D_connectionsThe MCU runs on 5V, means it will perform its functions within a range of 0-5V. So you need a 5V voltage regulator circuit which can be easily made using two capacitors (1uF and 10uF) and an IC LM7805. Now since our motors run on 12V, we will require a motor driver which converts these 5V signals to 12V i.e. L293D. The circuit connections for both are shown

For coding you need to use the software Atmel Studio. You can learn how to code by using the AVR- Mazidi book and also with the help of the Atmega32 data sheet. There are various extensive examples given in the book which will help you understand the various peripherals of the Atmega32 MCU like Basic Input/Output, ADC, PWM, Timer/Counters, Interrupts, etc.

For a basic line follower you just need to learn basic Input/output functions. Now the basic working principle of a Digital IR sensor is that it gives it will give high or low output according to the strip colour in front of it (black or white).

Once you figure this out then now let’s take an example where you have just 3 line sensors and the track made up of a white line and a black background on the arena. Now in the sensors are lined in such a fashion that if the bot is facing forward then it must have one sensor on the white line and two just reasonably outside it. Thus the sensor at the centre will give output 1(high) and the other two will give output 0(low) (Note: this is not necessary some sensors give inverted output like on black they give 1 and on white they give zero so you need to check this first). These output readings from the sensor are taken by the MCU as an input for further analysis. Now if any of the outer sensors will come inside the track due to the movement of your robot, then that sensor will also start giving 1 and the centre one that was inside might move out of the line and will start giving zero. In such a situation, your code should indicate that the bot needs to move in the opposite direction to get back on the line. Hence you might have 3 possible cases if the centre one is giving 1 then go straight, if the one on the right is giving you 1 then go right and if the left one is giving you 1 then go left.

Regarding the simulation install and run Proteus and then you can see it is very similar to Multisim, hence make your own circuit with the micro-controller, sensors, voltage regulator circuit, motor driver circuit, motors, etc and test it with your code on your pc and by doing this you will save time as well as the safety of your equipments is ensured.

Thus in this way very simply you can control your bot to follow a simple line. Now if you don’t want to use digital sensors and prefer analogue sensors then you need to implement ADC and if you want your bot to move very smoothly then you also have to implement PWM. They are a lot of other concepts and complicated algorithms that are used in advanced line following and rather these bots then almost act as grid solvers.

For AVR beginners there is an excellent YouTube channel that you can refer which will help you understand these things very easily:

CEV - Handout