Building Robots with LEGO Mindstorms NXT

Front Cover
Syngress, Apr 18, 2011 - Computers - 480 pages
The Ultimate Tool for MINDSTORMS® Maniacs
The new MINDSTORMS kit has been updated to include a programming brick, USB cable, RJ11-like cables, motors, and sensors. This book updates the robotics information to be compatible with the new set and to show how sound, sight, touch, and distance issues are now dealt with.

The LEGO MINDSTORMS NXT and its predecessor, the LEGO MINDSTORMS Robotics Invention System (RIS), have been called "the most creative play system ever developed." This book unleashes the full power and potential of the tools, sensors, and components that make up LEGO MINDSTORMS NXT. It also provides a unique insight on newer studless building techniques as well as interfacing with the traditional studded beams. Some of the world's leading LEGO MINDSTORMS inventors share their knowledge and development secrets. You will discover an incredible range of ideas to inspire your next invention. This is the ultimate insider's look at LEGO MINDSTORMS NXT system and is the perfect book whether you build world-class competitive robots or just like to mess around for the fun of it.

Featuring an introduction by astronaut Dan Barry and written by Dave Astolfo, Invited Member of the MINDSTORMS Developer Program and MINDSTORMS Community Partners (MCP) groups, and Mario and Guilio Ferrari, authors of the bestselling Building Robots with LEGO Mindstorms, this book covers:

Understanding LEGO Geometry
Playing with Gears
Controlling Motors
Reading Sensors
What's New with the NXT?
Building Strategies
Programming the NXT
Playing Sounds and Music
Becoming Mobile
Getting Pumped: Pneumatics
Finding and Grabbing Objects
Doing the Math
Knowing Where You Are
Classic Projects
Building Robots That Walk
Robotic Animals
Solving a Maze
Drawing and Writing
Racing Against Time
Hand-to-Hand Combat
Searching for Precision
  • Complete coverage of the new Mindstorms NXT kit
  • Brought to you by the DaVinci's of LEGO
  • Updated edition of a bestseller

What people are saying - Write a review

We haven't found any reviews in the usual places.


Chapter 1 Understanding LEGO R Geometry
Chapter 2 Playing with Gears
Chapter 3 Controlling Motors
Chapter 4 Reading Sensors
Chapter 5 Whats New with the NXT?
Chapter 6 Building Strategies
Chapter 7 Programming the NXT
Chapter 8 Playing Sounds and Music
Chapter 15 Building Robots That Walk
Chapter 16 Robotic Animals
Chapter 17 Solving a Maze
Chapter 18 Drawing and Writing
Chapter 19 Racing Against Time
Chapter 20 HandtoHand Combat
Chapter 21 Searching for Precision
Appendix A Resources

Chapter 9 Becoming Mobile
Chapter 11 Finding and Grabbing Objects
Chapter 12 Doing the Math
Chapter 13 Knowing Where You Are
Chapter 14 Classic Projects
Appendix B Matching Distances
Appendix C Note Frequencies
Appendix D Math Cheat Sheet

Other editions - View all

Common terms and phrases

About the author (2011)

Mario Ferrari received his first Lego box around 1964, when he was 4. Lego was his favorite toy for many years, until he thought he was too old to play with it. In 1998, the Lego Mindstorms RIS set gave him reason to again have Lego become his main addiction. Mario believes Lego is the closest thing to the perfect toy. He is Managing Director at EDIS, a leader in finishing and packaging solutions and promotional packaging. The advent of the MINDSTORMS product line represented for him the perfect opportunity to combine his interest in IT and robotics with his passion for LEGO bricks, which started during his early childhood. Mario has been a very active member of the online MINDSTORMS community from the beginning and has pushed LEGO robotics to its limits. Mario holds a bachelor's degree in Business Administration from the University of Turin and has always nourished a strong interest for physics, mathematics, and computer science. He is fluent in many programming languages and his background includes positions as an IT manager and as a project supervisor. Mario estimates he owns over 60,000 Lego pieces. Mario works in Modena, Italy, where he lives with his wife Anna and his children Sebastiano and Camilla.

Giulio Ferrari is a student in Economics at the University of Modena and Reggio Emilia, where he also studied Engineering. He is fond of computers and has developed utilities, entertainment software, and Web applications for several companies. Giulio discovered robotics in 1998, with the arrival of MINDSTORMS, and held an important place in the creation of the Italian LEGO community. He shares a love for LEGO bricks with his oldest brother Mario, and a strong curiosity for the physical and mathematical sciences. Giulio also has a collection of 1200 dice, including odd-faced dice and game dice. He studies, works, and lives in Modena, Italy.

