Extending the LEGO MINDSTORMS NXT to the Next Level Second Edition

Total Page:16

File Type:pdf, Size:1020Kb

Extending the LEGO MINDSTORMS NXT to the Next Level Second Edition Extreme NXT: Extending the LEGO MINDSTORMS NXT to the Next Level Second Edition ■ ■ ■ Michael Gasperi and Philippe “Philo” Hurbain Extreme NXT: Extending the LEGO MINDSTORMS NXT to the Next Level, Second Edition Copyright © 2009 by Michael Gasperi and Philippe “Philo” Hurbain All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN-13 (pbk): 978-1-4302-2453-2 ISBN-13 (electronic): 978-1-4302-2454-9 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. Java™ and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc., in the US and other countries. Apress, Inc., is not affiliated with Sun Microsystems, Inc., and this book was written without endorsement from Sun Microsystems, Inc. Lead Editor: Tony Campbell Technical Reviewer: Philippe “Philo” Hurbain Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham, Tony Campbell, Gary Cornell, Jonathan Gennick, Michelle Lowman, Matthew Moodie, Jeffrey Pepper, Frank Pohlmann, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Project Managers: Beth Christmas and Debra Kelly Copy Editor: Nancy Sixsmith Compositor: LaurelTech Indexer: Carol Burbo Artist: April Milne Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail [email protected], or visit http://www.springeronline.com. For information on translations, please e-mail [email protected], or visit http://www.apress.com. Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Special Bulk Sales–eBook Licensing web page at http://www.apress.com/info/bulksales. The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. The source code for this book is available to readers at http://www.apress.com. This book is rededicated to my dear wife, Jayne. Thanks for putting up with the mess I made on your desk . again. —Love, Mike I dedicate this book to my wife, Annie. She puts up with the pervasive invasion of LEGO and electronics parts everywhere, as well as with LEGO models “decorating” most of the shelves of our home. —Thanks and love, Philo Contents at a Glance ■ Chapter 1: In the Beginning ........................................................................................ 1 ■ Chapter 2: Extreme Software ................................................................................... 21 ■ Chapter 3: Making a Connection .............................................................................. 47 ■ Chapter 4: Contact Sensors ...................................................................................... 63 ■ Chapter 5: Resistive Sensors .................................................................................... 73 ■ Chapter 6: Potentiometer Sensors .......................................................................... 103 ■ Chapter 7: Voltage Sensors .................................................................................... 119 ■ Chapter 8: 4.3V Powered Sensors .......................................................................... 127 ■ Chapter 9: Two-Wire Powered Sensors .................................................................. 145 ■ Chapter 10: Light Sensor with LED Control............................................................. 165 ■ Chapter 11: LEGO Motor Interfaces ........................................................................ 173 ■ Chapter 12: Beyond LEGO Motors ........................................................................... 195 ■ Chapter 13: I2C Bus Communication ....................................................................... 229 ■ Chapter 14: Cool Combinations .............................................................................. 267 ■ Appendix A: Construction Techniques .................................................................... 291 ■ Appendix B: References, Links, and Sources ......................................................... 309 ■ Appendix C: Code Listings ...................................................................................... 315 ■ Index ....................................................................................................................... 327 v ■ CONTENTS Contents Contents at a Glance ....................................................................................................... v Contents ....................................................................................................................... vii Foreword ..................................................................................................................... xiii About the Authors ......................................................................................................... xv Acknowledgments ...................................................................................................... xvii Introduction ................................................................................................................. xix ■ Chapter 1: In the Beginning ........................................................................................ 1 The RCX and the Robotics Invention System ..................................................................... 2 The MINDSTORMS NXT ...................................................................................................... 3 The Sensors ....................................................................................................................... 5 The NXT Motor ................................................................................................................. 19 ■ Chapter 2: Extreme Software ................................................................................... 21 NXT-G ............................................................................................................................... 21 Not eXactly C and Bricx Command Center ....................................................................... 37 Other Alternative Languages ........................................................................................... 45 ■ Chapter 3: Making a Connection .............................................................................. 47 NXT Ports ......................................................................................................................... 47 Physically Connecting to the NXT .................................................................................... 52 vii ■ CONTENTS Screw Terminal for Passive Sensors ............................................................................... 60 ■ Chapter 4: Contact Sensors ...................................................................................... 63 Touching Wires ................................................................................................................ 63 Electronic Surfboard ........................................................................................................ 64 Construction .................................................................................................................... 64 Switches .......................................................................................................................... 66 Parallel and Series ........................................................................................................... 67 Antenna Sensor ............................................................................................................... 67 Going Further ................................................................................................................... 72 ■ Chapter 5: Resistive Sensors .................................................................................... 73 Analog-to-Digital Conversion ........................................................................................... 73 Ohmmeter ........................................................................................................................ 75 Legacy Temperature Sensor ............................................................................................ 78 Light Sensor ..................................................................................................................... 89 Two-Switch Input ............................................................................................................ 99 ■ Chapter 6: Potentiometer Sensors .......................................................................... 103 Connecting to the Pot ...................................................................................................
Recommended publications
  • 2006 FIRST Annual Report
    annual report For Inspiration & Recognition of Science & Technology 2006 F I R Dean Kamen, FIRST Founder John Abele, FIRST Chairman President, DEKA Research & Founder Chairman, Retired, Development Corporation Boston Scientific Corporation S Recently, we’ve noticed a shift in the national conversation about our People are beginning to take the science problem personally. society’s lack of support for science and technology. Part of the shift is in the amount of discussion — there is certainly an increase in media This shift is a strong signal for renewed commitment to the FIRST T coverage. There has also been a shift in the intensity of the vision. In the 17 years since FIRST was founded, nothing has been more conversation — there is clearly a heightened sense of urgency in the essential to our success than personal connection. The clearest example calls for solutions. Both these are positive developments. More is the personal commitment of you, our teams, mentors, teachers, parents, awareness and urgency around the “science problem” are central to sponsors, and volunteers. For you, this has been personal all along. As the FIRST vision, after all. However, we believe there is another shift more people make a personal connection, we will gain more energy, happening and it has enormous potential for FIRST. create more impact, and deliver more success in changing the way our culture views science and technology. If you listen closely, you can hear a shift in the nature of the conversation. People are not just talking about a science problem and how it affects This year’s Annual Report echoes the idea of personal connections and P02: FIRST Robotics Competition someone else; they are talking about a science problem that affects personal commitment.
    [Show full text]
  • At May 2013 Proof All.Pdf
    2013 SEASON PREVIEW — PAGES 6–7 Q&A WITH HERSCHEND’S JOEL MANEY — PAGES 41–42 © TM Your Amusement Industry NEWS Leader! Vol. 17 • Issue 2 MAY 2013 Merlin Entertainments’ U.S. Legoland Hotel a brickwork bonanza Southern California leap into the destination cat- their perspective that has gone egory. into the planning first and park becomes Officially opened April foremost.” full-fledged resort 5 after several days of me- AT found this in abundant dia previews, the three-story, evidence during a visit to the STORY: Dean Lamanna Special to Amusement Today 250-room inn, like the park, brightly multicolored hotel is designed to immerse fami- — beginning with the giant, CARLSBAD, Calf. — With lies with children aged two stream-breathing green drag- its unique toy theme and se- to 12 in the creative world of on made from some 400,000 ries of tasteful, steadfastly Lego toys. Guests of the hotel, Lego bricks that welcomes kid-focused additions over which is located adjacent to lodgers while guarding the its 14-year history, including Legoland’s entrance gate, will porte cochere from a clock an aquarium in 2008 and a have early-morning access to tower. Inside the lobby, which waterpark in 2010, Legoland the park of up to an hour be- contains a “wading pond” California established itself as fore the general public is ad- filled with Lego bricks, several a serious player in Southern mitted. of the more than 3,500 elabo- California’s heated amuse- “This is a one-of-a-kind rate Lego models adorning the ment market.
    [Show full text]
  • All Aboard the LEGO®Trains!
    The Magazine for LEGO® Enthusiasts of All Ages! Issue 24 • June 2013 $8.95 in the US All Aboard the LEGO® Trains! Train Layouts by Cale Leiphart and PennLUG Building a Train Station Features Instructions AND MORE! 0 5 0 74470 23979 6 Issue 24 • June 2013 Contents From the Editor ...................................................2 People The Idea Book 6000 Experience: Building a Childhood Dream ...............4 Building Minifigure Customization 101: Customizing Your “Friends” ..................18 You Can Build It: Micro Monorail System ..........................22 The LEGO® The Lone RangerTM Constitution Train Chase: Building a Steam Train the LEGO Way!...............................................28 Powering The Lone Ranger Train .......31 You Can Build It: Train Station.....................................................36 Peter Norman: Building and Styling LEGO Trains .........................54 Community PennLUG: Taking Layouts to New Levels .................................................59 Designing the LEGO Monorail .............63 Building a Different LEGO Monorail .............................................65 Steven Walker: Disney -Inspired Building ......................66 Masao Hidaka: A Different Approach to the Monorail .............................................68 Joe Meno: Following and Innovating Monorail Design ..........................................70 Nathaniel Brill: Suspended Monorail Design .............72 A History of LEGO Trains ..........................74 Community Ads .............................................78
    [Show full text]
  • Unofficial FIRST LEGO League (FLL) Frequently Asked Questions (FAQ) Page 1 of 50
    Unofficial FIRST LEGO League (FLL) Frequently Asked Questions (FAQ) Page 1 of 50 Unofficial FLL FAQ05-a - Unofficial FIRST LEGO League (FLL) Frequently Asked Questions (FAQ) Home Disclaimer: This FAQ is not an official FIRST document. It is an accumulation of knowledge derived from six thousand messages posted to the FLL forum over two seasons. It has been reviewed by numerous people, but may still contain errors. Use at your own risk. Specifics for previous challenged (Arctic Impact, City Sights, Mission Mars, No Limits) have been excluded. This information is outdated and will only confuse rookie teams that are not familiar with the previous challenges. The UFAQ has been updated with the new rules for the 2005 season. Attribution to questions and answers has not been given as it would needlessly clutter this document. Special thanks to the coaches that answered the lion’s share of questions posed by rookie coaches. Notably: Jack Gregory, Dave Kolberg, Team BOB, Peter Vogel, Skye Sweeney, Mark Beitz, Marie Hopper, Courtney Goeltzenleuchter, Jackie Keith, Catlin Gabel, and Ken Streeter. Special thanks to Steve Dakin for helping to automate these pages. He is responsible for the often requested "Printer friendly" page. Readers are encouraged to submit errors, suggested wording changes, new topics, or comments to Skye Sweeney at [email protected] Table of Contents Printer friendly version (everything on one page) Summary of rule changes since 2004 How to Ask A Good Question Please start by reading this section! Allowable parts Rules Strategy
    [Show full text]
  • Attractions Management
    Attractionswww.attractionsmanagement.com management MFC(, H))'(' KFJLGGCP=@IJK+; KFE<NQ<8C8E; Attractionswww.attractionsmanagement.com management MFC(, H))'(' K?<N@Q8I;@E>NFIC;F= ?8IIPGFKK<I K?<D8>@:ËJ89FLKKF9<>@E @E;<M<CFGD<EK K_\dfjk\oZ`k`e^gifa\Zkj le[\inXpXifle[k_\^cfY\ LEISU OF RE S M K?<D<G8IBJ R E A D E J:@<E:<:<EKI<J I Y A 0 QFFJ8HL8I@LDJ 3 3 0 DLJ<LDJ?<I@K8>< Y A 30 I E D years A K<:?EFCF>P E R S M O E F R ;<JK@E8K@FEJ L U S E I <OGFJ N8K<IG8IBJ M@J@KFI8KKI8:K@FEJ D<IC@E<EK<IK8@ED<EKJ >8CC<I@<J :?@<=<O<:LK@M<E@:BM8IE<P8E;?@JKFGK<8DK8CB89FLKK?<:FDG8EPËJ=LKLI< <EK<IK8@ED<EK François Fassier I Parc Asterix EDUCATION PASSION PEOPLE Stay connected. Stay informed. Stay ahead. egdYjXZYWn The conference and tradeshow for the attractions and leisure industry in Europe. Update your profile on www.IAAPA.org/EAS and we will keep you informed. ATTRACTIONS MANAGEMENT EDITOR’S LETTER OTHER DIMENSIONS ON THE COVER: The Wizarding World he glorious world of 3D has hit the mainstream, with fi lms like Alice in of Harry Potter, p36 Wonderland, Clash of the Titans and Avatar drawing record audiences. Suddenly, from being a treat confi ned to specialist attractions like IMAX, people READER SERVICES T can enjoy 3D in their local cinema. Apple is allegedly even developing the unoffi cially SUBSCRIPTIONS named ‘ispecs’ – glasses which will enable us to enjoy 3D fi lms while on the move.
    [Show full text]
  • Moonbots Contest Winners NXT-G Blocks for Hitechnic SMUX Are
    Moonbots Contest Winners by Xander 1 person liked this The winners for the Moonbots Contest have been announced! 1. Landroids 2. The Shadowed Craters 3. Moonwalk Congratulations to all teams who took part. All teams got a special recognition award for their efforts, some of which are very funny! Anyway, be sure to check out the teams‘ web sites for more information on what they did and how they did it. Add starLikeShareShare with noteEmailEdit tags: Lego and Robotics Aug 3, 2010 2:23 PM NXT-G Blocks For HiTechnic SMUX Are Here! by Xander 3 people liked this At last, the long anticipated NXT-G blocks for the HiTechnic Sensor MUX have arrived. Gus from HiTechnic has written a nice in-depth article about them on the HiTechnic blog which you can find here: [LINK]. It looks like using them is not a whole lot different from using them without the SMUX. Hurray for transparency. Anyway, hurry on down to the HiTechnic website and start downloading the new blocks right here: [LINK] or here [LINK]. Add starLikeShareShare with noteEmailEdit tags: Lego and Robotics Jul 30, 2010 11:14 AM Hispabrick Magazine 008 is out! by Xander Hispabrick Magazine 008 is out now! The Mindstorms NXT is featured quite a bit in this issue. Some of the highlights: Article about what the Mindstorms Community Partner programme (MCP) is all about; Interviews with some of the people in the MCP programme; A great tutorial on PID and how to apply that to line following; Actuators for the NXT (motors, things that move).
    [Show full text]
  • LEGO MINDSTORMS Masterpieces Building & Programming Advanced Robots Copyright © 2003 by Syngress Publishing, Inc.All Rights Reserved
    243_Mindstorms_fm.qxd 4/18/03 6:45 PM Page i [email protected] With more than 1,500,000 copies of our MCSE, MCSD, CompTIA, and Cisco study guides in print, we continue to look for ways we can better serve the information needs of our readers. One way we do that is by listening. Readers like yourself have been telling us they want an Internet-based ser- vice that would extend and enhance the value of our books. Based on reader feedback and our own strategic plan, we have created a Web site that we hope will exceed your expectations. [email protected] is an interactive treasure trove of useful infor- mation focusing on our book topics and related technologies. The site offers the following features: I One-year warranty against content obsolescence due to vendor product upgrades. You can access online updates for any affected chapters. I “Ask the Author” customer query forms that enable you to post questions to our authors and editors. I Exclusive monthly mailings in which our experts provide answers to reader queries and clear explanations of complex material. I Regularly updated links to sites specially selected by our editors for readers desiring additional reliable information on key topics. Best of all, the book you’re now holding is your key to this amazing site. Just go to www.syngress.com/solutions, and keep this book handy when you register to verify your purchase. Thank you for giving us the opportunity to serve your needs. And be sure to let us know if there’s anything else we can do to help you get the maximum value from your investment.
    [Show full text]
  • Sets! Over 70
    TM SUMMER 2020 CATALOGUE OVER 70 NEW SETS! FREE DELIVERY ON ORDERS OVER £50!* FREE EXCLUSIVE BLUE FURY HOT ROD WITH PURCHASES OVER £85!* See pg. 45 for details. THE LEGO® STORE LEGO.COM 00800 5346 1111 BUILD IT. DRIVE IT. LOVE IT. See What’s NEW! PRODUCT AVAILABILITY UPDATE LEGO® Technic AGES 7+ 2 Due to the uncertainty created by the COVID-19 pandemic, we wanted to let you know that Dom's Dodge Charger some sets in this catalogue which were available at the time of printing in early May may not be 42111 AGES 10+ 1,077 PIECES LEGO® immediately available now that the catalogue has reached you. Please visit LEGO.com for the FOR WARNING see p. 45, fi g. 1 Creator Expert AGES 16+ 6 latest set availability and additional COVID-19 updates. LEGO® Speed £89.99 Champions BENEFITS & SERVICE AGES 7+ 8 ® Measures Dedicated LEGO Experts to help with over 39 cm long, LEGO® City gift-giving advice and product support. 16 cm wide, Free Delivery every day on orders over £50! AGES 5+ Visit LEGO.com/shipping for complete shipping details. Call international freephone* 00800 5346 1111 11 cm high! 10 Mon – Fri 8 a.m. – 8 p.m. or visit a LEGO Store! *Mobile charges may apply. LEGO® Friends Exclusive Free Gifts with your order! Order missing pieces. AGES 4+ 12 Check LEGO.com or ask a Store Associate for details and purchase See service.LEGO.com or call 00800 5346 1111 for details. requirements to qualify. Available while supplies last only.
    [Show full text]
  • Experience UK: a Guide to Creative Excellence in Visitor Attractions
    2019 Experience UK A guide to creative excellence May in visitor attractions 17 Withdrawn 2 Experience UK Experience UK 3 Contents Visioning 4 Planning 10 Designing 16 Exciting 22 Engaging 28 Advising 36 There’s much more online... For a comprehensive online directory of UK expertise, creativity, products and services for the experience economy, visit A guide to creative excellence www.experienceuk.org in visitor attractions The UK is a global leader in the experience economy – the creation and operation of visitor attractions such as museums, galleries, science centres, heritage sites, zoos and aquaria, and theme parks It is home to many world-class visitor supply or management consultancy, attractions whose success is built the UK has companies able to deliver on the imagination, ingenuity and these capabilities with experience, expertise highlighted in this brochure know-how and cultural sensitivity. UK Trade & Investment – skills which UK companies are keen to offer attraction developers all A brochure of this size can only offer a snapshot of what the UK can offer – UK Trade & Investment is the UK Trade & Investment offers Withdrawn 17 May 2019around the world. but it will hopefully serve to illustrate Government Department that helps expertise and contacts through its Whether a project calls for feasibility, the country’s leading status in this UK-based companies succeed in the extensive network of specialists in architecture, construction, exhibit fast-growing sector. global economy. We also help overseas the UK, and in British embassies and design, interpretation, equipment companies bring their high-quality other diplomatic offices around the investment to the UK’s dynamic world.
    [Show full text]
  • 2020Easteruk.Pdf
    EASTER 2020 CATALOGUE FREE DELIVERY ON ORDERS OVER £50!* NEW SETS INSIDEINSIDE!! FREE EASTERFREE GIFTS WITH EASTER GIFTS WITH PURCHASES! PURCHASES!See pg. 2 for details. THE LEGO® STORE LEGO.COM 00800 5346 1111 One EASTER SETS FOR EVERYONE MANY SETS FREE FREE UNDER EXCLUSIVE EASTER BUNNY YOUNGEST BUILDERS VEHICLES £20 HEROES LEGO® EASTER EGG always WITH PURCHASES OVER £30!* Offer valid 23 March – 13 April 2020 * Gift WITH PURCHASES OVER £55! 4 6 14 Offer valid 23 March – 13 April 2020 NOT AVAILABLE FOR SALE! NOT AVAILABLE FOR SALE! stands out ONLY AT LEGO® STORES! *Free LEGO® Easter Bunny (30550) offer is valid for purchases in LEGO Stores only from 23 March to 13 April 2020, or while stocks last. Qualifying purchase must be equal to or greater than £30 in LEGO merchandise only. Bricks & Pieces orders are not valid for this promotion. One set per household. Cannot be applied to previous FROM THE MOVIES FRIENDSHIP DISNEY purchases. If the qualifying LEGO purchase(s) is returned to us for *Free Exclusive LEGO® Easter Egg (40371) offer is valid for orders online at LEGO.com, in LEGO Stores and for LEGO Catalogue telephone orders a refund, the gift must also be returned to us together with the from 23 March to 13 April 2020, or while stocks last. Qualifying purchase must be equal to or greater than £55 in LEGO merchandise only. Bricks & qualifying LEGO purchase(s). Item cannot be purchased, exchanged 18 28 34 Pieces orders are not valid for this promotion. One set per household. Cannot be applied to previous purchases.
    [Show full text]
  • Community Jon Hall: LEGO Aviator!
    The Magazine for LEGO® Enthusiasts of All Ages! Issue 22 • January 2013 $8.95 in the US Taking to the Skies Sky-FI Building with Cole Martin and Jon Hall NASA’s Curiosity Rover Instructions The Batcave Celebrating 50 Years of LEGO in Norway and MORE! 1 1 0 74470 23979 6 Issue 22 • January 2013 Contents From the Editor ...................................................2 People Are J. Heiseldal .....................................................3 To the Batcave! ....................................................8 BrickStix®: A Timeline ..................................18 Celebrating 50 Years of LEGO® in Norway ..........................................................20 Building The Norwegian Royal Palace......................................................22 Building Snowy Mountain ......................24 NASA AFOL! .......................................................26 You Can Build It: Curiosity Rover ..............................................28 Building You Can Build It: T-16 Skyhopper .............................................37 Minifigure Customization 101: Fun With a Vacuum! .................................40 Century Fighters .............................................44 Community Sky-Fi: Building in the Aerial Universe of Crimson Skies® and Dieselpunk .......................................................49 Cole Martin: Sky-Flyer! .................................56 You Can Build It: Modular Pirate Interceptor .................60 Jon Hall: LEGO Aviator! ...............................67 The LEGO Group Takes
    [Show full text]
  • 2008 FIRST Annual Report
    Igniting young minds. “It makes you feel if you try hard enough, you can do anything.” FIRST Team member EPORT R NNUAL 2008 A FOR INSPIRATION AND RECOGNITION OF SCIENCE AND TECHNOLOGY 1 What’s FIRST? As the world moves ever closer to a true global economy, the challenge to develop a lasting interest in science and technology in the world’s young people has never been greater. This is what will propel our collective future. And that’s what FIRST TM is all about (For Inspiration and Recognition of Science and Technology). As founder and renowned inventor Dean Kamen explains, “FIRST gives kids the opportunity to develop the muscle between their ears; to gain experience that will directly affect their future and our future as well.” A youth inspirational tool A meeting of amazing minds Founded by Kamen in 1989 to “turn young people on” to career Tapping into the selfl ess support of thousands of volunteers, opportunities in science, technology, engineering, and math, this mentors, sponsors (including some of the world’s largest – 501(c)(3) not-for-profi t organization designs accessible, motivational and smallest – companies), educational institutions, and programs that combine team work, competition, and just plain fun government, teams on average from fi ve to 25 students in four to help build self-confi dence, knowledge, life skills, career paths, different age groups accept the challenge to fund, design, build, and a sense of “Gracious Professionalism.” In 2008, with the tireless and compete with robots of their own creation in local, national, assistance of more than 73,000 committed volunteers, close to 160,000 and international contests.
    [Show full text]