Design Innovative Robots with LEGO SPIKE Prime - Aaron Maurer - E-Book

Design Innovative Robots with LEGO SPIKE Prime E-Book

Aaron Maurer

0,0
31,19 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

The new LEGO SPIKE Prime is one of the latest additions to the LEGO robotics line of products. This book will help you to enjoy building robots and understand how exciting robotics can be in terms of design, coding, and the expression of ideas.
The book begins by taking you through a new realm of playful learning experiences designed for inventors and creators of any age. In each chapter, you'll find out how to build a creative robot, learn to bring the robot to life through code, and finally work with exercises to test what you've learned and remix the robot to suit your own unique style. Throughout the chapters, you'll build exciting new smart robots such as a handheld game, a robotic arm with a joystick, a guitar, a flying bird, a sumobot, a dragster, and a Simon Says game.
By the end of this LEGO book, you'll have gained the knowledge and skills you need to build any robot that you can imagine.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 166

Veröffentlichungsjahr: 2022

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Design Innovative Robots with LEGO SPIKE Prime

Seven creative STEM robotic designs to challenge your mind

Aaron Maurer

BIRMINGHAM—MUMBAI

Design Innovative Robots with LEGO SPIKE Prime

Copyright © 2022 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

Group Product Manager: Rahul Nair

Publishing Product Manager: Vijin Boricha

Senior Editor: Arun Nadar

Content Development Editor: Sujata Tripathi

Technical Editor: Shruthi Shetty

Copy Editor: Safis Editing

Project Coordinator: Shagun Saini

Proofreader: Safis Editing

Indexer: Manju Arasan

Production Designer: Joshua Misquitta

First published: January 2022

Production reference: 2071221

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham

B3 2PB, UK.

ISBN 978-1-80181-157-6

www.packt.com

To my wife, who constantly challenges me to become a better person and for pushing me to dig within myself to believe in what I have to offer to the world.

To my three children, Aiden, Addy, and Ava, who remind me to hold onto my crayons to remember the joys of being a child and living in and embracing the moment. As adults, it is easy to lose sight of the power of play and enjoying the moments.

To all the people who have supported and followed me in my journey. Continue to make the world a better place one brick at a time.

Note from the Author

Welcome to this book. I am so excited to have the opportunity to share with you a passion of mine as an educator who has hands-on experience with LEGO, transforming learning and engagement with students; a parent who has spent countless hours building and creating stories with my kids; an Adult Fan of LEGO (AFOL) with my own LEGO collection to fulfill my hobby; and, of course, just someone who loves the energy of the LEGO community and the continuous positive sharing of remarkable ideas.

I have one major goal with this book: I want it to be a permission slip for you to build and make. Sometimes when we read books such as these, we build as suggested in the book and that is the extent of the creative process. Being an educator who has spent time in elementary and middle schools, I have learned that not providing the answer is the true facilitator of creativity. What I have created is a series of builds for you to explore not only the LEGO SPIKE Prime Kit but also the world of smart robots that impact our daily lives.

So, each chapter will explore a smart robot concept along with a model robot to build. However, each build has been designed for you to add your own touch. You will see suggestions and ideas to apply the learning of the chapter to new layers of building. I hope you love the freedom to take the ideas and build your own version. With this permission slip, I cannot wait to see what you create. Make sure you share! Here we go. Let's go explore the new LEGO SPIKE Prime Kit that is now available.

Contributors

About the author

Aaron Maurer, also known as Coffeechug is the STEM lead for 21 school districts in Iowa helping to expand STEM, Computer Science, Makerspace, and Purposeful Play into classrooms K-12. Aaron was also a FIRST LEGO League coach for 8 years with much success working with phenomenal kids.

He has a Master Educator License with endorsements in 5-12 Psychology – 163; 5-12 World History – 166; 5-12 American History – 158; 5-12 Computer Science – 278; PK-12 Talented and Gifted – 107; 5-8 Middle School Generalist – 182; and K-8 Computer Science – 277.

