I know this is very common project and it's already been done, however, most of the guides don't have a clear instruction, and being this inexperienced, I struggle to understand exactly what's going on.

I'm currently working on a line following robot, but I'm largely inexperienced. For the most part, I'm going to be using SparkFun's Magician Chassis with Inventors Kit. The main sensor available is the Line Sensor Breakout(QRE113), which I have 3 of, but I'm not sure if whether I should use the Digital or Analog model.

Also, I'm having trouble finding how to wire this circuit. I know as much that, I have to connect the motors, diode, simple transistor(with emitter, collector, and base), some sort of resistors, and maybe a capacitor(this one I'm not too sure of). All of this has to be set on a breadboard, and be jointly connected to the arduino. I think there has to be two identical circuits on the breadboard for each motor, as the voltage of the sensor is expected to decrease when it encounters a white reflective surface(tape), this in turn will slow down the motor, which would allow the robot to turn in the direction of the tape, due to the other wheel not slowing down. One part of the circuit, should handle the motor drive circuit, this should be the output of the transistor, but I'm not sure how to use the arduino(redboard) to control the speeds of the motors using the sensors, which I think will go into the base of the emitter. Which pins should I use basically?

Apart from this, how will the code look? But I think this is dependent on how I wire it, right?

This is what I'm using...



1 Answer 1


You should, really, cut this complete project into smaller little projects. Actually, first you should get clear what you want, there are a lot of possibilities.

  • Try to get one line sensor working
  • Try to get one motor working (check Pulse Width Modulation)
  • Try to get the two motors working and put them on the chassis.
  • Make the motors drive around a little, turn and reverse.
  • Get the three line sensors working (I think you're following a single line withouth crossroads etc.?)
  • Make your arduino check for changes in the pattern 0 1 0 respectively for the line sensors would mean that you're on the line. If the pattern is 0 0 1, you're driving off the line to the left.
  • Use the engines to adjust back onto the line.

I've actually done a project similiar to this one, but we used a motor-board instead. Driving the motors with a transistor&diode(&mosfet?) should indeed also be possible... but it'll get difficult once you want to be able to also reverse the motor (check H-Bridge motor driver).

For the patterns, you should make a switch case which checks the last pattern and keeps steering until he finds the right pattern again. But this can be achieved in many other ways.

Try to get a line sensor working, be sure to check some tutorials before you ask here and try to use different kinds of tape, blue tape didn't work for us :)

It's a really fun project, with lots of possibilities.

Below the schematics we used in the project.

  • We used a motor controller board.
  • Bluetooth module to receive command/routes from the server.
  • (LS) line sensors, 5 of them, to see crossroads/sideroads.
  • (Infrarood) IR sensors for collision detection.
  • (RS) I actually have no idea which sensors these are.
  • (Ultrasonic Sensor) Ping sensor to determine distance to other robots.


  • I can actually provide more reference material, but I would suggest you try it yourself (with the help of internet) and at the moment it starts to bother you, you should create a question specific for your problem. So as an example: You check some tutorials and FAQ on your line sensors, on how to get them working. After struggling for some time, you shouldn't drop the project but instead post a question with all details on this linesensor. So we can help you out to get that part working. Then you can happily move on towards the motors etc.
    – aaa
    Commented Apr 17, 2015 at 8:57
  • Thanks a lot guys. I'll get back to you guys if I run into more problems. Commented Apr 17, 2015 at 14:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.