Jet: Very Fast Line-Following Robot

Jet, David Cook’s robot that follows lines at over 1 meter per second

Jet, a robot that follows lines at over 1 meter per second

The Motivation

I’ve long admired Steve Hassenplug’s line-following robots for their graceful movements.

The first time I saw one of his robots was at the ChiBots Spring 2002 contest. I was finishing up a reasonably-fast trial run when Steve (who I hadn’t met before that) asked if he could try a couple of practice laps. I smiled to myself when I saw it was “just a LEGO robot”.

But, within seconds of Steve’s LEGO Lightning taking off, my attitude changed and a small crowd formed to admire its speed. After watching for a couple of laps (which didn’t take very long), my robot and I quietly backed away.

Steve’s LEGO Lightning achieved 73.8 cm/s that day. His robot was more than twice the speed of the next fastest competitor (me at 34 cm/s).

In the ChiBots Fall 2004 contest, Steve outdid himself. The course consisted of 10 straight tiles (12 inch long line) and 12 turn tiles (9.4245 inch long line) for a total of 233.1 inches or 592.07 centimeters. Steve’s Ben Hur robot took only 21.48 seconds to complete three laps, which calculates to a linear speed of:

(592.07 cm * 3 laps) / 21.48 seconds = 82.7 cm/s.

A significant feature of Steve’s designs is his steering mechanism. Some people mistakenly believe it is Ackerman steering, but it actually is differential steering with the majority of the mass (brain, batteries) being carried along like a cart.

The response is quick since the steering consists only of a compact group of motors and sensors -- low mass, low torque. It’s efficient and auto-smoothing, as the robot doesn’t struggle with changing the direction of the majority of the mass while sweeping the sensors back and forth trying to center over the line.

The Predecessors

I don’t like speed-based contests. The singular method of scoring is too stifling. These types of contests tend to encourage a narrow range of designs instead of diverse and creative robots with a variety of scoring strategies.

So, even though I’ve built a bunch of different line-following robots over the years, few have focused on speed.

As you can imagine, it wouldn’t be enough for me to create a robot that was just faster than Steve’s. The robot would have to be different (not an imitation of his design) and it would have to break the 100 cm/s barrier. And, of course, it would have to do so over a standard contest course, not something contrived for speed (like an oval with long straightaways or a high-traction surface).

The Course

The ChiBots line-following course consists of a 3/4 inch white line on a dark tile. There are straight tiles, turn tiles, and blank tile (for filling in the centers and edges).

592 cm line-following tile course matching the ChiBots Fall 2004 layout

592 cm line-following tile course matching the ChiBots Fall 2004 layout

The Fall 2004 tile layout features different sizes of straightaways (1, 2, 3, and 4 tiles in length). It includes single, double, and triple turns along with an S curve. As ran, it favors right-hand turns 8:4. However, the rules allow you to run either direction. I believe the Fall 2004 layout is an excellent arrangement for fully exercising a basic line-following robot.

Jet Speed

I am pleased to announce that on Dec 23, 2004, my new robot, Jet, successfully completed the course layout from the ChiBots Fall layout at 104 cm/s. I invite you to download the slightly large (800 KB), poorly-lit video.

Line-following course timer LCD showing lap split, lap, and total time

Line-following course timer LCD showing lap split, lap, and total time

(592.07 cm * 3 laps) / 17.05 seconds = 104.18 cm/s or just over 1 m/s.

I developed Jet using a different course. I then ran Jet several times on the ChiBots layout, optimizing speed settings between runs. This is just as anyone would do in practice. Jet does not have the course memorized nor is any programming taking advantage of the course layout or turn radius of the tiles or anything like that.

The tiles are the exact same expanded PVC tiles used for the Fall contest. No surface preparation was made, except for light dusting with a towel before beginning the practice laps. (Just as either Eddy Wright or Mike Davey had done before the Fall contest.)

Low-profile surface-mount infra-red emitter-detector reflective pairs for line-following sensors. White opaque slide blocks ambient light and provides the optimal minimum distance to the floor.

Low-profile surface-mount infra-red emitter-detector reflective pairs for line-following sensors. White opaque slide blocks ambient light and provides the optimal minimum distance to the floor.

There were some good-natured complaints about the lighting conditions on the day of the contest. However, I do not believe lighting conditions are relevant for Jet, as the sensors I’m using are less than 1 mm off the floor and are shadowed by a copper ground plane. (Eddy Wright recommended the low-profile infrared sensors to me, instead of my usual 8.5 mm tall visible-light LEDs.)

All of this being said, I realize it is easy to talk trash about how well your robot performs at home. I tried to reproduce the contest course as best as I could, but the real proof needed to occur at a public contest.


Race day. May 15, 2005. Schaumburg Public Library.

The course for the ChiBots Spring 2005 contest matched the Fall 2004 layout. Although future contests may use a different layout, this made for direct comparisons to the Fall scores.

Jet no longer has settings that need to be tweaked or configured. It took a single practice lap just to verify it was operational. Then, it waited patiently in a box.

