Grade 6 Robotics_Plus_eBook

Page 1


Tekie

Robotics Plus

Acknowledgements

Academic Authors: Neha Verma, Ayushi Jain, Anuj Gupta, Simran Singh

Creative Directors: Bhavna Tripathi, Mangal Singh Rana, Satish

Book Production: Rakesh Kumar Singh, Sanjay Kumar Goel

Project Lead: Jatinder Kaur

VP, Learning: Abhishek Bhatnagar

All products and brand names used in this book are trademarks, registered trademarks or trade names of their respective owners.

© Uolo EdTech Private Limited

First impression 2024

Second impression 2025

This book is sold subject to the condition that it shall not by way of trade or otherwise, be lent, resold, hired out, or otherwise circulated without the publisher’s prior written consent in any form of binding or cover other than that in which it is published and without a similar condition including this condition being imposed on the subsequent purchaser and without limiting the rights under copyright reserved above, no part of this publication may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, without the prior written permission of both the copyright owner and the above-mentioned publisher of this book.

Book Title: Tekie Robotics Plus 6

ISBN: 978-81-983027-3-1

Published by Uolo EdTech Private Limited

Corporate Office Address:

85, Sector 44, Gurugram, Haryana 122003

CIN: U74999DL2017PTC322986

Illustrations and images: www.shutterstock.com, www.stock.adobe.com and www.freepik.com

All suggested use of the internet should be under adult supervision.

Robotics

What is Robotics?

Robotics is the study and creation of robots. Robots are machines that can perform various tasks. They are built using parts like metal, wires, and circuits, and programmed with special instructions to tell them what to do.

Some robots look like humans, while others are designed to work in specific places, like factories, hospitals, or even outer space! For example, a robot might assemble cars in a factory or explore the surface of Mars where humans cannot go easily.

Robots can sense their surroundings using sensors. These sensors act like the robot’s eyes, ears, and hands, helping it understand distance, temperature, or touch. Once the robot knows its surroundings, it can make decisions based on its programming.

The field of robotics combines science, technology, engineering, and mathematics (STEM) to solve problems and create amazing inventions. It is an exciting way to bring creativity and technology together!

Components of Robots

Robots are made up of different parts that work together to help them move, sense, and do tasks. These parts are grouped into three main types: mechanical, electronic, and coding interface. Let us learn about them.

Mechanical Parts

Mechanical parts are like the bones and muscles of a robot. They include wheels, gears, motors, and arms. These parts help the robot move, pick up things, or spin. For example, wheels let a robot roll around, and motors make robots move by turning wheels, spinning gears, or lifting arms.

Electronic Parts

The electronic parts are like the robot’s brain and nerves. They include circuits, sensors, and batteries. These parts help the robot think and sense its surroundings. Sensors act like eyes, ears, or even a nose for the robot, allowing it to detect light, sound, or obstacles. The battery gives the robot the power it needs to work.

Coding Interface

Coding is how we talk to robots and tell them what to do. Coding means writing instructions for them to follow. The coding interface is the program or app used to give these instructions. Once coded, the robot can move in a specific direction, stop when it sees something, or even dance.

By combining these three parts—mechanical, electronic, and coding—robots come to life and do amazing things.

Robotics Advanced Kit

About Robotics Advanced Kit 1

The Robotics Advanced Kit (RAK) is a comprehensive tool for young innovators who are curious to explore the subject of robotics. It features the Robotics FULL 2.0 BLE Brain, which powers the kit’s projects. The kit also includes exciting projects, thereby encouraging creativity and problem-solving in students. With hands-on components and coding opportunities, RAK makes robotics fun-filled and accessible, inspiring students to think critically about robotics and innovate its programming. Let us explore its various components.

Electronics Parts

• Long Connecting Cable × 1 • USB Cable × 1

Construction Parts

Plastic Parts

1. FULL 2.0 Brain × 1 BLE
High Speed Motor × 2
High Torque Motor × 1
IR Sensor × 2
5. Touch Sensor × 1 6. Avishkaar Rechargeable Battery × 1 7. Adapter × 1
Manual Remote × 1
9. • Short Connecting Cable × 4
10. Male to Male DC Jack × 1
1.

Metal Parts

A comprehensive metal design system allows you to make from easy to complex mechanical bot designs.

The Motors

Let's understand how the motors work.

Robots move in different directions by the combination of the rotation from each wheel. For example: Robot Movement

Basics of Building

Let’s understand some basics of building:

Tightening Screws:

Tightening Axle Lock:

Tightening a Motor to a Plate:

Tighten (Rotate Clockwise)

Loosen (Rotate Anti-Clockwise)

Tighten (Rotate Clockwise)

Loosen (Rotate Anti-Clockwise)

About the Brain

Robotics FULL 2.0 BLE Brain

Let’s understand how the Full 2.0 Brain works.

Let’s understand how the Full 2.0 BLE Brain works.

the Ultrasonic Sensor to the brain.
This port powers the brain using the battery via Male to Male DC Jack.

Building a Remote Control Car

1 Insert the axle lock and the 3.5" axles into the high-speed motors, as shown.

2 After attaching the axles to both motors, screw them to the chassis using the 6mm bolts, as shown.

3 Repeat the previous step to attach the second high-speed motor to the other side of the chassis.

4 Add a filler to the axle, then add the wheel and lastly add another axle lock. Do this for both axles.

5

Screw a 7.5 inch rectangular plate using 12 mm bolts with the first two holes of both the right and left sides of the chassis

6 Attach two U-Beams, one on top of the other using 6mm bolts. Then, screw the Caster wheel to both U-Beams using 2 K-nuts and 6mm bolts, as shown below.

7 Attach the previous assembly to the chassis as shown, with 12 mm bolts.

8 Screw the Battery at the bottom of the chassis using 6mm bolts as shown.

9

Screw the Brain to the chassis using 6mm bolts. Connect the Brain to the Battery using Male to Male DC Jack wire

About Coding Interface

10

Connect the left motor to the "M4" port and the right motor to the "M3" port of the Brain using the short connecting cables

The coding interface serves as the central hub for your kit, acting as an Integrated Development Environment (IDE) that enables you to write code for all of your experiments. This code is then transferred to the hardware.

The coding interface consists of the following components:

1. Workspace Area: This is where you drag blocks for the code you want to write.

2. Blocks Panel: The blocks from the Blocks Panel help make your code.

3. Share Code: The Share Code option in the File drop-down menu generates a link for the project to share with others.

4. Control Buttons: The Control Buttons consist of Save, Compile, and Connect buttons.

• Save Button: The Save button helps save your code.

• Compile Button: The Compile button helps compile your code.

• Connect Button: The Connect button helps burn your code to the hardware.

5. Arena: This is where you can see the output.

6. Buttons: The buttons help move the bot front, back, left, or right. The buttons also help rotate the bot clockwise and anticlockwise in the virtual arena.

7. Play Button: The Play button runs the code.

8. Reset Button: The Reset button resets the arena.

Burning Your Code

Burning means loading your code into the hardware. This process, mainly, has the phases as shown:

Arrange the blocks to create the code Save the code

Compile the code Burn the code

In case of error, recheck the code.

1. Once you have completed your experiment, connect the bot to a PC/Laptop using a USB cable or Bluetooth.

2. Save and compile your code by clicking on the Save and Compile buttons, respectively.

3. Now, click on Connect

4. Click on the USB Connect option or the BLE Connect (Bluetooth) option.

5. Click on the Connect Device button, and a small window will appear. Thereafter, select your connected device, and then click on Connect

6. Now click on Burn to write your program into the bot.

7. You have successfully written your code into the hardware. Now you can experiment on the bot.

Experiment 1: Bot Movements Using Motor Control 2

Objective

Learn how to control a robot by making it move forward, backwards, left, and right using motors. This helps in understanding the basics of how robots work and is a great start to learning robotics!

Background

In this experiment, the concept of time delay is used to suspend the execution of a program for a particular time. Let us understand this by looking at the process of cooking a dish in the microwave. Start

Put the dish in the microwave.

Set the timer of the microwave.

Take the dish out. Wait for the buzzer to beep.

Let’s Code

1. Click on the Control category from the Blocks panel.

2. Drag the My Program block to the workspace to begin your program.

3. Drag the Move Motor at the block from the Motor category and drop it inside the My Program block.

4. Configure the motor at Port4 (Advance) as clockwise by selecting the Clockwise option from the drop-down.

