Simple Line Follower Robot With No Programming - Analog Line Follower




About: I'm 19 years old and a 2nd year Electronics Engineering student at ITBA, Argentina

Hi! This is a line follower robot that requires no programming, instead, the behaviour of the robot is determined by an electronic circuit. This build is fairly simple and if you have all the materials it will most likely take less than 2 hours to build and test it.

Tools needed:

  • Soldering Iron and solder
  • Wire Snips
  • Needle Nose Pliers
  • Hot Glue Gun

Materials needed:

  • 1 x Perfboard / Dot PCB
  • 2 x low-voltage small DC motors
  • 2 x plastic bottle caps
  • 1 x Double AA battery holder
  • 1 x 5mm LED
  • 2 x CNY70 infrared sensors
  • 2 x 220 ohm resistors
  • 2 x 10k ohm resistors
  • 2 x 1k ohm resistors
  • 1 x 10k trimpot
  • 1 x Dual Operational Amplifier IC such as the LM358
  • 2 x BC547 NPN transistor (could be another NPN transistor)
  • 1 x pin strip
  • Some cables, I used some from an UTP/Ethernet cable

Step 1: Making the Circuit

The circuit for this robot consists of 3 parts. The first is the CNY70 sensors, and the circuit for them is in the first image. Where it says A0, the voltage changes analogically to the amount of light reflected on the surface. To distinguish between black and white surface, we will need a comparator which outputs a HIGH or LOW voltage depending on the voltage threshold determined with the trimpot. The second image shows the circuit for the comparator, you can later adjust the trimpot to set the correct sensitivity for your surface. In the last image, there is the circuit to drive two motors from the output of the comparator and using 2 transistors to manage the current.

VERY IMPORTANT: You should connect the left sensor with the right motor and the right sensor with the left motor, you can see an explanation of why this will make the robot work in the pictures.

Tip: You can solder a LED on the front just as a supporting point so that the sensors don't scrape with the floor.

Step 2: Assemble and Test the Robot

The battery holder and the motors can be hot glued to the board. Two bottle caps can work as wheels and if they slip a simple rubber band wrapped around will fix it. The caps can be screwed on in some motors or hot glued.

You can now test your robot, don't forget to connect your motors and put on batteries. Also, make sure to turn the trimpot to the position where the robot works the best.

Good luck!



    • DIY Summer Camp Contest

      DIY Summer Camp Contest
    • Games Contest

      Games Contest
    • Beauty Tips Contest

      Beauty Tips Contest

    9 Discussions


    7 months ago

    drawing is wrong. first of all, input and output 1 are reversed. after that, the robot is running on black surfaces and stop on reflective surface. to work normal like in the film you need to reverse pin 2 with 3 and 5 with 6. and if you don`t have modified micro servo, you need some BD135 or similar.


    Question 1 year ago

    Hi I have finished the circuit but the motors are not moving, and one of the transistors is getting hot. Tried to cover the CNY sensors and adjust the potmeter, but nothing made the motors run... Would you help me please?


    2 years ago

    Hi Mati , i have some problems with this circuit , it does not work with me,

    can you help me or send a clear draw please?

    I need it quickly.

    3 replies

    Reply 2 years ago

    Hi, you need to have 2 CNY70's or reflectance IR sensors. The schematic for the CNY of the first picture needs to be made twice for the 2 sensors, so you will need 2 resistors for each sensor and they need to be connected like in the drawing. Each of the 2 circuits for a CNY has a place (A0 in the picture) which is the output of the sensor. You would need to connect the A0 from the picture of both sensors to the "CNY output" 1 and 2 from the second picture. Then the "Comparator output" goes to the "Comparated output" from the third picture. I hope that clears any confusion regarding the connections between the pictures. Remember to double check the circuit with the schematic and to turn the trimpot to the right sensitivity.


    Reply 2 years ago

    Thinks for your help mati,

    I turn the circuit on and it's work very well but i still have one problem , i used this dc motors in picture instead of servo motors but the motors didn't self starting it need a bush to start can you explain why, please?

    and lastly i send you a request friend on Facebook can you accept it

    My profile(Zaid M. Zahira).


    Reply 2 years ago

    Hi! If you are using 2 AA batteries then the voltage that can be applied to the motors will be at most 3v. If your motors have a higher rated voltage then it may not be enough to make them spin, thats the reason why I put low-voltage motors in the materials list. You may want to try connecting the motors to a 9v battery or any power source with a voltage higher than 3v to check if they work better that way and consider getting some motors for lower voltages, in my case I used modified servos that are rated at 5v, so 3v still makes them spin, but for example, some 12v motors may not spin at all.