Creative Projects with LEGO Mindstorms¿
The greatest thing about LEGO is that when you are building something and have a problem, you can take some of it apart, change things, and then keep building.--Cale Putnam, eighth grader   When the way comes to an end, then change; having changed, you pass through.--I ChingThe LEGO Mindstorms product line is a breakthrough in the world of technological toys. With plastic gears, pulleys, beams, bricks, axles, connector pegs, and other building elements, you can create mechanical contraptions that would make Leonardo da Vinci jealous. Combine these mechanisms with motors, sensors, and a programmable LEGO brick, the Robotic Command Explorer (RCX), and your creation can run on its own, interacting with and responding to you and its environment, including other robots. There are limitless possibilities to building and programming with LEGO Mindstorms. Mobile robots, kinetic works of art, toys, robotic animals, and robots that gather data are just some of the types of projects that you will see in this book.It's unfair to simply refer to LEGO Mindstorms as a "toy," however. The robotic devices that you can create can serve very real, practical, and serious purposes. More importantly, building and programming a robot is a rich learning experience. Your creation will never work right the first time you test it, and the process that you go through to figure out what went wrong is when the learning takes place. This book is about that process.At the Massachusetts Institute of Technology (MIT), Gene DiSalvatore has this saying on a piece of paper in his office: "Good judgment comes from experience, and experience comes from bad judgment." Applied to LEGO robots, this statement means that building a robot that works involves building a robot that doesn't work and then figuring out what is wrong with it. The more robots you build, the better your mechanical and programming skills will become.The LEGO Group has been designing educational products for many years. LEGO Dacta is the educational division of the LEGO Group, in the same way that LEGO Mindstorms is the new "robotic" division of the LEGO Group. In the early days, LEGO Dacta models that were connected to a serial interface box could be programmed from a computer with a language called LEGO LOGO (see Figure 0.1).Figure 0.1 The LEGO Dacta serial interface boxLEGO LOGO was an extension of the kids' programming language LOGO, developed by Dr. Seymour Papert and others at the MIT Media Laboratory. After the serial interface box came a prototype for a programmable brick, which later became the RCX. More work has been done since the development of that first programmable brick, too. Smaller programmable bricks called crickets are less bulky than the Mindstorms RCX (see Figure 0.2).Figure 0.2 The RCX, the brain of the LEGO Mindstorms Robotics Invention System, next to a third generation programmable brick prototype, the cricket.But Dr. Papert and his colleagues aren't just developing hardware and software; they're developing ideas, philosophies, and theories about the nature of learning and learning environments. Dr. Papert has coined the phrase constructionism to describe his philosophy of learning. The earlier theory of constructivism states that knowledge has to be constructed--put together into coherent understandable pieces--inside of the head, and that knowledge cannot be forced into your head or passively absorbed. Constructionism adds to these ideas the notion that by constructing something of personal interest outside of your head--a robot, a work of art, or a computer program, for example--you're better equipped to construct knowledge inside of your head, using the experience that you've gained from the physical world. Those experiences give you "objects to think with" and become the tools with which you can construct knowledge. Building and programming a LEGO robot is such an experience.For the past four years, my life has revolved around LEGO in one way or another. In 1996 I graduated from MIT and went to Tufts University to work on a project with Professor Chris Rogers to create an engineering curriculum for young students using LEGO. Dr. Rogers and his graduate students had already created a graphical programming environment for the LEGO Dacta serial interface box. Borrowing some ideas from LEGO LOGO, I made modifications to this graphical programming environment and gave it a name--"LEGO Engineer." We showed LEGO Engineer to LEGO Dacta, and they liked the concept. We were then asked to create the educational version of the software for the RCX, which is now called "ROBOLAB." Our philosophy for ROBOLAB was to create software that could be used by anyone from preschool to graduate school. ROBOLAB has easy-to-use programming interfaces that very young students are using in elementary schools, and a high-level programming environment, which includes data analysis capabilities, that is being used in middle schools, high schools, and colleges around the world.Being involved with LEGO spread to the people around me as well. Around the same time that we were working on ROBOLAB, we were asked to recommend people who could design robots that would push the boundaries of what the RCX could do. Among other things, LEGO wanted some "cool" examples of complex mechanical creations on the cover of the upcoming Robotics Invention System box. Dr. Rogers and I recommended my housemate Anthony Fudd, who had designed a LEGO airplane complete with hot-wire airplane wing cutter. Now Anthony is employed by LEGO Mindstorms as a master builder. He is the designer of the LEGO copy machine, ATM Machine, Refrigerator Fred, Card Dealer, a robot that can clean up LEGO bricks from the floor, an elephant that squirts water, and numerous other creations.Because of the popularity of the RCX and the growing online community surrounding it, the LEGO influence spread even further than among my housemates. When looking for beta testers for ROBOLAB, I thought of Dave Baum, a fellow MIT Phi Kappa Theta alumnus1 like Anthony Fudd and someone I had met on the LEGO User Group Network at lugnet. Dave beta-tested ROBOLAB and became one of the first users of the RCX. Although Dave loved ROBOLAB, his first love was C. After learning ROBOLAB inside and out, Dave went on to create NQC, which stands for Not Quite C. It's a C-like programming environment for the RCX.While at Tufts, I also worked toward a master's degree in education. One of my favorite classes was "Technological Tools for Thinking and Learning" with Professor Uri Wilensky. One of the first assignments in this class was to read a little book called Mindstorms: Children, Computers, and Powerful Ideas, written in 1980 by Seymour Papert. It was a powerful experience to read about ideas that were coming into their full fruition with the preparation of the launch of the LEGO Mindstorms product line. It was inspiring to be a part of it.In Dr. Papert's books and papers, he writes about his and others' experiences as educators working with students on various LEGO design projects. In this book, I wanted to do the same, to convey what it's like to design and build a LEGO robot. I didn't want to write a book full of instructions that show you how to build my robots. I wanted to write a book that would help you build your robots. To accomplish this, I've filled this book with descriptions of problems that were encountered when trying to design various LEGO robots, and how those problems were solved. Dr. Papert calls his stories "learning stories." The following chapters are my "learning stories" for you.There are several reasons why I chose to write a book about LEGO robotics that would be accessible to young adults as well as full-grown ones. In my experience with LEGO robots, I have seen lots of examples of wonderful creations that have been built by adults and kids alike. By looking on the Internet or attending a robotics festival such as Mindfest at the MIT Media Lab (media.mit/mindfest/), it's tempting to think that everyone who has used a Mindstorms kit has had success in creating wonderfully creative projects. In my experience of teaching hundreds of students and educators how to build LEGO robots, and talking to hundreds of parents and educators in person and online, however, I've seen that this isn't the case.Students and novice adults usually encounter two problems when they make a LEGO robot. I have seen many of these same problems, frustrations, and mistakes repeated over and over again. First, the largest frustration is when the robot "falls apart." Some people blame the robot's "falling apart" on the robot, without thinking about how they can use the LEGO building elements to make their robot stronger. Parents have told me stories of kids in the home setting who have given up completely on their Mindstorms kit out of frustration because they cannot get their robots to be crash-proof, or even stay together at all. I chose, therefore, to concentrate on construction techniques throughout the book. Second, I have heard from a lot of student