G7 - Unit 8 - Robotics and Animation

Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

Unit 8: Robotics and Animation

Learning Objectives
Learners will learn to:
 identify the components of Tinkercad circuits

 create and simulate a circuit using electronic components

 understand the basics of micro bit and Arduino board

 use a visual block-based interface, PictoBlox, to control Mico:bit

 craete a Face-Recognition-based attendance system using Micro: bit and

Pictoblox

Vocabulary
Arduino
circuit assemblies
micro bit
microcontroller
breadboard
LED

Let Us Start

Hey there! I have heard about Micro bit is a microcontroller


Micro bit but never got the platform that you can
chance to try it. What exactly program to interact with the
can you do with it? physical world.

1
Get, Set, Go
8.1 Using Tinkercad Circuits
Tinkercad allows us to create virtual electronic circuits and test them. This is called

simulation. It allows you to create simple to complex circuits and test them before

creating the physical circuit.


Steps to open the Circuit workspace in Tinkercad
Step 1: Go to www.tinkercad.com and log in to your account.

Step 2: Click the Create button.

Step 3: Select the Circuit option. The Tinkercad Circuits workspace appears as shown.

2
8.2 Components of Tinkercad Circuits
The Circuits workspace in Tinkercad is similar to that of 3D design workspace.
In addition to the regular options, it contains tools for creating and testing
circuits. These are listed below.

Workspace
It is the area where the electronic components and 3D objects are placed.
Rotate
It is used to rotate the selected component placed on the workspace.
Wire color
It is used to change the colour of the wires used to connect the components in
a circuit.
Wire type
It is used to select the type of wire used to connect the different components
in a circuit.
Start/Stop Simulation
It is a toggle button that is used to test the working of circuits and
components.

3
8.3 Electronic components
An electronic circuit is built using different components.
Basic Components
Breadboard
The electronic components are assembled using a breadboard. A breadboard is a

piece of plastic that has several holes. These holes are used to hold different

electronic components. The main area of the breadboard has a grid of 30x10 holes.

Rows are numbered from 1 to 30 while columns are labelled from ‘a’ to ‘j’. Columns

labelled ‘a’ to ‘e’ are separated from the columns labelled ‘f’ to ‘j’ by an area without

holes. The edges of the board contain two columns that are labelled as ‘+’ and ‘-‘and

also contain the same number of rows. These columns and rows are used for power

supply. The components in the main area of the board will be joined into these

columns to draw electric current.

Battery
A battery is used to supply power to the components in an electronic

circuit. In Tinkercad circuits, batteries are available with a voltage of 1.5V

and 9V. A coin cell battery of 3V is also available. The battery is labelled

with its voltage (V). A higher voltage will result in more current as V= I x R.

4
LED
A Light Emitting Diode (LED) is an electronic device that emits light when an electric

current passes through it. An LED has two leads, the shorter straight lead is called a

Cathode and the longer, bent lead is called Anode. The anode must be connected to

the positive end of the battery. The cathode is connected to the negative end of the

battery in a circuit.

Circuit Assemblies
Circuit assemblies are simple, pre‐made circuits that can be incorporated into
3D designs. Some available circuit assemblies are the glow circuit, move circuit
and spin circuit.

Arduino
Arduino is an open‐source platform that helps to build electronic projects. It
consists of both hardware and software. The Arduino hardware is a
programmable circuit board called a microcontroller. You can tell the board
what to do by sending a set of instructions through code to the
microcontroller. Arduino software is an IDE (integrated development
environment) through which developers write and upload the code to the

5
microcontroller. The Arduino boards can read inputs such as a light on a
sensor, a finger on a button, or a Twitter message and turn them into outputs
such as activating a motor, turning on an LED, publishing something online, etc.

Micro Bit

The micro:bit is a small, programmable microcontroller. It is a pocket‐sized


computer that helps to learn how software and
hardware work together. It is designed to learn
electronics and coding. It consists of various input‐
output features such as LED light displays, sensors,
buttons, and lights that help to create amazing
interactive projects.

8.4 Creating a circuit using a breadboard and resistor


Step 1: Place the breadboard onto the workspace.
Step 2: Rotate it clockwise by 90 degrees using the rotate tool.
Step 3: Place a AA battery of 1.5 volts along the left side of the breadboard.
Step 4: Rotate the battery to place it horizontally using the Rotate tool.
Step 5: Change the battery count from one to four.

6
Step 6: Click the negative terminal of the battery. A green wire appears.
Connect it to the negative rail on the breadboard. Similarly, connect the
positive battery terminal to the positive rail of the breadboard.

Step 7: Using the wire color tool, change the colour of the wires, black for
negative and red for positive.

Step 8: Place the resistor on the breadboard. Set the resistance value to 1
Ohm.
Step 9: Rotate the resistor such that one end connects to the positive rail of
the breadboard.
Step 10: Connect the other end of the resistor to the breadboard using a black
jumper wire.

7
Step 11: Place the LED above the resistor so that the Anode of the LED is in the
same row as the resistor.

Step 12: Use a red wire to connect the resistor and the anode of the LED. Use a
black wire to connect the cathode
of the LED to the negative rail.

Step 13: Click the Start Simulation


button. The LED will light up and
appear as shown.

8.5 Face-Recognition-based attendance system using Micro: bit and


Pictoblox
Using micro: bit, let us learn to make a face recognition‐based attendance
system in PictoBlox AI.
We will use one of the buttons on the micro: bit, i.e. button B, to feed a new
image into our system. To scan a face, we will use the other button – button
A. Once the system matches the face detected with the sample image, it will
display the name of that person on micro:bit’s LED matrix. Then, add the time
stamp to an Excel sheet.