5. Select the speed of the motor as High, Medium, or Slow from the Speed drop-down.

6. Similarly, drag another Move Motor at the block and drop it below the previous block.

7. Select the Port3 (Advance) option from the drop-down menu.

8. Configure the motor at Port3 as anticlockwise by selecting the Anticlockwise option from the drop-down menu.

9. Select the speed of your choice from the Speed drop-down menu.

10. Drag the Time block from the Control category and drop it below the second Move Motor at block.

11. Type "2000" in the value box of the block. This will allow the forward movement of the motor for 2000 milliseconds or 2 seconds.

12. To move the bot forward for infinite time, use the Repeat while block from the Loops category with the Move Motor at blocks.

13. Similarly, to turn the bot backwards, configure the motor at Port4 as Anticlockwise and Port3 as Clockwise by making the respective selections from the drop-down menus.

14. To move the bot backwards for infinite time, use the Repeat while block from the Loops category with the Move Motor at blocks.

15. To turn the bot to the right, configure the motor at Port4 and Port3 as Anticlockwise and add a delay of 1100 ms by adding a Time block.

16. To turn the bot to the left, configure the motor at Port4 as Clockwise and Port3 as Clockwise too.

Note: When you turn the bot left or right, the time value may vary from system to system. Therefore, to make a 90 degree turn, you can configure the time value accordingly.

17. Give a name to your program, save it, and then compile it.

18. Now, the program is ready to burn on the RAK.

Scan QR code to view output

A. Tick () the Correct Option.

1 Which block is used to start your program?

a  My Program

c  Begin Program

2 The execution of all the blocks in a code occur

a  timely

c  in a loop

b  Start Program

d  Your Program

b  step by step

d  with delay

3 In which direction should the motors rotate to turn the robot to the left?

a  Both motors clockwise

c Left motor clockwise, right motor anticlockwise

B. Answer the Following.

b Both motors anticlockwise

d Left motor anticlockwise, right motor clockwise

1 How should the motors be configured to move the robot in the right direction?

2 What is the use of the "Repeat while" block?

C. Apply Your Learning.

1 Where can you see the applications of a moving robot in daily life?

2 What will happen in your project if you don’t use the "Repeat while" block?

3 Experiment 2: Object Avoider

Objective

To create an object detection bot and teach it how to move around by itself. This will help the bot avoid obstacles and choose a path on its own in real time.

Things Around Us

The concept of object avoider is mostly used in the automatic vacuum cleaners.

Let’s Build

• Attach the IR sensor to the front on holes 1 and 2 in row 4 of the chassis of the RC car.

• Connect the IR sensor to Port S5 of the Brain.

Let’s Code

1. Click on the Control category from the Blocks panel.

2. Drag the My Program block to the workspace to begin your program.

3. Drag the Repeat while block from the Loops category and drop inside the My Program block to begin the infinite loop. This block is set to true by default.

4. Click on the Variables category.

5. Click on the Create Variable button. A pop-up box appears asking you to enter a New variable name

• Enter a suitable variable name, let’s say "IR_Sensor" to store the data of the IR sensor value received from the sensor.

• Click on the OK button.

6. Drag the set to block from the Variables category and drop it inside the Repeat while block.

7. Then drag the Read IR Sensor at the block from the Sensor category and attach this block with the set to block.

8. Select the "Port5 (Advance) " option from the dropdown menu of the Read IR Sensor at the block.

9. Drag the if block from the Control category and drop it below the set to block.

10. Click on the settings icon of the if block. A pop-up box appears.

11. Drag the else block and drop it below the if block in the pop-up box.

12. Click on the settings icon again to close the pop-up box.

13. Drag the equal operator block from the Control category and attach it to the right of the if block.

14. Select the '>' option from the drop-down of the equal operator block.

15. Drag the IR_Sensor block from the Variables category and drop it in the left part of the greater than operator block.

16. Now, drag the number block from the Math category and drop it in the right part of the greater than operator block. Type "400" for the text part of the number block.

17. If the value of the IR_Sensor variable is greater than 400, i.e., the IR Sensor senses the object, then blocks under the if block will be executed, else the blocks under the else block will be executed.

18. Drag the Print Data block from the Display category and drop it inside the do condition block.

19. Drag a Text Box block from the Text category and drop it inside the blank area of the Print Data block. Type "Object Detected" in the Text Box block.

20. Now, drag two Move Motor at blocks from the Motor category for Port4 (Advance) and Port3 (Advance) to Stop the two motors. This will instruct the bot to stop.

21. Drag and drop the Time block from the Control category. This will instruct the bot to stop for 1000 milliseconds or 1 second when the IR sensor detects an object.

22. Drag and drop two Move Motor at blocks below the Time block.

23. Configure the motor at Port4 (Advance) as anticlockwise by selecting the Anticlockwise option from the drop-down. Select the speed of the motor as Medium

24. Similarly, select the "Port3 (Advance)" option from the drop-down of the second Move Motor at the block.

25. Configure the motor at Port3 (Advance) as clockwise by selecting the Clockwise option from the dropdown. Select the speed of the motor as Medium. This will move both the motors backwards.

26. Also, drag and drop the Time block below the Move Motor at the block.

27. Then, instruct the bot to Stop again for "1000" ms.

28. Similarly, instruct the bot to move left for "1000" ms by configuring the motor at Port4 (Advance) and Port3 (Advance) as Clockwise. You can turn the bot in any direction as you wish.

29. Thereafter, Stop the bot for "1000" ms.

30. In the else condition, instruct the bot to move forward as long as the IR sensor does not detect any object.

31. Give a name to your program, save it, and then compile it.

32. Now, the program is ready to burn on the RAK.

Scan QR code to view output

A. Tick () the Correct Option.

1 Which block is used to set the initial value of a variable?

a  Read variable b  set to

c  create variable d  Repeat while

2 The blocks related to the sensor blocks are found in which category?

a  Robot

b  Control

c  Variable d  Sensor

3 Which icon should be clicked to add the "else blocks" with the "if" block?

a  settings

c  control

B. Answer the Following.

1 What is the use of the "greater than" block?

2 What is the purpose of the "Print Data" block?

C. Apply Your Learning.

1 How can you display a message in your program?

b  equal

d  sensor

2 Discuss any one application of the object avoider in real-life.

4 Experiment 3: Automatic Door Opener

Objective

To build a system that automates door operations using sensors and motors. It aims to apply logic and programming to create a functional system that simulates real-world automation.

Background

Functions

• A function is a reusable block of code designed to perform a specific task. It takes input, processes it, and returns an output. Functions help structure code, reduce repetition, and make programs more readable.

• Functions can be defined using the to do something block from the Functions category. All blocks placed inside this block collectively form the function definition.

• You can type a suitable name for the function, such as "My_Function", in the text part of the block.

• Since the My Program block is where the execution of all the blocks begins step by step, the function must be called inside the My Program block.

Things Around Us

This is how an automatic door opener may look like:

1 Connect the 7.5" L-Beam with the 7.5''U-Beam perpendicular to each other with K-Nuts and 12mm Bolts.

2 Connect another 7.5" L-Beam with another 7.5''U-Beam perpendicular to each other with Nuts and Bolts as shown.

3 Insert two Bolts and fix two Nuts in between the 7.5'' U-Channel as shown.

4 Tighten the Bolts with K-Kuts from the back side as shown.

5 Take two High Speed Motors, two 3.5'' Axles, and two Axle Locks and fix them all together with the U- Channel as shown.

6 Insert two Small Spur Gears and two Axle Locks into the 3.5'' Axles as shown.

7 Attach the IR sensor facing downwards to the 7.5'' U - Channel as shown.

8 Attach all three assemblies with four Nuts and Bolts.

9 Attach two Rack Gears to two 7.5'' Rectangular Plates.

10 Now, insert the Rectangular Plates from top to bottom.

11 Now, attach the Brain to the 7.5" L - Beam using 6mm Bolts.

1. Click on the Control category from the Blocks panel.

2. Drag the My Program block to the workspace to begin your program. The execution of all the blocks present inside this will occur step by step.

3. Drag the Repeat while block from the Loops category and drop it inside the My Program block to begin the infinite loop. The loop value is set to true by default.

4. Click on the Variables category.

• Enter a suitable variable name, let us say 'Door_Flag'.

• Click on the OK button.

5. Click on the Create variable button. A pop-up box appears asking you to create a new variable name.