Dave Astolfo (GIS A.S.) is a Project Manager / Business Analyst with the technical arm of a North American environmental consulting company. He currently provides project management, technical consulting, database design and software architecture with a focus on Geographic Information Systems ranging from desktop mapping software, web mapping portals and mobile software applications. His specialties range from database modeling, software design / architecture. Dave is a key contributor to the business development and implementation of products and services. As such, he develops enterprise-wide technology solutions and methodologies focused on client organizations. Dave holds a bachelor’s degree from Trent University and is a certified Geographic Information Systems Applications Specialist holding a certificate from Sir Sandford Fleming College. In early 2006, Dave was invited by Lego to participate in the Lego Mindstorms Developer Program (MPD) to help Lego beta test the pre-release of the Lego Mindstorms NXT robotics system. After the release of the NXT, Dave was invited back to participate in the Lego Mindstorms Community Partner Program (MCP) to work with Lego in developing the product further while and providing an ear to the community. Dave has been involved with Lego all of his life, and has been working with the Mindstorms product since the initial release of the Lego Mindstorms Robotics Invention System (RIS) in 1998. Dave is well known for building a Mindstorms domino-placing robot which was published in a previous Syngress book (10 Cool Lego Ultimate Builders Lego Mindstorms Robots). Since then, he has created newer versions with a more recent NXT version being used by Lego marketing staff in Europe. Visit Dave’s site,, for more information on his work.

Daniel T. Barry (M.D., Ph.D.) is a former NASA astronaut who was a crew member aboard the Space Shuttles Discovery and Endeavor. He logged more than 734 hours in space, including four spacewalks totaling 25 hours and 53 minutes. He holds a BS degree in electrical engineering from Cornell University; a master’s of engineering degree and a master of arts degree in electrical engineering/computer science from Princeton University; a doctorate in electrical engineering/computer science from Princeton University; and a doctorate in medicine from the University of Miami in 1982.

Organizations to which he belongs include the Institute of Electrical and Electronic Engineers (IEEE), the American Association of Electrodiagnostic Medicine (AAEM), the American Academy of Physical Medicine and Rehabilitation (AAPMR), the Association of Academic Physiatrists (AAP), and the Association of Space Explorers. He holds five patents, has written 50 articles in scientific journals, and has served on two scientific journal editorial boards.

Dr. Barry retired from NASA in April 2005 to start his own company, Denbar Robotics, where he currently builds robots. Dr. Barry currently lives in South Hadley, MA.

Bryan Bonahoom is a LEGO MINDSTORMS enthusiast. He is a member of the Lafayette LEGO Robotics Club and one of the original team that developed the Great Ball Contraption. Bryan is also cofounder of BrickworldTM. Bryan was selected by LEGO in 2006 as a member of the MDP and later as a member of the MINDSTORMS Community Partners (MCP). Bryan was also awarded the Best Robot Design Trophy at the 2005 AFOL Tournament at LEGO headquarters as a member of Team Hassenplug. Bryan is possibly most well known for the creation of an NXT-based robot that plays tic-tac-toe with a human opponent.

John Brost had a passion for LEGO and all things mechanical at an early age. However, the interest waned, and like most adult LEGO fans, John went through his “dark ages in high school and while attending Purdue University. The release of the Star Wars LEGO sets brought a renewed interest in LEGO to John. But it was a chance encounter with an announcement of a LEGO Robotic Sumo competition being held locally that brought John back to LEGO 100 percent. It took only this event to get John hooked. Less than two weeks later, John had his first MINDSTORMS RIS kit, and he has been busily building robots and all sorts of mechanical LEGO contraptions ever since then.

John has participated in all types of MINDSTORMS competitions, winning a few here and there. He has also been a coach for LafLRC’s (Lafayette LEGO Robotics Club) FIRST LEGO League team for the past five years. In 2006, John was lucky enough to become a member of the LEGO MINDSTORMS Developer Program to test the MINDSTORMS NXT. Currently, John is a moderator on LEGO’s NXTlog Web site.

Rebeca Dunn-Krahn is a member of a working group at the University of Victoria dedicated to increasing awareness and understanding of computer science among children and young adults. She is currently producing a short documentary film about these outreach efforts that include free robotics festivals using LEGO MINDSTORMS. Rebeca has also worked in quality assurance and as a Java developer.

Rebeca holds a bachelor’s degree in computer science and biochemistry from the University of Victoria and lives in Victoria, Canada, with her family.

Richard Li is one of two nonadult contributors to Building Robots with LEGO MINDSTORMS NXT. He is currently a seventh-grader at Beck Academy and heads two award-winning FIRST LEGO League (FFL) teams. They have been honored with the Champion’s Award on several occasions and are ranked as two of the top teams yearly. When not working with his FLL teams, he experiments with his own robots at home. He would like to thank his parents, Lin and Liang-Hong, for buying him his LEGOs and dealing with him as he stayed up late several nights to meet his deadline for this book. Richard currently resides in Simpsonville, SC.

Christopher Dale Minamyer (Bachelor of Science in Mechanical Engineering, University of Arizona, 2007) began studying mechanical engineering during the fall of 2002 and graduated from the University of Arizona in May 2007. A lifelong LEGO fan, Chris has been building with LEGO for 20 years.

