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 16: The BOOST Humanoid

Up to this point, you have built various types of robots using this book. Did you observe one thing that they have in common? None of these robots have their own eyes through which they can see and follow a specific path! Usually, robots tend to follow the line and accomplish the iterative tasks on a specific given route. Ideally, these robots are used in warehouses as well as other indoor industrial applications. You will be building a similar line-following robot using the color sensor that you have in the BOOST kit. As the name suggests, a robot will follow the black line and reach out to the required places to accomplish the tasks:

Figure 16.1 – Line-following robots at a warehouse

In this chapter, you will do the following:

  • Build a line-following robot
  • Let's code a robot to follow the line
  • Time for a challenge

In this robot, you will be replicating a human-like structure with legs, hands...

Technical requirements

In this chapter, you will need the following:

  • LEGO BOOST kit with six AAA batteries, fully charged
  • A laptop/desktop with Scratch 3.0 programming and an active internet
  • One-inch-thick black tape
  • A table top with a white background

Building a line-following robot

Refer the following link for the detailed build instructions of the line-follow robot:

https://github.com/PacktPublishing/Build-and-Code-Creative-Robots-with-LEGO-BOOST/blob/main/Bonus%20Chapter/Chapter16/B17095_BuildInstructions_16_Final_NM.pdf

Your line following robot will look as shown in the following figure:

Figure 16.2

Figure 16.2

Let's now code this robot to follow the line.

Let's code the robot to follow the line

Let's now start coding this line-following robot. There are various line-following techniques, such as two-state, five-state, proportional, and proportional integral derivative. In this chapter, you will be learning the easiest yet most accurate technique – the two-state line follow. You will be using the if-else programming block from the Control pallet. For line-following robots, it is necessary to have the right environment, including the following:

  • A plain white background
  • A properly etched black line
  • Controlled lighting conditions

Remember one thing. The robot always follows the edge of the line and not the center. Wondering why? This is because, if the robot follows the center of the line, it will miss the turns and leave the line, but if it is following the edge, it will never ever miss the turns/curves. The algorithm for two-state line following is simple – if the robot senses black, turn...

Time for a challenge

Challenge #1

Attach the external motor to this robot on the top and build an arm that can hit the tennis ball. Now, perform the following setup:

Figure 16.5 – Route setup

Solve the following tasks:

  1. Follow the line until the first ball. Now, hit the ball and clear the robot's path to reach the next stop. Change the BOOST Hub color to red.
  2. Now, follow the line to the second ball and hit that ball as well. Change the BOOST Hub color to blue.
  3. Reach the stopping place and play a sound of your choice.

The robot must finish this challenge accurately each time. While following the line, you must focus on accuracy instead of speed, as the most important element in such cases is the accuracy of the tasks solved, followed by time. You can play around with the speed of this robot and see how quickly you can complete this challenge with the utmost accuracy.

Summary

In this chapter, you learned about the practical application of the line-following technique and its use in industry. You wrote your own two-state line-following program and executed the same to solve various tasks. You also applied your construction skills in the challenge section to solve the challenge given. You will be able to build such humanoid robots on your own using LEGO elements on any other platform, such as EV3 and WeDo. In the next chapter, you will be building a robot with wheels and a color sensor on it that will be landing on the moon's surface for exploration purposes. You will be performing logical activities to identify the types of minerals present on the surface of the moon and grab some of these minerals.

Further reading

Amazon is said to be leading the race when it comes to automation and robotics at its gigantic warehouses across the globe. Read the following article about their execution of line-following robots: https://www.wired.com/story/amazon-warehouse-robots/.

Once you are familiar with programming, you can learn about advanced line-following techniques such as five-state and proportional derivative integrals using advanced Mindstorms sets or any other open-source platforms.

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