0% found this document useful (0 votes)
25 views38 pages

Robotics Review Sheet

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views38 pages

Robotics Review Sheet

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

Lahore Grammar School

Middle Section for Girls


49-Civic Centre, Johar Town, Lahore Grade: 8

Grade 8 Robotics Review Sheets


Arduino
Activity 1: Introduction to Arduino UNO and IDE
In this chapter, you’ll explore the Arduino board as well as the IDE
software that you’ll use to create and upload Arduino sketches
(Arduino’s name for its programs) to the Arduino board itself.

Learning Objectives

∙ To understand the hardware configuration of an Arduino UNO board.

∙ .To install IDE software and explore its features.

∙ To explore the IDE software to create your first sketch

Arduino UNO
What exactly is Arduino?
According to the Arduino website (http://www.arduino.cc/), it is an open-source
electronics prototyping platform based on flexible, easy-to-use hardware and
software. It’s intended for artists, designers, hobbyists, and anyone interested
in creating interactive objects or environments. In simple terms, the Arduino is
a tiny computer system that can be programmed with your instructions to
interact with various forms of input and output. The current Arduino board
model, the Uno, is quite small in size compared to the average human hand,
as you can see in the Figure.

Although it might not look like much to the new observer, the Arduino system
allows you to create devices that can interact with the world around you. By
using an almost unlimited range of input and output devices, sensors,
indicators, displays, motors, and more, you can program the exact interactions
required to create a functional device. For example, artists have created
installations with patterns of blinking lights that respond to the movements of
passers-by, high school students have built autonomous robots that can
detect an open flame and extinguish it, and geographers have designed
systems that
monitor temperature and humidity and transmit this data back to their offices
via text message.
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

You’ll find an almost infinite number of examples with a quick search on the
Internet.2

Take a look at Arduino UNO Board


Sections with annotations below are parts that will be regularly used.
Digital pins and analog pins marked on the diagram are what we call I/O
input/output). Digital pins are numbered from 0 to 13. Analog pins are
numbered from 0 to 5.
The voltage supply is also shown in the diagram below. Arduino can be
powered either by a USB connection or through a 6~12V DC supply via
the barrel jack connector. Also integrated into the board are four LED
lights and a reset button. The LED light marked with “ON” is the power
indicator, which will be on once power is connected. The LED light marked
with ”L” is an indicator for digital pin 13. TX (transmit) and RX (receive)
are indicator lights for serial communication. When we upload a program,
these two lights will blink rapidly, showing that data is being transmitted
and received between the board and your computer.

3
Blinking LED
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

Activity 2.1 Simple LED


Circuit

Challenge:
Design a simple LED circuit using
Arduino UNO.

Testable Goal:
Arduino acts as a power source to light
up an LED.

Research: How can we use Arduino UNO as a power


source?
Brainstorm: Think about different ways you can design the
circuit.

Materials Required:
Materials Quantity
.
Arduino Uno 1

USB Cable 1

Connecting Wire 1-2

Jumper Wires 1-2

Resistor 220 ohms 1

Bread Board 1
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

Instruction Sheet
1. You’re going to use the Arduino in this project, but only as a source of power. When
plugged into a USB port or a 9-volt battery, the Arduino will provide 5 volts between
its 5V pin and its ground pin that you can use. 5V = 5 volts.
2. If your Arduino is connected to a battery or computer via USB, unplug it before
building the circuit!
3. Connect a red wire to the 5V pin on the Arduino and put the other end in one of the long
bus lines in your breadboard. Connect the ground on the Arduino to the adjacent bus
line with a black wire. It’s helpful to keep your wire color consistent (red for power,
black for ground) throughout your circuit.
5. Use a 220-ohm resistor to connect power to one side of the LED. On the other side of
the LED, connect the anode (long leg) to the positive rail or 5v power pin. With a wire
connect the cathode (short leg) of the LED to the ground. When you’re ready, plug the
USB cable into the Arduino. You should see the LED light up.

Challenge:
Design a simple Arduino circuit using an LED and a switch on Tinkercad.

Components List:

∙ Arduino UNO R3

∙ Resistor

∙ LED

∙ Connecting Wires
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

Sketch

/*********************************************************** File name:


blinky
Description: LED blinks ON and OFF.
***********************************************************/

int ledPin=8; //definition digital 8 pins as pin to control the LED


Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

