Steve's LegWay
This LEGO robot was built to stand on two wheels and balance, follow a black line, and/or spin in place.
About LegWay
Many people have tried to build balancing robots, but few have actually been able to make it work. I managed to find the correct combination of hardware and software to allow the robot to balance. Once I was able to make it balance, it was a simple taks to make it move forward and follow a line.

Many people have asked if it will work on a slope. Actually, it will, for the same reason it will work on different color surfaces. LegWay constantly attempts to adjust its balance point. I've been able to put it on a table, and tilt the table, and LegWay continues to maintain its balance.

I've succeeded in making Legway work with the standard LEGO remote control. Using the motor control buttons, the robot can move forward, backward, or turn right or left while balancing.
Also, using an Acrobot (from the LEGO Constructipedia) I've made a robot that can stand up on it's own. I also attempted to make Legway balance using NQC, but the response of the software was just too slow. I still have some ideas for making it work with a standard light sensor, but I haven't been able to complete that, yet.

LegWay Program
View Program
The program for LegWay was written in
BrickOS (LegOS) and uses EOPDs to maintain a constant distance to the ground.  As the distance decreases, LegWay moves forward.  As the distance increases, LegWay moves backward.

Every 50 ms, LegWay attempts to re-calculate the balance point by measuring the current distance and motor speed.

To move forward (for line following) LegWay actually sets the motors to run backward, causing a tilt, which it automaticly corrects, by moving forward.  When one sensor is over the line, it stops that motor, and LegWay balances using only the other motor, causing it to turn.

To spin in place, both motors are shifted "off center" in opposite directions, the same amount, but they still correct for tilting.

In the pictures, you may notice the second sensor is disconnected.  The main LegWay program will follow a line if two sensors are attached (always moving forward) or attempt to stand still, if only one sensor is attached.

If the motors are set at full power (either direction) for more than 1 second, LegWay assumes it has fallen over and the program ends.


LegWay the Easy Way

I've finally created an install package for the LegWay software.  If you want to make your own LegWay, but don't want to learn and install BrickOS, just download this package, and unzip it.  Enclosed is a very brief readme file.

LegWay uses two EOPDs (Electro-Optical Proximity Detector) from
HiTechnic Sensors to balance and detect lines.  HiTechnic has stopped making these sensors again.  :(   

The EOPDs are based on the IRPD (Infrared Proximity Detector) circuit, but use visible light to determine distance by checking the detector, sending a pulse of light, and checking the detector again to calculate the amount of light reflected.  The value returned will change based on the distance to an object AND the color of the object.  IRPDs can be used in place of the EOPDs, but they will not work as well for detecting/following lines  These sensors are available, now. I used RED EOPDs.

For this application, a small change in the value will usually indicate a change in the distance to the surface, while a large change will represent a change in the surface color (white to black)  The EOPDs usually do not return a usable distance to a black surface, because the light is absorbed.

Here are a couple videos, and some more pictures.  The videos were taken with my LEGO Vision Command camera, so they're not really the best quality. 

Brickshelf Pictures
LegWay Following a Line
LegWay Spinning This video really doesn't show how fast it's going.  The motors are at full speed (almost) and in this video, it doesn't change direction.
Legway Building instructions
Quick Cash Payroll Loan
LegWay Past
I attempted to build LegWay using an accelerometer to detect tilt, but soon realized the acceleration due to gravity would not change as the robot tilts, because the robot is accelerating at 9.8 m/s^2.  So the reading will be zero, until it smashes into the floor.

Several people have said they tried (without success) to build something like this with standard LEGO light sensors, but I don't believe they have the resolution required.  (not even close)
LegWay Future
My next project will be to make LegWay work with a remote control. (I've done this)  I have a couple ideas, which include using a SpyBot remote to drive LegWay around, or use a regular LEGO remote to run some pre-programmed moves.

Another idea is to make LegWay stand up (from a lying position) on it's own.  It can't do that right now, because the center of mass is below the axle when it on it's side.
LegWay Response
I've had a TON of people contact me about my Legway. I believe it's been popular, because it seems easy, and many people have tried it. However, as far as I know, no one's been able to do it with LEGO Mindstorms before.
Legway was voted into the Hall of Fame at LEGO Mindstorms Monthly
LMSM Hall Of Fame
Legway was also selected as the Cool Robot of the Week by NASA's Space Telerobotics Program for November 18th 2002.
Cool robot of the week

On 1/17/03 Legway appeared on The Screen Savers
Here's a clip of the show (36MB! provided by Full System, Inc)

I really haven't kept this updated.  In the last couple years, Legway has appeared in several robot magazines, and won several medals for "Best Mindstorms Robot", and "Balancing robots"


As Seen On...
Thanks for checking it out.  Feel free to tell me what you think.