Pololu Robotics & Electronics
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

Extreme line following

Six robots enter, one robot leaves, kind of. This is an unedited video of an unofficial event at the local LVBots robotics competition we held this past weekend, so it’s rather long, but it has some interesting points. The six participants are using the same Pololu 3pi robot, but all of the robots were programmed independently by different people. Jan’s robot, the eventual “winner”, is playing a Hungarian rhapsody while the Paul’s robot, the third place finisher, is playing one of Bach’s fugues. Mine was the one that finished second and took out “Johann”.

I think next time I’m going to add a sharp sensor to the back of my robot so that it can slam on full reverse and take out the people who dare to catch me.


Update: We’ve put up a product page for the 3pi, which is now shipping.

1 Like

This is way cooler than regular line follower. I will suggest this to some of the tournament organizers I know.
BTW, do you know if anyone did this at any robot competition?
Also, what is 3pi robot? - there is no mention of it on Pololu site or elsewhere.
see: http://www.google.com/search?q=Pololu+3pi+robot&btnG=Search

I have no idea if there are any robot competitions out there that have a line-following event like this. Even for us it was just a fun thing to run after the real line-following event was over. Now we’re trying to see if we can brainstorm up a complete event that would be something like this, with a lot of robots running at once.

3pi is a programmable, AVR-based robot that we will begin selling hopefully this month or next month. The robots in the video are our first 3pi prototypes. More information will be coming soon!

- Ben


thanks for the quick reply. I will look forward to development of extreme line follower discipline. The 3pi seem quite fast - I would seriously be interested in buying one.

Would you consider putting preview of 3pi to this board? (pics, schematics, specs). This may give you a few additional improvement ideas from the users.

There should be more info on our web site soon; here’s some preliminary information:

The 3pi robot gets its name from its diameter, which measures 3pi centimeters (~3.7"). It is based on our newer Orangutan robot controllers (so it uses an ATmega168 microcontroller with hardware PWMs dedicated to motor control and has an LCD, buzzer, and three user pushbuttons), and the PCB has five integrated QTR-RC reflectance sensors along the front edge. The robot uses two 30:1 micro metal gearmotors is powered by four AAA cells. Its top speed is just over 1 m/s.

Here is a picture of one of our prototype units:

- Ben

That’s quite cool. Does it have a ball caster or two hidden away on the underside?


It has a single ball caster under the rear battery holder.

- Ben

Here’s a short video of our first attempt at this exhibition:

Unfortunately Candice wasn’t quite on board with the plan.

- Ben

I wasn’t really all that aware of Pololu until I began seeing all of Bens posts on the Arduino forum. Pololu will now be getting a pretty big chunk of my robotics budget this summer! I’m very appreciative of your ‘community spirit’; sharing code, helping with projects and creating Arduino libraries.

I’m very impressed by the 3pi robot and I’m looking forward to picking one up when it’s released. I’ve got a couple of questions so far:

  • I really like those wheels; will they be available for purchase separately?

  • Is there a chassis on this robot or is the PCB the chassis?

  • It looks like the 30:1 motors will be swappable with the 100:1 motors for more torque, is that right?

This looks like a great platform!

Thank you for the praise. I hope that enthusiasm is still there after you’ve used our products! To answer your questions:

  • The wheels will be available separately. Right now we are making them with our 3D printer, but we are working on getting them injection molded. In the beginning we’ll probably be selling the 3D-printed ones.

  • The robot chassis is a single-sided PCB with the surface-mounted components facing down. The through-hole components (buzzer, headers, and buttons) are on the top side of the PCB, and there are additional through holes for adding LEDs and extra capacitors to the top side (since the surface-mounted LEDs aren’t all that visible on the underside).

  • Yes, you can swap the 30:1 motors with slower, higher-torque 100:1 micro metal gearmotors. We’re also trying to get some additional gear ratios so that you would have more choice when it comes to speed and torque.

- Ben

That is insanely cool. I do believe I’ll be mentioning this to my club. :smiley:

To Ben -

Count me in among the folks interested in the 3Pi. Like some of the others have mentioned above, I’d like to use the 3Pi as a expandable base. One of the comments you made earlier has me intrigued:

Judging by the 3Pi picture and the data sheet for the 8X2 display, it looks like you’re using 11 pins?

I’m thinking:

Remove the LCD, and add some additional sensors to the base
Add a second platform with another AVR & the previously removed LCD
And maybe an xbee radio.
Instead of using the serial pins, utilize the 3Pi as an SPI Slave.

I look forward to checking out the schematics as soon as they’re posted, to determine approximately how much power the 3Pi is using, and how much might be left over.

Any thoughts?


  1. Would you consider making this robot modular with a baby-O controller attached to dumb base (motors and sensors only).
  2. Can you add a socket for some relatively popular and inexpensive wireless module?
  3. Are the line sensors read with analog conversion or via comparator chip?

[quote=“md10bldr”]To Ben -

Count me in among the folks interested in the 3Pi. Like some of the others have mentioned above, I’d like to use the 3Pi as a expandable base.[/quote]

The LCD on the 3pi is controlled by 4 data pins (4-bit mode) and 3 control pins, so you would only potentially recover 7 I/O lines by removing the LCD. Additionally, three of the LCD data lines serve the dual purpose of pushbutton inputs (they rely on the mega168’s internal pull-ups to work, so if you’re not pushing the button this just looks like a standard I/O pin) and one LCD data line is connected to an LED.

Unfortunately the 3pi isn’t designed for SPI communication. Like the Orangutan LV-168 and Baby Orangutan B, the motor drivers on the 3pi are controlled by the mega168’s four 8-bit hardware PWMs: the two from timer0 and the two from timer2, with each timer corresponding to one motor channel. The problem is that on the mega168, the SPI line MOSI also serves as timer2 PWM output A. What this means is that SPI communication on this line will drive motor 2 (we have to AND MOSI with RESET to make sure motor 2 isn’t driven when the 3pi is programmed). If you want to use the 3pi base as an SPI slave, you would need to have it running a program that implements software SPI. Our expansion plan was that the base could be a slave controlled by high-speed asynchronous serial. It would be fairly easy to achieve 115.2 kbps, and higher speeds could be used if the code on the base was efficient enough to be able to keep up (e.g. use a serial-received interrupt to buffer incoming data and make sure you can get around to acting on that data fast enough to keep the buffer from overflowing).

The 3pi’s 5V regulator should be able to supply around 100 mA to an expansion level. Additionally, you can probably power a number of things directly from the battery voltage, which spends most of the time between 5.5 to 4.5 V before dropping off precipitously as the batteries run out of power.

- Ben

Our cost for making the current base is almost the same as what it would be to make a dumb base with a baby-O socket, so there isn’t much incentive to go that route (making things modular incurs size and price increases because of considerations like connectors and reduced layout flexibility).

One major goal for this platform was that it be small, so we did everything we could to make it as compact as possible. Unfortunately, this doesn’t leave room for additional sockets, but such sockets could be added to second-level expansion platforms that communicate with the base using asynchronous serial. The expansion platform could even be controlled by an Orangutan or Baby Orangutan.

The line sensors are effectively QTR-RC sensors, so they are read by timing digital input pulses. We have determined that this gives us the best performance in terms of sample frequency, noise immunity, and range. The sensors provide an analog measure of reflectance (not just a black/white signal you would get from a comparator). The software libraries we released for the Orangutan LV-168 and Baby Orangutan B will work on the 3pi, so you will be able to read the sensors with a series of high level functions.

By the way, thank you for the suggestions. We definitely value hearing what kinds of things our customers (or potential customers) would like and will keep them in mind for things like expansion levels and future products.

- Ben


  1. What is approximately the timing advantage of QTR-RC digital sensor vs. regular phototransistor (like QRD 1114) output and ADC conversion?

  2. The line tracing speed is pretty impressive. Could you post a picture of the bottom of the robot to see the sensors layout? Also could you post the code?

Thank you!

Since the output of a QTR-RC sensor is a digital pulse, you can take all of your readings in parallel. The mega168 only has one ADC, which means you can only read one analog voltage input at a time, so you would need to process QTR-A sensors sequentially. On the 3pi, the line sensors have an even faster response time than standard QTR-RC sensors, producing a 250 - 500 us pulse for black and maybe a 40 us pulse for white, which leads to a potential five-sensor sample rate of 2 - 4 kHz.

Additionally, because of the greater noise immunity of the RC version, you don’t need to average readings to filter out noise. The QTR-A version, on the other hand, is succeptible to noise, especially if you are driving motors, so you would want to average several successive readings together before relying on the output.

You can see a not-so-high-resolution view of the bottom at the start of the 3pi maze-solving video (make sure to click on “watch in high quality” link). The line sensors are curved along the underside of the front edge. If you look at the picture of the top side of the robot, you can see schematic symbols in the silkscreen that show the locations of the sensors (there are three somewhat close together along the center portion of the front with one spread farther to the left beyond the left set of 8 prototyping holes an one spread farther to the right beyond the right set of 8 prototyping holes). We will release some better pictures of the 3pi soon!

We will also release some line-following and maze-solving code with the 3pi, but we don’t have anything specific we want to make public yet. If you want to see a slightly higher-level version of the code running on these line followers, take a look at the third sample program on this page:


If you pick the proper constants Kp and Kd, you pretty much have the line-following code that is running on the 3pis in the extreme line following video (it really is that simple).

- Ben

We have put up an initial web page for the 3pi and will continue to add to it over the coming days. We are in the process of working on more extensive documentation and sample programs, but for now we thought you might be interested in seeing some pictures of the final design!


- Ben

it looks like a very neat small bot, very compact with well thought-out parts placement.

  1. When will you start sales?
  2. Could you please publish the schematics and the PID line following code?
  3. What is its weight with 4 batteries?



We are still waiting for some parts to come in, but we hope that we can begin shipping in one to two weeks. We will definitely post information like schematic diagrams and sample code. The weight with the rechargeable batteries we carry is about 135 grams (4.75 ounces).

- Jan