void setup()
{
pinMode(ledPin,OUTPUT); //Set the digital 8 port mode, OUTPUT: Output mode
}
void loop()
{
digitalWrite(ledPin,HIGH); //HIGH is set to about 5V PIN8 delay(1000); //Set
the delay time, 1000 = 1 second digitalWrite(ledPin,LOW); //LOW is set to
about 5V PIN8 delay(1000); //Set the delay time, 1000 = 1 second }

Multiple LEDs & Breadboards


Let's learn how to control multiple LEDs using Arduino’s digital outputs and a breadboard. We'll
connect some LEDs to the Arduino Uno and compose a simple program to light them up in a
pattern. Explore the sample circuit here in the workplane, and build your own along side it. To
optionally build the physical circuit, gather up your Arduino Uno board, USB cable, solderless
breadboard, some LEDs, resistors (any value from 100-1K ohms will do), and breadboard wires.

Understanding Code
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

1. Click on the variable category in the code editor.

2. To make the speed of the animation adjustable, create a variable that will serve as the amount of time between
state changes. Name the variable "animationSpeed”.

3. At the beginning of the program, set the variable to your desired time, in milliseconds.

4. Drag the new variable animationSpeed onto the wait block to set the wait time to whatever
animationSpeed is set to. Don't forget to adjust the dropdown menu from "seconds" to "milliseconds."

5. Use another output block to set the next pin 12 HIGH, then LOW, with another pause after each.
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

6. Right click and select Duplicate to create a new copy of the block for as many LEDs as you have left, then
change the pin numbers to correspond to the connected LEDs. Test out your code by starting the simulator.

ULTRASONIC SENSOR WITH LED BULB

Ultrasonic ranging module HC - SR04 provides 2cm - 400cm non-contact measurement function, the ranging
accuracy can reach to 3mm. The modules includes ultrasonic transmitters, receiver and control circuit.This is
a simple example of using the ultrasonic sensor (HC-SR04) in Arduino where we will turn on a led with the
variation of distance and print the distance from an object to the serial monitor.

Step 1: All the Necessary Components

1. Arduino Uno

2. Ultrasonic Sensor (HC-SR04).

3. Mini-BreadBoard

4. 1 kohm Resistor.
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8
5. Jumpers.

6. Blue LED.

Step 2: Connect the Components

The connection of the components is very easy it is only necessary to follow the following pictures.
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

Ultrasonic Distance Sensor with Multiple LEDs


Let's measure distances with an ultrasonic rangefinder (distance sensor) and Arduino's digital input.
We'll connect up a circuit using a breadboard and use some simple Arduino code to control a single
LED.

You may have already learned to read a pushbutton and PIR motion sensor with Arduino's digital
input, and we'll build on those skills in this lesson.

Ultrasonic rangefinders use sound waves to bounce off objects in front of them, much like bats using
echolocation to sense their environment. The proximity sensor sends out a signal and measures how
long it takes to return. The Arduino program receives this information and calculates the distance
between the sensor and object.

Instructions

1. Explore the sample circuit here in the workplane by starting the simulation and clicking on the proximity sensor.
This will activate a highlighted area in front of the sensor with a circle "object" inside. You may need to resize the
view if the circle is off screen.

2. Click and drag the "object" circle closer and further away, noticing the changing distance values on screen.

3. In this lesson, you'll build this simulated circuit yourself along side the sample. To optionally build the physical
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

circuit, gather up your Arduino Uno board, USB cable, solderless breadboard, three LEDs, resistors (any value
from 100-1K), ultrasonic rangefinder, and breadboard wires.

Just as you’ve learned from the introductory lessons, start by wiring up your Arduino and breadboard
with power and ground next to the example circuit, then add the the three red LEDs to the
breadboard, as shown. These will be the "bar graph" lights for visually indicating the sensor's distance

measurement.

Instructions

1. Drag an Arduino Uno and breadboard from the components panel to the workplane, next to the existing circuit.

2. Connect the 5 volt and ground pins on the Arduino to the power (+) and ground (-) rails on the breadboard with
wires. You can change the wire colors if you want to! Either use the inspector dropdown or the number keys on
your keyboard.

3. Drag three LEDs on the breadboard in row E, spaced 2 breadboard sockets apart. You can change the LED color
using the inspector that pops up when you click on each one.

4. Use a 220 Ohm resistor to connect each LED's cathode (left leg) to the ground rail (black) of the breadboard.
You can change a resistor's value by highlighting it and using the dropdown menu.

5. Connect the LED anodes (right legs) to digital pins 4, 3, and 2 on the Arduino. Stuck?

Proximity sensors come in multiple flavors. Here in Tinkercad Circuits, you can choose between a
three-pin sensor or a four-pin sensor. In general, ultrasonic rangefinders have one pin that connects to
ground, another that connects to 5 volts, a third for sending a signal, and a fourth for receiving a
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

signal. The 'send' and 'receive' pins are combined into one pin on the three-pin flavor.

Instructions

1. In the circuits editor, find the ultrasonic rangefinder in the components drawer. To find the four-pin sensor, view
"All" in the components panel (using the dropdown menu).

2. Place the sensor on the breadboard to the left of the LEDs in row E, as shown in the figure.

3. Wire up the sensor so the 5V pin connects to the 5V voltage rail, the GND pin connects to the ground rail, the
SIG or TRIG pin to Arduino pin 7, and, if using the four-pin flavor, the ECHO pin connects to Arduino pin 6.
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

1. Click the "Code" button to open the code editor. The grey Notation blocks are comments for making note of
what you intend for your code to do, but this text isn't required or executed as part of the program.

2. Click on the Variables category in the code editor. Create a new variable called distanceThreshold and use a
"set" block to set it to 350 (centimeters).

3. To store the sensor value, create a variable named "cm".

4. Drag out a "set" block and adjust the dropdown to our new variable cm.

5. In the Input category, drag out a "read ultrasonic distance sensor on" block, and place it inside the set block.

6. Adjust the dropdown menus inside the input block to set the trigger pin to 7, the echo pin to "same as trigger"
and units to cm.

7. Optionally create a new variable for converting centimeters to inches with a set block and an arithmetic block
to read "set inches to (cm / 2.54)".

8. Add some serial monitoring blocks to print out the sensor distance in centimeters and inches.

9. Click the Control category and drag out an if then block, then navigate to Math and drag a comparator block
onto the if block.

10. In the Variables category, grab the cm variable and the distanceThreshold variable and drag them into the
comparator block, adjusting the dropdown so it reads "if cm > distanceThreshold then".

11. Add three digital output blocks inside the if statement to set pins 2, 3, and 4 LOW.

12. Duplicate this if statement four times and add arithmetic blocks and and/or blocks to create five total state
detection if statements. The first state is "the distance is farther than our threshold" so no LEDs light up. When
the distance is closer than or equal to the distanceThreshold and greater than distanceThreshold-100, light up
only pin 2's LED. When the temperature is between distanceThreshold-100 and distanceThreshold-250, light
up two LEDs. And so on to account for all the desired states.
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

Ultrasonic Distance sensor with Servo Motor


An ultrasonic sensor is a device that can measure the distance to an object by the use of sound
waves while a servo motor is built for precision control of the angular or linear position, velocity, and
acceleration.

Step 1: Components Needed

1) Arduino Uno x 1