6. Drag the set to block from the Variables category and drop it inside the Repeat while block.

7. Drag the number block from the Math category and attach it to the set to block. The number block is set to '0' by default.

8. Drag the if block from the Control category and place it below the set to block. Let’s Code

9. Drag the equal operator block from the Control category and drop it to the right of the if block. Select the not equal to option from the drop-down menu of the equal operator block.

10. Drag the Read IR Sensor at block from the Sensor category and drop it in the left part of the not equal to operator block.

11. Drag the number block from the Math category and drop it in the right part of the not equal to operator block. The number block is set to '0' by default.

12. Now, drag another if block and place it in the do part of the first if block.

13. Drag the equal operator block and drop it to the right of the second if block.

14. Drag the Door_Flag block from the Variables category and drop it in the left part of the equal operator block.

15. Drop the number block in the right part of the equal operator block.

16. Drag the to do something block from the Functions category and drop it anywhere in the workspace. Type "Door_Movement" in the text part of the block.

17. Now, we will drag and drop the blocks inside the to Door_Movement block to define the "Door_Movement" function.

18. Drag two Move Motor at blocks from the Motor category and drop them inside the to Door_Movement block.

19. Configure the motor at Port3 (Advance) as Clockwise and the motor at Port4 (Advance) as Anticlockwise.

20. Drag the Time block from the Control category and drop it below the second Move Motor at block. Type '400' in the value box of the bot to move the bot backwards for 400 milliseconds (ms).

21. Similarly, set conditions to stop the bot for 1000 milliseconds (ms), move the bot forward for 400 milliseconds and then stop the bot again.

22. Now, drag the Door_Movement block from the Functions category and drop it in the do part of the second if block.

23. Drag the set to block from the Variables category and drop it below the Door_Movement block.

24. Drag the number block and attach it to the right of the set to block. Type '1' in the value box of the number block.

25. Give a name to your program, save it, and then compile it.

26. Now, the program is ready to burn on the RAK.

Scan QR code to view output

A. Tick () the Correct Option.

1 Which among the following blocks is used for defining a function?

c d  None of these

2 Which among the following sensors has been used in the experiment?

a  Touch Sensor

c  IR Sensor

3 What is the primary advantage of using functions in a program?

a  They make the program run faster.

b  They eliminate the need for variables.

c  They allow code reuse and improve readability.

d  They ensure the program is free of errors.

B. Answer the Following.

1 What is a function?

b  Sound Sensor

d  Temperature Sensor

2 Under what conditions does the door automatically open as per the experiment?

C. Apply Your Learning.

1 How does the automatic door opener experiment demonstrate the use of sensors in real-life applications?

2 In what way can automatic doors be useful for people with disabilities?

5 Experiment 4: Toy Parking Station

Objective

To create a car parking lot using IR sensors, with which the door can open automatically and the car can enter.

Let’s Build

1 Connect the 2.5" L-Channel to the 7.5" Rectangle in the RC Car assembly using K-Nuts and 12mm Bolts.

2 Similarly, connect another 2.5" L-Channel to the 7.5" Rectangle

3 Connect the High Torque Motor to the 2.5" Square Plate using an Axle Lock, a 3.5" Axle, and Bolts.

4

Connect the Small Spur Gear to the Square Plate using a Filler, an Axle, and an Axle Lock.

5 Connect the Medium Spur Gear to the Square Plate using a Filler, an Axle, and an Axle Lock.

6

Connect the 7.5" U-Beam to the Axle connected to the Medium Spur Gear using a 3-Hole Connector, an Axle Lock, Nuts, and Bolts.

7 Connect the IR Sensor to the U-Beam using Bolts.

8 Connect the Square Plate in the assembly from the previous step to the L-Channel in the assembly from step 2 using Nuts and Bolts.

1. Click on the Control category from the Blocks panel.

9 Insert an Axle Lock in the Axle connected to the Medium Spur Gear to tighten the assembly.

10 Finally, we have completed the assembly for the Toy Parking Station as follows:

2. Drag the My Program block to the workspace to begin your program. The execution of all the blocks present inside this occurs step by step.

3. Click on the Variables category.

4. Click on the Create variable button. A pop-up box appears asking you to create a new variable name.

• Enter a suitable variable name, let us say "IR_Sensor".

• Click on the OK button.

5. Drag the set to block from the Variables category and drop it inside the My Program block.

6. Drag the number block from the Math category and attach the block to the set to block. The number block is set to '0' by default.

7. Drag the Repeat while block from the Loops category and drop it below the set to block to begin the infinite loop. The loop value is set to true by default.

8. Drag another set to block inside the Repeat while block.

9. Drag the Read IR Sensor at block from the Sensor category and attach it to the set to block. Select 'Port5 (Advance)' option from the drop-down of the Read IR Sensor at block.

10. Drag the if block from the Control category and place it below the set to block.

11. Click on the settings icon of the if block. A pop-up box appears.

12. Drag the else block and place it below the if block in the pop-up box (refer to the image below).

13. Click on the settings icon to hide the pop-up box.

14. Drag the equal operator block from the Control category and drop it to the right of the if block. Select '>' option from the drop-down menu of the equal operator block.

15. Drag the IR_Sensor block from the Variables category and drop it to the left of the greater than operator block.

16. Drag the number block from the Math category and drop it to the right of the greater than operator block. Type '400' in the text part of the number block.

17. Drag the Print Data block from the Display category and drop it in the do part of the if block. The Print Data block is set to Row1 by default.

18. From the Text category, drag the Text Box block and drop it in the empty space of the Print Data block. 19. In the Text Box block, type the text "Lifting Barrier".

20. Drag the Time block from the Control category and drop it below the Print Data block. Type '500' in the text part of the block to set the time to 500 milliseconds (ms) or 0.5 seconds.

21. Drag the Move Motor at block from the Motor category and drop it below the Time block. Configure the motor at Port2 (Advance) as Clockwise. The block is set to High speed by default.

22. Drag and drop the Time block below the Move Motor at block. Type '2000' for the text part of the Time block to set the time to 2000 milliseconds (ms) or 2 seconds.

23. Similarly, drag and drop the Move Motor at block below the last Time block. Configure the motor at Port2 (Advance) to Stop.

24. Drag and drop the Time block below the last Move Motor at block. Type '2000' in the text part of the Time block.

25. Now, drag and drop the Move Motor at block below the last Time block. Configure the motor at Port2 (Advance) as Anticlockwise.

26. Drag and drop the Time block below the last Move Motor at block. Type '2000' in the text part of the Time block.

27. Drag and drop the Move Motor at block below the last Time block. Configure the motor at Port2 (Advance) to Stop

28. Drag the Print Data block from the Display category and attach it to the else block. The Print Data block is set to Row1 by default.

29. From the Text category, drag the Text Box block and drop it in the empty space of the Print Data block.

30. In the Text Box block, type the text "Barrier Enabled".

31. Now, drag and drop the Move Motor at block below the Print Data block. Configure the motor at Port2 (Advance) to Stop.

32. Give a name to your program, save it, and then compile it.

33. Now, the program is ready to burn on the RAK.

Scan QR code to view output

A. Tick () the Correct Option.

1 Which of the following blocks is found in the 'Loops' category?

2 Which of the following is not a category in the Blocks panel? a  Control b  Text c  Sensor d  Time

3 What is the default value of the number block?

B. Answer the Following.

1 Write the steps to arrange the blocks in the given order.

2 Write the steps to arrange the blocks in the given order.

C. Apply Your Learning.

1 Which device helps the self-driving car detect obstacles and open the car parking door automatically?

2 At a railway crossing, a boom barrier comes down when a train is about to pass. Why do you think the boom barrier is important at the railway crossing?

6 Experiment 5: Soccer Bot AI

Objective

To play a soccer game using a soccer robot, a gaming robot.

Background

Artificial Intelligence (AI)

Artificial Intelligence or AI, is the field of computer science that deals with the study of the principles, concepts, and technology for building machines that enable them to think, act, and learn like humans. Machines possessing AI should be able to mimic human traits like making decisions, recognising patterns, predicting outcomes based on certain actions, learning, and improving on their own.

Natural Language Processing (NLP)

NLP is a domain of AI that enables computers to understand human language and generate appropriate responses when we interact with them. It allows computers to talk to us in a way that feels natural to us. Popular examples of NLP applications include Google Assistant, Siri, Alexa, Google Translate, etc.

Computer Vision

Computer Vision is a domain of AI which uses cameras to see and understand visual information.

