Grady Koch

Learn Engineering with LEGO

A Practical Introduction to Engineering Concepts

Grady Koch
Yorktown, VA, USA
ISBN 978-1-4842-9282-2e-ISBN 978-1-4842-9280-8
© Grady Koch 2023
This work is subject to copyright. All rights are solely and exclusively licensed by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed.
The use of general descriptive names, registered names, trademarks, service marks, etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant protective laws and regulations and therefore free for general use.
The publisher, the authors, and the editors are safe to assume that the advice and information in this book are believed to be true and accurate at the date of publication. Neither the publisher nor the authors or the editors give a warranty, expressed or implied, with respect to the material contained herein or for any errors or omissions that may have been made. The publisher remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

This Apress imprint is published by the registered company APress Media, LLC, part of Springer Nature.

The registered company address is: 1 New York Plaza, New York, NY 10004, U.S.A.

Introduction

This book explores engineering concepts by building examples with LEGO. Fundamental principles are presented of how machines work and why they are built the way they are. There are two reasons why it may be interesting to learn these engineering concepts. The first reason is for the simple joy of tinkering with machinery. It can be a captivating experience to contemplate the inner workings of a machine that can be held in the hand to take apart, modify, and reassemble. LEGO makes such tinkering easy and, nowadays, sophisticated with the interplay of mechanical, electronic, and computer aspects found in MINDSTORMS Robot Inventor or SPIKE Prime.

The second reason is that the basic designs explored in this book can serve as a basis for customized inventions. One of the exercises or projects may provide an idea for a new project or solve a particular design challenge for a device. For example, examples are included for two fundamental drivetrains for a robot or vehicle: tank drive and rear-wheel drive. Building these two fundamental approaches provides the experience to decide on which is better suited to a customized project. Drivetrains are just one example of basic designs covered in this book. Building exercises are also laid out to build structures, gear systems, sensors, computer control, and mechanisms to spin, push, point, and shoot.

All of the parts used in the exercises and projects of this book are in the MINDSTORMS Robot Inventor set, also referred to by the part number 51515. With this set, there’s no need to buy any other parts. The electronic controller, called the Hub, for Robot Inventor is programmed by connecting to a host computer or smart device that the user provides, from which an app is run to control and program inventions. The Robot Inventor app works on a wide variety of computers and smart devices including iOS, macOS, Fire OS, Windows, and Android devices. Once the app is installed on a computer or smart device, the code described in this book can be entered for each particular exercise or project. Code is also available for download on GitHub.

Most of the projects in this book make use of the Hub, which is programmed to control inventions. No prior experience is assumed in this book with programming, with a step-by-step explanation given of how computer programs are implemented from initial concept to code. Two programming languages are used, Word Blocks and Python, to work with the Hub; there is the option of using whichever language is of interest. Beginners, persons of more casual interest, or users of a smart device without a keyboard may prefer the Word Blocks version of the programs. But readers interested in advanced programming may find Python of greater interest. Many users, especially kids, start learning how to write programs with Scratch, which is quite similar to MINDSTORMS Word Blocks, and so it should be a quick adaptation to use the programs in this book. But many kids of middle-school age want to learn Python, but have a hard time. So another reason programs in this book are in both languages is to help the transition from Scratch to Python.

LEGO makes a product called SPIKE Prime as part of its Education product line primarily meant for use in schools that is a sort of cousin to Robot Inventor. The programs in this book will work in SPIKE Prime with no modification needed. Many parts are the same between SPIKE Prime and Robot Inventor, with just a difference in color. However, some of the more specialized parts are included in one set but not the other. So an owner of SPIKE Prime set will have most, but not all, of the parts used in this book. The few extra parts needed can be found individually on aftermarket parts dealers such as bricklink.com. All of the parts used in each exercise and project are described by part number in the Appendix, in case a particular part is needed.

This book explores the three specialties of software (Chapters 1 and 2), mechanical (Chapters 35), and electrical (Chapters 69) engineering. The electrical engineering chapters also incorporate the software and mechanical aspects of the earlier chapters. Each chapter has quick building exercises plus a larger concluding project. Topics in each chapter are described here in brief.

Chapter 1, “The Hub,” describes working with the Hub, the device that controls motors and sensors. Instructions are given on how to power the Hub and navigate its front panel controls. The Hub can be used as a stand-alone controller, without the need to get into programming, to spin a motor, and then use a Distance Sensor to control the speed of the motor.

Chapter 2, “Programming,” advances to the next level of using the Hub by programming it from the Robot Inventor app. The design of a program is described as starting from a problem statement to developing an algorithm. Implementation of an algorithm with a flowchart makes the final step of coding easier to understand. There are two options for the coding language, Word Blocks and Python, both of which are presented. Building projects include controlling the displays of the Hub, followed by a miniature dance floor decorated with light and sound effects.

Chapter 3, “Building Elements,” starts an exploration of mechanical engineering concepts by touring the many parts in the Robot Inventor set used to build structures and machines. The basic structural element is the liftarm, with connections made by pins, axles, and connectors. Liftarms come in a variety of shapes, and the reasoning behind these shapes will become apparent with building exercises. These building exercises include topics in strong structures, symmetry, and linkages.

