`
`EXHIBIT B1
`
`
`
`
`
`BUYER PROTECTION PLAN
`
` saga age a
`
`
`
`“LEGO
`Mindstor
`
`The ULTIMATE Tool for Mindstorms Maniacs!
`
`- Discover the Undocumented Secrets behind the Design
`ofthe Mindstorms System
`
`- Become Inspired by the Techniques otWorld—C|ass Mindstorms Masters
`
`
`Mindstorms Robotic Competition
`
`- Build a Competitive Edge forYour Next
`
`
`
`
`
`Giulio Ferrari
`
`Mario Ferrari
`
`
`
`
`Ralph Hempel
`Technical Editor
`
`
`
`
`
`Syngress Publishing, Inc, the ;iiitlio1‘(s). and my person or firm in\-'oI\'ed in the writing. editing, or
`_
`«
`«
`~
`/
`1'7
`roduction collectively “I\/lal<ers”‘, of this hook {'”tlie \X/orklll do not <*L'lJI‘Il1]t66 or \\-‘.’l1"l";t1)f the results to be
`obtained from the '\X/orlc.
`
`There is no gtlarantee otnny kind, expressed or implied, 1'eg.i;di11g the 'Worl< or its contents. The \X/ork is
`sold AS IS and \X/ITHOUT VI/ARRANTY. You 1n;1y h.iye other legal rights. \\-‘hich Vziry froin state to state.
`
`In no event will Makers be liable to you for d;iinAge.~;. including any loss ot'protit.s, lost sa\'iiig:<. or other
`incidental or consequential dainages arising out from the \Vorl»<; or its contents. Because some :~‘t;ites do not
`allow the exclusion or limitation othliability for conseqnentiiil or incidental Cl,:1111€t§_f<3§,
`the above limitation
`may not apply to you.
`
`You should ;ilways use reasonable care. including backup and other ;‘.pp1‘0pI‘i:‘:[L’ precautions, when working
`with computers, netxvorks. data. and tiles.
`
`
`are registered
`Syngress I\/1edia®, Sytigressfg, and “Career AClV'.-1HCC111Cl1'£Tl1I‘OL1gl7 Slszill E1ili;iiieeii'it>iit‘l§"
`l.'1‘8Cl€1TI31‘l<S of Syngress Media, Inc. “Ask the Author UPI1ATE”M," "‘l\/Iission Ci*itic;ilTMf’ “Hack ProofingTM,”
`and “The Only Way to Stop .1 Hacker is to Think Like ()I1c,‘TM” are U1tL'lt.‘111;1}‘l(< ofSyngress Publisliing, Inc:
`Brands and product names mentioned in this book are tmdein;irl<:s or service rnarks of their 1'e.~:pect1ve
`cornpanies.
`KEY
`SERIAL NUMBER
`001
`B8EL495GK4
`O02
`2N\/A4UHBBJ
`O03
`CJGE946l\./I43
`004
`3BVNAM7L4T
`O05
`D38-4NSARSD
`006
`4ZI\/IWAQEKFK
`007
`FMAPPW8GN9
`O08
`XSLEKRK2FB
`009
`QMVQDSRUJT
`,,,,,,, ,_, _,g,1,g_,__.-_5,|4N,Ap};RpAR., -,-.,,..-,:_.-.,,.-.-—,.,-_W W —_.—..—w—W.—— —r—_~ —-
`
`—m—————~————«—~-
`
`PUBLISHED BY
`
`Syngress Publishing, Inc.
`800 I-Iinghani Street
`Rockland. l\/IA (L370
`
`Building Robots with LEGO MENDSTQRMS
`
`Copyright CC“ 2002 by Syngress Publisliing, Inc. All 1‘igl’]t.\ reserVed. Printed in the United States L)i-A1]1C‘1‘lC3.
`Except as permitted under the Copyright Act of I976, no part of this publication in-ay be reproduced or
`distributed in any form or by any inenns, or stored in a dzttabase or retrie\:;il system. without the prior
`written permission of the publisher, with the exceptioii that the prograin listings may he entered, stored,
`and executed in a computer system. but they may not be reproduced for publication.
`Printed in the United States ot‘America
`
`3 4 5 6 7 8 9 0
`
`ISBN:
`
`l—928994«67—9
`
`Technical Editor: Ralph I“IC111p€l
`Co~Publisher: Richard Kristof
`Acquisitions Editor: Catherine B. Nolan
`Developmental Editor: Kate Glennon
`Freelance Editorial l\/I21I1£1g'c‘1“I M-aribeth Coron:t—Ev;iiis
`
`Cover Designer: Micliael Km-‘isli
`Page Layout and Art by: Shannon Toziei:
`Copy Editor: l\/Iichael McGee
`Indexer: Robert S-aigli
`
`Distributed by Publishers Group "West in the United States and jagttitr Book Group in Ciaiizicia.
`
`
`
`
`
`
`
`Forewcérd
`
`Preface
`
`
`
`_
`Part i T9015
`Cha§p ter 1» Un‘de_fstanVdi ;
`
`
`Ch
`
`Learn about Lego Gears
`
`
`
`1
`
`"§VTfh—Cfi:E‘,5’€Tfi’fC‘fT"'6331"""""’“‘""’
`ti Fi1tting Gearsp
`‘ "
`»u11eys,vVBeItA’s,V;1n»d:Chai11s-
`I
`fey_s=.andBe1;g
`‘V
`f
`aims
`.
`’
`W
`
`
`‘-
`31
`32
`
`A
`
`nCeA-A:fThe Differential
`
`
`
`xiv
`
`Contents
`
`
`
`
`Chapter 3 Controlling Motors
`Introduction
`
`Pacing, Trotting, and Galloping
`Mounting Motors
`Wi.ring Motors
`Controlling Power
`Braking the Motor
`Coupling Motors
`Summary
`
`Chapter 4 Reading Sensors
`Introduction
`
`buch Sensor
`
`Light Sensor
`
`Measuring Reflected Light
`Line Following
`Proximity Detection
`Rotation Sensor
`
`Temperature Sensor
`
`Explore LEGO Sensors
`/‘§‘\$\\\‘___‘lco/
`LEGO sensors come in two
`families: active and
`passive sensors. Passive
`
`simply means they don't
`require any electric supply
`to work. The touch and
`
`Sensor Tips and Tricks
`V V W M _,,_ ,,,,t,em_p,ei:a,tu teasen.se r—s—v--»— — -—«—————v—~—v——~—---E~fFru’l2rt*i’fl"g"3':.[:Ou'C'l1“S'€'I'1’ST()T’"'"" "T" W
`belong to the passive
`Eniulating a Rotation Sensor
`class, while the light and
`rotation sensors are
`Connecting Multiple Sensors to the
`members of the active
`Same Port
`class.
`
`Other Sensors
`
`N
`
`Summary
`
`Chapter 5 Building Strategies
`Introduction
`
`Locking Layers
`Maximizing Modularity
`Loading the Structure
`Putting It All Together: Chassis, Modularity,
`and Load
`
`Summary
`
`90
`
`94
`
`
`
`lBl;ll"ileefl1:‘:a(?‘lEiDt25elgning
`'fi;"*”'a‘ C°de
`(9
`. Readabmty
`Reusabimy
`
`B Testablllly
`
`Contents
`
`xv
`
`Chapter 6 Programming the RCX
`Introduction
`
`What Is the RCX?
`
`A Small Family of Programmable Bricks
`Using LEGO RCX Code
`Using the NQC Language
`Using Other Programming Languages
`Using legos
`Using pbForth
`Using 1e]OS
`Using Other Programming Tools and
`Environments
`Divide and Conquer: Keeping‘./our
`Code Organized
`Running Independent Tasks
`Summary
`
`Chapter 7 Playing Sounds and Music
`Introduction
`
`Communicating through Tones
`Playing l\/lusic
`Converting MIDI files
`Converting WAV Files
`Summary
`
`Chapter 8 Becoming Mobile
`Introduction
`
`97
`98
`
`98
`
`100
`101
`102
`103
`104
`104
`105
`
`105
`
`106
`1 13
`1 14
`
`117
`118
`
`1 18
`119
`122
`124
`124
`
`127
`128
`
`“ ’
`
`r ’ '
`
`128
`Building a Simple Differential Drive
`""'"W" WW -V """~'“*"*'*""”~~*’-K6€p1'1‘}g%{«§-EFEl1~gl1}E—P&t—l11~——~»————»——~~——-—.——.—~.mW—_.-_,,_,1,3_{1.-,,,_ ___,__,_
`Using Sensors to Go Straight
`130
`Using Gears to Go Straight
`131
`Using Casters to Go Straight
`134
`Building 21 Dual Differential Drive
`136
`Building a Skid—Steer Drive
`138
`Building a Steering Drive
`140
`Building aTricvcle Drive
`144
`Building 21 Svnchro Drive
`146
`
`
`
`
`
`
`
`Other Configurations
`
`Summary
`
`Create Custom
`
`Components
`‘ Q.‘
`
`Chapter 9 Expanding Your Options
`with Kits and Creative Solutions
`Introduction
`
`3
`
`Acquiring More Parts
`
`150
`
`15 1
`
`153
`154
`
`154
`
`155
`161
`
`163
`164
`170
`
`172
`
`17 7
`
`179
`180
`
`180
`
`Explore extra parts,
`custom sensors, and tricks
`for using the same motor
`for more than one task:
`
`Extra parts come from
`either sets or service
`
`packs.
`
`I Custom sensors are a
`new frontier, and
`reveal a whole new
`
`world of possibilities.
`
`I Mechanical tricks
`
`enable you to use the
`same motor to power
`multiple mechanisms.
`
`Introducing Some Specialized Components
`Buying Additional Parts
`
`Creating Custom Components
`Building Custom Sensors
`Solving Port Limitations
`Creative Solutions '\X/hen
`
`More RCX Ports Are Needed
`
`S um rnary
`
`Chapter 10 Getting Pumped: Pneumatics
`Introduction
`
`Recalling Some Basic Science
`
`
`
`7
`
`181
`Pumps and Cylinders
`187
`Controlling the Airflow
`'77B"iiildii§A"iFC<§fipre§sorsmi77777757717777777ISSDCSIBIJ
`Building a Pneumatic Engine
`194
`Summary
`198
`
`Chapter 11 Finding and Grabbing Objects 199
`Introduction
`200
`
`Operating Hands and Grabbers
`
`Transferring Motion Using Tubing
`Understanding Degrees of Freedom
`Finding Objects
`
`Summary
`
`Chapter 12 Doing the Math
`Introduction
`
`Multiplying and Dividing
`Averaging Data
`Simple Averages
`Weighted Averages
`
`200
`
`203
`205
`209
`
`212
`
`213
`214
`
`215
`218
`218
`223
`
`
`
`Contents
`
`xvii
`
`226
`
`229
`
`232
`
`233
`234
`
`234
`236
`
`239
`243
`
`246
`
`247
`
`249
`250
`250
`253
`255
`256
`264
`265
`270
`
`274
`
`276
`
`277
`
`279
`280
`
`Using Interpolation
`
`.
`
`Understanding Hysteresis
`
`Summary
`
`Chapter 13 Knowing Where You Are
`Introduction
`
`Choosing Internal or External Guidance
`Looking for Landmarks: Absolute Positioning
`
`Following the Beam
`Measuring Movement: Relative Positioning
`
`Summary
`
`Part ll Projects
`
`Chapter 14 Classic Projects
`Introduction
`I EXploringYour Room
`i
`Detecting Edges
`Variations on Obstacle Detection
`E Following a Line
`Further Optimization of Line Following
`Modeling Cars
`Front~\X/heel and Four—Wheel Drives
`
`U59 Aflkle Bending
`Techniques
`
`
`
`Switching Gears
`
`Using the Gear Switch
`
`Suniniary
`
`Chapter 15 Building Robots That Walk
`Introduction
`
`_
`
`L L -2 L _ ,, _ _ 2 ._,,,.___,,,,.,__,_,__,,,,___,____,___.,,:£hes:[:heQ.igz_b_eh_in.dN([;ilk,in,g.2,__..~,-_,,,.,,_,,,._,.2,,,,,,,,,,.B_2.8.Q2,_-..-,._-,_.,,.,
`
`Building Legs
`
`Building a Four—l,egged Robot
`Building a Si:<—Legged Steering Robot
`
`Designing Bipeds
`
`Interlacing Legs
`
`COG Shifting
`
`Ankle Bending
`
`Making Bipeds Turn
`
`W
`
`Suniniary
`
`287
`
`.289
`293
`
`299
`
`299
`
`302
`
`306
`
`309
`
`310
`
`
`
`
`
`
`
`xvill
`
`Contents
`
`Creating a Skier
`
`Cresiting Other Vehicles
`Elevator
`
`Use Angle Connectors
`
`There are currently six
`types of angle connectors
`in the LEGO line,
`n LTn”T5éFe‘d‘l'”to75’."l'n”'c"aEe‘"‘
`
`you're wondering how the
`numbers relate to angles,
`here are the correspond-
`ences: 1 : 0°, 2 = 180“,
`3 = l57.5°, 4 =135°,
`5 = i12.5°, 6 = 90°. They
`go by increments of 225°,
`a quarter of a right angle.
`
`Train
`
`_
`
`Cable Railway or Gondola
`Boat
`
`Sailing Tricycle
`
`Suniniary
`
`Chapter 17 Robotic Animals
`Introduction
`
`Creating St l\/louse
`
`lniprovenients Upon the i\/louse’s
`Construction
`
`Creating :1 Turtle
`
`lniprovenients Upon the Turtles
`'"'ConsrrtiEt16h'
`t
`*
`*
`
`Creating Other Animals
`
`Suniniary
`
`Chapter 18 Replicating Renowned Droids
`Introduction
`
`Building an R2—D2—Style Droid
`
`Prograinniing the Droid
`Variations on the Construction
`
`Building a Johnny Fit-’e—Style Droid
`V:1ri2.tions on the Construction
`
`Su minziry
`
`Chapter 19 5olvlng a Maze
`Introduction
`
`Finding the Way Out
`Using the Left Side——Right Side Strategy
`Applying Other Strategies
`
`Chapter ‘Z6 Unconventional Vehicles
`Introduction
`S
`
`Creating Your Own SHRIMP
`
`Building 3 SHRIMP
`
`31'?
`
`DJ’4DJ144‘Qr-\»—-\CK)>—*C‘[Ul\)
`L»1.20(4)L24DJlk.)lal\)[\Jl‘\.)[Ul\C\D00O0
`
`
`
`Building a Maze Runner
`
`Constructing the Maze Runner
`
`Programming the Runner
`
`Creating the Maze
`Variations on the Maze Runner
`
`Building a Maze Solver
`
`Constructing the Maze Solver
`
`Programming the Solver
`
`Summary
`
`Chapter 20 Board Games
`Introduction
`
`Playing Tic—Tac—Toe
`
`Building the Hardware
`
`Wiiiting the Program
`
`ImproVingYour Game
`
`Playing Chess
`
`Building aVisual Interface
`
`Building a Mechanical Interface
`
`Connecting and Programming
`Broad Blue
`
`Variations on the Construction
`
`Playing Other Board Games
`
`Summary
`
`Contents
`
`xix
`
`377
`
`377
`
`380
`
`381
`381
`
`382
`
`383
`
`387
`
`389
`
`391
`392
`
`392
`
`393
`
`394
`
`396
`
`396
`
`397
`
`400
`
`406
`
`408
`
`409
`
`410
`
`-.
`
`._ as __e__
`
`Build 3 Pianist
`
`Chapter 21 Playing Musical instruments
`Introduction
`
`411
`412
`
`412
`Creating a Drummer
`Q’
`3
`._._ _____._IllEL‘ll?9LI§i9lI§§.§‘_ l9L9I_.._,.r__~_._,Bruildii1g_tl:ie_Drummer_2,e_.__, ,._l_.__l___l____ ,4;L3_.,e,e_r,__-_,2-
`extra parts, mainly beams
`and plates Used to make
`Programming the Drummer
`416
`the structure solid enough
`VQTIHUOUS
`417
`to vvlithstand the forces
`Creating a pianist
`417
`.
`.
`'
`d '
`th
`.
`.
`-
`“W0 Ve
`in
`E
`Buildin the Pianist
`41/
`8
`_
`.
`performance.
`~
`,
`D
`‘O
`Provramminv the Pianist
`422
`
`Changes and Improvements
`
`Other Suggestions
`
`Summary
`
`423
`
`424
`
`424
`
`
`
`
`
`
`
`xx
`
`Contents
`
`Chapter 22 Electronic Games
`Introduction
`
`Creating a Pinball Machine
`Building the Pinball Machine
`Programming the Pinball Machine
`Improvements on the Construction
`Creating a. Simon—Says Game
`Building a Simon~Says Game
`Programming the Simon~Says Game
`Variations
`
`Other Electronic Game Suggestions
`
`Summary
`
`Chapter 23 Drawing and Writing
`Introduction
`
`Creating a Logo Turtle
`Building the Turtle
`
`Programming the Turtle
`Choosing the Proper Language
`Variations
`
`425
`426
`
`426
`426
`431
`432
`432
`432
`434
`438
`
`438
`
`439
`
`441
`442
`
`4——2
`443
`
`448
`453
`454
`
`—,IW--,I3.pe+\Xfipj.1;@p.-._7-..,-,-_e..t,,.-_,,.,w,.._,_--,.,_
`Building the Writer‘
`455
`Programming the W1'iter
`462
`VI/hat to Write
`462
`
`,,,_,_.,
`
`,
`
`Variations
`
`Further Suggestions
`
`Copying
`Emulating Handwriting
`Learning by Example
`
`Summary
`
`Chapter 24 Simulating Flight
`Introduction
`
`Introducing the Forces Involved in Flight
`Designing the Simulator Project
`
`Building the Hardware
`Programming the Simulator
`
`463
`
`464
`
`464
`464
`465
`
`465
`
`467
`468
`
`468
`471
`
`473
`480
`
`Understand Infrared
`Communication
`'3
`
`rs,
`
`Infrared (IR) light is of the
`same nature as visible
`
`light, but its frequencywis
`below that perceivable by
`the human eye. Provided
`the intensity is high
`enough, we usually feel IR
`radiation as heat.
`
`
`
`Contents
`
`xxi
`
`Operating the Simulator
`Downsizing the Project
`Upsizing the Project
`Summary
`
`Chapter 25 Constructing Useful Stuff
`Introduction
`Building a Floor Sweeper
`Constructing the Sweeper
`Programming the Sweeper
`Improvements on the Floor Sweeper
`Building a Milk Guard
`Making the Milk Guard
`Programming and Using the Milk Guard
`Improvements on the Milk Guard
`Building a Plant Sprinkler
`Making the Sprinkler
`Programming and Using the Sprinkler
`Improvements on the Plant Sprinkler
`Designing Other Useful Robots
`Summary
`
`Part Iii Contests
`
`488
`489
`491
`492
`
`493
`494
`494
`494
`497
`497
`498
`499
`501
`502
`502
`503
`504
`505
`508
`509
`
`511
`
`1%
`
`Design other Useful
`Rébots
`I Alarm Clock
`I Baby Emertamer
`E Pet Feeder
`D09 Trainer
`
`*‘
`
`~ ' —~ '
`
`~ ~ —
`
`v—— — —
`
`—
`
`—
`
`Chapter 26 Racing Against Time
`Introduction
`Hosting and Participating in Contests
`Optimizing Speed
`———~— ———— — V 7 7 W.mW__t.,__--_,_.,_‘Drasg_R_a_cMing__V_W _V>___‘_»___V___g_____g
`Combining Speed with Precision
`Line Following
`\X/all Following
`Other Races
`Summary
`
`513
`514
`514
`516
`________§j._(3_ g_ W W
`518
`519
`520
`522
`523
`
`Chapter 27 Hand-to-Hand Combat
`Introduction
`Building a Robotic Sumo
`Setting the Rules
`
`525
`526
`526
`527
`
`
`
`
`
`
`
`xxii
`
`Contents
`
`Maximizing Strength and Traction
`Attack Strategies
`
`Finding the Enemy
`
`Using Speed
`
`Using :1 Transmission
`
`Other Sumo Tricks
`
`Getting Defensive
`
`Testing Your Sumo
`
`Sumniary
`
`Chapter 28 Searching for Precision
`Introduction
`Precise Positioning
`Finding and Collecting Things
`Ma:~:well’s Demons
`
`Stealing the Cube
`Variations on Collecting
`Playing Soccer
`
`528
`530
`
`530
`
`532
`
`533
`
`53?»
`
`534
`
`535
`
`536
`
`537
`538
`538
`540
`540
`
`541
`543
`543
`
`flv i
`
`_ G fly, ,
`
`Surnniary
`Chapter 28 Searching for Precision
`,,,_r,,,_Intro.ducti.on,
`WW
`— —~e——~——~——-«
`
`545
`537
`up90
`———~——5
`
`—-———~e—
`
`
`
`Find useful Lego sites
`§*‘%..\_____3=_=y
`E www.br1ckshe|f.tom
`E l‘n‘1leF’(;/i/E::‘131‘”i't’f‘e'(:‘l’J‘?’pV(:Ople/
`
`fl-edm/mmdstormy
`index.html
`www,crynwr_com/
`le90“V0b0‘ilC5/
`E vvww.bvandam.net
`
`Precise Positioning
`Finding and Collecting Things
`MaXWell’s Demons
`
`Stealing the Cube
`Variations on Collecting
`Playing Soccer
`Summary
`Appendix A Resources
`
`Introduction
`Bibliography
`General Interest Sites
`Chapter 1 Understanding LEGO
`Geometry
`Chapter 2 Playing with Gears
`Chapter 3 Controlling Motors
`Chapter 4 Reading Sensors
`
`.338
`540
`540
`
`541
`543
`543
`545
`5_47
`
`348
`548
`549
`
`551
`551
`55]
`552
`
`
`
`
`
`Contents
`
`xxiii
`
`Chapter 5 Building Strategies
`Chapter 6 Programming the RCX
`Chapter 7 Playing Sounds and l\/lusic
`Chapter 8 Becoming Mobile
`Chapter 9 Expanding Your Options with
`Kits and Creative Solutions
`
`Chapter 10 Getting Puniped: Pneumatics
`Chapter 11 Finding and Grabbing
`Objects
`Chapter 12 Doing the Math
`Chapter 13 Knowing Where You Are
`Chapter 14 Classic Projects
`Chapter 15 Building Robots That Walk
`Chapter 16 UnconventionalVehicles
`Chapter 17 Robotic Animals
`Chapter 18 Replicating Renowned
`Droids
`
`Chapter 19 Solving a Maze
`Chapter 20 Board Games
`Chapter 21 Playing Miisical lnstruinents
`Chapter 22 Electronic Games
`Chapter 23 Drawing and Writing
`Chapter 24 Simulating Flight
`Chapter 25 Building Useful Stuff
`Chapter 26 Racing Against Time
`Chapter 27 Hand~to—Hand Combat
`Chapter 28 Searching for Precision
`
`552
`553
`556
`556
`
`557
`
`559
`
`559
`560
`560
`561
`562
`562
`563
`
`563
`
`564
`564
`565
`565
`565
`566
`566
`566
`567
`567
`
`Appendix B Matching liistén-zésmmlli"C1777"7569'7"'"'”"""‘i'"’
`
`Appendix C Note Frequencies
`
`Appendb<D|wafl1CheatSheet
`Sensors
`
`Averages
`Interpolation
`Gears,\X/heels, and Navigation
`
`Index
`
`575
`
`577
`578
`
`578
`578
`579
`
`581
`
`
`
`
`
`
`rewet
`
`
`
`'
`
`
`
`biotic
`
`
`
`‘
`Like many other progrzirnniers, 1 credit my ctairly years of playing with LEGO as a
`major factor in my future Career path. As my family and I Watched the United States
`launching the Apollo 'l l rocket, I was playing with :1 LEGO t1'uck—~—it was my
`birthday and I was 7 years Old.VVl1Z1t I could not know at the time was th;1t.30 years
`later I would hold in theypalni of my hand :1 microcontroller with more raw._spe_e,d__ .
`and nieniory than the onegfthie apstronautsused to get to the moon and ba<ik}That
`C5Q(‘D 1"’.,_:y«
`C)
`b .
`computer would be
`yellow fAiBSApla’stic and would clia
`V
`‘
`‘
`i
`’
`"
`hobby and educatio
`The story ofniy V
`Discussion ofbuildinik
`
`quent topic in Lugne
`about our ability to 1‘£13'l{:'E'..
`
`
`
`i
`
`’
`
`Marcus Noga and Dave BaL1I11ii§?}:O
`~~~* W '-~-~ -' —~— — »»————~ ————~——» — ——————r-C—he~RQ9§$i—nel~uding—iny_@w:p1
`
`
`
`
`’
`:
`V
`I
`A
`tributed his knowledge freely.
`ton their hancls.The sales of the l\/lINDiST‘iORl\/IS
`LEGO had an Ll11b€ll6V’al}l(:
`kits exceeded their xvililest predictions, and more than half the sales were to adults?
`Wlieii the Massachusetts Institute ofTechnoiogy
`asked me to participate in :1
`panel at the Mindfest gathering in 1999, I was li.o1i‘ored to be there with the likes of
`Dave Bziuni. Michael Gasperi, Marcus Nog
`Kekoa Proudfoot. In our panel dis-
`
`i at
`in
`cussion, we discussed how the Int:
`aide it possible for Widely separated
`people to work together
`
`
`
`
`
`
`
`
`xxvi
`
`Foreword
`
`Wliile at Mindfest, I met Mario and Giulio Ferrari.They had their Tic Tac Toe
`robot set up for demonstrations and it was a big hit.The brothers immediately struck
`me as energetic and dedicated LEGO hobbyists.Tlie other members of the Italian
`ITLug group have provided LUGNET readers a steady stream of wonderful robots in
`the past few years.
`I have had the pleasure of watching children and adults of all ages build machines
`and robots with their I\/IINDSTORMS kits. In almost all cases their initial attempts
`ended in frustration with their merlmzzirrzl skills. In fact, many builders never even get
`to the stage of programming their robots. This book will be a welcome addition to
`their libraries because of the Vast amount ofinformation it contains. From basic
`bracing techniques to drive and grip mechanisms——it’s all here. Even ifa particular
`robot does not appeal to the reader, the ideas used in its construction may be trans-
`ferred to other robots in unusual and surprising Ways.
`As a co—author of Exfreiize M'z'rza’.<fz>;‘.1zzs, a book about programming the RCX, I
`appreciate the effort that went into this book. Mario and Giulio have taken the time
`to guide the reader through the basics of building their creations by setting realistic
`performance goals and then experimenting with different methods. This important
`skill goes by the unassuming name of 2‘i'iz/eerz'Hg, and cannot be underestimated. The
`l\/IINDSTORMS system gives the hobby and educational market a modular and
`in expensive way to _deyel_op‘these_ipiportantgnkern1g__skflls_,
`,,,r,._,N.
`,
`As the technical editor of this volume, I have had my own creativity sparked. by
`some of the robots I\/Iiario and Giulio have documented. I am amazed at the sheer
`volume ofideas, the quality of the photos, and the careful presentation ofideas that
`many readers will encounter for the first time.The staff at Syngress Publishing has
`been a pleasure to work with, and they deserve credit for bringing the hard work of
`the Ferrari brothers to the Wide audience that I’m sure this book will enjoy.
`So clear some space on a table, open this book and get out your MIND-
`STORMS set, and start tinkering!
`
`—~RaIpI2 Hempei
`
`
`
`
`
`w,‘ _
`
`
`
`
`
`Why Robotées’?
`\X/hat’s so special about robotics? Why have LEGO MINDSTORMS experienced
`such great success? Each one of us might have our own answers.
`.
`_
`Robotics is an interdisciplinary_ subject, combining different fields of study that in
`traditional educational’ sysiteIi'iiisvyoti usually examine separately: physics, 1112L:t;l‘1':ltfl.C _,-f
`electronics, and coinput
`\
`A
`I
`i
`I
`through which you c L
`studied in school~—o
`
`
`
`
`
`
`
`offers a great way to
`tant point, however, is
`
`
`rienee
`by havinigsorne fui
`‘
`
`‘tics. is rriore than the su:
`
`required to know. It giv ,
`
`grate and complete each “
`to a problem, by folloyvinb
`
`
`
`
`
`
`in detail in Part ]I).You discove
`
`
`
`but it ____o;ofirn_ nylcorrec—
`_W_g‘sp;eed Wligit cotrl_dmyoL1;tj_o”t_o es: it?gmfW_'
`
`
`
`ght be to tryyand
`L
`pproat:h«_
`,
`9
`'t-.You might observe that theiwheels-fare} too ‘
`structure and architecture of you
`:1} drive, and for this reason your robot turns Very
`close to each other in your diffe
`fast and tends to over
`rrectyits steering. Or you might decide that the differential
`
`drive architecture after all is not the best option for line folloWing.You may even dis—
`cover that the position of the light sensor in the robotlfgreatly afilects its performance.
`If you are an experienced prograrnni '
`niighft instead work out your code to
`
`_vv1th timers and counters, so you change
`correct the robots behavior.You f el
`’
`the route changes, then you spend some in
`i
`’
`xxvii
`
`
`
`_, We -__,-_,
`
`_.,-,, ,__,,,.-_.____, _,ti.o_ns._to,its_ste_eringaa nd._this;_affe 1
`
`you have a talent for mechanics, y _
`
`the program to introduce s
`
`
`
`
`
`xxviii
`
`Preface
`
`time in testing and trimming it until you find an optimum value for the constants
`you used.
`At the same time, ifyou have a decent understanding of physics, you could reach
`into your knowledge base for something useful, and discover a model you were
`taught when studying magnetism: hysteresis (if you don’t know what hysteresis is,
`don ’t worry, well explain it in Part ll).You realize that you can make your robot
`follow a different scheme when going fiom black to white rather then from white to
`black.You think that this might improve its performance——and it actually does.
`\X/hat lesson should we learn from this example? That there’s no one unique
`solution, there are many of them..And the more you are able to open your mind and
`explore new possible approaches, the higher your chances of working out a solution.
`Robotics does not involve a list of techniques to follow in order, rather it is a process
`in which your creativity plays a very strong role, allowing you to follow a new path
`to the goal each time.
`There’s another element that makes robotics so interesting to us and, I suspect,
`to many other people as well. lt forces you to look at the world with new eyes, those
`ofa chil.d’s.
`
`If you observe babies exploring the environment, you will notice that they are
`surprised by everything. They don’t take anything for granted. They try everything,
`continuously developing new con epts by tes_tin_0_gnew_,ap1p_roaches,,}X[e_adultsi
`laugh at most of those attempts, to our mature minds they seem absurd, either
`because we already know that a specific thing is impossible to do, or because we
`know the solution to the problem the child is tackling.\Y/hen approaching tasks in
`robotics, we are forced to become children again, to rediscover the world with dif-
`ferent senses.
`
`Let’s look at this concept using another example:You are new to robotics, facing
`your first project, but are wise enough to decide on a very simple task.You want to
`create a robot that’s able to move around your house.You naturally want your robot to
`be able to detect obstacles when it hits them, so it can change direction and toddle off
`on a new path.You design your mechanical marvel so it can go forward, backward, and
`change direction.Then you add a simple bumper to detect obstacles, something that
`closes a switch when pressed. Finally, you write some code so your robot is ready for its
`debut on the living room floor—but wait, you forgot about the shag carpet, and carpet
`loops get into your gears and mess everything up.iYou decide testing might be better in
`the kitchen. Now your robot runs well; it hits a wall, turns on itself and spins off in
`another direction. Up to this point, it’s a pleasure to watch. . .but then it runs up against
`a sideboard, and the upper part of the robot gets blocked by the furniture, preventing
`
`
`
`
`
`
`
`
`
`
`
`Preface
`
`xxix
`
`the lower bumper from detecting the obstacle. Okay, so you have to improve the
`bumper. In the meantime, you break down and manually turn the robot in a new
`direction. Hey! Pay attention! It’s heading to the basement stairs! Rescue it and add
`edge detection to your list of improvements.You will learn quickly that even a simple
`action like climbing the stairs is the result of a very, very complex balancing of weights
`and strengths, precise positioning, and coordination.
`If you have kids in your circle of family and friends, you will have the precious
`opportunity to watch how they interact with your robots. In our experience, young
`kids tend to expect a lot from robots—~a lot more than what simple inexpensive
`robots can currently do.They have forgotten all the difficulties they had to overcome
`themselves, and they’re still naive enough to believe that all the amazing things robots
`do in movies can be carried out by your robots as well. They see any possible task or
`function as easy to implement. “V/hy don’t you make one like the real R2~D2, Dad?”
`MINDSTORMS provides a great way for kids to understand that even the most
`common activities are composed of many individual operations. If they don’t under-
`stand, if they become frustrated by what the robots carz’t do, play an easy but funny
`game with them in which you are the robot and they have to “program” you using
`only a very simple vocabulary describing a few basic actions.They will laugh at all
`the stupid things you’ll do and the unusual situations their commands will get you
`into——but they will very likely understand the point.This is an extra gift that robotics
`will provide to your family: showing your children how to deconstruct and analyze
`what they consider a single action.
`Wlien you°re really at a loss for what robot you might build next, ask the kids!
`You’re sure to get a bunch of fresh ideas. Most of us tend to design robots that move
`around, grab objects, find soda cans in a room or do any other activity we expect
`robots should do. Some of these projects are very challenging, and most are very
`instructive. But if you ask the kids what they would like to see, you get responses
`.._hke;.fiilXZh.y._dt>_n:t__wehuild a slgsiiug robot. Da_d?_’s’\X_/_oul_d you__e_ver think of a__skiing___
`robot? just the same, robots of this type are easy to make (see Chapter 16).They
`require only basic parts, they’re fun. and like any MINDSTORMS challenge. theyre
`definitely worth the time you spend on them.
`
`Why LEGO?
`
`
`
`If you’ve been raised with LEGO like we have, you already know whats special
`about it. But for those relatively new to the LEGO concept, including those who
`have yet to buy a MINDSTORMS set, let us explain why LEGO is an excellent
`choice for exploring the world of robotics.
`
`
`
`
`
`xxx
`
`Preface
`
`The power of the LEGO system lies in its founding concept: reusability. The
`same basic brick can today be the foot of an elephant, tomorrow a block in an
`Egyptian pyramid, and the day after the nose ofa robot.‘When you open a LEGO
`box, you see the parts that will form :1 LEGO model, but you also see an infinite
`number ofpossible models you might create with those parts.
`The property that transforins these small plastic pieces into a construction system
`is their connectivity, You don't need glue, screws, or any special tools (other then your
`hands) to assemble (or dismantle) :1 LEGO model.The LEGO parts easily snap on to
`each other and stay firmly in place until you decide to take them apart.The parts
`won’t be damaged, no matter how much you use them.
`But what really makes LEGO easy to use is its modularity. Not only does one
`brick connect to another, but they do so at predefined, discrete positions. There are
`studs and holes that force you to assemble parts following a precise geometric
`scheme. This might seem a limitation at first, but it actually makes your life easier
`because Ol-s0111C‘El’1l11g called precise positioning_You don’t need a ruler or a square-—
`all that’s required is that you can count!
`
`__
`
`LEGO is {ast You don’t have to saw, cut, drill, solder, fold, file, or mill your
`components.They are ready to use,just pick up what you need from the box.
`
`roduce filings, don ’t need any lubricants or
`LEGO is clean You don’t
`b
`/
`,c},3.9.iL1ES.,.Lt11.d,¥\«1h-G-1Tl—yQ-U~l4-é1¥é~fiHi-S'l3-€dr"pl‘&yifi’g''VVl’fl1’’ifiytfu1’T?5CTLT'l©L(5l{§’§’?i'CL’El$7’L ’"EL"W L
`as it did before.This is a very important point to make to the people who
`live with you if you want them to be tolerant of your hobbyl
`E LEGO is cost-efilective You can use and reuse your LEGO parts as
`needed to produce many generations of robots. And should you ever even-
`tually tire of your LEGO pieces, they will still have a market Value. There are
`other easy—to-assemble robotic kits on the market, but they usually only
`permit you to build one specific model. Beyond that, there’s nothing more
`you can get from their kits.
`
`E LEGO is ecological V/e don’t mean that its ABS plastic is easy to recycle.
`It is, but that’s not the point.You simply don’t need to recycle it, because
`you’ll never throw it away. After all, this is the most respectful approach to
`the environment: making products with a long life span, that don’t exhaust
`their function and don’t require recycling or disposal.\X/e still use many of
`the LEGO bricks we received during childhood.
`
`
`
`
`
`Preface
`
`xxxi
`
`»To return to robotics, some of you may believe that LEGO MINDSTORMS is
`
`too limited a system to build sophisticated projects.This is true if you mean really
`sophisticated systems! Others may observe that LEGO is not suitable for building
`
`robots that perform actual work. This, again, can be true, although we will show
`some examples in Chapter 25 that are indeed useful work projects.The LEGO
`
`IVIINDSTORIVIS kit is definitely more than a toy—it is probably the most fun and
`effective educational tool for learning the scientific principles behind robotics.There
`are indeed limitations, but this is part of the fun, challenging you to use your imagi—
`nation, to find esoteric solutions for seemingly unsolvable problems.
`Suppose you’re an experienced programmer, asked to write the umpteenth ver-
`sion of an invoicing software-just the thought of it puts you to sleep. But then your
`employer adds “Oh, by the way, it has to run on a machine with 3 K of RAM. Now
`you’re interested! After all, there’s nothing like a challenge.
`So, don’t feel limited by the constraints you find in the system, feel inspired.
`Create a robot that makes your friends say “I didn’t think it was possible to make
`such an incredible thing with LEGO!” Because you can.
`
`Using this Book
`
`This book is about building robots using LEGO bricks and components.The chap-
`ters in Part I are about how to build a robot. Here, we provide a set of tools you’ll
`need to explore the world of robotics.We’ll review basic knowledge about
`mechanics, motors, sensors, pneumatics, and iiavigation.We will compare different
`standard architectures, discuss solutions to common recurring problems, and will sug-
`
`gest how to organize complex projects in terms of subsystems.
`Part II will face the tough question, “I’ve got my IVIINDSTORIVIS kit, I’ve
`learned how to use it~—so what do I build?” Here we will show you a large survey of
`
`possible ideas, but do not expect to find complete models to build step by step. The
`goal of this book is mil? to teachwyou to re—create our models, instead it islto stintiiilate
`your imagination to create your own. Imagination and creativity cannot be tcmglzt,
`but it can be inspii‘ed.\X/e hope that our approach might help you see the world with
`different eyes.The same is true for understanding the mechanics of robotics: you will
`learn best by guided and informed experimentation. Actively participating in the
`process, not simply cloning our models, will bring you the greatest rewards.
`Part III takes you into the world of robotics co11tests.These contests offer LEGO
`builders a challenge beyond the initial goal of building a working robot——they pro-
`vide a means to inspire ideas, share solutions, and just have fun, whether with your
`
`
`
`
`
`
`
`
`
`xxxii
`
`Preface
`
`own friends. in 3 local group. or even internzitionally. There are difterent ways to
`attend :1 robotic contest: you can compare robots with friends in person, or you can
`t;il<:c up 3 Cl18.ll(:‘1’1gt‘ someone has organized through the lnternet, in which case you
`submit your solution in pictures or p1'Og1TH1‘]11'1'li1‘i§f code. Either ‘way, you will learn :1
`great deal from your opponents. And froin the rules, too: what really ni;il<es 3 contest
`exciting is trying to find an original but “legal” solution you hope your opponents
`
`l
`
`
`«
`
`h:i\.«'en’t thought of.
`The lost part of the book consists of appendices that provide you with various
`tec