Currently, Aaron is a member of ISTE Making It Happen Award; LEGO Education Ambassador and Master Educator; PBS Digital Innovator and All-Star; PITSCO Tag Committee; Microsoft Innovator Educator Expert; Microsoft Innovative Educator Fellow; Global Learning Mentor (formerly Skype Master Teacher); Minecraft Global Mentor; and Makey Makey Ambassador.

Finally, Aaron was a finalist for the Iowa Teacher of the Year in 2014.

You can find more of his work at www.coffeeforthebrain.com.

About the reviewers

Khushboo Samkaria (Rana) lives in India with her husband, Vivek, and son, Agastya. She is a certified LEGO Serious Play (LSP) practitioner with more than 8 years of experience working globally with LEGO Education partners and organizing FIRST (For Inspiration and Recognition of Science and Technology) programs. She is devoted to the mission of helping young innovators to understand the real world using an interdisciplinary approach – STEM (Science, Technology, Engineering, Math). Since 2011, she has interacted with more than 100,000 kids and adults globally as a part of the FIRST programs. Currently, she is working with various organizations to help them tap their knowledge and ideas using the LSP approach so that they can be the winner in this period of intense change.

Scott Reece holds an Educational Specialist in mathematics with a certification in technology education. His career as a classroom teacher spans 26 years in social studies, mathematics, and technology classrooms. Even before becoming an educator, Scott was working with children through the children's ministry at different churches. His passion is seeing children grow, both spiritually and educationally. Over the years, Scott has become a go-to for technical support both in his school and in his district. Scott also began a relationship with LEGO Education that led to him being recognized as a US Master Educator in 2019. Scott also proudly holds the roles of husband, father, and DeDe (grandpa).

Table of Contents

Preface

Chapter 1: Getting Started with SPIKE Prime

Technical requirements

Overview of the kit

The cables for motors and sensors5

The Intelligent Hub6

Elements8

Sensors12

Motors14

Hub connection15

Programming

Creating a rock, paper, scissors wrist game

Coding a rock, paper, scissors wrist game

Making your own game

Summary

Chapter 2: Building an Industrial Robot Claw

Technical requirements

Building the base

Building the Intelligent Hub frame to move multidirectionally

Building the robot arm

Building the cargo

Writing the code

Identifying the ports65

The Intelligent Hub remote-control robot program66

Making it your own

Summary

Chapter 3: Building a LEGO Guitar

Technical requirements

Building the guitar

Assembling the guitar body77

Assembling the neck86

Building the color sensor slide bar88

Writing the code

The ports96

Playing the guitar

Making it your own

Summary

Chapter 4: Building a Mechanical Bird

Technical requirements

Building the body frame of the mechanical bird

Building the wings of the mechanical bird

Building the head and torso

Writing the code

The ports133

Calibrating the motors134

Wing movement135

Eyes and head movement135

Activating the bird

Making it your own

Summary

Chapter 5: Building a Sumobot

Technical requirements

Building the base

Building the ultrasonic sensor attachment

Building the force sensor attachment

Writing the code

The ports167

Code stack 1 – motors168

Code stack 2 – end program168

Code stack 3 – main program169

Code stack 4 – white edge program172

Code stack 5 – ultrasonic program173

Code stack 6 – force sensor program174

Making it your own

Summary

Chapter 6: Building a Dragster

Technical requirements

Building the dragster

Building the motor frame

Building the gear system and back wheels

Building the body of the dragster

Adding the body design

Coding the dragster

Connecting to the proper ports208

Code stack 1 – countdown timer and broadcast209

Code stack 2 – activating motors and stopping on the finish line211

Making it your own

Summary

Chapter 7: Building a Simon Says Game

Technical requirements 

Building the handheld game

Coding Simon Says

Code stack 1 – main code223

Code stack 2 – displaying images for player direction228

