Extreme line following

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?

-Adam

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?

Ben,

  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]
Hello.

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

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:

pololu.com/docs/0J19/3

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!

pololu.com/catalog/product/975

- Ben

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?

thanks!

Hello,

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

We’re hoping to start shipping units by the end of this week.

We have made the schematics available under the product page’s resources tab:

pololu.com/catalog/product/975/resources

We are still working on creating some release-worthy sample code.

- Ben

Ben,
Thanks for the schematics. Coluld you also share schematics of the switching voltage upgrader? I consider some tweaks and also want to use it on my other robots (which use other parts from Pololu).

Could you please elaborate on line sensors placement? Some line tracers that I’ve seen use reverse V pattern with central sensor closer to the center of the bot. Some others use straight line. The number varies from 2 to 7 with 5 being most common. What were your considerations in placing the 3Pi sensors the way you did?

Jan made up the schematics, so I’ll let him address this.

The main consideration was to place them as close to the forward edge of the robot as possible so that you have the maximum amount of time to see the line and react. Putting them in a straight line doesn’t really do anything for you except move them closer to the center of the robot and decrease the time you have to react. Having played with it, I really like having all of the sensors the same distance from the center of the robot.

There are three sensors close together along the center of the front edge that are intended for line following. Their positioning is such that a 3/4-inch line will not get lost in gaps between these three sensors; at least one of these three sensors will always be over such a line if you are reasonably centered, and three sensors give you enough of a span to be able to reliably stay on the line if your algorithm is tuned (as you can see from the demo line-following video).

The two outside sensors help if you’re following a line with very sharp curves. Furthermore, they become useful when you’re on a line course that has intersections or branches, such as a line maze. If you are following the line reasonably well, these outside sensors will be sufficiently far from the main line that they don’t see it at all. Therefore, if they do see something, you know you have detected an intersection (or a very sharp curve).

We chose five sensors because we wanted at least three closely packed central ones for line-following to go along with the two outside sensors. We briefly considered going with six sensors (i.e. four central ones), but we decided it was more useful to leave an additional digital I/O for the user.

Does this sufficiently answer your questions?

- Ben

Unfortunately, we are not releasing the details of the power supply at this time. We might release stand-alone versions or other similar products, which might make it more appropriate or necessary to provide additional details. What kinds of tweaks are you thinking about?

- Jan