The LineBot Project Page

(Last Updated 08/16/07)


LineBot Pictures

Here are some pictures of my fist LineBot prototype. The pc board was made on an LPKF Circuit Board Router. I've found that to be a good way to get past my initial mistakes without spending a lot of money. :) You will notice minor differences between this board and the final one shown below. I like to think of these differences as "improvements" rather than "mistakes".

(Note: You can click any of these pictures for a larger image)


Here are some photos of the finished LineBot built with a commercial printed circuit board.


Project Information

So what's this project all about anyway?

Quite a few members of our club (Southern Oregon Robotics Club - Grants Pass, Oregon) have been interested in learning to program Atmel microcontrollers for quite a while. Most of them have at one time or another purchased the Atmel STK-500 development system to learn with, but very few have gotten the courage to do anything with it. I think the problem is that when you are starting out and you look at all that chip and programming documentation you are simply overwhelmed. It's pretty intimidating and it's no wonder that some guys can't even figure out where to start. Many of those that do decide to take the leap, get started on the wrong foot. By that I mean that they start downloading other peoples code and playing around with it. While that sounds like a good idea, it invariably leads them to a dead end. You will never learn to program from doing that! Never! I'm not saying that you should "never" look at anyones code. I'm just saying that until you buckle down and start to write your own, you will never learn to do anything meaningful and you won't ever understand what you've done. You will also have traded all the satisfaction that you could have had for a lot of frustration. What you will eventually come to realize is that most of the code that's out there to download was written by someone else that really didn't know how to program either. It's a blind following the blind kind of thing. Trust me... Don't go there!

So what's a better way to get rolling? Well... I think you need to keep it really simple and whatever you do, you do yourself. Nobody can "tell" you how to program and you can read books until the end of time and you still won't know how to do anything. You'll need books for reference for sure, but you need to actually do something to learn how it's done. It's a lot like building a house. You can buy all the hammers you want and all the books in the world, but you won't be a house builder until you actually build a house!


So how does this LineBot fit into the plan?

Well... The design of the LineBot is very unique. It is what I call a "scalable" project. By that I mean it's possible to start out with something really really simple that actually works and progress to something really really sophisticated that works even better. I've had my bot following a line with less than ten lines of code. This can be about as simple a project as you could dream up to get started and after your programming skills improve, you can do some really impressive things with it. Best of all, by the time you have done all that can be done, you'll "really" know how to program!


The hardware design.

The LineBot is designed around an Atmel AtTiny13 processor. This is just a "sub dollar" 8-pin part, but it has a remarkable number of resources available. In addition to the RAM, ROM, EEPROM and I/O Ports you would expect, it also has two PWM ports and a four channel A/D converter. By the time this project is over you will be employing all of these facilities in your design. You will start out simply looking for logic levels from the line sensors. Then you will progress to reading the sensors with the A/D converter to give you true proportional feedback from the line. Then eventually you will employ the PWM ports to provide proportional motor control in response to what the sensors are doing. By this time you'll be doing some pretty fancy stuff! Beyond that there are unlimited possibilities to create selectable program strategies and advanced features. The "sky is the limit" at that point. You'll have "the keys to the kingdom" and you'll only be bound by your imagination!

Locomotion for the LineBot is provided by two Solarbotics GM-10 gearmotors. These tiny pager motor based gearmotors run just great off the 3 volt CR2 lithium battery and they draw very little current. The wheels and tires are some that I injection mold for Solarbotics. They fit the unusual square spline on the GM-10's and have lots of traction. Other motors could be used on this bot, but these seem like a good choice when all things are considered.


What we will and won't be doing here.

I don't think anyone knows the exact course this project might take. I suppose it's even possible that people will loose interest and the project will crash and burn. I sure hope that's not the case. I've done everything I could think of in designing the LineBot to make it interesting and challenging at all levels. But in the end, it's only going to be what you make of it.

A couple things you should understand... First, we will NOT be teaching a course in programming on this site. I made the bot and you'll have to take the initiative to learn the programming. I'm sure we will have many programming related discussions and perhaps demonstrations at our club meetings, but in the end, you'll be doing the grunt work that makes things happen or not happen. This project will take a lot of work and determination on your part. If you put forth that effort, you will be richly rewarded. Please don't expect anyone to hold your hand. You really need to dive into this on your own. The purpose of the LineBot is just to make your adventure in programming exciting and rewarding. It's still going to be a lot like "work".

The function of this site is just to provide basic information on the LineBot so you can use it effectively. I will probably continue to provide suggestions here on what course to follow in your exploration, but I will not be providing any programming suppost. What technical support I provide will probably be done at club meetings. The only exception to that would be if eveyone is having trouble with something, I will likely address it here. To do any more than that would take more time than I have available. This has already been a lot of work. :)


How you should start and where you should end.

The first thing you want to do is get your bot assembled and tested. At least the first batch of kits I'm doing will have all the surface mount parts installed so all you have to do is solder in the few remaining thru hole parts and then install the motors. You will want to be sure to download and read the assembly notes I took when I was building the first ones. There are some things in there that might save you some real grief! Once the bot is all together, you can get the HEX file I've included below and load it into the LineBot's processor using your STK-500 (or other programmer). Doing this will accomplish two things. Fist, you will have learned how to use your STK and the Atmel Studio Software to talk to the LineBot's processor. Secondly, you will have verified that your new bot is fully functional.

Now you should be ready to start your first program! I've included what I call a "Boiler Plate" for your first program (see below). This is just a "framework" to start your program in. I've provided this to get you off to a good start and show you the basic structure for a program. About all the boiler plate does is establish some constants and initialize the part. You will want to use this basic structure in all your programs so take a few minutes to study and understand what is there.

Your first program should be a "one liner". Just enter one line of code that will turn on one of the motors. Then progress to the second motor. Once you are comfortable with that, you might try reading the push button switch and using it to start the motors running. Once you get this far, you are off and running!


Gotta stop for now! To be continued...



Things to download

Click here for a LineBot schematic in pdf format.

Click here for the Assembly Notes I made while building the prototypes.

Click here for a sample HEX file that can be downloaded to your bot to see if it works. Be sure to read the Assembly Notes and look at the programming setup information on the schematic sheet BEFORE you attempt to connect your bot to the STK500! This program is about as basic as it gets. The total program is only eleven lines of code (instructions). I could actually have cut four lines off of that by not using subroutines. It's an optical "bump switch" implementation so expect it to be jerky. What it will do is tell you that your bot does work and you're on the right track.

By now you should be excited enough to start programming on your own! I've decided to give you a jump start on that process. Here is the boiler plate I used to start the project. It helps you get your ports assigned and the part configured. I know this is cheating on my basic premise for the project, but I'm thinking it will give us all some common ground when we start to discuss our programs at the meeting.


Have Fun!