Things Around Us

Some real-life examples of natural language processing are:

1. Virtual Assistants
2. Language Translation Apps

1. Face Recognition in Smartphones 2. Self-Driving Cars 3. Medical Imaging and Diagnostics

Soccer Bot AI: Using Speech Recognition Mode

In this experiment, the use of NLP in the RAK bot includes:

• Recognising spoken commands such as "arm", "forward", "backwards", "left", and "right".

• Converting spoken commands into actions that the RAK can execute.

• Detecting user input that is not clear and prompting the user to repeat the commands.

Let’s Code

1. Click on the Control category in the Blocks panel.

2. Drag the My Program block to begin your program. The execution of all the blocks present inside this will occur step by step.

3. Drag the repeat while block from the Loops category and drop it inside the My Program block to begin the infinite loop. The loop value is set to true by default.

4. Click on the Variables category.

5. Click on the Create variable button. A pop-up box appears asking you to enter a new variable name.

• Enter a suitable variable name, let us say "Speech".

• Click on the OK button.

6. Drag the set to block from the Variables category and drop it inside the repeat while block.

7. Drag the get recognised speech block from the Speech Recognition category and attach it to the set to block.

8. Now, drag the if block from the Control category and drop it below the set to block.

9. Click on the settings icon of the if block. A pop-up box appears.

10. Drag the else if block and drop it below the if block in the pop-up box. Repeat this four times (refer to the image below).

11. Click on the settings icon again to hide the pop-up box.

12. Now, drag the includes block from the Text category and attach it to the if block.

13. Drag the Speech block from the Variables category and drop it in the left text box of the includes block.

14. Type "arm" in the right text box of the includes block.

15. Now, drag the Print Data block from the Display category and drop it in the do part of the if block.

16. Drag the Text Box block from Text category and drop it in the empty part of the Print Data block. In the Text Box block, type "Moving Arm".

17. Now, drag the Move Motor at block from the Motor category and drop it below the Print Data block.

18. Configure the Motor at Port2 (Advance) as anticlockwise by selecting the Anticlockwise option from the drop-down.

19. Select the speed as Medium from the Speed drop-down menu.

20. Drag the Time block from the Control category and drop it below the Move Motor at block.

21. Type "2000" in the value box of the block. This will allow the movement of the motor for 2000 milliseconds or 2 seconds.

22. Similarly, drag another Move Motor at block and drop it below the Time block.

23. Configure the Motor at Port2 (Advance) as clockwise by selecting the Clockwise option from the dropdown.

24. Select the speed as Medium from the Speed drop-down menu.

25. Drag the Time block and drop it below the Move Motor at block.

26. Type "2000" in the value box of the block. This will allow the movement of the motor for 2000 milliseconds or 2 seconds.

27. Now, drag the includes block from the Text category and attach it to the first else if block.

28. Drag the Speech block from the Variables category and drop it in the left text box of the includes block.

29. Type "forward" in the right text box of the includes block.

30. Now, drag the Print Data block from the Display category and drop it in the do part of the else if block.

31. Drag the Text Box block from the Text category and drop it in the Print Data block. In the Text Box block, type "Forward".

32. Now, drag the Move Motor at block and drop it below the Print Data block.

33. Configure the Motor at Port4 (Advance) as clockwise by selecting the Clockwise option from the drop-down.

34. Select the speed as Medium from the Speed drop-down menu.

35. Drag another Move Motor at block and drop it below the previous Move motor at block.

36. Configure the Motor at Port3 (Advance) as anticlockwise by selecting the Anticlockwise option from the drop-down. This will move the bot in the forward direction.

37. Select the speed as Medium from the Speed drop-down menu.

38. Similarly, set the conditions for "backward" in the second else if block as shown in the figure below.

39. Similarly, set the conditions for "left" in the third else if block as shown in the figure below.

40. Similarly, set the conditions for "right" in the fourth else if block as shown in the figure below.

41. Name your program, save it, and then compile it.

42. Now the program is ready to burn on the RAK.

Note: The RAK should be connected to your computer through a Bluetooth or USB cable for the experiment to run.

43. Click on the Run button in the AI window.

44. Allow the system to use your microphone to hear your commands.

45. Click on the microphone button in the AI window

46. Give any command (arm, forward, backwards, left or right). Here, the AI detects the voice as "forward".

47. Click on the microphone button again and observe the output.

Soccer Bot AI: Using Camera Capture Mode

• The AI model is trained to detect specific handposes, such as palm, fist, and fingers.

• Once trained, the model can identify these gestures in real-time.

• Each gesture then triggers specific actions within the game, such as moving forward, backwards, turning left, or turning right.

This allows players to control the bot with hand movements.

Instructions

Before we start writing the code, let us train our AI Model. Follow the given steps:

1. Allow the system to use your camera.

2. Click on the Configure AI Model button in the AI Window on the right of your screen.

3. Choose your model by selecting Handpose from the Create Your Model pop-up window.

4. Add a name for your model and click on the Save button. You can also skip it.

5. Now, add the label name 'Palm' and click on the Save button.

6. Click on the Start Recording button and show your palm up to 60 Frames on the camera.

7. Now, click on the Plus sign in the top left corner and add a name for Label 2. Here, the name of Label 2 is "Fist". Then, click on the Save button.

8. Similarly, record different fist postures up to 60 Frames on the camera.

9. Similarly, add other labels such as 1 Finger, 2 Fingers and 3 Fingers.

10. Now, click on the Train Model button to train the AI on the recorded handposes. It will take a few minutes.

11. Add an appropriate model name and save it.

12. Test your model to check whether the AI is able to recognise the palm, fist, and different number of fingers correctly.

13. Now, click on the Download button.

14. You are now ready to write your code.

Let’s Code

1. Click on the Control category in the Blocks panel.

2. Drag the My Program block to begin your program. The execution of all the blocks present inside this will occur step by step.

3. Drag the repeat while block from the Loops category and drop it inside the My Program block. The block is set to true by default.

4. Now drag the if block from the Control category and drop it inside the repeat while block.

5. Click on the settings icon of the if block. A pop-up box appears.

6. Drag the else if block and drop it below the if block in the pop-up box. Repeat this five times (refer to the image below).

7. Click on the settings icon again to hide the pop-up box.

8. Drag the equal operator block from the Control category and attach it to the if block.

9. Now, drag the get detected AI label block from the AI category and drop it in the left part of the equal operator block.

10. Drag the Palm block from the AI category and drop it in the right part of the equal operator block.

11. Now, drag the Move Motor at block from the Motor category and drop it in the do part of the if block.

12. Configure the motor at Port2 (Advance) as anticlockwise by selecting the Anticlockwise option from the drop-down.

13. Select the speed as Medium from the Speed drop-down menu.

14. Drag the Time block from the Control category and drop it below the Move Motor at block.

15. Type "2000" in the value box of the block. This will allow the movement of the motor for 2000 milliseconds or 2 seconds.

16. Similarly, drag another Move Motor at block and drop it below the Time block.

17. Configure the Motor at Port2 (Advance) as clockwise by selecting the Clockwise option from the dropdown.

18. Select the speed as Medium from the Speed drop-down menu.

19. Drag the Time block and drop it below the Move Motor at block.

20. Type "2000" in the value box of the block. This will allow the movement of the motor for 2000 milliseconds or 2 seconds.

21. Similarly, drag another equal operator block and attach it to the first else if block.

22. Now, drag the get detected AI label block and drop it in the left part of the equal operator block.

23. In the right part of the equal operator block, drag and drop the Palm block from the AI category. Select the Fist option from the drop-down of the Palm block.

24. Now, drag the Move Motor at block and drop it in the do part of the first else if block.

25. Configure the Motor at Port4 (Advance) as clockwise by selecting the Clockwise option from the drop-down.

26. Select the speed as Medium from the Speed drop-down menu.

27. Again, drag the Move Motor at block and drop it below the previous Move Motor at block.

28. Configure the Motor at Port3 (Advance) as anticlockwise by selecting the Anticlockwise option from the drop-down.

29. Select the speed as Medium from the Speed drop-down menu.

30. Now, drag the Print Data block from the Display category and drop it below the Move Motor at block.

31. Drag the Text Box block from the Text category and drop it in the empty part of the Print Data block. In the Text Box block, type "Forward".

32. Similarly, set the conditions for "1 finger" in the second else if block as shown in the figure below.

