Make: Lego and Arduino Projects
John Baichtal
Matthew Beckler
Adam Wolf
Special Upgrade Offer
If you purchased this ebook directly from oreilly.com, you have the following benefits:
DRM-free ebooksuse your ebooks across devices without restrictions or limitations
Multiple formatsuse on your laptop, tablet, or phone
Lifetime access, with free updates
Dropbox syncingyour files, anywhere
If you purchased this ebook from another retailer, you can upgrade your ebook to take advantage of all these benefits for just $4.99. to access your ebook upgrade.
Please note that upgrade offers are not available from sample content.
A Note Regarding Supplemental Files
Supplemental files and examples for this book can be found at http://examples.oreilly.com/0636920024316/. Please use a standard desktop web browser to access these files, as they may not be accessible from all ereader devices.
All code files or examples referenced in the book will be available online. For physical books that ship with an accompanying disc, whenever possible, weve posted all CD/DVD content. Note that while we provide as much of the media content as we are able via free download, we are sometimes limited by licensing restrictions. Please direct any questions or concerns to .
Foreword
Remember the initial excitement of experimenting with Lego robotics? It felt like the entire universe was open to you! With so many robots to build to tackle interesting challenges, perform experiments, and make interesting algorithms, the possibilities were endless. From modifying some bricks with LEDs, to gluing assemblies together to make your robot better, robot building with Legos is an exciting experience.
One of my personal favorite experiments with Lego robotics was conducting an experiment to determine if using a light sensor or touch sensor (which was calibrated with springs using Hookes law) would be better for counting pills. Between the real world applications, as well as the scientific method applied behind it, it ended up winning two gold medals at my high school and regional science fairs.
In order to accelerate towards more advanced experiments in robotics, using the RCX 2.0 was not a viable solution. The lack of ability to interface to various sensors and actuators was a major roadblock, so I adventured into the land of Arduino! Since then, my mind has been opened up to even more interesting areas of robotics.
The journey of learning about robotics is interesting and never-ending. This book will be a huge help to springboard you into more in-depth robotics. Not only will you be able to make more sophisticated robots that tackle more complex challenges or perform more elaborate experiments, but you will have a better opportunity to discover which area of robotics you enjoy the most, whether its programming, electrical, mechanical, or design and implementation.
As you embark on your new Lego robots that utilize Arduino, it will feel like the entire universe is open to you again, with even more galaxies to explore! Embrace this, as you never know where your next robotic creation may take you. Maybe it will be like RoboBrrd, from a prototype to a kit, inspiring even more robot builders. Be sure to share your excitement for robots with your friends or an online community. Remember, robots teach us about ourselves, how we think, behave, and act.
Welcome to the awesome world of robotics! Now get on with the learning and advance your robots to the next step!
Erin RobotGrrl Kennedy
Preface
IN THIS CHAPTER
In the classic swords & sorcery flick Conan the Barbarian, the title character is asked What is best in life? To which the mighty-thewed warrior responds, To crush your enemy, see them driven before you, and hear the lamentation of their women.
Wrong, Conan. You are wrong.
First of all, crushing people and getting off on their significant others lamentations is mega uncool. No, Conan, what is best in life is having your cake and eating it too. Why, barbarian, should youoh, for examplebe able to play with Arduinos but not be able to integrate them into your Lego Mindstorms NXT projects?
If you dont know, the Arduino phenomenon is pretty much the coolest thing to hit the amateur electronics scene. It makes programming your own microcontroller absurdly easy. You may also be unaware that the Lego Mindstorms NXT phenomenon is pretty much the coolest thing to hit the amateur robotics scene. It makes building your own robot absurdly easy.
Make: Lego and Arduino Projects is dedicated to combining the two.
Assumptions This Book Makes
This book starts easy, with the first two projects being relatively simple and accessible to all skill levels. That said, you may find certain topics in the later chapters rather challenging. Dont worry! Everything you need in order to build the various projects is clearly explained; most of the really hard stuff is purely informational.
Additionally, we made enthusiastic use of our extensive Lego collection in designing the books robots. If you have only a modest collectionat the very least youll want the Lego Mindstorms NXT 2.0 setyoull definitely need to buy more parts to build the projects.
Contents of This Book
We cover a wide variety of topics in this book. Heres what you get:
introduces the reader to the mysteries of Lego and Arduino with our Drawbot project. Its a simple project that creates a robot that draws shapes with a pen. Itll help you delve into the mysteries of controlling Mindstorms motors with an Arduino. We also introduce the Bricktronics Shield, our Arduino add-on that interfaces between Lego and Arduino.
In we brush up on our Lego skills, learning about the Mindstorms set and compatible product lines like Technic and Power Functions.
covers the opposite side of the equation: learning about Arduino and their add-on boards, called shields.
Our second project, a Clock, debuts in , and will teach us how to use Mindstorms motors to precisely control the clocks hands.
details one of the most complicated robots in the book, a Chocolate Milk Maker that pumps milk and chocolate syrup into a cup and mixes them up with a motorized spoon.
We learn more about the mysteries of electronics in , discovering how electricity works, what all those components do, and how to use the electronic hobbyists primary diagnostic tool, a multimeter.
serves up another convoluted robot, a Gripperbot: a wheeled manipulator controlled with a pair of Arduino-equipped wristbands and Wii Nunchuk controllers.
shows you how to build a cool electronic instrument, a Keytar. Its a Lego guitar equipped with buttons and knobs that create a variety of electronic noises!
For the final project, describes our Lamp project, which details the creation of a smartphone-controlled Lego light fixture.
The book closes with , where we cover a number of advanced electronic topics like choosing motors and power supplies, and how to create breadboard equivalents to our Bricktronics Shield.
Good luck and have fun!
Conventions Used in This Book
The following typographical conventions are used in this book:
ItalicIndicates new terms, URLs, email addresses, filenames, and file extensions.
Constant width
Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.