On the first official run, Jet ran with the lighter battery pack at 8.4 V. I had wanted to use the heavier battery pack, but a wire broke in transit. Due to a slight algorithm change (traded speed for consistency), Jet managed a slightly slower time than at home in practice. None the less...

17.71 seconds -> 100 cm/s!!!

ChiBots allows for up to three attempts. While other contestants were running, I added an additional battery and a variable voltage regulator to bring the voltage up to 9.6 V.

15.38 seconds -> 115 cm/s!!!

With a simple twist of a potentiometer, I could have brought the voltage up to 12 V for a third run. However, I decided it would be better not to tempt fate on Jet’s 6 V motors.

Success! Mission accomplished.

About Jet

Mass: 196 g (w/340 mAh battery) or 212 g (w/880 mAh battery) The lower the mass, the lower the amount of energy required to change directions.

Dimensions: 13.3 cm wide x 10.8 cm long x about 5 cm tall Wide with low center of gravity for better cornering.

Overhead view of Jet the line-following robot, showing the various electronics

Overhead view of Jet the line-following robot, showing the various electronics

The front and rear sensors boards (the top and bottom of the photograph) have shiny tinned copper ground planes. This greatly reduces, dare I say “eliminates”, the amount of ambient light that can affect the sensors.

Note: The ground plane exists for optical reasons, although it may provide some trivial reduction in sensor electrical noise as well. I am a little concerned about fast moving plates over statically-charged PVC. I’ve added a 5.6 V zener diode to each PCB, just in case of an overvoltage.

Processor: 68HC908GP32 @ 7.3728 MHz (divides down to a nice baud rate for wireless debugging)

The microcontroller is able to make about 7000 complete line-following decisions per second, which is almost 7 decisions per millimeter when the robot is going full speed. By upping the clock, unrolling loops, and removing my wireless debugging and extraneous code, I could increase the number of decisions per second. The theoretical upper limit of around 14000 is based on the number of conversions possible per second by the microcontroller’s onboard analog-to-digital converter for one complete sensor sweep. (Yes, Eddy, I’m using analog, not digital values from the sensors.)

Motor Driver: Two full H-bridges made of discrete IRF7307 n-channel/p-channel power MOSFETs (50 mOhm / 90 mOhm) with discrete 1N5817 Schottky diodes and 4427A drivers.

The H-bridge arrangement is very similar to the one presented in Figure 10-15 on page 188 of Intermediate Robot Building. To conserve on space, I selected surface-mount power MOSFETs. To avoid reverse-current heating, I decided to add the optional Schottky diodes.

Each motor can draw up to 1.7 A, so it was important to use power transistors to allow for the highest possible motor performance. Even during the worst moments, the motors still receive over 97% of the electrical power from the H-bridge.

Because these motors are being pulsed a lot, a power MOSFET driver (4427A in this case) was critical. I would have used IXDN404SI chips, but I didn’t have any on hand at the time.

MOSFET heating does not appear to be a problem. The chips don’t even seem warm after long periods of use. This is because of the power MOSFET driver (rapid saturation), Schottky diodes, and oversizing of the MOSFET resistance versus the maximum motor draw. In other words, the chips stay cool, so the resistance stays low, so the motors perform well (repeat).

Start and Settings: Panasonic PNA4602M 38 kHz infrared decoder for start/stop/speed and Ramtron 25640 non-volatile serial memory for settings. (PNA4602M is no longer available. See Vishay TSOP4038.)

Jet has an infrared remote control start and stop, in case you were wondering how I did that for the video. To make this robot a little more sophisticated, I removed DIP switches and pushbuttons from the board. I configure the robot using either the remote control, wireless serial, or hard-wired serial. The settings are stored in the non-volatile memory, which is also fast enough for data logging.

Front view of Jet, the line-following robot, showing the battery and motors

Front view of Jet, the line-following robot, showing the battery and motors

Notice how the sensor board lies flat against the floor. The nylon spacers were carefully milled to make the position exact. There’s no gap for the light to seep in and no need for a baffle (beyond the glide pad itself).

Body Material: Mainly PCB. There are some nylon spacers, steel screws, aluminum screws, and aluminum angle motor mounts. Unknown material (likely Garolite) for battery rack / structural stiffener. ABS plastic glides.

Normally you’d choose glide material that is as slick as possible (Teflon or UHMW). However, I wanted the robot to grip a little bit, rather than slide all over the course. In exchange, that means the motors have to work a little harder to overcome friction.

Battery Pack: Lithium polymer (LiPoly) 7.4 V nominal / 8.4 V max rechargeable batteries. Either 340 mAh or 880 mAh.

Don Kerste recommended LiPoly batteries to me and I haven’t looked back since. My NiMH batteries just sit on the shelf, going to waste. Lithium polymer provides a number of significant advantages:

  1. It is lightweight.
  2. Thin, flat shape.
  3. Naturally high voltage (3.7 V nominal) per cell.
  4. Good discharge capability (up to 6C) easily provides several amps of peak demand current. (Liberal use of ceramic, tantalum, and electrolytic capacitors also helps.)