33. Similarly, set the conditions for "2 finger" in the third else if block as shown in the figure below.

34. Set the conditions for "3 finger" in the fourth else if block as shown in the figure below.

35. Now, set condition for "none" (if none of the above handposes is detected) in the fifth else if block as shown in the figure below.

36. Give your program a name, save it, and then compile it.

37. Now the program is ready to run on the RAK.

Note: The RAK should be connected to your computer through a Bluetooth or USB cable for the experiment to run.

38. Click on the Run button on the AI window.

39. Show any handpose (Palm, Fist, or Finger) on the camera.

40. Observe the output.

Scan QR code to view output

A. Tick () the Correct Option.

1 Which AI domain is used to convert spoken commands into actions on the RAK?

a  Machine Learning b  Natural Language Processing

c  Computer Vision d  Data Science

2 Which block is used to display a message like "Forward" or "Backward" on the screen?

a  includes b  get recognised speech

c  Print Data d  Move Motor at

3 What gesture will make the bot move forward?

a  Fist

b  Palm

c  1 Finger d  2 Fingers

B. Answer the Following.

1 What is the purpose of Natural Language Processing (NLP) in this experiment?

2 Explain the role of the "Move Motor at" block in controlling the bot.

C. Apply Your Learning.

1 If you want the bot to stop moving when there is no command, how could you modify the code?

2 Name any two real-life examples of NLP and CV.

Maker Board

Exploring the Hardware Kit 1

About Maker Board

Maker Board is an easy-to-use electronic platform that helps you to make innovative projects. It consists of a 5×5 RGB LED matrix, a buzzer, four push buttons and six GPIO pins.

You can use your creative ideas using the Maker Board by controlling its electronic sensors and modules. You can make and play interactive games using the LED matrix and the push buttons. You can make a piano, a snake game, a smart band, and many more such things.

Components of the Hardware Kit

The Maker Board robotics kit contains the following components:

The Maker Board can be programmed using the Maker Studio coding interface, an easy-to-use Graphical User Interface (GUI) block-based coding platform.

1. Maker Board 2. IR Sensor
3. Servo Motor 4. LEDs
5. Jumper Cable 6. Batteries
7. LDR Sensor
8. Rain Sensor

Detailed Description of the Components

1. GPIO Pads

There are 4 Pulse Width Modulation (PWM) pins and 2 Analog to Digital Converter (ADC) pins, which make a total of 6 General Purpose Input Output (GPIO) pins to interface with analog and digital sensors, LEDs, Motors, etc., using jumper cables and alligator clips.

2. Power Pins

1 VCC pin—This pin outputs a regulated voltage of 3.3V.

2 GND pins—Power Output (0V).

1 VIN pin—The input voltage to the Maker Board when it is using an external power source.

3. Programming LED Matrix

An LED matrix is a grid of addressable Red, Green, and Blue (RGB) LEDs arranged in rows and columns. In this, a total of 25 addressable RGB LEDs are used, which can be controlled individually. An LED matrix can be used to display animations or scroll text, numbers, patterns, etc. It can also be used to make different types of 8-bit games.

4. Push Buttons

There are 4 on-board push buttons named A, S, W, and D to perform various operations like activate, deactivate or move the blinking light of the LED in different directions.

5. Buzzer

The buzzer is used to make different types of sounds at distinct frequencies and at different beats per minute.

6. Reset Button

The reset button is used to restart any program loaded in the Maker Board.

7. Bluetooth Module (HC-05)

The Bluetooth module gets you started with the possibilities of IoT and enables wireless controlling of various equipment connected to the Maker Board.

IoT stands for Internet of Things which refers to a network of interconnected devices embedded with sensors and software, enabling them to collect, exchange data, and make autonomous decisions.

8. Standoff Holes

These holes are present to ensure that the Maker Board can be safely used on electrically conductive surfaces.

About Maker Studio Coding Interface

The Maker Studio coding interface acts as an integrated development environment that allows you to write code for all of your projects. This code is then loaded into the Maker Board.

The Maker Studio coding interface consists of five major components:

1. A workspace area to drag blocks for the code you want to create.

2. A blocks panel, which contains all the blocks required to make your code.

3. The Share Code option in the File drop-down menu generates a shareable link for the project.

4. Buttons to save, compile, and burn your code.

5. The Simulator Window to see the output.

Burning Your Code into Maker Board Hardware

Burning means loading your code into the Maker Board hardware. This process, mainly, has the following phases:

Arrange the blocks to create the code Save the code

Compile the code Burn the code

In case of error, recheck the code.

Experiment 1: Count till 10 2

Objective

Let’s make a program to understand the programming of variables and display counting till 10 on the Maker Board.

Background

Variables

• In coding, variables are objects that can be manipulated rather than just a placeholder for an unknown value.

• Variables are used to store information to be referenced and manipulated in a computer program. They also provide a way of labelling data with a descriptive name, so our programs can be understood more clearly by the reader and ourselves.

• Consider variables as containers that hold information. Their sole purpose is to label and store data in memory. This data can then be used throughout your program.

Things Around Us

Some of the real-life examples are:

Let’s Code

1. Click on the Control category from the Blocks panel.

1. Speed in the online game
2. Traffic signal
3. Digital wrist watch

2. Drag and drop the My Program block to begin your program. The execution of all the blocks present inside this occurs step by step.

3. Now, create a variable named "count" using the Variables category and set its value to 1.

4. Drag the count with block having the value of "i" variable from 1 to 10 skipped by 1.

5. Display the value of "i" variable using the show number block from the Display category. Choose the colour of your choice from the colour palette. Set the brightness to 100.

6. Drag and drop the wait block from the Control category and type 700 in the value box.

7. Give a name to your program, save and then compile it.

8. Now the program is ready to burn on the Maker Board, and you can use your digital display.

Note: The Maker Board should be connected to your computer through a USB for the experiment to run.

Scan QR code to view output

A. Tick () the Correct Option.

1 In coding, variables are used to:

a  Display information only

c  Only store numbers

b  Store and label data

d  Create images

2 What block do you use to start the program in the Makerboard?

a  Show number block

c  My Program block

b  Wait block

d  Variables block

3 Which block can be used to set a pause time of 700 milliseconds?

a  My Program block

c  Display block

B. Answer the Following.

1 What is the purpose of variables in coding?

b  Wait block

d  Variables block

2 Why should you connect the Makerboard to your computer using a USB?

C. Apply Your Learning.

1 Name three real-life examples of variables. How is each one used to store or display data?

2 Write the steps you would take to make a program count to 5 on the Makerboard instead of 10.

Experiment 2: TV Remote 3

Objective

Let’s make a TV remote which will show different animations on the Maker Board when the W, A, S, and D keys are pressed on the keyboard.

Background

Events

An event is an action that causes something to happen. We can use events to tell programs under what circumstance(s) a particular action or set of actions should happen.

Here are some of the events:

• Touch events (Detecting touch)

• Keyboard events (Detecting the press of a certain key)

• Mouse events (Left/right click)

As per the Input/Output system, events are considered as input and corresponding actions are considered as output.

Things Around Us

Some of the real-life examples of remote controls are:

1. Television remote
2. Remote control for games

1. Click on the Control category from the Blocks panel.

2. Drag and drop the My Program block to the workspace to begin your program. The execution of all the blocks present inside this block occurs step by step.

3. Drag and drop the repeat while block from the Loops category inside the My Program block to begin the infinite loop.

4. Drag the If button block from the Button category and drop it inside the repeat while block to set the condition for button "W" to be pressed.

5. Drag the show animation block from the Display category and drop it inside the If button block.

6. Select the Basketball animation from the drop-down of the show animation block.

7. Again, drag the If button block and drop it below the previous If button block to set the condition for the "A" button on the Maker Board.

8. Drag the show animation block from the Display category and select the Exercise animation.

9. Again, drag the If button block and drop it below the previous If button block to set the condition for the "S" button on the Maker Board.

10. Drag the show animation block from the Display category and select the Snake animation.

11. Again, drag the If button block and drop it below the previous If button block to set the condition for pressing button "D" on the Maker Board.

12. Drag the show animation block from the Display category and select the Police Light animation.

13. Give a name to your program, save, and then compile it.

14. Now the program is ready to burn on the Maker Board, and you can use your TV remote.

Note: The Maker Board should be connected to your computer through a USB for the experiment to run.

Scan QR code to view output

A. Tick () the Correct Option.

1 An event is:

a  A block used to store data

c  A loop in a program

b  An action that triggers a response

d  An animation

2 Which block is used to create an infinite loop in the program?

a  My Program block

c  Repeat while block

3 Which animation will appear when the "D" key is pressed?

a  Basketball animation

c  Exercise animation

B. Answer the Following.

1 What is the purpose of an event in coding?

b  Show animation block

d  If button block

b  Police Light animation

d  Snake animation

2 What happens when you press the "W" key in this program?

C. Apply Your Learning.

1 Name two real-life examples of remote controls. What actions do they control?

2 Describe the steps you would take to make the Makerboard show a "Heart" animation when the "W" button is pressed, instead of the Basketball animation.

Experiment 3: Wandering Sprite 4

Objective

Let’s make a game with sprites on the display of the Maker Board. In this game, a sprite will be put in a cage and if it tries to escape out of the cage, the game gets over.

Background

1. Sprites

• Sprite is a two-dimensional bitmap that is a part of a larger scene.

• Sprites can be static images or the animated ones.

• Sprites have location in x and y coordinates.

• The blocks of the Sprite category are used to perform various operations related to LEDs. Sprite is a type of element which helps to develop independent animated images, text, etc., that can then be combined in a larger animation or patterns. In this category, there are blocks that help to perform different operations using these sprites.

2. Sprite Movement

• You can create a sprite, basically a character displayed as light on the Maker Board.

• You can set its colour and brightness.

• You can make it move in steps, change its direction, and set its position through x and y points.

Things Around Us

Some of the real-life examples are:

Video games like Super Mario, Pac-Man, etc.

1. Click on the Control category from the Blocks panel.

2. Drag the My Program block to begin your program. The execution of all the blocks present inside this occurs step by step.

3. Click on the Sprite category.

4. Click on the Create Sprite button to create a sprite variable with your name (for example, "Mel").

5. Drag the draw sprite block from the Sprite category and drop it inside the My Program block.

6. Type the value of the x and y coordinates as 2 and 2, respectively.

7. Choose the colour for the sprite and set the brightness to "100".

Note: By default, the sprite faces in the right direction.

8. Drag the repeat while block from the Loops category and drop it below the draw sprite block.

9. Drag the If button block from the Button category and drop it inside the repeat while block to set the condition for button "W" to be pressed.

10. To ensure that the sprite moves up when the "W" key is pressed, follow the given steps:

• Drag the turn sprite block from the Sprite category and drop it inside the If button block.

• Turn the sprite in the "left" direction by selecting "90" degrees in the drop-down.

• Drag and drop the move sprite block below the turn sprite block to move the sprite by "1" step.

• Drag and drop the turn sprite block below the move sprite block.

• Turn the sprite in the right direction by "90" degrees by selecting "right" for the direction and "90" for the degrees in the drop-down.

11. Similarly, set actions based on different events (pressing the keys A or S or D) by using the If button blocks. It will allow the user to move in the left direction, downwards, and in the right direction.

12. Drag the if block from the Control category and drop it below the last If button block.

13. Click on the settings icon of the if block. A pop-up box appears.

14. Drag the else if block and drop it below the if block three times in the pop-up box.

15. Now, let’s add conditions to not allow the sprite to move out of the cage. For this, set a log to restrict the sprite to not touch the top edge of the LED Matrix. Drag the touching edge block from the Sprite category and attach it to the right of the if block.

16. Drag the show scrolling text block from the Display category and drop it to the right of the do block.

17. Type "Game Over" for the text part of the block and set the colour to green from the colour palette and set the Brightness to "100". If the sprite touches the top edge, a scrolling text "Game Over" will be displayed.

18. Similarly, set conditions around all edges of the LED Matrix.

19. Give a name to your program, save and then compile it.

20. Now the program is ready to burn on the Maker Board, and you can play wandering sprite.

Note: The Maker Board should be connected to your computer through a USB for the experiment to run.

Scan QR code to view output

A. Tick () the Correct Option.

1 What is a sprite?

a A three-dimensional object b  A type of LED

c A two-dimensional bitmap image or animation d  A sound effect

2 Which block do you use to create a sprite in the program?

a  draw sprite block

c  My Program block

b  repeat while block

d  Create Sprite button

3 What message is displayed when the sprite reaches the edge of the LED matrix?

a  "Try Again"

c  "Game Over"

B. Answer the Following.

b  "Level Up"

d  "Congratulations"

1 Explain the purpose of x and y coordinates in sprite movement.

2 How can you make the sprite move to the right when the "D" key is pressed?

C. Apply Your Learning.

1 Give an example of a video game that uses sprites. How are sprites used in that game?

2 Describe the steps you would take to create a sprite that moves left when the "A" key is pressed and stops if it touches the left edge.

Experiment 4: Burglar Alarm 5

Objective

To make a circuit using a sound sensor that alerts you when an unauthorised person enters a room.

Things Around Us

Some real-life examples of systems using sound sensors are:

1. Home security system 2. Virtual assistants 3. Automated Door System 4. Hearing aids and assistive devices

Circuit

• Connect the G of the Sound Sensor to the Gnd of the Maker Board.

• Connect the '+' of the Sound Sensor to the Vcc of the Maker Board.

• Connect the DO of the Sound Sensor to the P1 of the Maker Board.

Maker Board
Sound Sensor

1. Click on the Control category from the Blocks panel.

2. Drag the My Program block to the workspace to begin your program. The execution of all the blocks present inside this occurs step by step, in sequence.

3. Drag the configure pin block from the Hardware category and drop it inside the My Program block. Select the P1 pin as Input from the drop-down of the block.

4. Now, drag the repeat while block from the Loops category and drop it below the configure pin block. By default, the loop value is set to true

5. Click on the Variables category.

6. Click on the Create variable button. A pop-up box appears asking you to enter a new variable name.

• Enter a suitable variable name like "sound_sensor".

• Click on the OK button. This will create a variable to store the data of the sound sensor value received from the sensor.

7. Drag the set to block from the Variables category and drop it inside the repeat while block.

8. Drag the read status block from the Hardware category and attach it to the set to block.

9. Set the value of the read status block to P1

10. Drag the if block from the Control category and place it below the set to block.

11. Click on the settings icon of the if block. A pop-up box appears.

12. Drag the else block and place it below the if block in the pop-up box (refer to the image below).

13. Again, click on the settings icon to hide the pop-up box.

14. Drag the equal operator block from the Control category and attach it to the if block.

15. Drag the sound_sensor block from the Variables category and drop it in the left value box of the equal operator block.

16. Drag the number block from the Math category and drop it in the right value box of the equal operator block. Type '1' in place of '0' in the text box of the number block. If the value of the sound_sensor variable is equal to 1, i.e., the Sound Sensor senses the sound, blocks under the if block will be executed, otherwise the blocks under the else block will be executed.

17. Drag the play tone of frequency block from the Sound category and drop it in the do part of the if block. The block is set to play the sound frequency of 1000 Hertz (Hz) by default.

18. Type "500" inside the milliseconds (ms) value box to play the sound for 500 milliseconds or 0.5 seconds.

19. Drag another play tone of frequency block and drop it below the previous play tone of frequency block.

20. Type "2000" in the Hz value box to create a higher pitch tone. Also, type "500" in its ms value box.

21. Repeat steps 17 to 20 to create a tune.

22. For the else part, drag the show LEDS block from the Display category and drop it inside the else block.

23. Select green colour from the Select color palette and click on squares of the LED matrix to change the colour, and set the brightness to "100".

24. Give a name to your program, save it, and then compile it.

25. Now the program is ready to burn on the Maker board.

Note: The Maker Board should be connected to your computer through a USB for the experiment to run.

Scan QR code to view output

A. Tick () the Correct Option.

1 Which of the following sensors has been used in the experiment?

a  Touch Sensor

c  IR Sensor

b  Sound Sensor

d  Color Sensor

2 Which of the following units represents the rate at which sounds vibrate and gives us insights into the pitch and tone of musical notes?

a  Hz

c  km

b  ms

d  None of these

3 Which of the following is an application of the burglar alarm circuit created in the experiment?

a  Home Security System

c  Smart Doorbells

B. Fill in the Blanks.

b  Google Lens

d  Both a and c

1 The "configure pin" block is available in the category of the blocks.

2 The "play tone of frequency" block is set to hertz by default.

3 In the experiment, the Sound Sensor senses the sound if the value of the sound_sensor variable is equal to