2) Ultrasonic Sensor x 1

3) Servo Motor x 1

4) Breadboard

Step 2: The Working Principle

The servo motor will rotate to a certain angle depending on the distance detected by the ultrasonic
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

sensor. The distance detected will also be displayed on the serial monitor.

Step 3: Connection (Ultrasonic Sensor)


Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

1) Connect the 5V pin of the Arduino board to the bottom row of the breadboard
2) Connect the GND pin to the top row of the breadboard.

3) Connect the VCC pin of the sensor to the positive terminal of the breadboard.

4) Connect the GND pin to the negative terminal of the breadboard.

5) Connect the TRIG to pin 9 of the Arduino.

6) Connect the ECHO pin to pin 8 of the Arduino

Step 5: Connection (Servo Motor)


Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

1) Connect the positive terminal/power to the positive terminal of breadboard.

2) Connect the ground terminal of servo motor to the negative terminal of the breadboard.

3) Connect the data wire/ signal to pin 6 of the Arduino board.

PIR Motion Sensor (Digital Input)


Let's learn to sense movement in a room with a PIR motion sensor and Arduino. We'll connect up a
circuit using a breadboard and use some simple Arduino code to control three LEDs.
PIR stands for Passive InfraRed, which describes the technology inside—it passively detects infrared
light levels (unlike an infrared camera that may also emit infrared light in order to capture its
reflection). The white dome is a lens that expands the IR detector's field of vision. The sensor reports
a LOW signal by default, reads the amount of ambient infrared light coming in, and then triggers a
HIGH signal for a certain period of time when the light levels change, indicating movement. It can tell
you whether or not there is movement in a scene, but cannot detect distance.
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

