Search Header Logo
Robotics

Robotics

Assessment

Presentation

Computers

4th Grade

Practice Problem

Hard

Created by

Nano Felle

FREE Resource

57 Slides • 0 Questions

1

media
media
media
media
media

P6 Student's Guide

Term 1 - Smart Camera

2

media

© education.makeblock.com

1

1.What is Artificial Intelligence?

Artificial intelligence (AI) is the simulation of human intelligence processes by machines,
especially computer systems. Specific applications of AI include expert systems, natural language
processing (NLP), speech recognition and machine vision. AI programming focuses on three
cognitive skills: learning, reasoning and self-correction.

Learning processes. This aspect of AI programming focuses on acquiring data and creating
rules for how to turn the data into actionable information. The rules, which are called algorithms,
provide computing devices with step-by-step instructions for how to complete a specific task.

Reasoning processes. This aspect of AI programming focuses on choosing the right algorithm
to reach a desired outcome.

Self-correction processes. This aspect of AI programming is designed to continually fine-tune
algorithms and ensure they provide the most accurate results possible.

We can use sprite on mBlock to try AI services. How can you use the AI service from mBlock?
You need to add a new extension that is called Cognitive Services, like the figure below;

Lesson 1

Artificial Intelligence 1

3

media

© education.makeblock.com

2

Then, you must connect the mBlock app with your google account.

In the top right corner, you will see the following menu bar

Click the “Gray” Image

Then it will pop up a log in/sign up page

4

media

© education.makeblock.com

3

Click the google account

Add your google account
Click Okay

2.Speech, Text, and Image Recognition

AI give us ability to recognize something like human. With AI, our computer and robot have ability
to hear, read, and distinguish image. Here are some blocks that we use to use those functions

Block Programming:

Recognize speech in (English) for (2) seconds

Function:
Recognizes speech in the specified language for 2, 5 or 10 seconds

How to use:
When you run the block, the computer will record a voice and upload it to the Microsoft
servers, and then the servers recognize the speech and return the speech recognition results
to mblock. To use this block, please sign in to your mblock or google account first.

List of supported languages:


Example:
After pressing the space key, say "Hello". Your speech is recognized and the panda says
"Hello" on the stage.

5

media

© education.makeblock.com

4

Set speech recognition result to (Hide) punctuation mark

Function:
Set the speech recognition result to “Hide” or “Display” the punctuation marks

How to use:
When you run the block, the computer will record a voice and upload it to the Microsoft
servers, and then the servers recognize the speech and return the speech recognition results
to mblock. If you add this block, the system will set to display or hide the punctuation mark,
based on your setting.

Example:
After pressing the space key, say "How are you?". Your speech is recognized and the panda
says "How are you?" on the stage with the punctuation marks.

Speech recognition result

Function:

Reports the speech recognition result

How to use:

6

media

© education.makeblock.com

5

It is a reporter type block. A reporter block can be used in any script that requires data but

cannot be used independently.

Select the checkbox next to the block to display the recognized speech.

