Reader small image

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

Product typeBook
Published inNov 2021
PublisherPackt
ISBN-139781801075572
Edition1st Edition
Concepts
Right arrow
Author (1)
Ashwin Shah
Ashwin Shah
author image
Ashwin Shah

Ashwin Shah is an Electronics and Communication engineer from India. Teaching is his passion and he started working at the tender age of 16 as a doubt solver for younger kids at after-school classes. Today, he is a successful edupreneur who runs his own STEM-based robotics, coding, and IoT institute - RoboFun Lab. Being one of the pioneers of STEM education in India, he has taught over 3000 students and trained 200+ educators thus far. He has trained 100+ teams for prestigious STEM competitions with 50+ national and 12+ international awards in the bag. Most of his students are now pursuing careers/education in STEM at prominent universities. Ashwin was a state-level badminton player during his college days.
Read more about Ashwin Shah

Right arrow

Chapter 12: Building a BOOST Racing Car

So far, whatever models you have built using your BOOST kit have had a simple two-wheel drive feature. In this chapter, you will be building a steering-controlled car with gears. You might have observed that your parents always maneuver their car using the car's steering wheel. Whenever the steering wheel is moved, the wheels of the car move in the respective direction. This helps the car maneuver. To build such cars using LEGO elements, we will be using gears. For a car, it is important to have a stopping position in both directions to ensure our turns are controlled. Let's start building this car:

Figure 12.1 – Racing car

In this chapter, we will cover the following topics:

  • Building the racing car
  • Let's code the robot to run on different racetracks
  • Time for a challenge

Technical requirements

In this chapter, you will need the following:

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

Building the racing car

In this chapter, we will be building the following racing car:

Figure 12.2

Follow these steps to build this racing car robot:

  1. Take your BOOST Hub and ensure that its batteries are fully charged:

    Figure 12.3

  2. Take one 4x6 brick and connect it to the back of the hub, as shown in the following figure:

    Figure 12.4

  3. Take six connector pegs and connect three pegs to each side of the 4x6 brick, as shown here:

    Figure 12.5

  4. Now, flip the model, take one 1x2 flat tile and one 1x4 flat tile, and connect both to the side beam of the BOOST Hub, as shown in the following figure. Now, take one 3x5 angular beam and connect it to all three connector pegs on that side:

    Figure 12.6

  5. Now, take one 5M axle with a 1M stop and one ½ bush. First, remove the angular beam, connect the top part of the axle to motor B of the BOOST Hub, connect that to the angular beam, and then connect the ½ bush to the axle:

    Figure 12.7

  6. Now, rotate...

Let's code the robot to run on different racetracks

First, find out the number of rotations of motor C that are needed for left steering and right steering:

  • Number of rotations for left steer = ________ rotations.
  • Number of rotations for right steer = ________ rotations.

Now, let's do some interesting activities.

Activity #1

Try to use some items in your home and form a race track that looks as follows. Get to the end of this race track using your coding skills:

Figure 12.73 – Race track setup 1

Let's move on to the next activity.

Activity #2

For this activity, simply swap the start and stop positions shown in Activity #1 and run the robot on same race track again:

Figure 12.74 – Race track setup 2

Let's try another activity with the race track.

Activity # 3

Now that you know how to turn left and right, take some extra items from your home, and form the race track...

Time for a challenge

Challenge #1

Attach a color sensor to the front of the robot and find some red and green objects that your sensor can sense. Now, create the track shown in the following image and get to the end of the racetrack while ensuring the following conditions are satisfied:

  • The car must only start the journey when it senses the green object. You must place this green object in front of the color sensor when you wish to start the journey on the racetrack.
  • The car must stop whenever it senses the red object. Try to show this object at the stop point of the racetrack.

Hint: Position your color sensor horizontally so that it can sense the objects that you have provided.

Figure 12.77 – Final racetrack

You can try many such different routes and try to finish them as quickly as possible. This will help you enhance your coding skills as well.

Summary

In this chapter, you built a race car with a steering wheel and navigated various race tracks using the coding blocks that you learned about in the previous chapters. You also enhanced your building skills by attaching the color sensor to the front of the robot on your own to solve this chapter's challenge. You can now apply advanced coding concepts to build and code completely autonomous cars, as well as other robotics applications with sensors mounted on them. With this, we have come to the end of our exciting journey of learning how to build and code using the LEGO BOOST kit.

In the next chapter, you will be solving a challenge without any guidance provided on how to build and code the robot. This will help you figure out what level your learning is at regarding this kit and will help you learn more if you're stuck on something. It is highly recommended that you go through this and the previous chapters before you move on to the next chapter. All the best!

...

Further reading

Did you know that it takes less than 3 seconds for the technicians at the pit stop in F1 races to change the wheels of any F1 race car? To find out more about this and many more exciting facts about F1 racing, go to

https://www.thrillist.com/cars/facts-about-race-cars-surprising-details-about-the-world-s-fastest-vehicles.

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 2021Publisher: PacktISBN-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.
undefined
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

Author (1)

author image
Ashwin Shah

Ashwin Shah is an Electronics and Communication engineer from India. Teaching is his passion and he started working at the tender age of 16 as a doubt solver for younger kids at after-school classes. Today, he is a successful edupreneur who runs his own STEM-based robotics, coding, and IoT institute - RoboFun Lab. Being one of the pioneers of STEM education in India, he has taught over 3000 students and trained 200+ educators thus far. He has trained 100+ teams for prestigious STEM competitions with 50+ national and 12+ international awards in the bag. Most of his students are now pursuing careers/education in STEM at prominent universities. Ashwin was a state-level badminton player during his college days.
Read more about Ashwin Shah