O'Reilly Network    
 Published on O'Reilly Network (http://www.oreillynet.com/)
 See this if you're having trouble printing code examples


Lego Mindstorms

Mindstorms in Education

08/04/2000

Also this week:

Building a Game in Mozilla -- Part Two

Linux Gaming Resources

Get the Inside Scoop on the Mozilla Project

Open Source Roundtable: Where's That Lizard?!With audio

Previous Features

Lego Mindstorms robots have found their way into a lot of classrooms, from primary schools to universities. There are several reasons for the popularity of Lego robots as teaching tools. Most importantly, Lego robots are fun. Secondly, the robot kits are very flexible, in terms of building and programming. There are programming environments readily available for any level of programmer. Finally, Lego robots are surprisingly inexpensive.

It's fun!

Building and programming Lego robots is fun. While you're having fun, you can learn about mechanical design and computer programming. Lego robots scurrying around in a public space are sure to attract attention, as John Lorenz found out at Western Washington University (WWU). "The class put on a robotics expo in Red Square, the center of the WWU campus," he said. "We showed off all our interesting projects, and I was personally surprised at the size of the crowd we gathered."

In the classroom, "Every day of robotics class was also show and tell day," Lorenz said. Students showed remarkable creativity: "Wall following, line following, experiments with range finding, collection of Coke cans and ping pong balls: At one time or another, we saw it all. One group created a device that focused an IR (infrared) beam on a wall by moving a couple of lenses back and forth until the illumination was the brightest." Finally, there was a contest in the class: "Each robot would travel toward a wall and stop before hitting the wall. The winning entry stopped with the shortest distance to the wall. The professor was pleasantly surprised with how much variation and creativity he saw."

Previously in Lego Mindstorms:

Lego MindStorms: An Introduction (01/31/2000)

Lego MindStorms: RCX Programming (01/31/2000)

Lego MindStorms: Programming with NQC (02/25/2000)

Tools to Save Your MindStorm Models (03/29/2000)

The Straight and Narrow (05/22/2000)

Lego robots are fun to watch, and even more fun to build and program. Never mind textbooks and tests; this is learning by doing. Jeff Abramson, who teaches 8-13 year olds at the Computer Street Academy in Oakland, CA, says "I decided to use Mindstorms because it looked to be fun and would give students a chance for individual exploration in a problem-solving setting." A highlight of the class was participating in the First Lego League (FLL) competition. This competition is held every year; a challenge is announced in the fall and students rush to create a solution. Teams from all over the U.S. create a robot to solve a specific problem. Local competitions allow students to showcase their solutions to the challenge.

Axel Schreiner uses Lego robots to teach a class on low-level and real-time programming at the Universität Osnabrück in Germany. He likes to bring robots to class to "pass them around, run them, show movies of running robots, show programs, explain, explain design principles ..."

There are few things that will teach you more about mechanical design than actually building something, finding out whether it stays together or falls apart, and observing how it moves. The best way to find out how gears, pulleys, and wheels work is to play around with them. Similarly, you can learn a lot about writing software by writing robot programs and seeing how they behave. Making a robot drive across the floor is a lot more exciting than watching a computer monitor.

Lots of development options

The brain of the Mindstorms Robotics Invention System is an oversized brick called the RCX. The RCX is a small computer that can control motors and read sensor values. By writing software for the RCX, you determine how your robot behaves.

Related Reading:

The Unofficial Guide to LEGO MINDSTORMS Robots

The Unofficial Guide to LEGO MINDSTORMS Robots
By Jonathan B. Knudsen

One of the reasons the RCX is such a great platform for teaching is its versatility. There are many choices for developing programs for the RCX, from graphical environments suitable for novices to advanced environments based on C++, Smalltalk, and Java.

People who haven't ever programmed before usually start with one of the graphic environments, either RIS Code, which comes with the Robotics Invention System, or ROBOLAB, which can be bought from Pitsco-LEGO DACTA. Both pieces of software allow the student to create programs by dragging functional blocks into a sequence with the mouse. For example, you might string together blocks to set the direction of the motors and turn them on. Other more complex blocks allow for building loops and reacting to the values of sensors.