Recognize printed (Chinese “Simplified” text after (2) seconds

Function:
Recognizes a printed text in the specified language after 2, 5, or 10 seconds

How to use:
Choose the language and time from the drop-down menus. After the specified time, the
camera takes a photo and uploads it to the Microsoft servers, and the servers will recognize
the photo and return the text recognition result to mblock. To use this block, sign in to mBlock
5 first. A camera is required.
Note: This block is only used to recognize printed texts, like text on books.

7

media

© education.makeblock.com

6

Example:

After you press the space key, the printed text in English is recognized in two seconds, and
then the panda will say the text recognition result.

Recognize handwritten English text after (2) seconds

Function:
Recognizes handwritten English text after 2, 5, or 10 seconds

How to use:

Choose the time from the drop-down menu. After a specified time, the camera takes a photo
and upload it to the Microsoft servers, the servers will recognize the photo and return the text
recognition result to mblock. To use this block, please sign in to your mblock account first,
and a camera is required.

Example:
After you press the space key, the handwritten English text is recognized and the panda will

say the text recognition result.

Text recognition result

Function:

8

media

© education.makeblock.com

7

Reports the text recognition result

How to use:

It is a reporter type block. A reporter block can be used in any script that requires data but

cannot be used independently.

Select the checkbox next to the block to display the text recognition result.

Recognize (image recognition) in image after (1) secs

Function:
After the specified time, recognizes the image and returns the image category, the image

description, and the brand, celebrity, or landmark in the image.


How to use:
This block is used to recognize an image and return the image category, the image

description, or the brand, celebrity, or landmark in the image. To use this block, sign in to

mBlock 5 first. A camera is required.

9

media

© education.makeblock.com

8

You can use the (image recognition) recognition result block to display the recognition

result. Note that the same recognition type should be chosen in the two blocks.

(Image recognition) recognition result

Function:
Reports the recognized image category, image description, or brand, celebrity, or landmark in

the image

How to use:

It is a reporter type block. A reporter block can be used in any script that requires data but

cannot be used independently.

Select the checkbox next to the block to display the specified recognition resul

10

media

© education.makeblock.com

9

Exercise:

Command your mBot to lights up a specified color with speech recognition.

Press the green flag to use mBlock’s AI system

If Sprites detects “green”, mBot lights up green color

If Sprites detects “Red”, mBot lights up red color

If Sprites detects “Blue”, mBot lights up blue color

If Sprites detects “Yellow”, mBot lights up yellow color

11

media

© education.makeblock.com

10

1.Human Recognition

In this chapter, you will learn how to use the Cognitive Service to recognize human facial
expression, detect people’s age, detect emotion, and many more.

Block Programming:

Recognize people’s age after (1) secs

Function:
Recognizes people's age after the specified time

How to use:

Choose the time from the drop-down menu. After the specified time, the camera takes a

photo and uploads it to the Microsoft servers, and the servers will recognize the photo and

return the age recognition result to mblock. To use this block, sign in to mBlock 5 first. A

camera is required.

Example:

After you press the space key, the block starts recognizing people's age after one second,

and then the panda will say the age recognition result.

Lesson 2

Human Recognition

12

media

© education.makeblock.com

11

Age recognition result

Function:
Reports the age recognition result

How to use:

It is a reporter type block. A reporter block can be used in any script that requires data but

cannot be used independently.

Select the checkbox next to the block to display the age recognition result.

Recognize emotion after (1) seconds

Function:
Recognizes emotion after the specified time

How to use:

13

media

© education.makeblock.com

12

The block is used to detect the happiness, neutral, surprise, sadness, anger, contempt,

disgust, and fear emotion and return the emotion value.

Choose the time from the drop-down menu. After the specified time, the camera takes a

photo and uploads it to the Microsoft servers, and the servers will recognize the photo and

return the age recognition result to mblock. To use this block, sign in to mblock 5 first. A

camera is required.


Example:

When you click the green flag, the block starts recognizing emotion after three seconds, and

then the panda will say the happiness value.

Emotion (happy) intensity

Function:
Reports the emotion value (0-100)

How to use:

It is a reporter type block. A reporter block can be used in any script that requires data but

cannot be used independently.

Select the checkbox next to the block to display the emotion recognition result.

Choose the emotion type from the drop-down menu:

14

media

© education.makeblock.com

13

Emotion is (happy)?

Function:
Detects if you are in the specified emotion

Example:

When you click the green flag, the block starts recognizing emotion after three seconds. If the

detected emotion is happiness, the panda will say "So happy!"

Detect gender after (1) secs

Function:
Detects gender (male or female) after the specified time

How to use:

Choose the time from the drop-down menu. After the specified time, the camera takes a

photo and uploads it to the Microsoft servers, the servers will recognize the photo and return

15

media

© education.makeblock.com

14

the gender recognition result to mblock. To use this block, sign in to mblock 5 first. A camera

is required.

Example:

When you click the green flag, the block starts detecting gender after three seconds, and then

the panda will say the gender recognition result.

Gender recognition result


Function:
Reports the gender recognition result

How to use:

It is a reporter type block. A reporter block can be used in any script that requires data but

cannot be used independently.

Select the checkbox next to the block to display the gender recognition result.

16

media

© education.makeblock.com

15

Detect glasses type after (1) secs


Function:
Detects the glasses type after the specified time

How to use:
The block is used to detect the glasses type, including sunglasses, reading glasses,
swimming goggles or no glasses. Choose the time from the drop-down menu. After the
specified time, the camera takes a photo and uploads it to the Microsoft servers, the servers
will recognize the photo and return the glasses type recognition result to mblock. To use this
block, sign in to mblock 5 first. A camera is required.

Example:

When you click the green flag, the block starts detecting the glasses type after three seconds.

If the recognition result is sunglasses, the panda will say "Cool!".

17

media

© education.makeblock.com

16

Wearing (sunglasses)?


Function:
Detects if you are wearing sunglasses, reading glasses, swimming goggles or no glasses

How to use:

It is a boolean type block. It reports Ture if you are wearing the specified glasses, otherwise it

reports False. A Boolean block must be put into the hexagonal slot of another block, and

therefore cannot be used independently.

Choose the glasses type from the drop-down menu:

Detect smile score after (1) secs

Function:
Detects smile score (0-100) after the specified time

How to use:

Choose the time from the drop-down menu. After the specified time, the camera takes a

photo and uploads it to the Microsoft servers, the servers will recognize the photo and return

18

media

© education.makeblock.com

17

the smile score recognition result to mblock. To use this block, sign in to mblock 5 first. A

camera is required.

Example:

When you click the green flag, the block starts detecting the smile score after one second,

and then the panda will say the smile recognition result.

Smile recognition result

Function:
Reports the smile recognition result

How to use:

It is a reporter type block. A reporter block can be used in any script that requires data but

cannot be used independently.

Select the checkbox next to the block to display the smile recognition result.

19

media

© education.makeblock.com

18

Detect head gesture after (1) secs

Function:
Detects the head gesture after the specified time

How to use:

The block is used to detect the head pitch, yaw, or roll angle.

Value Range

Pitch: –90 to +90 degrees

Yaw: –180 to +180 degrees

Row: –90 to +90 degrees


Example:

20

media

© education.makeblock.com

19

When you press the space key, the block starts detecting the head gesture after three

seconds, and then the panda will say the pitch angle.

Head (roll) angle


Function:
Reports the head pitch, yaw or roll angle

How to use:

It is a reporter type block. A reporter block can be used in any script that requires data but

cannot be used independently.

Select the checkbox next to the block to display the specified angle.

Choose the angle type from the drop-down menu:

Exercise

Let’s build age, emotion, gender analyzer !!!

Press Space to use Age Analyzer
Press A to use Emotion Analyzer
Press B to use Gender Analyzer
Panda will display the result
mBot will light up green color during the age analysis process
mBot will light up blue color during the emotion analysis process
mBot will light up yellow color during the Gender analysis process

21

media

© education.makeblock.com

20

1.Text Sentiment

Do you know that Artificial Intelligence could identify sentiment of a sentence and recognize the

language based on a simple sentence and word? Well with Cognitive Services from mBlock you

see and learn how AI detects sentiment from any sentences.

Block Programming:

Analyze (English) text sentiment (…)

Function:

Analyze the sentiment of a sentence

Example:

When you press “Space” on your keyboard, start to analyze the text in English, then panda

will display the sentiment for 2 seconds

Lesson 3

Text Sentiment Analyzer

22

media

© education.makeblock.com

21

Sentiment analysis result

Function:

Reports the result of sentiment analysis (positive or negative)

How to use:

It is a reporter type block. A reporter block can be used in any script that requires data but
cannot be used independently.

Recognize language: (…)

Function:

Recognize the language from a specific sentence or word

Example:

When you press “Space” on your keyboard, start to analyze the text, then panda will display

the Language recognition result for 2 seconds

Language recognition result

Function:

Report the Language recognition result

23

media

© education.makeblock.com

22

Exercise

1. Fill this table below: (100)


Sentence / Word

Language

Good Morning

Jó reggelt kívánok

Buna dimineata

Eu gosto de comer maçãs

Ou te fiafia e 'ai apu

Bonne nuit

What is the program to detects the language?

2. Make a program with these conditions below:

If Sprite detects a “negative” sentiment, mBot will turn on a siren and the mBot’s LED lights

up red colour and black colour, repeat it for 2 times

If detects “positive sentiment, mBot will play a song for 2 times and lights up blue color,
Panda also displays the result

24

media

© education.makeblock.com

23

1.What is Smart Camera?

What is Smart Camera? Smart camera is a machine vision system which, in addition to image

capture circuitry, is capable of extracting application-specific information from the captured

images, along with generating event descriptions or making decisions that are used in an

intelligent and automated system, Makeblock smart can learn and recognize brightly colored

objects as well as detecting bar codes and lines, which allows it to be used in various applications,

such as garbage sorting, intelligence transportation, object tracking, and intelligence line following.

Lesson 4

What is Smart Camera?

25

media

© education.makeblock.com

24

2.Pixymon

What is Pixymon? PixyMon is software that runs on your computer and allows you to configure
the Smart Camera, train it to recognize objects and monitor and debug your own programs. It
also provides a monitor that allows you to see that the camera is “looking at”.

2.1.

Download PixyMon

Open the following link:


https://pixycam.com/downloads-pixy2/

If you use windows, please click the windows version

If you use mac, please click the mac version

26

media

© education.makeblock.com

25

Install the app, you can find the installation guide on the same link

2.2.

Learning an Object through PixyMon

You can teach Smart Camera an object through PixyMon. This may be useful if the object
you want to teach is small, or if you want more control over which pixels are used for
teaching. Begin by plugging in the USB cable between Smart Camera and your computer
and running PixyMon.

Now hold the object you want to teach in front of Smart Camera and select ActionSet

signature 1 from the pulldown menu.

Using the mouse, click and drag to select the region you want Smart Camera to use to

learn the object.

27

media

© education.makeblock.com

26

That's it! After you select the region, Smart Camera will “learn” the object and automatically

and start tracking it.

28

media

© education.makeblock.com

27

2.3.

Connect to mBot

These picture below will show you how to connect smart camera to mBot:

Method 1 Power through the mBuild power block (recommended)

Method 2 Power through a 3.7V lithium battery

Note: with this method you need extra Lithium Battery






29

media

© education.makeblock.com

28

3.Color Sensing

The smart camera can learn brightly colored objects and identify the color blocks after learning,
and then return their coordinates, length, and width.

Learn a colored object as follows:

1. Long press the Learn button until the indicator turns red (orange, yellow, green, blue, or

purple, different colors indicate learning different objects), and then release the button.

2. Place the color block to be learned in front of the camera.
3. Observe the indicator on the front or back of the smart camera, and slowly move the object to

be learned until the color of the indicator matches the object.

4. Short press the Learn button to record the current learned object. After the learning is

successful, when the camera recognizes a learned object, the color of the indicator becomes
the same as that of the learned object.

A maximum of seven objects can be learned and recorded in this mode.

Note:

1. The brighter color of the learned object, the more accurate the recognition.

2. The smart camera can learn and record seven objects, which should be easily distinguished in

color

Cautionary Example: learning a yellow ball and a yellow hat

30

media

© education.makeblock.com

29

Good example: learning an orange ball and a green ball

3. Switch the smart camera to the color block detection mode to detect the coordinates and size

of the color block.

4. The smart camera can prevent light interference. However, changeable light can still affect

recognition accuracy. The previous learning results may fail to be used in a new environment.

Here are some solutions:

Reset the white balance

Turn on the LED before learning or recognizing

Set the detail parameters in PixyMon

Use a lampshade to cover the blocks

Basic Block Programming:

Smart Camera (Port 1) switch to color detection mode

Function:
Switches to the color block detection mode for the smart camera connected to the

specified port of mBot


How to use:

A smart camera can work in either the color block detection or line/label tracking mode.

In the color block detection mode, a smart camera can detect and track color
blocks.

In the line/label tracking mode, a smart camera can track lines or barcodes.

Switch the smart camera to the corresponding working mode before using its functions.

31

media

© education.makeblock.com

30


Example:
When you start mBot, the smart camera connected to port 1 of mBot is switched to the

color block detection mode.

Smart Camera (Port 1) detected color block [1…]

Function:
Determines whether the smart camera connected to the specified port of mBot detects the

specified color block


How to use:

This is a Boolean block. If the smart camera detects the specified colour block, the block

reports True, otherwise it reports False. This block must be used in combination with

another block that requires a condition. It can't be used independently.

Note: Before using the smart camera to detect a colour block, you need to use it to learn

and record the colour block first.

Example:

After you start mBot, all the LEDs on it are lit up in red for one second if the smart camera

detects the recorded color block 1.

Smart Camera (Port 1) [Open/Close] fill light

32

media

© education.makeblock.com

31

Function:
Turns on or off the fill light of the smart camera

How to use:

A smart camera is equipped with two fill lights on the two sides of the camera. Smart

cameras can resist the interference of light to some extent. Changing light, however, may

affect the detection capability of a smart camera. Objects or colors learned in an

environment may fail to be recognized in another environment with different lighting

conditions. Fill lights can reduce the influence of ambient lighting conditions on the

accuracy of detection.

Example:

When you start mBot, the fill lights of the smart camera are turned on and the smart

camera starts to learn and record color block 2.

Exercise:

Try to make mBot controller with smart camera.

If it sees green, mBot lights up green color
If it sees red, mBot lights up red color
If it sees yellow, play 5 different tones
If it sees blue, mBot spins in place

33

media

© education.makeblock.com

32

1.Color Recognition and DC Motor

In this lesson you will learn how to combine Smart Camera and DC motor, to make your mBot

moves based on the specific color. First, you need to set up your robot like the following images.

Fig 1. mBot with Smart Camera

Lesson 5

Line Following with Smart Camera

34

media

© education.makeblock.com

33

Fig 2. mBot with Smart Camera Top View

Fig 3. mBot with Smart Camera side view (right)

Fig 4. mBot and Smart Camera side view (left)

Materials:

Beam 0824 x 048 (1 pcs)

Bracket 3*3 (2 pcs)

35

media

© education.makeblock.com

34

Block Programming:

Smart Camera (Port 1) switch to color detection mode

Function:
Switches to the color block detection mode for the smart camera connected to the

specified port of mBot

Smart Camera (Port 1) detected color block [1…]

Function:
Determines whether the smart camera connected to the specified port of mBot detects the

specified color block

Smart Camera (Port 1) [Open/Close] fill light

Function:
Turns on or off the fill light of the smart camera

Move Forward at power (…) % for (…) secs

Function:

Moves mBot forward at the specified power for the specified period of time

Move Backward at power (…) % for (…) secs

Function:

Moves mBot backward at the specified power for the specified period of time

Turn Left at power (…) % for (…) secs

36

media

© education.makeblock.com

35

Function:

Turns mBot left at the specified power for the specified period of time

Move Forward at power (…) % for (…) secs

Function:

Turns mBot right at the specified power for the specified period of time

Example Program:

In this example program, you will command mBot to move forward when mBot detects green color,

and moves backward when detect yellow color. Make sure to set the signature color 1 to green and

signature color 2 to red.

2.Solve Maze with Smart Camera

For the exercise, please make a program to solve the following maze

Maze:

37

media

© education.makeblock.com

36

Note:

Black

: Start Position (No Code)

Blue

: Stop Moving

Red & Purple

: Change Direction

Yellow

: Move with 100% Power

Green

: Move with 50% Power

When you build the maze, please use black tape and make sure the background will not affect the
recognition process.

Fig 4. Black Tape

38

media

© education.makeblock.com

37

1.Object’s Coordinate

In this lesson you will learn how to detect coordinate of an object with Smart Camera. You already

learned that Smart Camera could recognize color, but do you know if Smart Camera could detect

coordinate of specific object? Well, Smart Camera has an ability to detects coordinate of a specific

object by using the following blocks;

Block Programming

Smart Camera (Port 1) detected color block (1) at (center) of the image?

Function:

Determines whether the smart camera detects the specified color block in the specified

position of the image

How to use:

The following figure shows the coordinates and areas of an image captured by a smart
camera.

Lesson 6

Object Location and Sprite

39

media

© education.makeblock.com

38

You can use the PixyMon software to view images captured by a smart camera. After

installing the PixyMon software, connect a smart camera to the computer by using a Micro

USB cable. Then you can view images captured by the smart camera in PixyMon.

Example:

After you start mBot, it turns left if the smart camera detects color block 1 on the left of the

captured image.

Smart Camera (Port 1) detected (x-coordinate) of color block (1)

Function:

Reports the coordinate, width, or height of the specified color block

How to use:

The following figure shows the coordinates of the image captured by a smart camera.

X-axis coordinate range: 0–320

Y-axis coordinate range: 0–240

40

media

© education.makeblock.com

39

You can use the PixyMon software to view images captured by a smart camera. After

installing the PixyMon software, connect a smart camera to the computer by using a Micro

USB cable. Then you can view images captured by the smart camera in PixyMon.

Example:

After you start mBot, it moves forward for one second if the width of color block 1 detected

by the smart camera is greater than 50.

2.Do Not Touch Game

In this section, you will learn how to make a simple game with Sprite and Smart Camera. But

before you make the game, you will see some examples that is related to the game.

1. Sprite display the object’s coordinate

This example allows panda to display the coordinate of the detected object by using upload

mode broadcast system.

mBot:

Sprite:

41

media

© education.makeblock.com

40

2. Moving sprite with Smart Camera

This example allows to move panda by using the object’s coordinate and the data is sent by

using upload mode broadcast

mBot:

Sprite:

42

media

© education.makeblock.com

41

For this game, example number 2 will be used as the main program. In the other word, you will

control the sprite based on the object’s position. Like the example number 2, if the object is detected

in upper area, Sprite will change the y coordinate by 10 (go to upside), vice versa if the object is

detected in bottom area, sprite will change the y coordinate by -10 (go to downside). Please follow the

guide below when you build the game.

1. Open mBlock 5, add mBot from device library

2. Click extension then, add Smart Camera & Upload Mode Broadcast from extension library

3. Please make the program like example number 2 on mBot section

43

media

© education.makeblock.com

42

4. Then, move to sprite section. In this section, click extension and add Upload Mode Broadcast

5. Copy the following program on Sprite Section

44

media

© education.makeblock.com

43

6. Next, we must design the environment of the game. Go to background section then choose

“costumes”.

7. In costumes section, you will see an interface like the image below;

45

media

© education.makeblock.com

44

8. In toolbar section, there are lot of tools. One of the tools that we use is rectangle, we use

rectangle to build black wall like the image below;

Image:

46

media

© education.makeblock.com

45

Note: Please set the fill and outline like the image below

9. After you make the design in background section, the next step we will add program to the

sprite (Panda). The logic of the program is, if sprite (panda) touches the black line, panda says

text “ouch!!!”

47

media

© education.makeblock.com

46

Exercise:

Please upgrade the previous project with the following objectives;

If panda touches the black line, mBot lights up red color and play sound C4

Please add start line and finish line in the background

Make a variable with name “Score”, set the value to 100, when panda touches the black

line, it will decrease the variable score by 10.

When panda touches the finish line, mBot lights up green color, and panda says

“Congratulation” for 2 seconds, then after panda says “congratulation”, panda says the

final score.

48

media

© education.makeblock.com

47

1.Object Tracking

In this lesson we will improve the project difficulty, you will learn how to make your mBot moves

based on the object position. When, an object is in the left side of your smart camera, mBot will

automatically adjust its position, until the position of that object is back to center, vice versa.

Design:

Please redesign or rebuild you robot by using the following image as reference;

Note:

Connect the smart camera to Port 3

Block Programming

Lesson 7

Object Tracking

49

media

© education.makeblock.com

48

For this project we will learn some new blocks from “event specific smart camera”

, they are;

Smart camera (Port 1) sets KP in motor differential speed calculation to (0.5)

Function:

Sets Kp for the smart camera to calculate the motor differential speed

How to use:

Kp is the coefficient for calculating motor differential speed. It determines the turning speed

of a robot when it performs automatic line/color block following. Value range of Kp: 0–1, a

greater value indicates faster turning. This block is used to initialize Kp and is usually

placed in the beginning of a program. It needs to be executed for only once, and therefore

it is not recommended that you put it into loop statements.

Example:

When you start mBot, the coefficient Kp for calculating the motor differential speed is set to
0.5.

Smart camera (Port 1) calculates motor differential speed (auto follows color block [1] to [x]

axis (150))

Function:

Reports the motor differential speed required for making mBot follow the specified color

block while keeping the color block in the specified x- or y-coordinate of the captured

image

How to use:

50

media

© education.makeblock.com

49

The motor differential speed is positively related to Kp. A greater Kp value indicates a
greater motor differential speed.
Value range of the motor differential speed: 0–100

The following figure shows the coordinates of an image captured by a smart camera.

X-axis coordinate range: 0–320
Y-axis coordinate range: 0–240

Example:
After you start mBot, it follows color block 1.

Smart camera (port 1) targets area near color block [1] to [x] axis (150)?

Function:

Determines whether the specified color block is located near the specified x- or y-

coordinate of the captured image

How to use:

The following figure shows the coordinates of the image captured by a smart camera.

51

media

© education.makeblock.com

50

X-axis coordinate range: 0–320
Y-axis coordinate range: 0–240

Example:

After you start mBot, if the smart camera detects that color block 1 is near the x-coordinate

of 150, all LEDs on mBot are lit up in red for one second.

2.Object Tracking Program

Please follow the guide below to make the Object Tracking Program;

1. Open the PixyMon application on your device

2. Select one object as signature 1on the PixyMon, you can use the green ball or orange ball

3. Open mBlock5 application

4. Add mBot from device library

52

media

© education.makeblock.com

51

5. Go to extension center, then add “Smart Camera”

6. Switch mode to “Upload Mode”

53

media

© education.makeblock.com

52

7. Then, drag an event block dan drop it in script area

8. Then add this block

, drag it from smart

camera’s block and drop it below the event block

Note: Set the port to “Port 3”

9. Next, add the Kp block to the program. Drag dan drop it to the script area

10. Now we completed the setting of Object Tracking Program, next we will add looping to the

program. Please drag and drop the “Forever” block.

11. For this project we will use the differential block, which will give you a specific report of the

detected object’s coordinate.

12. Please make 2 variables with name “Right” and “Left”

54

media

© education.makeblock.com

53

13. Drag 2 “set (…) to 0” from variable, and drop it inside the forever block. After that, change the

name of one variable to “right”

14. Go to operator and drag

and

, drop those blocks into set variable blocks

like the image below

15. Drag the block below and combine those blocks with the previous variable blocks

Block:

Combination:

55

media

© education.makeblock.com

54

Note:

Set the y value to 120, and the x value to 160 (center of image)

16. Lastly, add the motion block to the program. We want to use the coordinate to control the

motor’s speed.

Block:

Note:

Replace the power percentage with variable, change the left wheel with variable left and vice

versa.

Combination:

Exercise:

Please make ab object tracking program but using the block below;

56

media

© education.makeblock.com

55

Week 1:

Please make a group with 3 – 5 students
Discuss a project with theme “Help my Daily Routine”
About the Theme:

You can make gadgets that help your daily activities; you can develop a robot that can replace
humans to do housework independently; you can invent smart household items that can
eliminate housework from the beginning. As long as your ideas are related to helping you to
solve your daily problems

Please use minimum 2 Sensors and Smart Camera

Week 2:

Make the program and decorate your project to looks more attractive
Make a presentation about your project

Week 3:

Present your project in front of your class

Term 1 Final Project

Group Project

57

media

E N D

of term 1

media
media
media
media
media

P6 Student's Guide

Term 1 - Smart Camera

Show answer

Auto Play

Slide 1 / 57

SLIDE