Come on, there's nothing wrong with someone my age wanting LEGOs for a birthday present. And as luck would have it, that's exactly what I got. But not just any LEGOs. No sir-ee Bob, a handful of red and yellow bricks isn't for me. What I got was LEGO's version of the full monty -- the LEGO Mindstorms Robotics Invention System, with more than 700 LEGO pieces, light and touch sensors, a programmable embedded computer, infrared transmitter, software, and enough motors, gears, and wheels to roll out a pretty big barrel. Gee, I can't tell you what a thrill it is to be the envy of every 12-year-old on the block.
LEGO Mindstorms, developed by LEGO and the Massachusetts Institute of Technology, lets you design, build, and program mobile robots using LEGO pieces. At the heart of the system is a 16-MHz Hitachi H8/3292 microcontroller with an 8-channel 10-bit A/D converter, serial communications interface, timers, and multiple I/O ports. The AA-battery powered Mindstorms computer, officially called the "RCX" (short for "Robotic Command Explorer"), has 16 KB ROM, 32 KB RAM, and is packaged in a "LEGO-enabled" case so that you can attach standard (and not so standard) LEGO bricks and beams to it. The RCX (about the size of a standard calculator) stores several programs that can be selected and executed via a small keypad and LCD.
Software development takes place in a host/target environment, whereby you build programs on a Windows 95 PC, then download them -- via an infrared transmitter attached to the PC serial port -- to the RCX. Programs are created using a visual environment called "RCX Code," which is loosely based on the LOGO programming language. With RCX Code, you connect on-screen program blocks (instructions) to build programs. Program blocks are categorized as "commands," "sensor watchers," "stack controllers," and "my commands." Commands let you turn on/off motors, specify direction, set speeds, and the like. Sensor watchers let you specify how the robot responds to touch and light (or temperature and rotation, if you have the appropriate add-on kits). Stack controllers let you identify the different ways robot parts (motors, wheels, and so on) are to run based on sensor input, timers, or whatever. Finally, "my commands" allows you to organize stacks into groups.
Program blocks are added top to bottom; you edit programs by inserting or deleting new blocks in between existing ones. The figure above (courtesy of the Mindstorms CD-ROM) shows both the development environment and part of a program that controls a robot. In this case, the robot is called "Track Talker" and uses two motors (one for each wheel) and a light sensor. The robot is designed to locate colored objects in its path. It repeatedly beeps as it follows a trail, but goes silent when it encounters a particular color. In the figure, the commands are on the left, the program "trcktlk" is in green (A and C control the motors attached to the A and C output ports on the robot), and the light sensor is controlled by the blue sensor watchers on the right (the sensor is attached to the robot's input port 2).
Of course, RCX Code isn't the only way to write Mindstorms programs. LEGO also sells an SDK that lets you program the RCX using tools such as Visual Basic. And since the RCX is built around the Hitachi H8 microcontroller, you have the entire suite of GNU C tools at your fingertips.
A slew of freeware/shareware programs have also cropped up, including Markus Noga's legOS operating system (which will be presented in a upcoming issue of DDJ), Dave Baum's RCX Command Center, Barry Ruffner's RCX Creator, and the like. As you might expect, there are a number of Mindstorms web sites, most of which can be found through the official site at http://www.legomindstorms.com/. Likewise, information for building do-it-yourself sensors is available at various web sites.
But Mindstorms is more than a toy. In fact, it has become a very serious, yet inexpensive, research tool. At Denmark's University of Aarhus (http://www.daimi.au.dk/~mic /speciale/index.html), for instance, Claus Bjerre, Jes Hvoldal, and Michael Nielsen are building "adaptive pet robots" like a robot dog that is capable of intelligent interaction with its environment. More specifically, the robot understands spoken commands, determines the source of the sound, and responds to those commands -- depending on its current "mood" (hunger, anger, stress, and so on) which, in turn, is controlled by genetically evolved neural networks.
Right. These guys are building robotic Fidos, and I'm still trying to find a connector peg to stick into a 1×8 beam. Thank goodness there are plenty of LEGO experts up and down the block -- or will be as soon as school lets out for the day.
Jonathan Erickson
editor-in-chief
jerickson@ddj.com