Code stack 3 – displaying images and sound for game sequence230

Code stack 4 – player input of answers234

Code stack 5 – game over sequence238

Code stack 6 – correct choice music sequence240

Making it your own 

Summary 

Other Books You May Enjoy

Preface

The new LEGO SPIKE Prime is one of the latest additions to the LEGO robotics line of products. This book will help you to enjoy building robots and understand how exciting robotics can be in terms of design, coding, and the expression of ideas.

The book begins by taking you through a new realm of playful learning experiences designed for inventors and creators of any age. In each chapter, you'll find out how to build a creative robot, learn to bring the robot to life through code, and finally work with exercises to test what you've learned and remix the robot to suit your own unique style. Throughout the chapters, you'll build exciting new smart robots such as a handheld game, a robotic arm with a joystick, a guitar, a flying bird, a sumobot, a dragster, and a Simon Says game.

By the end of this LEGO book, you'll have gained the knowledge and skills you need to build any robot that you can imagine.

Who this book is for

This book is for robot enthusiasts, LEGO lovers, hobbyists, educators, students, and anyone looking to learn about the new LEGO SPIKE Prime kit. The book is designed to go beyond the basic builds to intermediate and advanced builds, while also helping you to learn how to add your own personal touch to the builds and code. To make the most of this book, you'll need a basic understanding of build techniques, coding in block-based software environments, and weaving them together to create unique robot builds.

What this book covers

Chapter 1, Getting Started with SPIKE Prime, focuses on the new kit and explores all the elements, sensors, components, and the coding platform that come with the kit. It is important to understand the new pieces introduced in this kit along with the sensors and how they work.

Chapter 2, Building an Industrial Robot Claw, contains our first robotic project, in which we explore how smart robots are used in everyday life. We will explore the concept of a claw and how it is used in various jobs and industries. Finally, we will build a claw that can be expanded by the user to complete various build challenges.

Chapter 3, Building a LEGO Guitar, explains that entertainment is important to our well-being. This chapter will explore how to build a working guitar that can be played and modified to meet the needs of the user.

Chapter 4, Building a Mechanical Bird, explores the mechanisms required to design and build a mechanical bird. It is designed to showcase new ways to build robots using mechanisms for wing, head, and leg movement.

Chapter 5, Building a Sumobot, covers the sumobot robotic challenge, a classic robot challenge that has been around for a long time. Despite not being a new concept, it is loved by many. This chapter contains a sumobot build to take your competitive advantage to new levels.

Chapter 6, Building a Dragster, focuses on designing and building a dragster to see how fast we can move our robot down a speedway. Robots have been playing a critical role in travel.

Chapter 7, Building a Simon Says Game, contains a very fun project for hobbyists to build and code: a handheld game of Simon Says. This chapter will explore less on the actual build mechanics; instead, more space is given to the developing code. The goal of this chapter is to increase your coding skills so you can go and create a game of your own.

To get the most out of this book

You require a basic understanding of build techniques, coding in block-based software environments, and how to weave them together to create unique robot builds.