1. Identify the PIR motion sensor, LED, resistor, and wires connected to the Arduino in the Tinkercad Circuits
workplane.

2. Drag an Arduino Uno and breadboard from the components panel to the workplane, next to the existing
circuit.

3. Connect breadboard power (+) and ground (-) rails to Arduino 5V and ground (GND), respectively, by
clicking to create wires.

4. Extend power and ground rails to their respective buses on the opposite edge of the breadboard by creating a
red wire between both power buses and a black wire between both ground buses.

5. Plug the LED into two different breadboard rows so that the cathode (negative, shorter leg) connects to one
leg of a resistor (anywhere from 100-1K ohms is fine).
Show hint
6.
7. Connect other resistor leg to ground.

8. Wire up the LED anode (positive, longer leg) to Arduino pin 13.
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

9. Drag a PIR motion sensor from the components panel to your breadboard, so its legs plug into three different
rows.

10. Click to create a wire connecting the rightmost leg to power.

11. Connect the center leg to ground.

12. Create a wire connecting the leftmost leg to Arduino analog pin A0.

1. Click the "Code" button to open the code editor.

2. Click on the Variables category in the code editor. Create a new variable called sensorState.

3. Drag out a "set" block.

4. We’ll store the state of our PIR motion sensor to our variable sensorState. Click on the Input block
category, drag out the the “read digital pin” block, and place it into the “set” block after the word “to”.

5. Since our sensor is connected to the Arduino on Pin 2, change the dropdown of the “read digital pin” block to
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

2. Now your blocks should read “set sensorState to read digital pin 2” which stores a digital reading of the
sensor pin into our sensorState variable!

6. Click the Control category and drag out an "if then" block.

7. Configure it to evaluate whether sensorState is equal to HIGH using a Math comparator block. Drag out the
Math comparator block into your if statement to check whether our variable sensorState is equal to HIGH.

8. We want to turn our LED on if the sensor is activated - otherwise, we want our LED to be off. Under the
Output block category, find the “set built-in LED to HIGH” block. Try adding two of these blocks to our if
statement so that the LED will only be on when the sensor is activated.

4 Way Traffic Control System - Arduino Based

This project uses the Arduino UNO to synchronize and manage a four-way traffic signal, giving a complete
solution for traffic crossings.
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

Components Required

Mini Breadboard

Arduino UNO
Traffic Light Module x 4
Male Header
Female Header
On/Off Switch
Battery Clip
9V Battery
Circuit Diagram

The power source in the circuit schematic is a 9-volt battery that can be turned on and off using a switch. The
configuration includes the Arduino UNO, the central component. The Arduino is linked to four traffic light
modules, each of which represents a signal pole. Each traffic light module’s circuitry has 100-ohm resistances
connected in series with the red, yellow, and green LEDs’ positive terminals. Each signal pole’s LEDs are wired
to a distinct pin on the Arduino. For example, the LEDs of pole 1 are allocated pins 2, 3, and 4, while pole 2 is
assigned pins 5, 6, and 7. Pins 8, 9, and 10 correspond to pole 3, and pins 11, 12, and 13 correspond to pole 4.
The Arduino’s ground pin is linked to the common ground pins of each of the four modules.
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

Code Explaination :

The code given is for an Arduino microcontroller software that controls a series of LED traffic signal lights for
four separate poles. Each pole has three LEDs, which stand for the red, yellow, and green signals, and these
LEDs are attached to designated pins on the Arduino board. Variables for each signal’s open times are
initialized by the code, along with a variable that indicates how long the yellow signal will last until turning
green. There are further variables to monitor the current mode of operation, time in milliseconds, and seconds.
The setup function sets the starting mode to 0 and initializes the timers and pin modes. The loop function,
which cycles through several modes to regulate the traffic signals, is where the core logic is implemented. The
software use timers to control the length of each state, with each mode denoting a distinct condition in the
traffic light sequence. Depending on the current mode, the yellow and open routines are called to control the
yellow and green LEDs, respectively. Open the code on Arduino IDE. Compile the code. Select the board as
Arduino UNO. Then, select the port. After this, upload the code on the Arduino UNO
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

