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 11: Building a Color-Sorter Conveyor Belt

With the introduction of the Industrial Revolution 4.0, most industries are now turning toward automation for their production. Huge assembly lines are deployed, and multiple robots are lined up around these assembly lines to do various tasks one after another, automatically. A whole car body is prepared automatically with the help of robots today! Just as we need robots for such processes, we also need robots for sorting various things, ranging from faulty products to different products, into different trays. In this chapter, you will be building one such assembly line that sorts different-colored LEGO bricks into different trays.

You can see an example representation of an assembly line here:

Figure 11.1 – Assembly-line representation

In this chapter, you will do the following:

  • Building a color-sorter conveyor belt
  • Let's code the robot to sort different colored LEGO bricks
  • ...

Technical requirements

In this chapter, you will need the following:

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

Building a color-sorter conveyor belt robot

Let's build a robot like the one shown in the following figure:

Figure 11.2

Follow these given instructions to build the robot:

  1. Take your BOOST Hub and ensure that the batteries are fully charged. The Hub is illustrated in the following figure:

    Figure 11.3

  2. Take four 1x6 bricks and connect them to the back side of the BOOST Hub, as follows:

    Figure 11.4

  3. Take four 1x3 bricks and connect them to all four 1x6 bricks, then take one 4x6 brick and place it so that it will connect to all four 1x6 bricks, as shown here:

    Figure 11.5

  4. Now, take two 6x10 plates and connect them to two 1x3 bricks and the 4x6 brick, as shown here:

    Figure 11.6

  5. Now, turn the model frontside, take two 2x4 bricks, and place them on the BOOST Hub, as follows:

    Figure 11.7

  6. Take three 3M connector pegs with friction and connect them to the BOOST Hub, as shown here:

    Figure 11.8

  7. Then, take two 1x10 bricks and connect one of them...

Let's code the robot to sort different colored LEGO bricks

Let's now sort the LEGO bricks with this color sorting robot. First, find out the number of rotations needed by the external motor to do the following:

  1. Knock LEGO brick to the left tray:______________ rotations.
  2. Knock LEGO brick to the right tray:_____________ rotations.
  3. Allow LEGO brick to pass through at the blue tray:_____________ rotations.

Ensure that the hitter comes back to the original position after knocking the LEGO brick. The hitter is connected to port C and the conveyor belt is connected to port A.

Activity #1

Place a red LEGO brick on the belt. Now, move the belt until the color sensor senses this brick. Display the brick color on the screen. Now, move it further until it reaches a proper knocking position. Knock it to the left tray.

The sample code for this task is given here:

Figure 11.51 – Sample code

Let's repeat the same process...

Time for a challenge

Challenge #1

Just as with Activity #4, can you add a green brick and do the respective programming as follows?

  1. Red brick to be knocked to the left tray
  2. Blue brick to be knocked to the right tray
  3. Green brick to be knocked to the front tray (made with blue LEGO bricks)

You must display on the screen the respective color name that is sensed by the sensor. The program must be such that no matter the order in which you place the bricks on the belt, it should be able to sort them out. Make sure to place one brick after another.

Summary

In this chapter, you learned about the practical application of color sorters in an industrial setting. You learned how to use if-else conditions effectively and repetitively. You were able to program your robot to make decisions from the multiple conditions it was offered. In the next chapter, you will be building a racing car with an internal steering system that will conquer various racetracks at different speeds and of different complexities.

Further reading

Here are some interesting topics that can be explored:

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