Chapter 4, “Gears,” unlocks the principles of using gears to change the speed, torque, and direction from a rotational power source, like a motor. Speed and torque are critical parameters in designing robots and vehicles, and the relationship between speed and torque is explored. Moreover, building exercises show how to manipulate gear configurations to get the desired speed and torque. The concluding project of the chapter builds a two-speed transmission.

Chapter 5, “Mechanisms,” explores fundamental machines for taking action to lift, spin, push, nudge, drive, or shoot. Building exercises include the example mechanisms of a ratchet, cam, differential, turntable, and dart shooter. The final chapter project combines several mechanisms to build a steerable cannon.

Chapter 6, “Motors,” begins topics in electrical engineering with learning how to use motors, including programming to set speed or go to a specific angle. Practical limitations of torque and stall on motor performance are explored. Motors are integral in providing motion to robots and vehicles, and so two fundamental ways of providing steerable motion of tank drive and rear-wheel drive are presented in building examples.

Chapter 7, “The Motion Sensor,” works with the sensor built into the Hub to measure tilt and orientation. The meaning of yaw, pitch, and roll is explored by building a motion alarm. Another exercise experiments with orientation of the Hub to trigger different sounds. The chapter project combines the Motion Sensor with a motor to build a machine that always points toward the ceiling, no matter the roll angle.

Chapter 8, “The Distance Sensor,” incorporates distance measurement into inventions. The first exercise is to build a handheld tool to replace an old-fashioned tape measure. This sensor can also detect when an object comes close, which is put into use to modify the cannon in Chapter 5 to automatically detect and fire upon a target.

Chapter 9, “The Color Sensor,” adds the capability to work with light, measuring the brightness of light and the color of objects. Building experience starts with a beeping tone generator that changes pitch depending on brightness of light. The concluding project combines ideas from earlier chapters in the book to combine the Color Sensor, motors, a linkage, and structures to sort liftarms by color.

Acknowledgments

My continued appreciation goes out to the LEGO Group for their phenomenal building toy. To me, LEGO is much more than a toy. LEGO can be used and enjoyed on many levels for many uses. Sure, it’s a toy, and a rather engaging one that attracts and brings together people of all ages. But LEGO is also an excellent tool to teach science and engineering concepts, which I’ve used with my own kids and is a motivation for this book. Another motivation for this book is to show LEGO as a tool for invention.

To convey the concepts and inventions in this book, I’ve included step-by-step instructions for building exercises and projects. I made the building instructions with a combination of BrickLink Studio (bricklink.com) and LDraw (ldraw.org). BrickLink Studio is a computer-aided design (CAD) utility for building with virtual LEGO that evolved from Digital Designer developed by the LEGO Group. LDraw, originally built by James Jessiman, is another LEGO CAD package that has been expanded on by many dedicated people. There are several interfaces to the LDraw foundation. Among these interfaces, I used MLCAD (mlcad.lm-software.com) developed by Michael Lachmann, and LDCad (melkert.net/LDCAD) developed by Roland Melkert. To create building instructions from CAD models, I used the LIC utility (bugeyedmonkeys.com) developed by Remi Gagne and LPub3D (sourceforge.net/projects/lpub3d) based on the work of Trevor Sandy, Kevin Clague, Leonardo Zide, Travis Cobbs, and Peter Bartfai.

My appreciation is extended to Apress, whose books I’ve been enjoying for many years. So it’s been a thrill to write for such a great publishing company for a third LEGO book. My thanks are given to Jessica Vakili and James Markham, who did fantastic work in editing. Part of writing a good book is to have an insightful technical reviewer, and Vishnu Agarwal came through in this regard.

Finally, let me thank Melissa, Kirsten, and Elias for supporting my indulgences in LEGO and building strange devices. LEGO is stuffed and scattered throughout our home, for which I apologize and promise to clean up one day.

Table of Contents
About the Author
Grady Koch

A photo of Grady Koch.

is the author of several books about LEGO and the founder of the website hightechlego.com. He has a Ph.D. in Electrical Engineering and 35 years of experience as a research engineer at NASA Langley Research Center, where he has built optical and laser instruments that have been flown on aircraft and orbited the Earth. He has three patents in the field of lidar for studying the atmosphere and is the author or contributor of over 200 journal and conference publications. Throughout his career, Dr. Koch has mentored many interns and found that students sometimes need a little help in making the transition of what they’ve learned in classroom to real-world practice. These ideas of applying knowledge to practice are incorporated into his LEGO books.
 
About the Technical Reviewer
Vishnu Agarwal

has more than seven years of experience in the field of LEGO robotics. He is the founder of ROBO-G, a robotics and STEAM education service provider. He is also the “Mentor of Change” for Atal Tinkering Lab at the Vidyashilp Academy. Vishnu has successfully coached teams in the World Robot Olympiad and First LEGO League competitions. Many students and teachers alike have learned STEAM concepts using LEGO education from Vishnu’s courses and coaching. And he has presented a research paper on Teaching Programming and Computational Thinking to Elementary Level Children Using Lego Robotics Education Kit at T4E at IIT, Bombay.

 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.21.5