RIS Code is great for people who haven't programmed before, but it has its limitations. First, RIS Code only runs on Windows. Second, it doesn't allow the use of variables. ROBOLAB addresses both of these concerns, to some degree: it runs on MacOS and Windows, and it allows for more complex programming.

Beyond the graphic environments, powerful tools are available for free on the Internet for programming the RCX in C, C++, Forth, Java, Visual Basic, and other languages. The most popular options are:

At WWU, Lego robots were used in two classes: one on robotics and one on artificial intelligence (AI). The RCX was flexible enough to handle both subject areas. The RCX is lightweight, computationally speaking: a 16-MHz processor and 32 kilobytes of RAM are minuscule by today's desktop computer standards. However, AI has undergone a fundamental shift in recent years that makes a small platform like the RCX a good choice for exploring algorithms and behavior.

While the AI course focused on software and behavior, the robotics class focused on hardware, particularly sensors. The students explored many types of sensors, going well beyond the usual touch and light sensors that come with RIS. According to John Lorenz, Pitsco-LEGO DACTA has "air pressure sensors, motion sensors, sound sensors, pH sensors, and even humidity sensors, all of which connect to any Mindstorm set with a simple yet horribly overpriced adapter." Students also created their own sensors, which are easy to connect to the RCX.

Meanwhile, at the Universität Osnabrück, Axel Schreiner teaches a far-ranging course on robot programming. There, the RCX's flexibility makes it a great platform: The course covers just about every development option for the RCX, from Spirit.ocx programming through NQC, pbFORTH, legOS, a Java Virtual Machine for the RCX, and many other environments. Axel uses several other platforms in his classes, including fischertechnik. "I marvel most about the fact that Fischer has been hooking up to computers for 15 years and has the much more sophisticated platform (mechanical and interface they beat Lego hands down), but has not created the enthusiasm Lego did. In part I blame it on the rather annoying closed serial interface they put out in 1997. Before, you needed to drag around an umbilical cord; now you can only download using their own programming system, which is a bit old-fashioned."

It's cheap!

At $200, the Robotics Invention System sounds like an expensive toy. It's actually an excellent value. If you tried to assemble a similar kit elsewhere, you would probably end up with something more expensive that was much harder to use. Teachers are almost always on a limited budget; RIS provides a reasonably-priced package with a lot of power and flexibility. This one kit provides enough computational power, software options, and mechanical versatility to last through at least a semester, possibly two.

John Lorenz said "When I first saw the price tag, my eyes popped out of my head. Since then, I haven't found any robot systems that are as flexible and as cheap as a Mindstorm set."

Summary

Lego robots are the tool of choice for teaching a variety of topics: robot construction, real-world programming, and artificial intelligence. The combination of learning and fun, software flexibility, and low cost makes Lego robots extremely attractive. Don't just take my word for it, though: Go to your favorite search engine and look for something like "syllabus mindstorms." At Google, a simple search produced links for Mindstorms-related classes at Duke, Lawrence Technological University, University of Southern California, Toin University of Yokohama, Rensselaer Polytechnic Institute, Centralia College, Indiana University, Smith College, and more. If you are an educator, consider jumping on this wagon. You'll have a lot of support from a worldwide community.

Jonathan Knudsen is an author at O'Reilly Media, Inc.. His books include The Unofficial Guide to Lego Mindstorms Robots, Java 2D Graphics, and Java Cryptography.


Also this week:

Building a Game in Mozilla -- Part Two

Linux Gaming Resources

Get the Inside Scoop on the Mozilla Project

Open Source Roundtable: Where's That Lizard?!With audio


Read more Lego Mindstorms columns.

Discuss this article in the Mindstorms Forum.

Return to O'Reilly Network Home.

Copyright © 2009 O'Reilly Media, Inc.