Motors: Two rare-earth magnet 13 mm diameter 1.2 W 6 V Maxon motors with 17:1 metal gearheads and precious-metal brushes

Yes, John Orlando, of course I used Maxon motors.

No-load motor speed is 16500 RPM @ 6 V
Which is 8.4 V / 6 V * 16500 RPM = 23100 RPM @ 8.4 V
With gearing, the no-load output is 23100 RPM / 17 gear ratio = 1358.82 RPM
Wheel circumference is pi * 30.4 mm = 95.5 mm = 9.55 cm
No-load maximum linear speed is 9.55 cm * 1358.82 RPM = 12977 cm/min
Which is 12977 cm/min / 60 seconds in a minute = 216 cm/s

Jet goes slightly less than half (104 cm/s) the maximum no-load speed (216 cm/s) because the motor speed slows down as it carries a load. Also, the robot doesn’t drive the motor at 100% speed, as it varies speed to steer. Also, the robot doesn’t match the track length exactly; There’s some understeer, some oversteer, and some wiggle.

I computed the actual linear speed vs. no-load motor speed of Sandwich, LEGO Lightning, and Ben Hur. Their ratios are slightly higher than half. But, in any case, keep this 50% ratio in mind when you select motors for your fast robot.

There are no encoders on Jet. I would have liked some, but I didn’t have motors in that size, with that gearing, with encoders. (Home-built encoders can be added on, if necessary).

Wheels: LEGO 30.4 mm tall x 14 mm wide VR tires with tapped hubs (no coupler)

Unlike most line-followers that tend to use large diameter wheels to increase speed, these short wheels require less torque and have a lower moment of inertia for better responsiveness.

Side view of Jet, showing off an aluminum motor mount and LEGO hub with setscrew

Side view of Jet, showing off an aluminum motor mount and LEGO hub with setscrew

The hubs are tapped for a setscrew, which is a trick I learned from Paul Jurczak. After tightening the hub onto the motor shaft, simply cover with the rubber tire.

I’m particularly proud of the aluminum motor mounts. I made them from aluminum angle stock (see pages 403-406 in Intermediate Robot Building). To reduce weight, I cut out the curved lower half with a Dremel rotary tool and a cut off disc. I then sanded the edges smooth.

Underneath Jet, the line-following robot, with 4 front and 4 rear sensors

Underneath Jet, the line-following robot, with 4 front and 4 rear sensors

Although Jet includes 8 sensors, only the four front sensors ended up being utilized. The rear sensor board remains intact for balance and grip.

How to Make a Fast Line-Following Robot

1. Crawl and walk before you run.

Try making Sandwich first. It’s easy to build, relatively inexpensive, and has well-documented instructions.

Perhaps you think that this advice is too paternal? Consider that, on average, only half the robots entered in ChiBots contests can even complete the course, regardless of speed. And, think of all the people that couldn’t even finish a robot to enter at all.

Trust me, building a line-following robot isn’t easy. Be kind to yourself by starting out succeeding with an achievable goal. For the next tips, I’m going to assume you’ve already accomplished this step.

2. Mr. Physics cannot be fooled.

Keep the robot as compact, lightweight, and low to the ground as possible. There’s a good reason why Formula 1 and Indy cars don’t look like armored cars or SUVs. Okay, well, there are other good reasons besides aerodynamic drag.

If you find your robot is a little heavy, use Steve’s cart trick: Have the steering pivot independently of the main body.

3. It’s all about the algorithm, baby.

The things you’ve read on this page got Jet to 68 cm/s. The next 50% boost had to do with software. I had to come up with a way to reduce oscillations and to reduce curve overshoot after a long straightaway.

Eddy Wright’s robot has such good oscillation reduction that you can knock it in the butt and it will straighten itself out. When the robot overshoots a corner, it not only knows which way to go to return to the line but it anticipates the line coming up and straightens out to match the angle. At one point, Eddy had a great write up about line following at

4. Be creative.

I don’t have all the answers. As proud as I am about Jet, it isn’t the final word on line-following robots.

There may be simple optimizations or major design changes that bring about the next leap in speed. I suspect something like John Orlando’s camera-enabled robot or a robot that memorizes the course will be required so that the robot can throttle speed and anticipate turns. Certainly accelerometers or encoders would provide a robot with a more accurate sense of motion. It’s likely that the rule set will have to change to define how much a robot can cut a corner.

5. Have fun!

Remember, a hobby is supposed to be fun. My “new world record” isn’t going to last. And, as far as I know, no one is planning on sending me a big check for the accomplishment. (Although I did get a nice gift certificate from Solutions Cubed for winning the ChiBots Spring 2005 contest.)

So, my best advice is to build a robot that you enjoy and accomplishes a goal that it is important to you. Line following isn’t exactly solving world hunger or bringing peace to humankind. However, I certainly appreciate the camaraderie that the event has brought to me and my friends at ChiBots.