Home | Store | Showcase | Forums | Examples | Guides | Reviews | Support | Download | About Us

Mini Line Follower

I built this line follower after building a much larger, microcontroller-based robot called BADlam. For the task of line following, a simple yet elegant design is to use a comparator circuit and IR reflective sensors. To read more about the LM339 comparator chip, check David Cook's website - http://www.robotroom.com.  He has a great write up on the LM339 and even has a book for beginner robot builders.  

 

The Design
I decided to make this line follower as simple as possible yet still be competitive. I chose to power it with a pair of AA batteries, so everything had to work with only 3 volts of power.   The overall size of the bot is 5" wide including wheels and 5" long. This line follower only works with white lines on a dark background. The circuit could easily be modified to allow you to select between white or black lines. I may include this option in the version.  If you're curious, the "gear eyes" actually serve a purpose; they are counter balance for the batteries on the back. The weight of batteries made the front end too light.

  

The Chassis
I like working with polystyrene plastic.  It's light, strong, easy to cut and easy to join. Finding usable styrene can be difficult though. You're best bet, albeit more expensive,  is the local hobby store. Sheets of styrene are used for model train and building construction. Call around to find a hobby shop that carries it.  I also found a nice selection on John Dunsmoor's site,  machinist-materials.com . He carries a wide variety of plastics and metals at a good price. He also has several auctions on eBay.

 

The Drive Train
The drive train was taken from a mechanical wall-following mouse. It uses a worm drive that minimizes the number of gears needed. The mouse used a single C cell battery, but it was obvious that these motors were under powered. The motors run great with 3 volts, which is exactly what I was looking for.  The wheels are Lego. Luckily, in with the box of wheels I picked up on eBay, I found a couple of axle splines to round adapters. This made it easy to attach the wheels to the axle. I simply pushed the adapter on the axle and slid the wheel in place.

 

The Sensors
I picked up a pair of Optek OPB706A infrared reflective sensors at Future Electronics. These turned out to be excellent sensors for low power applications. The sensor is a low-power (1.7v) IR LED and a photo transistor combined in a single package. It's designed to detect a reflective surface within a 1/4" to 1/2". The four pins are spaced a standard .1" so it is very easy to work with.

 

The Circuit
My first circuit design used the LM339 to set the threshold of the sensors. I could adjust the point in which the sensors would register that it was over the white line and cause the corresponding motor to shut off. I connected the output of the LM339 to the base of a power transistor. When the LM339's output went low, the transistor would shut off. The motor speed was controlled by a resistor that limited the amount of power that is fed to the power transistor. This was a very inefficient method of controlling motor speed, but only required the one variable resistor.

Since the LM339's output is either open or low, I had to use a pull-up resistor to keep the transistor's base at high when the sensor wasn't over the line. This drained the battery very quickly. I then added a hex inverting schmitt trigger to keep the transistors base high and built a basic pulse width modulator to control the speed of the motor. I eventually simplified the circuit by connecting the output of LM339 to a 2N2222 transistor that controlled the power transistor. I no longer needed the inverting schmitt triggers, except for the PWM piece.  See the final schematic.


First Schematic

Second Schematic

Third Schematic


Final Schematic

The Prototype Board
Here was my original working design.  Two things caused this design to work poorly. The heavy drain on the batteries and only having 2 IR sensors.  The motors are fast enough to overshoot the line before coasting to a stop. With only 1 sensor per side, the motor had to stop before the sensor traveled past the  3/4" white line. I had to slow the motors way down to the point of stalling to keep it on the line.

 

The Printed Circuit Board
This project was the first time I created a printed circuit board using the photo sensitive process.  In the past, I used direct etch - printing my artwork onto a transparent sheet using a laser printer, then ironing it onto the copper board. This works well, but requires that you have a laser printer (which I don't at home).  By using photo sensitive transfer, you get very precise, very sharp transfers. But it is more involved than direct transfer.

I used positive sensitive boards and developer so that I didn't need to invert my artwork. The process involves exposing the copper board to ultraviolet light while the artwork is on top of it, then developing the etch resistant coating (this removes the etch resistant coating that was exposed), and then the usual etching to remove the copper.  Click here to see a video of the process.

The artwork should be printed at exactly 2.9" wide by 2.5" tall.

Overall, I found this process clean and easy to do.  MG Chemicals and Future Electronics carries all the supplies you need.

 


Final Artwork


One version of the PCB

Video of Mini following a line - Windows Media File:  56k    384k