If you are using the digital version of this book, we advise you to type the code yourself or access the code via the GitHub repository (link available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code. The programming software can be used on computers and/or tablets/phones. You may want to explore and experiment with both platforms to find out what you prefer.

Download the example code files

You can find the code files for this book on GitHub at: https://github.com/PacktPublishing/Design-Innovative-Robots-with-LEGO-SPIKE-Prime. If there's an update to the code, it will be updated in the GitHub repository.

We have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Code in Action

Code in Action videos for this book can be viewed at https://bit.ly/3r0qpSy.

Download the color images

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://static.packt-cdn.com/downloads/9781801811576_ColorImages.pdf.

Conventions used

There are a number of text conventions used throughout this book.

Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: " …and select numbers 1-3."

Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Add an orange control block named stop all."

Tips or important notes

Appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, mention the book title in the subject of your message and email us at [email protected].

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Share your thoughts

Once you've read Design Innovative Robots with LEGO SPIKE Prime, we'd love to hear your thoughts! Please click here to go straight to the Amazon review page for this book and share your feedback.

Your review is important to us and the tech community and will help us make sure we're delivering excellent quality content.

Chapter 1: Getting Started with SPIKE Prime

In this chapter, we will be exploring the SPIKE Prime kit. It has over 500 elements to build robots, upgraded sensors, a new Intelligent Hub compared to previous versions of MINDSTORMS, and new programming platforms to bring our robots to life and control them.

Figure 1.1 – The front of the box when you get your hands on this amazing kit

To begin with, we are going to examine what the new elements are in this kit for us to build our designs with, how the sensors have changed, and the new Intelligent Hub. As we explore, we will take a closer look at some excellent features of this kit to start learning more about this LEGO MINDSTORMS product.

Finally, we will do some exploration of the new programming interface and how we use code to bring our ideas to life. The end goal of this chapter is to make sure you understand all possibilities and to build a foundation of basic knowledge of the kit to begin to build some of the exciting ideas to follow in the upcoming chapters. This would also be a perfect time to explore the Getting Started section of the software to see how everything works and operates if you are new to SPIKE Prime. You will build one mini project at the end of this chapter to serve your understanding of what can be achieved with the parts.

In this chapter, we're going to cover the following main topics:

Overview of the kitIntelligent HubNew elementsSensorsProgrammingBasic projects to learn more

Technical requirements

One of the creative constraints when designing the builds in this book is to only use the parts, sensors, and elements contained in the kit. There will not be any additional parts needed to complete any of these builds. You will only need the SPIKE Prime Set 45678.

For software, you will need to download the LEGO SPIKE Prime software on either your computer, phone, or tablet. Please check the site to ensure your hardware and operating system are compatible with the software. You can get everything you need to set up by choosing LEGO Education SPIKE Prime on the LEGO site at https://education.lego.com/en-us/start.

For the building of the robot, all you will need is the SPIKE Prime kit. For programming, you will need the LEGO SPIKE application/software.

Access to the code can be found here: https://github.com/PacktPublishing/Design-Innovative-Robots-with-LEGO-SPIKE-Prime/blob/main/Ch%201%20Rock%20Paper%20Scissor.llsp.

You can find the code in action video for this chapter here: https://bit.ly/2Ziax2e

Overview of the kit

This kit comes with 523 elements to build, design, and bring your ideas to life.

When you open the plastic tub, you'll see two pieces of paper. The first one provides a layout of how LEGO Education suggests you organize the parts and elements in your tub. The second paper contains all the stickers to label and mark the trays, tubs, and elements.

Figure 1.2 – The layout diagram for all the elements

Next, you will find the inside of the box has the bottom of the tub to store the larger pieces and two smaller plastic sorting trays with stickers to better organize and sort your elements.

Figure 1.3 – Two smaller sorting trays to help organize and build more efficiently

The kit does not have a manual to build robots, but the software comes with a huge library collection of lessons, builds, and units to help a builder learn some new build techniques and to get started with building robots. It is quite nice once you get started with the software to see all that it provides.

Here is what the kit provides:

One Micro USB cable One Intelligent HubOne rechargeable batterySticker sheetOne plastic tub with two sorting traysOver 500 building elementsExternal sensors (one distance sensor, one color sensor, and one force sensor)Motors (two medium motors and one large motor)

You will explore these parts in greater detail throughout this chapter to understand them better.

The cables for motors and sensors

One of the biggest changes that the builder will notice right away is the cable connections. If you have previously used LEGO MINDSTORMS kits such as the EV3 or NXT, then you will notice the new Intelligent Hub. Additionally, you will notice that the cables are different. They are flat and smooth. They are also permanently connected to the motors and sensors, unlike previous kits where you could use various lengths of cables to connect and build your robots.

Figure 1.4 – Flat wires and wire clips