4 In the experiment, we connect the G of the Sound Sensor to the of the Maker Board.

C. Apply Your Learning.

1 How can a burglar alarm system be useful for someone who travels frequently?

2 What will happen if you reduce the 'Hz' value for the "play tone of frequency" block to half?

Experiment 5: Guest Counter

Objective

Let’s make a guest counter using an IR sensor to be used for counting the guests.

Background

IR Sensor

• An infrared (IR) sensor is an electronic device that measures and detects infrared radiation in its surrounding environment.

• Anything that emits heat (everything that has a temperature above around five degrees Kelvin) gives off infrared radiation but is invisible to the human eye.

• There are two types of infrared sensors: active and passive. Active infrared sensors both emit and detect infrared radiation. When an object comes close to the sensor, the infrared light from the LED reflects off of the object and is detected by the receiver.

• Passive infrared (PIR) sensors only detect infrared radiation and do not emit it from an LED.

Things Around Us

Some of the real-life examples:

1. Television remote
2. Automated drones

Circuit

• Connect P0 of the Maker Board with the OUT pin of the IR sensor.

• Connect the GND of the Maker Board with the GND pin of the IR sensor.

• Connect the Maker Board’s VCC to the IR sensor’s VCC pin.

Let’s Code

1. Click on the Control category from the Blocks panel.

2. Drag the My Program block to the workspace to begin your program. The execution of all the blocks present inside this occurs step by step.

3. Now create a variable named "visitor".

4. Add the set to block from the Variables category.

5. Drag the block from the Math category and attach it to the set visitor to block.

6. Drag the configure pin from the Hardware category and drop it below the set visitor to block at "P0". Set its direction to Input

7. Drag the repeat while block from the Loops category and drop it below the configure pin block.

8. Drag an if block from the Control category to add the else part.

9. Attach the equal input block to the right of the if else block.

10. Drag the read status block from the Hardware category and drop it in the left part of the equal input block.

11. Set in the right part of the equal input block from the Math category.

12. Now, drag the set visitor to block from the Variables category and drop it as shown in the figure below.

13. Drag the block from the Math block and attach it to the right part of the set visitor to block. In place of "1" at the left side of the block, insert the variable visitor block from the Variables category.

14. Now drag the show number block from the Display category and drop it below the set visitor to block.

15. In place of "0" in the show number block, insert the variable visitor block.

16. Now set the color to green from the color palette and set the brightness to 100.

17. Now drag the wait block from the Control category and set it to 1000 ms.

18. Drag the clear display block from the Display category thereafter.

19. Drag the show pattern block from the Display category and drop it in the else condition. Set it to any pattern of your choice.

20. Give a name to your program, save, and then compile it.

21. Now the program is ready to burn on the Maker Board, and you can use the guest counter.

Note: The Maker Board should be connected to your computer through a USB for the experiment to run.

Scan QR code to view output

A. Tick () the Correct Option.

1 What does an IR sensor detect?

a  Visible light b  Radio waves

c  Infrared radiation d  Sound waves

2 What type of infrared sensor emits and detects infrared radiation?

a  Passive infrared sensor b  Active infrared sensor

c  Both active and passive sensors d  Ultrasonic sensor

3 Which variable is used to store the count of guests in this program?

a  counter b  guest

c  visitor d  IR sensor

B. Answer the Following.

1 Explain the difference between active and passive infrared sensors.

2 Why do you need to set the pin direction to "Input" for the IR sensor on the Maker Board?

C. Apply Your Learning.

1 List two real-life examples of IR sensors and explain their functions.

2 Describe the steps you would follow to modify the program to count cars passing by instead of guests.

Experiment 6: Servo Sweep

Objective

Let’s make a circuit to learn about how servo motors can be used.

Background

Servo Motor

The servo motor is a special type of motor having a shaft that can move to a specific position and at a specific speed based on the received input. It is used in control applications and robotics.

The servo motor has three main parts:

A motor, a sensor, and a controller.

The motor provides the mechanical power to move or rotate the shaft.

The sensors measure the position and the speed of the shaft.

The controller works like the brain of the servo motor. It tells the motor how much to move and in which direction.

Things Around Us

Some of the real-life examples:

Circuit

• Connect P0 of the Maker Board with the Orange wire of the Servo motor.

• Connect the GND of the Maker Board with the Brown wire of the Servo motor.

• Connect the positive terminal of the battery with the Red wire of the Servo motor.

1. Car wipers
2. Boom barrier

• Connect the negative terminal of the battery with the GND of the Maker Board.

Let’s Code

1. Click on the Control category from the Blocks panel.

2. Drag the My Program block to the workspace to begin your program. The execution of all the blocks present inside this occurs step by step.

3. Drag the repeat while block from the Loops category and drop it inside the My Program block.

4. Now drag the count with block from the Loops category and drop it inside the repeat while block.

5. Now create a variable named "angle".

6. Select the variable angle in the count with block in the place of i.

7. Now set the rest of the values in the count block as given below.

Now drag and drop the move servo PWM pin block from the Hardware category.

Drag the angle variable block and place it in the move servo PWM pin block as shown in the image below.

10. Now drag a wait block from the Control category and set the value to 5 ms.

11. Similarly, drag another count with block, set the count with value to angle and set the rest of the values as given below.

12. Now again drag the move servo PWM pin from the Hardware category and add the angle block as given in the image below.

13. Now drag a wait block and set the value to 5 ms.

14. Now the program is ready to burn on the Maker Board, and you can use the servo sweep.

Note: The Maker Board should be connected to your computer through a USB for the experiment to run.

Scan QR code to view output

A. Tick () the Correct Option.

1 What is the purpose of a servo motor?

a To increase speed only

c To generate electricity

b To move to a specific position at a specific speed

d  To store data

2 Which part of the servo motor acts like its "brain" and controls its movement?

a  Motor

c  Controller

b  Shaft

d  Sensor

3 In this circuit, which wire of the servo motor is connected to the GND of the Maker Board?

a  Orange wire

c  Red wire

B. Answer the Following.

b  Brown wire

d  White wire

1 Describe the role of each main part (motor, sensor, controller) in a servo motor.

2 Why do you use a "wait" block after moving the servo motor in the program?

C. Apply Your Learning.

1 Name two real-life applications of servo motors and explain how they work in each application.

2 Explain the steps you would follow to adjust the servo motor's range of motion to sweep between 0° and 90° instead of a full 180°.

Experiment 7: Wandering Sprite 1 Using AI 8

Objective

Let’s create a game with sprites on the display of the Maker Board using AI. In this game, a sprite will be put in a cage and if it tries to escape, then the game is over.

Background

Artificial Intelligence

Artificial Intelligence or AI, is the field of computer science that deals with the study of the principles, concepts, and technology for building machines that enable them to think, act, and learn like humans. Machines possessing AI should be able to mimic human traits, i.e., making decisions, recognising patterns, predicting outcomes based on certain actions, learning, and improving on their own.

Natural Language Processing

NLP is a domain of AI that enables computers to understand human language and generate appropriate responses when we interact with them. It allows computers to talk to us in a way that feels natural to us. Popular examples of NLP applications include Google Assistant, Siri, Alexa, Google Translate, etc.

Computer Vision

Computer Vision is a domain of AI which uses cameras to see and understand visual information.

Things Around Us

Some real-life examples of NLP are:

1. Virtual Assistants
2. Language Translation Apps

1.

Face

Recognition in Smartphones 2. Self-Driving Cars

Using Speech Recogniser Mode

In this experiment, the use of NLP in the Maker Board includes:

• Recognising commands such as forward," "left," "backward," etc., to control the sprite.

• Converting spoken commands into actions that the Maker Board can execute.

• Detecting unclear input and prompting the user to repeat commands.

Let’s Code

1. Click on the Control category in the Blocks panel.

2. Drag the My Program block to begin your program. The execution of all the blocks present inside this occurs step by step.

3. Click on the Sprite category.

4. Click on the Create Sprite button to create a sprite variable with any name (for example, 'Mel').

5. Drag the draw sprite block from the Sprite category and drop it inside the My Program block.

6. Type the values of the x and y coordinates as 2 and 2, respectively.

7. Choose the colour for the sprite and set the brightness to '100'.

Note: By default, the sprite faces the right direction.

8. Drag the repeat while block from the Loops category and drop it below the draw sprite block.

9. Create a variable named "speech" using the Variables category.