DANCING LIGHTS USING MIC SENSOR

Sound sensors can be used for a variety of things, one of them could be turning lights off and on by clapping.
Today however we are going to use hook up the sound sensor to an array of LED lights which will beat with
music, clapping or knocking.

Arduino UNO

A Sound Sensor

LED

220 ohm Resistors

Mini Breadboard

Wires
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

MArduino Sound Detection Sensor

This module allows you to detect when sound has exceeded a set point you select.Sound is detected via a
microphone and fed into an LM393 op amp. The sound level set point is adjusted via an on board potentiometer.
When the sound level exceeds the set point, an LED on the module is illuminated and the output is sent low.
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

Connections list

a) AO sensor pin → Digital pin 3

b) + sensor pin → 5 V pin


c) G sensor pin → GND pin
d) 3 LEDs to be attached on power rail of breadboard.
e) Negative rail of breadboard → GND Pin
f) Positive rail of breadboard → Digital pin 7

DHT 11 TEMPERATURE & HUMIDITY SENSOR WITH ARDUINO

Lets learn how to use temperature and humidity sensor dht 11 module with lcd display.

Parts Required :

● Arduino Uno/Mega/Nano
● 2x16 Lcd display with i2c controller
● Dht 11 module
● Jumper wire

Connections & Circuit Diagram :


Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8
IR (infrared) Sensor with LED Arduino

Reference Video Link : https://www.youtube.com/watch?v=Wj9KBcNQwaA

An IR sensor is a device that measures the Infrared radiation in its surroundings and gives an electric signal as
an output. An IR sensor can measure the heat of an object as well as can detect the motion of the objects.

Parts Required :

● IR sensor
● Arduino UNO
● Jumper wires
● Breadboard
● led

Circuit Diagram and Connection :

● VCC - 5V
● GND- GND
● OUT PIN- PIN 7
● LED Anode - Resistor - Dig Pin 13
● LED Cathode - Gnd
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

Machine Learning Environment - PictoBlox


Lesson 1: Image Classifier Model
Note: You need to download Pictoblox for free to proceed with these activities.
Video Tutorial link: https://www.youtube.com/watch?v=IswXXPONjqg
Introduction to Image Classifier Link: https://ai.thestempedia.com/docs/pictoblox/machine-learning-
environment/getting-started-with-image-classifier-ml-in-block-coding/
At the end of this lesson, the students would be able to:
● classify images into different classes based on their characteristics.
● set up the ML Environment
● Collect and Uploading the Data
● Train the Model
● Test the Model
● Export the Model to the Block Coding Environment
● Script in the Block Coding Environment to
● used image classification to make their own mask detection project.
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

In this project:
● You will create an AI model using image data to classify whether a person is wearing a mask, not wearing a mask and
wrongly wearing a mask.
● Open pictoblox and choose block coding.
● next from the file menu open the ML environment.
● Now create a project with appropriate names and select the image classifier.
● Select the image classifier as project type and click on the create button.
● Introduce them with the AI environment, how to create classes , in this case 3 as mask on: mask off and wrong mask
● now train the model and test the model
● after testing export the model to pictoblox block coding environment to write the following Programming:
● Create the following program in pictoblox by selecting their favorite sprite
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

Question: In what situations could you use the Mask classifier model?
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

Lesson 2: Object Detection Model


Video Tutorial link: https://www.youtube.com/watch?v=eqcPu8qs4EA
Introduction to Image Classifier Link: https://ai.thestempedia.com/docs/pictoblox/machine-learning-
environment/getting-started-with-object-detection-ml-in-block-coding/
At the end of this lesson, the students would be able to:
● annotate images with their identities
● set up the ML Environment
● Collect and Upload the Data
● Train the Model
● Test the Model
● Export the Model to the Block Coding Environment
● Script in the Block Coding Environment to
● use object detection model to detect objects of their choice
In this project:
● Students will learn how to make custom object detection models in PictoBlox and use it in Block coding.
● Open pictoblox and choose block coding.
● next from the file menu open the ML environment.
● Now create a project with appropriate names.
● Now select the object detection as project type and click on the create button.
● You will experience the new AI environment, you shall see the Object Detection workflow with two classes already
made. The environment is all set. Now it’s time to upload the data.
● now use the Webcam to capture images.
● After capturing images, annotate all the images. Annotating means: creating a bounding box that is a rectangular box
that can be drawn around an object in an image. Bounding boxes are used in object detection algorithms to identify
objects in images.
● We draw these rectangles over images, outlining the object of interest within each image by defining its X and Y
coordinates. This makes it easier for machine learning algorithms to find what they’re looking for, determine collision
paths, and conserves valuable computing resources.
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

