Basic layout of a Line Follower Robot
Building a line follower robot doesn't really requires much time and money as long as you are familiar with the parts you are going to use. It doesn't really takes much effort to interface the peripherals with the Arduino board. The first step is to prepare the body of the bot. Its important to prepare the layout of the body in such a way so that you won't face any problem the time when you're attaching the DC gear motors. Next we have to attach the Dc gear motors.. Now there is one catch here, its up to you to decide whether you want to build a three wheeler robot or a four wheeler. For a three wheeler we attach a castor wheel at the front.
Next we have to decide the type of sensor we are going to use. We can either go with individual IR sensors or a line array IR sensor. For more precision array based sensor is the best but it might give you a little problem during coding if you're a beginner. But its not like using individual IR sensors is a wrong call because if we use three sensors with one at the middle, then we can get a better precision output. The only limitation is that we have to calibrate it individually.
In the next step we can connect the input from Arduino to the motor driver and give it as an input to the motors and provide the power supply to the motor driver. Later we can connect the Vcc, GND and Output of the IR sensor to the Arduino.
Now in the end all we have to do is create the code. There isn't anything new here, just create some macro definitions and assign the pin numbers. Next you can calibrate the IR sensors by using the serial monitor to get better output. After that we create the condition using if statement for motions i.e. left, right, forward, stop.. furthermore its up to us whether we want to use analog or digital pins, I'd say using digital pins are much better since that way you don't have to take average of the calibrated value of sensor on black and white surface.