Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Build and Code Creative Robots with LEGO BOOST

You're reading from  Build and Code Creative Robots with LEGO BOOST

Product type Book
Published in Nov 2021
Publisher Packt
ISBN-13 9781801075572
Pages 428 pages
Edition 1st Edition
Languages
Concepts
Author (1):
Ashwin Shah Ashwin Shah
Profile icon Ashwin Shah

Table of Contents (20) Chapters

Preface Chapter 1: Introduction to the LEGO BOOST Kit Chapter 2: Building Your First BOOST Robot – Tabletop Fan Chapter 3: Moving Forward/Backward Without Wheels Chapter 4: LEGO BOOST Rover Chapter 5: Getting into Gear – My First Geared Robot Chapter 6: Building a Forklift Chapter 7: Building a Helicopter Chapter 8: Building R2-D2 Chapter 9: Building an Automatic Entrance Door Chapter 10: Building a Candy Dispenser Robot Chapter 11: Building a Color-Sorter Conveyor Belt Chapter 12: Building a BOOST Racing Car Chapter 13: Final Challenge Bonus Chapters
Chapter 14: The Grabbing Robot Chapter 15: Obstacle Avoidance Robot Chapter 16: The BOOST Humanoid Chapter 17: The Moon Rover Other Books You May Enjoy

Chapter 8: Building R2-D2

Who isn't a Star Wars fan here? As a child, I would make sure to watch the latest offerings from Star Wars on the very first day of release. One of the reasons to love Star Wars is the number of crazy and fancy robots in the movie and the kinds of special actions they do. Of all these robots, I really loved R2-D2 from day 1. Its movement and unique design with a rotating head have always kept me glued to the character. Which is your favorite Star Wars robot? In this chapter, you will be building an R2-D2 robot and solving fun programming tasks:

Figure. 8.1 – R2-D2 robot from Star Wars

Let's first understand what a pulley is and how it works. A pulley is one of six simple machines used to make our pulling efforts easy. Some common applications of pulleys are as follows:

  • Curtains/blinds: A pulley is used to open and close the blinds and helps in pulling the curtains up and down.
  • Flower basket: A pulley mechanism...

Technical requirements

In this chapter, you will need the following:

  • A LEGO BOOST kit with six AAA batteries, fully charged
  • A laptop/desktop with Scratch 3.0 programming and an active internet connection
  • A diary/notebook with a pencil and eraser

Building the R2-D2 robot

Let's build the following robot:

Figure 8.3 – R2-D2 robot using the BOOST kit

We will use the following building instructions:

  1. Take your BOOST Hub. Ensure that the batteries are fully charged:

    Figure 8.4

  2. Take two 1x2 bricks with a horizontal snap and connect them to the BOOST Hub:

    Figure 8.5

  3. Take two 2x2 round plates and connect them to the back side of the BOOST Hub as shown in the following figure:

    Figure 8.6

  4. Now take two 1x6 bricks with a bow and two 1x11 Technic bricks. Connect them to the BOOST Hub, one above the other:

    Figure 8.7

  5. Take two 2x6 bricks with a bow, one 2M cross axle, and one 1x1 beam. Connect the 2x6 bricks with a bow to the 1x2 bricks and 2M cross axle in motor A of the BOOST Hub, then insert a 1x1 beam:

    Figure 8.8

  6. Take two 1x16 Technic bricks and connect them to the back side of the 2x6 brick with a bow, as shown in the following figure:

    Figure 8.9

  7. Take one 3M stopper axle and...

Let's code the robot to move on a specific path

In this activity, you will be making use of sound and display blocks to make the R2-D2 more interactive.

Activity

Do the setup as shown in Figure 8.117. R2-D2 is on a rescue mission for his master – Padme. R2-D2 needs to reach the computer system in under 5 seconds and turn it off by moving his head 180 degrees after reaching the spot. Once done, display Padme Saved! Mission Successful and play Hooray:

Figure 8.117 – Route setting

The sample code for this activity is given here:

Figure 8.118 - Sample code

Now, let's move on to a challenge.

Time for a challenge

Build a small LEGO element that can represent Yoda. You will have to attach this element to your R2-D2 robot. You can build it using spare LEGO elements from your BOOST kit/use any of your LEGO minifigures that you have at home. Once done, program your R2-D2 to do the following:

  1. Go and meet Jedi Master Yoda at point A. Rotate R2-D2's head one time when the task is done and change the BOOST Hub light color to purple.
  2. Reorient the position of R2-D2 toward Dagobah, the mysterious force planet. Now, reach this planet in less than 6 seconds with Yoda. Rotate the neck for one full rotation and display the message Landed successfully on Dagobah with the master. Also play a unique sound for 3 seconds.
  3. Now, reorient R2-D2 toward the base position again and program it to reach the base in under 4 seconds.
  4. Calculate the total time taken to perform this activity once you are set with the route. Time taken = __________ seconds.

Your route setting...

Summary

In this chapter, you built an R2-D2 robot using the application of gears as well as a simple machine pulley. You solved two tasks: one to rescue Padme and another to pick up the Jedi Master and go to the planet Dagobah. The purpose of this chapter was to strengthen your construction skills using the pieces given in your LEGO BOOST kit. By now, you should be able to build robots that have human-like movements, such as the neck movement of R2-D2. You should also be able to design robots that are like real-life/sci-fi character robots that you have seen either onscreen or in real life. In the next chapter, you will be building an automated entrance door with the help of a color sensor. The door construction will resemble the entrance that you see at malls/offices where the door will open only for specific people and not for others. It will be a fun task for you.

Further reading

lock icon The rest of the chapter is locked
You have been reading a chapter from
Build and Code Creative Robots with LEGO BOOST
Published in: Nov 2021 Publisher: Packt ISBN-13: 9781801075572
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}