Robotic roller-coasters...mobile intelligent cat toys...a robotic disk jockey...an autonomous self-propelled video camera...a tiny mobile image scanner that builds up pictures by crawling millimeter by millimeter across a page: all these are gadgets produced by an R&D organization that few know even exists.
The inventors are not part of a big research university or at some forward-looking computer company, but a loosely knit group of engineers who build gizmos out of Lego bricks. Developed by the Billund-based Danish toy company, some bricks contain microcomputer-controlled sensors and motors, and all are components of a three-year-old product called Lego Mindstorms.
Originally intended for use by children at home or in the classroom, Mindstorms has instead enraptured tens of thousands of adults. Engineers, academic researchers, and hobbyists have reverse-engineered its firmware, hacked together new programming environments, and shared recipes for unanticipated ways of connecting it to the outside world.
While Lego Co. may have been taken aback by the extent to which Mindstorms had transcended the child's toy category, the company is happy to have the millions of dollars in extra revenues it brings in. In response, it is expanding its range of computer-controlled toys, publishing some of Mindstorms' internal documentation, and enlisting fans as advisors and testers for new versions of the product. It even sponsors symposia to discuss Mindstorms theory and applications, the most recent of which was held in August in Fort Worth, Texas.
Bricks that think
Lego and the engineering community share a long history. As far back as the early 1980s, automotive engineers reportedly used the brightly colored interlocking bricks and hinges--then years away from built-in microcomputers--to make scale models of proposed vehicle assembly lines. In 1984, the company began working with researchers at the Massachusetts Institute of Technology (MIT), in Cambridge, to adapt its motors, switches, and other parts for computer control. Indeed, the RCX controller that serves as the brain of every Mindstorms robotic gizmo is based on what the company learned by sponsoring the development at the MIT Media Laboratory of a "programmable brick."
RCX stands for robotic command explorer. It is an oversized Lego brick [left], a little larger than two stacked decks of playing cards. On the outside are a liquid-crystal display (LCD), four control buttons, and six wiring connectors. Inside are a Hitachi H8 central processing unit (CPU) with 32KB of RAM, space for batteries, and an infrared transmitter and receiver, which communicate with a base station plugged into a PC port.
Three of the external wiring connectors are outputs, each supplying a user-controlled voltage to a motor, a lamp, or anything else that will run off half a dozen AA batteries. The remaining connectors can read data from a variety of sensors (one light and two touch sensors, all housed in Lego-style bricks, are included with the basic kit, along with two stepper motors). The LCD can display motor settings, sensor readings, or diagnostic information about the status of the RCX and its software.
To construct a working gizmo [see photo], a Mindstormer typically builds the mechanism out of the RCX, motors, sensors, wire, and the roughly 700 bricks, beams, gears, axles, and wheels included with the basic kit, which lists for US $199. Then, to program the RCX, an aspiring inventor runs a graphical environment provided by Lego for the PC. By connecting blocks representing commands such as READ SENSOR LEVEL or TURN MOTOR ON, he or she creates a program, downloads it to the RCX by an infrared link, and pushes the appropriate control button to start it running.
The PC sends the program to the RCX in the form of byte-codes. These are sequences of 8-bit instructions that specify such actions as turning on a motor, waiting for input from a sensor, or jumping to another point in the program. A little more than half the RCX's 32 KB of RAM is taken up by firmware--downloaded from the PC when the RCX is first powered on--that interprets these byte codes and executes the H8 machine code that actually makes things happen.