## Introduction: How to Make a Line Following Robot

Hello Instructables,

This my first time making a robot . In this instructable i will show you how to make a line following robot. Note that this a instructable for beginners who just want to make a robot for the fun of learning it. It will not be good for people who want their robot to be really fast and follow a line in less then a minute . This robot moves at a medium speed.

## Step 1: Materials

For this robot you will need:
prototype board x1
-2907 transistor x2
-leds x8 (3 red,3 yellow,2 orange)
-LM339 x1
-1k resistor x2
-150 ohms resistor x 4
-Photocells x4
- 20k potentiometer x2
- DPDT switch Center off x1
- Motors x 2 (any kind of motors you would like)
- Wheels x 2 (wheels that fit your motor)
- A sandwich container, box, etc..(something strong enough to hold your circuit in)
- 9 volt battery
- 9 volt battery connecter
- Wires

Tools:
- Side cutter
- Long Nose Plier
-  Soldering Ion
-  Solder
- Wire stripper

## Step 2: Building the Indicator Lights

In this step we will be building the indicator lights these lights tell us which photoresistors are getting more light.First place the Ic in the middle of the board so that none of the pins are connected to each other.
1. Connect Pin 2 of LM339 to 1k resistor.
2. Connect the other end of the resistor to the base of the 2907 transistor.
3. Now connect the collector of the transistor to one end of a 150 ohms resistor and emitter to 9V.
4.  Connect the other end of the resistor to the positive end of the yellow led.  The negative end of the yellow LED then connects to the positive of the next yellow LED. Like wise connect the third yello LED so that the three yellow LEDs are connected in series and the third LED's negative is connected to ground.
5. Now connect Pin 1 of the LM339 to 1K resistor and repeat the steps 2-4 thereafter using Red LEDs instead of yellow.
6. It would be convenient to make a separate rail for the positive 9V and for the ground so that you can connect your 9V battery connector to those lines when you are finally ready to connect the battery.

## Step 3: Looking at the Pins

In this step we will look at all the pins and connect them to where they have to go. First connect pin 3 to positive (9V). Then connect pin 12 to ground. Now connect pin 4 to pin 7 and connect pin 5 to 6.

## Step 4: Adding the Sensors

1. Connect a 20k potentiometer between pin 6 and pin 7.
2. Then connect the one end of a 150 ohms resistor to the middle of the potentiometer and the other end to positive(9V).
3. Now connect 2 photocells from pin 7 to ground in series. And connect two other photocells from pin 6 to ground in series.
4. You must remember to connect the photocells so that the photocells are facing downwards to be able to sense the line.

## Step 5: Making the Headlights

1. Connect a 150 ohms resistor to the middle of the 20Kohm potentiometer and connect the other end of the resistor to positive (9V).
2. Now connect the one leg of the 20K potentiometer to the positive of the white/Orange and the negative of the LED to the positive of another white/Orange LED, and then connecting the negative of the second LED to ground.

## Step 6: Adding the Switch

Now for the adding the switch.
1. First, connect one of the middle leg of the DPDT switch to one terminal of the first motor and connect the other terminal of the motor to ground.
2. Connect the other middle leg of the DPDT switch to one terminal of the second motor and connect the other terminal of this motor to ground.
3. Now, remember the two 2907 transistors that we connected to the two 150 ohms resistors in the second slide. Connect one of the remaining legs of the DPDT switch to one of the collectors and the corresponding leg of the DPDT swich to the collector of the second transistor. Make sure you use the corresponding leg.

Now give yourself a pat on the back because your line following circuit is done.

## Step 7: Soldering It All Up

Finally, solder everything into place and make sure that none of the components are shorting each other. At this time, connect your battery connector to the positive and the negative rail of your board.

## Step 8: Body Building

Now onto the final step body building.

For my robot, I used a cardboard box. You may use something different if you like.

1. I made holes on the sides of the box to place my motors. I also made holes at the bottom of the box for my sensors (the sensors should not touch the ground, as in ground and not the negative) and the headlights ( because I connected them upside down).
2. For my convenience, I also made a hole on the side for the 20 K potentiometer to be able to adjust the brightness of the headlight.
3. If you would like, you could screw your board inside the bottom of the body (I did not because i just liked it as it was).

## Step 9: Checking Connections

Now, before you add the battery, look over everything see for loose connections or something that doesn't seem right.

## Step 10: Launching the Line Follower

Finally connect your battery and make your line and see you robot follow it. (Tip) you should make your line fairly thick with black tape.

If you have any comments or questions I will be happy to answer them

Enjoy!