For the past four years Chris was an instructor of LEGO Robotics at Ventana Vista Elementary School in Tucson, AZ. During this time he instructed more than 300 students in grades one through five in LEGO MINDSTORMS RCX and NXT. In addition Chris is a founding member of the Tucson LEGO Club Masters Group and the head coach. Chris has been a FIRST LEGO League coach for the past four years. In that time the teams he coached have won the Robot Performance award (2004) and the Research Quality award (2005) for the state of Arizona. In addition Chris received the Adult coach/mentor award (2005) and the Appreciation award (2006).

Deepak Patil developed interest in LEGO robotics when the original LEGO MINDSTORMS kit was introduced in 1998. Since then Deepak has coached FLL teams and has conducted several robotics workshops with LEGO MINDSTORMS.

Deepak has a master’s degree in Industrial Design from IIT Bombay and has designed user interfaces for diverse products, including programmable logic controllers, telephony software, and multimedia systems. Deepak has worked for Cisco and other leading technology companies, and he has led technology projects with globally interspersed teams of engineers.

Mac Ruiz is a retired construction superintendent. His work entailed problem solving and coordinating of off-site engineers and subcontractors with the projects’ realities. He also has experience in fabrication of farm equipment from his family’s dealership. This included steel fabrication and mechanicals.

Christian Siagian is working toward a Ph.D. degree in Computer Science at the University of Southern California (USC). He is involved in the Beobot Project that develops a biologically inspired vision-based mobile-robot localization and navigation system. His research interests include robotics and computer and biological vision.

As a teaching assistant for CS445 Introduction to Robotics at USC, Christian develops laboratory curriculum to prepare undergraduates for research in robotics. Christian also volunteers for after-school programs at St. Agnes Parish School and EPICC in Los Angeles. These programs use robotics to promote interest in science and mathematics in elementary and middle school students.

Christian holds a bachelor’s degree from Cornell University in Computer Science and is a member of the IEEE.

Dick Swan is an embedded software consultant. He partnered with the Robotics Academy at Carnegie Mellon University in developing the RobotC programming environment for the NXT. He also codeveloped with Tufts University the Robolab programming environment for the NXT. Dick has 30 years’ experience in software and hardware projects, including embedded systems, telephone systems, and compilers. Dick has both a bachelor’s and master’s degree in Computer Science from the University of Waterloo and is a member of the IEEE.

Sivan Toledo is Associate Professor of Computer Science in Tel-Aviv University in Israel. He holds a BSc degree in Math and Computer Science and an MSc degree in Computer Science, both from Tel-Aviv University, and a PhD in Computer Science from the Massachusetts Institute of Technology. He authored more than 50 scientific papers and one textbook. He serves on the editorial boards of the SIAM Journal of Scientific Computing and of Parallel Computing.

Joshua Whitman is a home-schooled eighth-grader from Wichita, KS. He has been building with LEGO bricks for as long as he can remember. He received his first MINDSTORMS RCX kit at age eight. He has participated in numerous robotics groups, clubs, and classes. He competed on a team in WSU’s MINDSTORMS Robotics Challenge for two years. His team won the first-place trophy both times. As an experienced member of the team, he had to learn how to help teach the newer kids about MINDSTORMS. He was a part of the first winning team to use an NXT to compete in the challenge.

His favorite (and most impressive) creation is a robot that can actually lock and unlock his room through a rotation sensor combination lock. The system is surprisingly secure, and 99.9 percent foolproof. He loves programming more than anything else in robotics. His current project involves using the NXT display as a screen for simple videogames like Pong.

Larry Whitman (Ph.D., P.E.) is an Associate Professor of Industrial and Manufacturing Engineering at Wichita State University. Larry promotes engineering in every context possible. He is especially interested in promoting the technical literacy of all citizens, not just those who intend to be engineers. To this end, he and several colleagues at Wichita State have developed a course using LEGO MINDSTORMS in a hands-on environment to demonstrate basic engineering skills to nonengineering undergraduates. He also coordinates a LEGO MINDSTORMS challenge competition for middle school students. Finally, he promotes engineering by training his two sons, Joshua and David, to love building LEGO robots.

Larry holds bachelor's and master's degrees from Oklahoma State University. After spending 10 years in the aerospace industry as a practicing engineer, he completed his Ph.D. from the University of Texas at Arlington.

Guy Ziv is now finishing his graduate studies in biological physics at the Weizmann Institute of Science in Israel. He holds a bachelor’s degree in math and physics from the Hebrew University of Jerusalem and a master’s degree in physics from the Weizmann Institute. Guy has been working in the field of measurement and automation for several years. He is an experienced LabViewTM programmer and was a beta tester of NI LabViewTM toolkit for NXT and MINDSTORMS NXT v. 1.1. Guy is the author and editor of, the second largest NXT community site, and he moderates’s repository and forums.

Bibliographic information