10. Drag and drop the set to block and attach get recognised speech block from the Speech Recognition category as shown in the figure below.

11. Now, drag the if block from the Control category and drop it below the set to block.

12. Click on the settings icon of the if block. A pop-up appears.

13. Drag the else if block and drop it below the if block three times in the pop-up box.

14. Click again on the settings icon to hide it.

15. Now, drag the includes block from the Text category.

16. Drag the Speech block from the Variables category and drop it inside the String1.

17. Rename String2 block as forward.

18. To ensure that the sprite moves forward when it recognises the speech as "forward", follow the given steps:

• Drag the turn sprite block from the Sprite category and drop it inside the if block.

• Turn the sprite in the "left" direction by selecting "90" degrees in the drop-down.

• Drag and drop the move sprite block below the turn sprite block to move the sprite by "1" step.

• Drag and drop the turn sprite block below the move sprite block.

• Turn the sprite in the right direction by "90" degrees by selecting "right" for the direction and "90" for the degrees in the drop-down.

19. Similarly, set actions based on different commands (left, backward, and right) by using the else if blocks. It will allow the user to move in the left, backward, and in the right directions, respectively.

20. Again, drag the if block from the Control category and drop it below the last else if block.

21. Click on the settings icon of the if block. A pop-up box appears.

22. Drag the else if block and drop it below the if block three times in the pop-up box.

23. Click again on the settings icon to hide it.

22. Now, let us add conditions to not allow the sprite to move out of the cage. For this, set a log to restrict the sprite to not touch the top edge of the LED Matrix. Drag the touching edge block from the Sprite category and attach it to the right of the if block.

23. Drag the show scrolling text block from the Display category and drop it to the right of the do block.

24. Type "Game Over" for the text part of the block. Set the colour of the text to green from the colour palette and set the Brightness to "100". If the sprite touches the top edge, a scrolling text "Game Over" will be displayed.

25. Similarly, set conditions around all edges of the LED Matrix.

26. Give a name to your program, save, and then compile it.

27. Now the program is ready to burn on the Maker Board, and you can play the game.

Note: The Maker Board should be connected to your computer through a Bluetooth or USB cable for the experiment to run.

28. Click on the Run button on the AI window.

29. Allow the system to use your microphone to hear your commands.

30. Click on the microphone button present on the AI window.

31. Give any command (forward, left, backward, or right).

32. Again, click on the microphone button and observe the output on the Maker Board.

Using Camera Capture Mode

In this experiment, computer vision is used to recognise hand gestures through the Maker Board’s camera.

• The AI model is trained to detect specific hand poses, such as "Palm," "Fist," "ThumbsUp," and "Peace."

• Once trained, the model can identify these gestures in real-time.

• Each gesture then triggers specific actions within the game, such as moving or turning the sprite.

• This allows players to control the sprite with their hand movements.

Before we start writing the code, let us train our AI Model. Follow the given steps:

1. Allow the system to use your camera.

2. Click on the Configure AI Model in the AI Window.

3. Create your model by selecting Handpose

4. Add a name for your model and save it. You can also skip it.

5. Now, add the label name as 'Palm' and save it.

6. Click on the 'Start Recording' button and show your palm up to 60 frames.

7. Now, click on the Plus sign on the top-left corner and add other labels such as Fist.

8. Similarly, add other labels such as ThumbsUp and Peace.

9. Now, click on the Train Model button to train the AI about these hand poses. It will take a few minutes.

10. Add an appropriate model name and save it.

11. Test your model to check whether the gestures are working correctly, then download it.

12. You are now ready to write your code.

1. Click on the Control category from the Blocks panel.

2. Drag the My Program block to begin your program. The execution of all the blocks present inside this occurs step by step.

3. Click on the Sprite category.

4. Click on the Create Sprite button to create a sprite variable with any name (for example, 'Mel').

5. Drag the draw sprite block from the Sprite category and drop it inside the My Program block.

6. Type the values of the x and y coordinates as 2 and 2, respectively.

7. Choose the colour for the sprite and set the brightness to '100'.

Note: By default, the sprite faces in the right direction.

8. Drag the repeat while block from the Loops category and drop it below the draw sprite block.

9. Now drag the if block from the Control category and drop it below the repeat while block.

10. Click on the settings icon of the if block. A pop-up appears.

11. Drag the else if block and drop it below the if block in the pop-up box. Repeat this three times.

12. Again, click on the settings icon to hide the pop-up box.

13. Drag the equal operator block from the Control category and attach it to the right of the if block.

14. Now, drag the get detected AI label block from the AI category and drop it to the left part of the equal operator block.

15. Drag and drop the Palm block to the right part of the equal operator block.

16. To ensure that the sprite recognises the correct gesture, follow the given steps:

• Drag the turn sprite block from the Sprite category and drop it inside the do block.

• Turn the sprite in the "left" direction by selecting "90" degrees in the drop-down menu.

• Drag and drop the move sprite block below the turn sprite block to move the sprite by "1" step.

• Drag and drop the turn sprite block below the move sprite block.

• Turn the sprite in the right direction by "90" degrees by selecting "right" for the direction and "90" for the degrees in the drop-down menu.

18. Similarly, set actions based on the different hand gestures (Fist, ThumbsUp, and Peace) by using the else if blocks. It will allow the user to recognise the different hand gestures.

19. Again, drag the if block from the Control category and drop it below the last else if block.

20. Click on the settings icon of the if block. A pop-up box appears.

21. Drag the else if block and drop it below the if block in the pop-up box. Repeat this three times.

22. Now, let us add conditions to not allow the sprite to move out of the cage. For this, let us restrict the sprite from touching the top edge of the LED Matrix. Drag the touching edge block from the Sprite category and attach it to the right of the if block.

23. Drag the show scrolling text block from the Display category and drop it to the right of the do block.

24. Type "Game Over" for the text part of the block. Set the colour to green from the colour palette and set the Brightness to "100". If the sprite touches the top edge, a scrolling text "Game Over" will be displayed.

25. Similarly, set conditions around all edges of the LED Matrix.

26. Give a name to your program, save it, and then compile it.

27. Now the program is ready to burn on the Maker Board, and you can play the game.

Note: The Maker Board should be connected to your computer through a Bluetooth or USB cable for the experiment to run.

28. Observe the output on the Maker Board.

Scan QR code to view output

A. Tick () the Correct Option.

1 Which block is used to create a sprite variable in the game?

a  Create variable block

c  Create sprite block

b  Make sprite block

d  Initialise sprite block

2 In which direction does the sprite face by default when created?

a  Left

c  Up

b  Right

d  Down

3 Which gesture will be recognised if you raise two fingers in a V shape?

a  Palm

c  ThumbsUp

B. Answer the Following.

b  Fist

d  Peace

1 What steps are followed to move the sprite forward when the speech command "forward" is recognised?

2 How can you prevent the sprite from moving out of the cage in this game?

3 How does the AI model recognise different gestures?

C. Apply Your Learning.

1 Modify the game to add more speech commands such as "up" and "down" for sprite movement. How would you implement this in the code?

2 Imagine a player uses the "ThumbsUp" gesture to control the sprite. How would you use code blocks to make the sprite move in a specific direction for this gesture?

About the Book

This book introduces learners to the captivating realm of robotics, with a learner-friendly, motivating, and hands-on approach. It combines theoretical understanding with practice, through insightful examples of real-world applications, while promoting creativity and coding skills. Emphasising a project-based learning methodology, the book provides a series of projects, each with detailed instructions. These instructions can be effortlessly executed using the accompanying robotics hardware kit. The assembly and programming of the robotics systems are done through block-based coding, and simulation environments; accelerating the experiential learning journey of the learners.

Special Features

• Hands-on Experiments: Engaging experiments that allow students to build and test-run robots themselves.

• Detailed Coding Practice: Step-by-step coding instructions to program robots, making it easy for beginners to learn.

• Things Around Us: Each experiment connects robotics to real-world scenarios, showing how technology solves everyday problems.

• Comprehensive Background: Clear explanations of the concepts and the technology behind each experiment, helping students understand the "why" and the "how."

• Interactive Exercises: Exercises at the end of each experiment to reinforce learning and to challenge students to think critically.

About Uolo

Uolo partners with K-12 schools to provide technology-enabled learning programs. We believe that pedagogy and technology must come together to deliver scalable learning experiences that generate measurable outcomes. Uolo is trusted by over 15,000+ schools across India, Southeast Asia, and the Middle East.

Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.