● Object detection has two components: object classification and object localization. In other words, to detect an
object in an image, the computer needs to know what it is and where it is.

Follow the process:

● Go to the “Bbox” tab to access it.


● To create the bounding box in the images, click on the “Create Box” button, to create a bounding box.
After the box is drawn, go to the “Label List” column and click on the edit button, and type in a name for the
object under the bounding box. This name will become a class. Once you’ve entered the name, click on the
tick mark to label the object.
● The object will be color coded as soon as you label it.
● Once you’ve labeled an object, its count is updated in the “Class Info” column. You can simply click on
the class to classify another object under that label.
● Once you’ve labeled an object, its count is updated in the “Class Info” column. You can simply click on
the class to classify another object under that label.
● You can view all the images under the “Image” tab.
● You can find the Unlabelled images in the tab and you can click on the image to add the label.
● Train the data and export the data and do the following coding

Programming:
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

Question and Answers:


1. What do they think about how object detection models can help in solving a problem in the assembly line in
factories?
Lesson 3: Hand Pose Model
Video Tutorial link: https://www.youtube.com/watch?v=K4XxUen_2MY
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

Introduction to Image Classifier Link: https://ai.thestempedia.com/docs/pictoblox/machine-learning-


environment/getting-started-with-hand-pose-classifier-in-block-coding/
At the end of this lesson, the students would be able to:
● create 5 classes
● set up the ML Environment
● Collect and Upload the Data
● Train the Model
● Test the Model
● Export the Model to the Block Coding Environment
● Script in the Block Coding Environment to
● use hand pose model to move an object on screen
In this project:
● Students will learn how to make a custom hand pose classifier model in PictoBlox and use it in Block coding.
● Open pictoblox and choose block coding.
● next from the file menu open the ML environment.
● Now create a project with appropriate names.
● Select the hand pose classifier as project type and click on the create button.
● Introduce them with the new AI environment, they shall see the hand pose classifier work flow with 2 classes: Class is
the category in which the Machine Learning model classifies the hand poses. Similar hand poses are put in one class.
● Create 5 classes with 5 hand poses palm in front as forward class, back of hand as backward class, turning the hand
right as right class, turning the hand left with palm in front as left class, making a fist with palm straight as stop class.
Note: you should use the same hand for all the hand poses to create the data set
● After capturing images for all classes 120 at least for each class, train the model and export the model to create a
script.
● Now add a maze background and a beetle sprite to do the following coding.
Programming:
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

Question and Answers:


1. What do they think about how a hand pose model is helpful in communicating with specially abled people
with sign language?
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

Lesson 4: Audio Classifier Model

Introduction to Image Classifier Link: https://ai.thestempedia.com/docs/pictoblox/machine-learning-


environment/getting-started-with-audio-classifier-in-block-coding/
At the end of this lesson, the students would be able to:
● create 3 different audio samples classes
● set up the ML Environment
● Collect audio samples and Upload the Data
● Train the Model
● Test the Model
● Export the Model to the Block Coding Environment
● Script in the Block Coding Environment to
● use audio classifier model to make Tobe/Sprite change it’s costume.
In this project:
● Students will learn how to make a custom audio classifier model in PictoBlox and use it in Block coding.
● open pictoblox and choose block coding.
● next from the file menu open the ML environment.
● Now create a project with appropriate name.
● Now select the audio classifier as project type and click on the create button.
● You will experience the new AI environment, you shall see the audio classifier work flow with backnoise class already
made. Do not delete the class and create 2 more classes with the name of snap and tap.
● In the Audio Classifier, you can add samples by using your device’s microphone. Click on the “Microphone” button to
record samples. The “Background” class will simply contain the background noise samples.
● Create at least 25 audio samples of each class.
● After Recording for all classes, train the model and export the model to create a script.
● Note: You must add at least 20 samples to each of your classes for your model to train. More samples will lead to
better results.
● Now do the following coding.
Programming:
Lahore Grammar School
Middle Section for Girls
49-Civic Centre, Johar Town, Lahore Grade: 8

You might also like