Coding and Robotics GR9 T2
Coding and Robotics GR9 T2
3.3.2 Term 2
Content (Grade 9 / Term 2) Notes/Examples
CAPS
C.1 Apply computational thinking (CT) skills to develop a set of logical instructions to solve a problem. Link to C.2 – C.7 and R.5 – R.7
Example activity – Breakout game Note:
A breakout game consists of one paddle used to return a bouncing ball back and forth across the screen. The aim of the game is to break the bricks of a brick wall Learners use computational, what they have learned in
by getting the ball to hit/bounce on the bricks. breakout game in scratch | 101 computing coding as well as their experience from working through the
In pairs, work through the code below and create your own breakout game like the one below: example game to create their own game.
Step1: Paddle Step 2: This activity includes C..2, (creating code) C.3 (interpreting
code), C.4 (debugging code) and C.5 (evaluating their code
Use paddle sprite for improvement)
Add code to control paddle Add ball sprite Resize to
50
Add code for ball sprite
Step 3: Bouncing off paddle Step 4: Make variable for keeping score
Add code to ball sprite to make it bounce when it hits the paddle.
Make variable
135
136
Add Game Over backdrop Load the program
Switch to Game Over backdrop Execute it and ensure that you understand the code.
C.2 Present a simple coding solution using symbolic or written statements representing sequences of commands, single repetition, and conditional Link to C.1, C.3-C.7 and R.5 – R.7
constructs.
Activity 1: Scratch Scrabble score keeper level 1 (String handling, determine length of a string, extract characters in a string)
In the game of Scrabble, you get a score according to the letters in the word that you place on the board.
The purpose of this program is to calculate the total for each word and keep the score by adding the total of all the words. Input a word and calculates the score for a
word. The letters are scored as follows: A = 1; B=2; C=3; D=4; etc.
If a word is longer than 6 letters, the first and last letters must count double points.
Examples:
• The word “computer” will score 132 (c=3x2)+(o=15)+(m=13)+(p=16)+(u=21)+(t=20)+(e=5)+(r=18x2)
• The word “strong” will score 93 (s=19)+(t=20)+(r=18)+(o=15)+(n=14)+(g=7)
Add the points that the player got to the player’s total.
For each word, display the points for the word as well as the player’s total at that stage
The program must allow the user to repeatedly place a word until the user has at least 100 points.
The program must also count how many words it took to reach a total of at least 100 points and display the number of words.
CAPS
• How is the output of both programs different/the same?
• How are the loops (repeat structures) different/the same?
• For the same number, how many times will the loop in
each program execute?
• Which of the two programs will work with any number
(even bigger than 9999)?
Note:
It is important that learners understand that, in many
instances, a problem can be solved using different
approaches and/or tools.
C.6 Recognise and interpret patterns in symbolic sets of data or visualisations. Link to C.2 – C.5 and C.7, D.8 and D.9
C.7 Create or complete a pattern to represent a data set Do with C.6
Example activity – Fibonacci numbers C.6 and C.7 done together
Fibonacci numbers start with two predetermined terms and each term afterwards is the sum of
the preceding two terms.
The first two numbers are 0 and 1 (T1 = 0, T2= 1) and the next number is always the sum of the
previous two numbers
The first few Fibonacci numbers with signature (0,1) are 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89,
144…
(Note: The first two terms are the signature. The signature may vary.)
• Work through the program on the right to see if it displays the first 10 Fibonacci numbers
137
138
Robotics
R.3 Outline the different components of a robot Link to R.5 – R.7
Learners need to describe and use the following sensors: Introduce learners to sensors that provide analogue input,
Component Basic definition Purpose Practical application example – May be used to: e.g. soil moisture sensor, temperature sensor and humidity
Soil Moisture Sensor A sensor that measures the Employed in agricultural or gardening Monitors soil conditions for automated plant care sensor
moisture content in so robots to monitor soil conditions for systems in agricultural robots.
watering or plant care. Learners need to know the elementary difference between
digital and analogue input and how to process the readings in
block-based code
Temperature and Humidity Sensor: A sensor that measures both Enables climate control, Enables climate control, environmental monitoring,
temperature and humidity levels in environmental monitoring, and and weather reporting in robots.
the environment. weather reporting in robots.
CAPS
Also see: (https://makecode.microbit.org/55671-93208-82700-45427) and https://makecode.microbit.org/reference/pins/map
In relation to the code the learners also need to know how to use
the MAP function as part of the block-based language used to map
ranges to single values from readings.
>Žǁ
DW
,ŝŐŚ
139
140
Revisit logical gates and truth tables
The learners should present a basic understanding of the principles of:
• Boolean logic and
• Logical gates (AND, OR and NOT) and how it relates to the design, programming, and functioning of robotic systems.
The learners revisit the 3 ANSI symbols for the three logical gates.
NOT AND OR
Examples of scenarios
Scenario 1
Smart home application that automatically turns on a light bulb (actuator) in a room when it gets dark, but only if there is someone in the room. You have two sensors to accomplish
this: a light sensor and a motion sensor.
Example
An AND gate outputs a high (1) signal only when both of its inputs are high. In this context, we can use an AND gate to combine signals from both sensors, ensuring that the light
turns on only when it's dark (low light sensor reading) and there's motion (motion sensor detects someone).
▪ Light Sensor (LS) -> Input 1
LS MS Y (Light Bulb)
0 0 0 (Off)
0 1 0 (Off)
1 0 0 (Off)
1 1 1 (On)
Scenario 2
A parking lot entry gate with a boom gate and a ticket payment system. The gate should only open if two conditions are met: a customer has inserted a valid parking ticket, and a
sensor detects a vehicle waiting to exit.
The ticket payment system (TPS) verifies if a customer has inserted a valid parking ticket. It provides a binary signal (0 for invalid ticket, 1 for valid ticket).
The vehicle sensor (VS) detects the presence of a vehicle waiting to exit and provides a binary signal (0 for no vehicle, 1 for a vehicle detected).
The AND gate combines these signals. It outputs 1 only when both conditions are met (valid ticket and vehicle detected).
The NOT gate inverts the AND gate's output. If the AND gate outputs 1, the NOT gate will output 0 (opening the boom gate); if the AND gate outputs 0, the NOT gate will output 1
(keeping the boom gate closed).
CAPS
1 0 0 (Off)
1 1 1 (On)
A NOT gate inverts its input signal. You can use a NOT gate to ensure the boom gate remains closed when the AND gate's output is 0 (i.e., both conditions are not met).
Example of a truth table and a logic circuit (with 3 inputs and a maximum of 4 gates)
142
A B C D (NOT A) E (NOT C) F (D OR B) G (F AND E)
0 0 0 1 1 1 1
0 0 1 1 0 1 0
0 1 0 1 1 1 1
0 1 1 1 0 1 0
1 0 0 0 1 0 0
1 0 1 0 0 0 0
1 1 0 0 1 1 1
1 1 1 0 0 1 0
Experiments / The learners must be able to apply the principles of design thinking to develop an artefact where a relay or transistor is used as a
Projects switch and a sensor to activate a device such as a DC water pump. Such an experiment or project could be a self-watering plant or an
automatic biltong drier with humidity sensor.
Source (https://www.instructables.com/Automatic-Plant-Watering-System-Using-a-Microbit/)
Automatic Biltong Drier, where a humidity sensor and temperature sensor regulates the fan.
CAPS
The Internet of Things (IoT) refers to a network of interconnected physical devices or "things" that are embedded with sensors, software, and other technologies to Link to the concept of networks
collect and exchange data over the internet or other communication networks. These devices can range from everyday objects such as online cameras, security Learners need to understand
devices, vehicles, and wearable gadgets to industrial machines and infrastructure components. • What the IoT is
IoT relies on infrastructure, including networks, servers, and cloud computing, to enable data communication and processing. IT systems provide the backbone for • Basic components of IoT
IoT to function effectively. • Computing devices that enable the IoT
Example activity – Introduction to IoT • Challenges with IoT such as privacy and security
Divide learners into small groups/pairs
Learners watch the following videos https://youtu.be/ps9ucSDH8s4 and https://youtu.be/6mBO2vqLv38
Each leaner completes a KWLS chart and report back
D.2 Recognise that he or she is living as citizens in a digital world. Done with D.4, D.6.
Ethical implications of IoT include security, privacy, and ethical considerations. Link to D.1
Example activity – IoT, cybersecurity and privacy
In pairs learners watch the following video https://youtu.be/4XycTona5qI and https://youtu.be/u1ymmRQ_p3k and complete a KWLS chart
Discuss issues related to IoT:
• Cybersecurity: IoT devices are vulnerable to cyberattacks
• Privacy and data collection: IoT devices collect vast amounts of data, often including personal information. Users may not always have control over the data
generated by IoT devices. Discussion of who collects and owns this data.
D.3 Demonstrate an understanding of the concept of a computing device. Done with D.1.
D.4 Identify the common uses of ICT in the real world.
Describe the concept of the Internet of Things (IoT) and explain how it connects physical devices and data.
Common uses of IoT:
• Smart Homes: IoT helps control lights, thermostats, and security in homes.
• Healthcare: It's used for remote patient monitoring and fitness trackers.
• Agriculture: IoT helps farmers with things like crop health and animal tracking.
• Transportation: IoT is used in cars and trucks for navigation and safety.
• Energy Savings: IoT helps save energy in homes and manages electricity grids.
• Environmental Monitoring: It's used to check air and water quality and protect wildlife.
• Smart Cities: IoT manages traffic and waste in cities.
• Building Control: It helps with things like lighting and heating in offices.
D.5 Differentiate between the components of an ICT system Link to D.4, D,7 and C.7, R.3 – R.7
Identify the key components of an IoT system: Reference to Rs.
• Devices: Physical objects connected to the internet that can be used to collect
and exchange data
• Sensors: These collect data, e.g. temperature sensor, movement
• Actuators: These perform actions based on data, e.g. a thermostat that adjusts
143
144
D.6 Explain how the adaptation of technology impacted the world we work and live in Link to D,4, D.5 and R.1 – R.7
Internet of Things link to Rs D.5 and D.8 done together
Example Activity – Use KWLS chart to learn more about IoT Link to Rs
Provide learners with a KWLS chart on paper. Learners compete the first two columns (what I know and what I want to know), then learners watch the following Learners need to
video: https://youtu.be/6mBO2vqLv38?t=36 • Understand what the IoT is
Learners then complete the last two columns of the KWLS chart while watching the video. • Understand what the basic components of IoT is
• Understand how it impacts our lives
Discuss the following example of an IoT device: • Provide an example
Example Impact
For example, let's take a smart fridge. This fridge is part of the Internet of Things because it IoT makes virtually everything "smart". The IoT is gradually
has sensors inside that can detect how cold it is, how full it is, and what items are inside. It becoming one of the most prominent ICT technologies that
can then send this information over the internet to your phone or computer. So, if you're at underpin our society. It presents a unique technology
the grocery store and forgot to make a shopping list, you can check your phone to see transition that is impacting all our lives. Some people refer to
what's inside your smart fridge. it as Internet of Everything.
Link to microcontrollers (Rs)
https://youtu.be/6mBO2vqLv38 The Internet of Things (IoT) describes the network of physical
https://youtu.be/_AlcRoqS65E objects - “things”—that are embedded with sensors, software,
What is IoT? - A Simple Explanation of the Internet of Things (iotforall.com) and other technologies for the purpose of connecting and
https://bit.ly/3owhfZF exchanging data with other devices and systems over the
internet. These devices range from ordinary household
objects to sophisticated industrial tools.
Refer to any object that is connected to the internet and
can exchange information with other devices online.
D.7 Present a basic understanding of the concept of input processing and output. Link to D.4, D.5, D.6 and Rs.
Example activity - The process of how sensors measure data, transmit it to a microcontroller, and trigger an actuator Do in relation to Rs.
Provide learners with the following diagram: Also link to IPO tables
Learners need to
• understand input, processing and output with regards to
CAPS
Analogue, on the other hand, is more like a smooth,
continuous flow. Imagine a dimmer switch for a light instead
of a simple on-off switch. With an analogue system, things
can have any value within a range, and there are no discrete
steps. It's like turning up the volume on a radio; you can have
it at any level you want, not just loud or quiet.
Example activity 2: - Extend the activity to create bingo cards with ASCII characters and their corresponding binary values.
145