Components
1. A laptop or a computer
2. Camera/Webcam

3. The latest version of PictoBlox

4. A good Internet connection.

5. Micro: bit

6. USB cable
8
Using PictoBlox
PictoBlox is a programming software based on Scratch 3.0; hence,

its basic functionality is similar. As additional features, it has various

extensions related to hardware, robotics, Artificial Intelligence and

Machine learning.

Download PictoBlox
Use the link https://thestempedia.com/product/pictoblox/download-pictoblox/ and

choose the appropriate Operating System (Windows, macOS, Linux) to download it.

Opening Screen of PictoBlox


Just like the Scratch user interface, PictoBlox has the following basic elements.

9
Steps to create face-recognition-based attendance system
Setting up the project
Step 1: Open Pictoblox and log in to the app.

Step 2: Click the Add Extension button, choose Face

Detection extension and wait until the models load.

Step 3: Now, to log the timestamp of attendance, we need to

add the Data Logger extension. Click the Add Extension

button and choose Data Logger from the list. This extension

lets you generate a CSV file and store data according to your

requirements.

Connecting the micro: bit with the computer

Step 1: Connect your micro: bit to the laptop using the USB cable.

Step 2: Install the Scratch link to use the microbit with the help of the given link.

https://scratch.mit.edu/microbit

Step 3: Select the Board. Click the Connect button and select the appropriate device.

10
Setting up the stage
Step 1: Click the Choose a backdrop button and select the blue sky backdrop.

Step 2: When pressing the green flag, the default backdrop, which is the Blue sky

backdrop, should come. Thus, place the ‘when flag clicked’ block from the Events

palette and place the switch backdrop to block below it. Make sure that Blue Sky is

selected from the backdrop.

Step 3: The camera needs to be turned OFF. Thus, from the Face detection palette,

use the turn-on video on stage with a 0% transparency block and choose OFF from

the dropdown menu.

Step 4: Place a say block from the Looks palette. To mark the attendance, the user

must press the Button A on the micro: bit. Thus, write “Please press Button A to mark

the attendance” in the space given.

Step 5: Duplicate the say block and write “Please press Button B to mark the

attendance” in the space given.

Step 6: To create a new file to store the attendance data, from the logger palette,

choose a ‘create block ‘we will give it the name “Attendance 2020”.

The final script is given below.

Making the Attendance System Store the Image


Step 1: From the micro: bit palette, drag and drop ‘when the B button pressed’ block.

11
Step 2: To analyze the images from the camera, we need the camera to be ON. From

the face detection palette, place a turn on video on stage with 0% transparency

block.

Step 3: Place a say block from the Looks palette to say, “Feeding the Face”.

Step 4: From the micro: bit palette, place the display text block and write “Feeding…”

in it.

Step 5: To store the user's images in memory, click the Face detection palette and

place add class 1 as a stage block. Select 1 from the first drop-down and stage from

the second. To identify the user as his/her name, write the user name into the space

given.

Step 6: Once the face is added into the memory, make the sprite say “Face Added

into the Database” using the say block from the Looks palette.

Step 7: To turn OFF the camera and come back to the default backdrop, from the

face detection palette, place a turn on video on stage with 0% transparency block

and choose OFF from the drop-down menu.

Step 8: Finally, to come back to the default backdrop, place switch backdrop to

block from the Looks palette and choose Blue Sky from the drop-down.

The final script is given below.

12
Marking the attendance using the Micro: bit’s button
Step 1: To execute the program, whenever Button A is pressed on the micro: bit, from

the micro: bit palette, drag and drop ‘when A button pressed’ block.

Step 2: As we want to verify the image from the camera feed, we will ensure the

camera is on, thus add the ‘turn on video’ block.

Step 3: Add a delay of 3 seconds using the wait block from the controls palette.

Step 4: Now, to store the data, we will add blocks from the data logger extension. To

store the timestamp, place a set the data 1 to block and drag and drop the current

timestamp block into the space given. The get current timestamp block contains all

the date and time-related information.

Step 5: Now, in the second data, we will store the class of recognized face which

contains the name of a person whose face is recognized. We need to use the save

data block to save the data permanently onto the file.

Step 6: If the faces are matched, we need to print the user's name on the LED matrix.

Thus, place the display text block from the micro: bit palette and drop the get class

of face detected block in the space given.

Step 7: We need to match the faces on the stage thus, drag and drop the do Face

matching on stage block.

Step 8: Also, we would like sprite to inform the user that the attendance is marked

and greetings. Thus, place a say block from the Looks palette and write Attendance

Marked in the space given.

Step 9: To greet the user, we want sprite to say welcome along with the user’s name.

Thus, from the Operators palette, place a join block, write “Welcome “ in the space in

the first join block, drag and drop another join block into the second input. Place get

class of face detected in the first input of the second join block and write “ !” in the

second input of the second join block.

Step 10: Switch the backdrop to the default. Thus, place the switch backdrop to and

choose Blue Sky from the drop-down menu.

13
Assembling components
Step 1: Connect the Microbit controller to the computer using USB cable.

Step 2: Upload the code from PictoBlox to the Microbit.

Step 3: Scan a face using button A. Once the system matches the face detected with

the sample image, it will display the name of that person on micro:bit’s LED matrix

and add the time stamp to an Excel

sheet.

14
Resources
https://ai.thestempedia.com/docs/pictoblox/pictoblox-tutorials/getting-started-with-pictoblox/

Reference Material
https://www.youtube.com/watch?v=hWEKOch666s&t=37s

15

You might also like