0% found this document useful (0 votes)
37 views65 pages

Grade 8 Coding and Robotics

The document serves as a coding index and curriculum guide for mastering Python and robotics, outlining chapters and activities focused on key programming concepts. It covers topics such as conditional statements, loops, and functions, with practical activities and projects to reinforce learning. The curriculum aims to prepare students for text-based coding by deepening their understanding of block coding principles.

Uploaded by

bharat
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)
37 views65 pages

Grade 8 Coding and Robotics

The document serves as a coding index and curriculum guide for mastering Python and robotics, outlining chapters and activities focused on key programming concepts. It covers topics such as conditional statements, loops, and functions, with practical activities and projects to reinforce learning. The curriculum aims to prepare students for text-based coding by deepening their understanding of block coding principles.

Uploaded by

bharat
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/ 65

CODING INDEX

CHAPTER NO. CHAPTER NAME PAGE NO.

1 Mastering Python 3
2 Conditional in Details 4
3 If-01 Activity 6
4 If-03 Activity 6
5 It-06 Activity 7
6 If-07 Activity 7
7 It-16 Activity 8
8 If-else 16 Activity 8
9 Advanced Loops 10
10 For-01 Activity 12
11 For-02 Activity 12
12 For-09 Activity 13
13 For-29 Activity 14
14 Advanced Functions 16
15 Function-01 Activity 16
16 Function-02 Activity 17
17 Function-07 Activity 18
18 Function-10 Activity 18
19 Function-13 Activity 19
Data Science: Uncovering Secrets of
20 22
Data

educobot.com 1
ROBOTICS INDEX

CHAPTER NO. CHAPTER NAME PAGE NO.

1 Breadboard Basic: A Revision Activity 26


Understanding Active and passive com-
2 28
ponents
OHM'S LAW: Understanding Voltage,
3 29
Current and Resistance
4 Charging & Discharging Of Capacitor 32
Getting Started With ESP32: Program-
5 35
ming A Buzzer
Smart Lamp: Controlling RGB with Mi-
6 36
crocontroller
Smoke Detection: Triggering Buzzer on
7 39
Detection
Fire Alarm System: Smoke Detection in
8 41
Hut
9 Pump Control: Automating With Motor 43
10 Water Dispenser Automation 44
5 Introduction to IOT 46
6 Exploring IoT Dashboard on Innovator 47
7 IOT Based LED Light Control 50
8 IoT Weather Station with dht11 51
IoT Distance Management with Ultra-
9 53
sonic Sensor
10 Smart Garbage Monitoring with IoT 55
11 IoT Smart Bell With Access Control 59

educobot.com 2
Mastering Python

Welcome back, coding superstars! You've already built some amazing projects with Python block
coding in Grades 6 and 7. This year, we're going to become true Python block coding masters. We'll
solidify our understanding of core concepts and explore some powerful techniques that will get
you ready for text-based coding in Grade 8!
What We'll Explore This Year:
• Review and Deepening of Core Concepts: We'll start by revisiting and deepening our under-
standing of the fundamental Python block coding concepts: variables, conditional logic, loops,
lists, and functions. We'll focus on using these concepts effectively and efficiently. This isn't just
review – we'll be looking at how these concepts work together in more complex ways.

• Advanced Block Coding Techniques and Best Practices:


We'll explore some techniques that will make your block coding
more powerful and prepare you for text-based coding:
 Optimizing Code: We'll learn how to write cleaner, more effi-
cient block code. This is like learning good handwriting – it makes
your code easier to read and understand.
 Modular Programming with Functions: We'll become experts
at using functions to break down large projects into smaller, man-
ageable pieces. This is a key skill that will be essential when you
start text-based coding.
 Data Structures with Lists and Dictionaries: We'll not only
work with lists but also introduce the dictionary data structure
which is very important and helps us store information in key-
value pairs.

 Event Handling and User Interaction: We'll focus on making our projects more interactive by
responding to user input, mouse clicks, and other events.

• Building Complex and Polished Projects: We'll use these skills to create highly polished and
complex projects:
 Sophisticated Games: We'll design games with complex gameplay, multiple levels, AI oppo-
nents, scoring systems, and refined user interfaces.
 Interactive Simulations: We'll build realistic simulations that model real-world systems, like a
physics engine or a simple economy.
 Data-Driven Applications: We can create projects that analyze data and present information in
interesting ways.
 Thinking Like a Coder (Computational Thinking): Throughout the year, we'll focus on develop-
ing our computational thinking skills – breaking down problems into smaller steps, designing algo-
rithms, and thinking logically about how to solve problems with code. This is the most important
skill you'll need for any kind of coding.
 Preparing for Text-Based Coding: While we'll stay in the block environment this year, we'll start
to talk about how the concepts you're learning in blocks relate to text-based code. This will give
you a head start when you make the transition in Grade 8.

educobot.com 3
This year is all about mastering Python block coding and building a strong foundation for text-
based programming. You'll become expert block coders, ready to take on the challenge of text
-based Python in Grade 8!

Conditional In Details

1.1 What will you learn in this chapter?

• Understanding IF ELSE and ELSE IF statements


• Using logical operators
• Using nested conditions

1.2 Types of Control Structures

In programming, control structure is a block of program that accepts and analyses different
variables and chooses the direction in which to go based on the given parameters. To put
simply, it is a basic decision-making process in computing. It is like a prediction that program
makes by accessing the given parameters.
There are three basic types of control structures in programming:

1. Sequential

2. Selection / Conditional

3. Iteration

Sequential - In a sequential control structure, the statements in a program are executed


sequentially, i.e. step-by step in an order that they are written.

Selection / Conditional - A selection (conditional) control structure is used to test a condition


in a program. This control structure takes a decision to execute one statement/operation over
another statement/operation depending on the condition.
Iteration – This control structure executes a set of statements for a certain number of times till
the mentioned condition is true. Loops are examples of iterative statements.

educobot.com 4
1.3 Understanding IF-ELSE and ELSE-IF statements
In programming, decision-making is a key concept that allows a computer to execute different
actions based on conditions. IF-ELSE and ELSE-IF statements are used to control the flow of a
program by checking conditions and executing the corresponding block of code.

IF-ELSE Statement
The IF-ELSE statement is used when we want the program to choose between two possibilities:

1. IF Condition is True : Execute a specific block of code.


2. ELSE (otherwise) : Execute a different block of code.
Example:

Let’s say we want to check if a person is old enough to vote:


age = 18
if age >= 18:
print("You are eligible to vote.")
else:
print("You are not eligible to vote yet.")

• If age is 18 or more, the program prints "You are eligible to vote."

• Otherwise, it prints "You are not eligible to vote yet."


ELSE-IF (elif) Statement
Sometimes, there are multiple conditions to check. Instead of writing multiple IF-ELSE
statements, we use ELSE-IF (elif) to handle different cases efficiently.
age = 25
if age < 13:

print("You are a child.")


elif age < 20:

print("You are a teenager.")

elif age < 60:

print("You are an adult.")

else:

print("You are a senior citizen.")

• If age is less than 13, it prints "You are a child."

• If age is between 13 and 19, it prints "You are a teenager."

• If age is between 20 and 59, it prints "You are an adult."

• Otherwise, it prints "You are a senior citizen."

educobot.com 5
Conclusion:
• Use IF-ELSE for simple yes/no decisions.
• Use ELSE-IF (elif) when checking multiple conditions in a structured way.
• The computer always executes the first TRUE condition it finds and ignores the rest.

If-01

Task: In this lesson, we will get introduced to conditions, Applying in simple scenarios.

In this activity, we will use a


condition to check if it is
raining. Based on the result,
we will decide whether to
go outside and play or stay
indoors.

This code checks if the


climate is "Raining".

• If it is raining, it prints:
"Do not play outside"
If it’s not raining, it does
nothing.

If-03

Task: In this lesson, we will get introduced to the equality operator incorporating it in a conditional
statement.

The equality operator (==) in Python is


used to compare two values and check if
they are equal. If the values match, it re-
turns True; otherwise, it returns False. It is
commonly used in conditions and deci-
sion-making

educobot.com 6
· money = 30 : This assigns the value 30 to the variable money.

· if money == 30: : This checks if money is exactly equal to 30.

• If the condition is true, the program executes the next line:

• print('I have Rs.30 so I cannot buy the toy') : Displays the message if the condition is met.

If-06

Task: In this lesson, we will get introduced to the greater than equal operator incorporating it in a
conditional statement.

This code checks if you have enough money to buy a toy.

• money = 55 means you have Rs. 55.


• if money >= 50: checks if you have Rs. 50 or more.
• Since Rs. 55 is more than Rs. 50, the message "I have Rs. 55, so I can buy the toy!" will be
shown.

If-07

Task: In this lesson, we will get introduced to the less than equal operator incorporating it in a condi-
tional statement.

educobot.com 7
In this code:

• money = 45 means you have Rs. 45.


• if money <= 50: checks if you have Rs. 50 or less.
• Since Rs. 45 is less than Rs. 50, the message "I have Rs. 45 which is less than Rs. 50 so I cannot
buy the toy" will be shown.
• The explanation also highlights the 'less than or equal to' comparison operator (<=), which
checks if the amount is less than or equal to Rs. 50.

If-16

Task: we will get introduced to the boolean operator incorporating it in a conditional statement.

• if True == True: checks if True is equal to True.


• Since True is always equal to True, the condition is True.
• Because the condition is True, the message "condition is true" will be shown.

This explains how the == (equal to) comparison operator works by checking if both values are
the same.

If-Else 16

Task: we will get introduced to the AND (&) operator incorporating it in a conditional statement.

educobot.com 8
Code Explanation:

• a = 10, b = 50, c = 40: These lines assign values to three variables.


• if a > b and a > c: checks whether a is greater than both b and c.
• Since 10 is not greater than 50 or 40, this condition is false.
• The else: block runs because the condition is false.
• It prints: "a is not greater than b and c".

This example highlights the use of the logical and operator, which ensures that both conditions
must be true for the block to execute.
QUIZ TIME
Q1. What is the correct syntax for an if statement in Python?
if x = 5:
if x == 5:
if x === 5:

Q2. Which operator is used to check if two values are equal?

==
===

Q3. Which of the following is a logical operator in Python?


not

\\
&&

<>

SHORT ANSWER QUESTIONS


Q1. What is an if statement in Python?
Q2. What is the purpose of elif in Python?
Q3. What are logical operators in Python?

educobot.com 9
Capstone Project:
Project 1: Interactive Quiz Game (Conditions)
Explanation: In this project, we'll create a simple quiz game. The computer will ask the player
questions, and the player will type in their answers. We'll use conditional statements (if/else) to
check if the player's answer is correct. If it's correct, we'll add to their score. At the end, we'll tell
the player their final score.

questions = {
"What is the capital of France?": "Paris",
"What is the largest planet in our solar system?": "Jupiter",
"How many continents are there?": "7"
}

score = 0

for question, answer in questions.items():


user_answer = input(f"{question} ")
if user_answer.lower() == answer.lower():
print("Correct!")
score += 1
else:
print(f"Incorrect. The answer is {answer}.")

print(f"You scored {score} out of {len(questions)}.")

After Coding Task: Let's make our quiz even better! Try these:
1. Add More Questions: Add at least 5 more questions to the questions dictionary. Think about
different topics you're interested in!
2. Different Point Values: Make some questions worth more points than others. For example,
harder questions could be worth 2 points. You'll need to use if/elif/else statements or another
way to assign different point values.
3. Quiz Topic Choice: Before the quiz starts, ask the player if they want a "Science" quiz or a
"History" quiz (or any topics you like!). Then, only ask questions from the chosen topic. This will re-
quire you to organize your questions by topic.

Advanced Loops

2.1 What will you learn in this chapter?

educobot.com 10
• What are the different types of loops?
• Definition of different types of loops
• Break and Continue loops

2.2 What are Loops?

Everyday there are some tasks which need be done repeatedly. Loops are programming ele-
ments which repeat a portion of the code for a set number of times till the desired process is
complete. Repetitive tasks are common in programming and loops are important to save time
and minimize errors.
Loops make our code more manageable and organized.
Let us now see what the different types of loops are:

1. While Loop

2. . For Loop

3. Nested Loop

The While Loop The While loop can execute a set of commands till the condition is true While
Loops are also called conditional loops. Once the condition is met then the loop is finished
For example - Print from 1 to 10 Here, if we want to derive the loop from this scenario, we have
the following conditions:
Condition: Write from 1 to 10 And the decision we are deriving is:
Decision: Have we reached 10
The For Loop : For loop is needed for iterating over a sequence.

For example – We need to calculate the square of numbers present in a list.

Numbers= [1, 3, 5, 7, 13]

The Nested Loop : Loop can be nested in Python. A loop that occurs within another loop is called
nested loop. Consider the below program.
numbers = [1, 2, 3]

alphabets = [a, b, c] for num in numbers for alphabet in alphabets

print (alphabet)

We have used two loops here. The outer loop, iterates over the numbers array and the inner loop
iterates over the alphabet array. So each of the alphabets get printed 3 times. Finally, we have 9
items that are printed.

ab c a b c a b c

educobot.com 11
2.3 Exit Criteria
Now that we have understood about loops and its iterations, it is also important to understand
when and where should one stop iterating through these loops. As mentioned in the previous
topic, it is very important to keep in mind while programming that the looping condition should
result false at a certain point in time. Otherwise, the block of code will enter an infinite loop. To
make sure that the loop does not enter an infinite loop, it important to define an exit criterion for
the loop.
Exit criteria is defined as a condition that must be met before completing a specific task. It is a set
of conditions that must exist before you can declare a program to be complete. Exit criteria is one
of the most important components while defining a loop. As without an exit criterion, the program
tends to enter in an infinite loop. These criteria differ from program to program as per the require-
ment.
For example, while creating a loop to print numbers from 1 to 1000, exit criteria is that loop should
exit the block of code when the 1000th number is printed, else the program will enter an infinite
loop.
2.4 Activities on Conditions.

For-01

Task: In this lesson, we will get introduced to for loop

Code Explanation:

• str = 'python': The variable str stores the string "python".


• for i in str: iterates through each character of the string.
• print(i) prints each character on a new line.

For-02

Task: In this lesson, we will get understand for loop in depth by applying for loop in simple scenarios.

educobot.com 12
This code prints each car brand in the list one by one.

• mylist = ['audi', 'bmw', 'benz'] defines a list of car brands.


• for i in mylist: loops through each item in the list.
• print(i) displays each car brand on a new line.

For-09

Task: In this lesson, we will understand how to read dictionary in python using for loop.

This code prints each key in the dictionary one by one.

• mydict = {'car1': 'audi', 'car2': 'bmw', 'car3': 'benz'} defines a dictionary where each key ('car1',
'car2', 'car3') is associated with a car brand.
• for i in mydict: loops through the dictionary keys.
• print(i) displays each key on a new line.

By default, looping through a dictionary only retrieves the keys, but you can use mydict.values()
to get the values or mydict.items() to get both keys and values.

educobot.com 13
For-29

Task: In this lesson, we will get merge condition with for loop.

This code prints numbers from a list but skips 3, and after the loop completes, it prints a message.

• for x in [1,2,3,4]: loops through the list [1,2,3,4].


• if x == 3: checks if x is 3.
• continue skips printing 3 and moves to the next iteration.
• print(x) prints all numbers except 3.
• else: runs after the loop finishes, printing 'for loop completed'.
QUIZ TIME
Q1. Which loop is used when the number of iterations is known beforehand?
While loop
For loop
If statement

Q2. What does the continue statement do in a loop?

Repeats the current iteration

Ends the program


Exists the loop

Q3. What is an infinite loop?


A loop that runs forever

A loop that runs a fixed number of times


A loop that executes only once

A loop that runs two times

educobot.com 14
SHORT ANSWER QUESTIONS
Q1. What is the difference between a for loop and a while loop?
Q2. How do you write a loop that prints numbers from 1 to 10?
Q3. What is exit criteria?

Capstone Project:
Project 2: Number Guessing Game (Conditions and Loops)

Explanation: This time, we'll make a number guessing game. The computer will pick a random
number, and the player will try to guess it. We'll use a loop to let the player guess multiple times.
We'll also use conditional statements to tell the player if their guess is too high, too low, or correct.

import random

def number_guessing_game():
number = random.randint(1, 100)
guesses_left = 7 # Allow 7 guesses

while guesses_left > 0:


try:
guess = int(input("Guess the number (1-100): "))
except ValueError:
print("Invalid input. Please enter a number.")
continue

if guess < number:


print("Too low!")
elif guess > number:
print("Too high!")
else:
print(f"Congratulations! You guessed the number in {7 - guesses_left
+1} tries.") #correct guess in current try
return # End the game

guesses_left -= 1
print(f"You have {guesses_left} guesses left.")

print(f"You ran out of guesses. The number was {number}.")

number_guessing_game()

After Coding Task: How can we make this game more fun?

1. Adjustable Range: Let the player choose the range of numbers at the start of the game (e.g., 1
-50, 1-200, or even 1-1000).
2. Difficulty Levels: Create different difficulty levels (Easy, Medium, Hard). Easy gives the player
more guesses, and Hard gives fewer guesses.
3. Hints (Challenge): After each guess, give the player a hint. For example, if the number is even,
say "The number is even." If the number is a multiple of 5, say "The number is a multiple of 5."

educobot.com 15
Advanced Functions

3.1 What will you learn in this chapter?

• How using function helps us?


• Function Parameter
• Activities on Function

3.2 Recap of functions


A function is a block of code made up of a set of steps that results
in a single specific action. The programmer will give this action a
simple name. Giving a simple name to a function, increases the
chances that the set of steps can easily talked about and reused
again and again in the program.

3.3 Function Parameter

By now, you already had a brief idea of what functions are and how it works. Function parameters
are variables which are taken as inputs to the function to do a task when the function is called. An
argument is the value passed to a function which is received by the function as parameter. For ex-
ample, if we need to calculate the volume of a cube, we need three variables length, breadth and
height. The formula to calculate the volume of a cube is

where V is the volume of the cube, L is the length, B is the breadth and H is the height of the cube.

V=L*B*H
We can make a function named VolumeOfCuboid which takes parameters L, B and H. Now the
function would look like
VolumeOfCuboid (L, B, H)

return L * B * H

3.4 Activities on Functions

Function-01

Task: In this lesson, we will get introduced to functions.

educobot.com 16
This code defines a function called display() and then calls it.

def display(): defines a function named display.

print("Hello, world!") This line, inside the function, prints the text "Hello, world!".

display() calls the function display().

This causes the code inside the function to run, which results in "Hello, world!" being printed.

Function-02

Task: In this lesson, we will get understand functions using arithmetic operator.

This code defines a function addfunc() and then calls it.

def addfunc(): defines a function named addfunc.

a = 10 assigns the value 10 to the variable a.

b = 5 assigns the value 5 to the variable b.

c = a + b calculates the sum of a and b (10 + 5 = 15) and stores it in c.

print(c) prints the value of c (which is 15).

addfunc() calls the function addfunc(). This causes the code inside the function to run, resulting in
15 being printed.

educobot.com 17
Function-07

Task: In this lesson, we will understand how data types value can be passed to parameters.

This code defines a function addfunc() that concatenates strings and then calls it.

def addfunc(a, b): defines a function named addfunc that takes two arguments, a and b.

c = a + b concatenates the strings a and b and stores the result in c. Because a and b are strings
("Hello" and "World"), the + operator performs string concatenation, not addition.

return c returns the concatenated string c ("HelloWorld").

result = addfunc('Hello', 'World') calls the function addfunc with the strings "Hello" and "World"
as arguments. The returned value ("HelloWorld") is stored in the variable result.

print(result) prints the value of result (which is "HelloWorld").

The note "Any data type values can be passed to parameters" highlights Python's dynamic typ-
ing. While this example uses strings, you could pass other data types to addfunc (though the +
operator's behavior would vary). However, as written, the function is designed implicitly for string
concatenation.

Function-10

Task: In this lesson, we will get introduced to arguments in functions.

educobot.com 18
This code defines a function greeting that prints a personalized greeting.

def greeting(name, msg='Welcome back!'): defines the greeting function, taking a name and an
optional msg (defaulting to 'Welcome back!').

print(name, ',', msg) prints the name and msg.

greeting('Sam') calls greeting with the name 'Sam', using the default message.

greeting('Sam', 'How do you do?') calls greeting with the name 'Sam' and the message 'How do
you do?'.

The note says the function has two arguments (parameters), one with a default value.

Function-13

Task: In this lesson, we will get introduced to keyword arguments in functions.

educobot.com 19
This code defines a function greeting that prints a personalized greeting and then calls it us-
ing keyword arguments.

def greeting(name, msg): defines the greeting function, taking name and msg as arguments.

print(name, ',', msg) prints the name and msg.

greeting(name='Sam', msg='How do you do?') calls greeting using keyword arguments. This
explicitly assigns 'Sam' to the name parameter and 'How do you do?' to the msg parameter.
This is an alternative way to pass arguments, making the code more readable, especially
when there are many parameters.

The note explains that this call uses "keyword arguments," which allow you to specify which
parameter each value is associated with by using the parameter name followed by an equals
sign.
QUIZ TIME
Q1. What is the primary purpose of a function in Python?
To make code run faster
To organize code into reusable blocks
To confuse other programmers

Q2. Which keyword is used to define a function in Python?

function

def
define

Q3. Can a function call itself?


Yes, this is called recursion

No, it's not allowed in Python


Only if it's a built-in function

A loop that runs two times

SHORT ANSWER QUESTIONS


Q1. Explain the difference between a function definition and a function call.
Q2. Why are functions useful in programming? Give at least two reasons.
Q3. What is the purpose of parameters and arguments in the context of functions?

educobot.com 20
Capstone Project:
Project 3: Animated Story with User Interaction (Conditions, Loops, and Functions)

Explanation: Let's create an interactive story! The story will have different scenes, and the player
will get to make choices that affect what happens. We'll use functions to organize the different
scenes, conditional statements to handle the player's choices, and (optionally) loops for any simple
animations.

def scene1():
print("You are in a dark forest. You see two paths.")
choice = input("Do you go left or right? ")
if choice.lower() == "left":
scene2()
elif choice.lower() == "right":
scene3()
else:
print("Invalid choice.")
scene1()

def scene2():
print("You encounter a friendly gnome.")
print("The gnome offers you a magical potion.")
choice = input("Do you drink the potion? (yes/no) ")
if choice.lower() == "yes":
print("You feel stronger!")
print("You continue your journey and reach the castle.")
else:
print("You decline the potion.")
print("You continue your journey and reach the castle.")

def scene3():
print("You fall into a pit.")
print("You are trapped!")
print("Game Over")

scene1() # Start the story

After Coding Task: Let's make this story epic!

1. More Scenes: Add at least 3 more scenes to the story. Get creative with what happens!
2. More Choices: At each scene, give the player at least 3 choices instead of just 2.
3. Character Inventory: Give the character an inventory. If they pick up an item in one scene, they
can use it in a later scene (this might require arrays or lists).

educobot.com 21
DATA SCIENCE: UNCOVERING
SECRETS OF DATA
4.1 What is Data Science?

Imagine you're a detective, but instead of solving crimes, you solve mysteries hidden within infor-
mation. That's what data scientists do! They explore the world of data – numbers, words, images,
and more – to find clues, patterns, and answers to important questions. Data science is all about
uncovering these hidden secrets and turning them into useful knowledge.

Think of data as a giant puzzle. Data scientists are like puzzle solvers. They use special tools and
techniques to organize the puzzle pieces (the data), put them together, and see the big picture.

4.2 Why is Data Science Important?

Data science helps us make better decisions about almost everything! From choosing what to eat
for lunch to understanding how climate change is affecting our planet, data science plays a role.
Here are some examples:

• Personalized Recommendations: When Netflix suggests a movie you might like or Amazon
recommends a product, that's data science at work. These companies analyze your past choices
to predict what you'll enjoy.
• Weather Forecasts: Meteorologists use data from weather stations, satellites, and other
sources to predict the weather. This helps us plan our day and stay safe.
• Medical Breakthroughs: Scientists analyze patient data to understand diseases and develop
new treatments. This can lead to life-saving discoveries.
• Social Issues: Data science can be used to study social problems like poverty or inequality
and find ways to address them.

Data science is used in almost every field you can imagine – from sports and entertainment to
healthcare and environmental science. It's a powerful tool for understanding the world and
making it a better place

4.3 Working with Data: Our First Steps

Data comes in many forms – numbers, words, dates, and even images. Let's start with a simple
example using Python, a popular programming language for data science. Don't worry if you've
never seen code before – we'll explain it step by step! You've actually worked with a similar con-
cept before! Remember learning about lists in eduCOBOT's Introduction to Coding lesson,
"Store99"? Just like how you used lists to store items in that lesson, we can use lists in Python to or-
ganize data.

educobot.com 22
# Example: Making a list of your friends' names
friends = ["Alice", "Bob", "Charlie", "David"]
print(friends) # This line shows us the list of friends.

Explanation: This code creates a "list" called friends and stores the names of four friends. The print() command
then displays these names on the screen. Lists are a basic way to organize data in Python, just like in the
"Store99" lesson.

4.4 Calculating Something Cool: The Average


Let's say we want to find the average height of your friends. We can use Python to do the
math for us!
# Example: Finding the average height (in centimeters)
heights = [150, 160, 155, 165] # Heights of your friends
average_height = sum(heights) / len(heights) # Calculates the average
print(average_height) # Shows us the average height

Explanation: sum(heights) adds up all the heights. len(heights) counts how many heights there
are. Dividing the total height by the number of heights gives us the average height. Python makes
these calculations super easy!

4.5 Organizing Data with Pandas


Remember the "Play Your Song" lesson where you organized musical notes and keys? Pandas is
a tool that helps us organize data in a similar way, but instead of music, we're working with all
sorts of information! Pandas helps us organize information into neat tables, just like a spread-
sheet.
import pandas as pd # This line brings in the Pandas tool.
class_data = {'Name': ['Alice', 'Bob', 'Charlie', 'David'],
'Age': [13, 14, 12, 13],
'Height': [150, 160, 155, 165]}
df = pd.DataFrame(class_data) # Creates a table from the data.
print(df) # Shows us the table

Explanation: This code creates a table (called a "DataFrame") with information about your class-
mates. Pandas makes it easy to work with data organized in this way. You can easily add more
columns (like "Favorite Subject") and rows (for more classmates). It's like organizing your music
notes and keys, but on a much larger scale!

4.6 Seeing Data with Matplotlib


Sometimes, it's easier to understand data if we can see it in a picture, like a chart or a graph. Mat-
plotlib is a tool that helps us create these visual representations.

educobot.com 23
import matplotlib.pyplot as plt # This line brings in the Matplotlib tool.
ages = [13, 14, 13, 12, 14, 13, 13, 12, 14, 13] #Ages of students
plt.hist(ages) # Creates a histogram (a type of chart).
plt.xlabel("Age") #Label for x axis
plt.ylabel("Number of Students") #Label for y axis
plt.title("Age Distribution of Students") #Title of the chart
plt.show() # Shows us the chart.

Explanation: This code creates a histogram, which shows how many students are each age. Mat-
plotlib makes it easy to create different kinds of charts and graphs to help us understand the data
visually. Visualizations are a powerful way to see patterns and tell stories with data.
4.7 Exploring Data: What's Next?

Now that you've got a taste of working with data, we can start exploring some exciting topics. But
first, let's put your new skills to the test with a few challenges!

Challenge 1: Classmate Data

1. Think about your own classmates. Make a list of at least five of your classmates' names and
their favorite subjects.
2. Using the Python list example from section 4.3 as a guide, create two separate lists: one for the
names and one for the favorite subjects.
3. Print both lists to make sure they look correct.

Challenge 2: Average Score

1. Imagine your classmates took a quiz. Make a list of their scores (out of 10). Include at least five
scores.
2. Using the code from section 4.4 as a guide, calculate the average quiz score.
3. Print the average score. What does the average tell you about how the class did on the quiz?

Challenge 3: Class Data Table

1. Take the name, age, and height data from the Pandas example in section 4.5.
2. Add two more classmates to the data, including their names, ages, and heights.
3. Run the code to create the DataFrame (the table).
4. Print the updated DataFrame. Can you see how the table has grown?

Challenge 4: Favorite Subject Chart

1. Collect data on your classmates' favorite subjects (e.g., Math, Science, English, Art). Aim for at
least ten responses.
2. Use the Matplotlib code from section 4..6 as a guide. Instead of ages, use the favorite subjects
to create a chart. You might need to adapt the code slightly to work with words instead of num-
bers. Hint: Look up "bar chart" in Matplotlib.
3. Label the axes of your chart clearly (x-axis for subject, y-axis for number of students). Give your
chart a title.
4. What does the chart tell you about the most popular subjects in your class?

educobot.com 24
Bonus Challenge: Combined Data

Combine the skills you've learned! Create a DataFrame that includes your classmates' names,
ages, favorite subjects, and quiz scores. Then, create a chart to visualize some aspect of this
data (e.g., a bar chart showing the average quiz score for each favorite subject).

A graphical representation in data science helps visualize data patterns, trends, and relation-
ships effectively. Common types include line charts for trends, bar charts for comparisons, and
scatter plots for correlations. These visualizations simplify complex data, making it easier to an-
alyze and derive insights.

educobot.com 25
Breadboard Basic: A Revision
Activity
Activity: In this revision activity, students will review the fundamental concepts of using a breadboard to build circuits.
They will practice connecting various components, such as LEDs, resistors, and switches, to the breadboard,
reinforcing their understanding of how to create circuits without soldering. The focus will be on reviewing how to make
proper connections, the function of each part of the breadboard, and the importance of organizing components for
effective circuit design.

Bread Board Buzzer


1 4

2 5

3 6

educobot.com 26
Bread Board LED with Resistor Process

1 4

2 5

3 6

educobot.com 27
7 8

Learning Outcome: Students will refresh their knowledge of breadboarding and circuit-building basics. They will im-
prove their skills in connecting components correctly and gain hands-on experience in designing and testing simple
circuits. This revision will reinforce their understanding of circuit connections and component placement, laying the
foundation for more advanced electronics projects.

UNDERSTANDING ACTIVE AND


PASSIVE COMPONENTS

Activity: In this theoretical activity, students will learn about the difference between active and
passive electronic components. They will explore the characteristics, functions, and examples of
each type of component. Active components, like transistors and diodes, require an external power
source and can amplify or control electrical signals. Passive components, such as resistors,
capacitors, and inductors, do not require power and can only store or dissipate energy.

educobot.com 28
Learning Outcome: Students will understand the distinction between active and passive components and their roles in
electronic circuits. They will learn about the functionality of common components and how they contribute to circuit
behavior. This foundational knowledge will help them design and analyze circuits more effectively in future projects.

OHM'S LAW: UNDERSTANDING


VOLTAGE, CURRENT AND RESISTANCE
Activity: In this theoretical activity, students will learn about Ohm’s Law, which states the
relationship between voltage (V), current (I), and resistance (R) in an electrical circuit. The equation V
= I × R will be explained, showing how voltage is directly proportional to current and resistance.
Students will also explore how changes in voltage or resistance affect the current in a circuit, using
practical examples and simple calculations to illustrate these concepts.

educobot.com 29
What is a Resistor?
A resistor is an electrical component that reduces the electric
current to protect devices from damage.
The resistor's capability to reduce the current flow is called
resistance and is measured in ohm (Denoted by the Greek symbol:
Ω.)
Resistance
The word ‘Resistance’ means to oppose.
What happens when you are cycling and you suddenly apply
brakes? Do you keep moving or the movement stops?
Yes, the movement will stop because the brakes oppose the
movement of the wheels. In other words, brakes offer resistance
against the movement of the wheels.
All things have a certain capacity to resist.
For example, consider two different water pipes of unequal width.
The wider pipe will have more space and hence will allow more
water to flow. Hence, it will have low resistance (less opposition to
the flow of water).

However, the thinner pipe will have less space and hence will al-
low less water to flow through it. In other words, it opposes the
flow of large quantities of water, that is, it offers more resistance to
water.
educobot.com 30
You can easily understand this in terms of a water analogy. If you consider
the water inside a pipe to be ‘Current,’ then the width of the pipe acts as a
resistor. The wider the pipe, the lesser it will oppose the flowing water and
hence more water can flow through it. This is called low resistance. If the
width of the pipe is reduced, it would limit the amount of water coming
out. This opposition is called high resistance.
Low Resistance = More Current
High Resistance = Less Current
This relation between Voltage, Current and Resistance is well explained
using the Ohm’s law.
Ohm’s Law: Ohm’s law states that the voltage across a conductor is
directly proportional to the current flowing through it.
This means that if the resistance is fixed, current can be increased by
increasing voltage and current can be decreased by decreasing voltage.
Mathematically, it is expressed as:
Voltage = Current * Resistance
V=I*R
If a circuit having 100 Ω resistance is powered by a 9 V battery, the current
flowing through the circuit will be equal to 9/100 = 0.09 A.
The same circuit with 100 Ω resistance, when powered by an 18 V battery,
will have a current equal to 18/100 = 0.18 A.
Ohm’s Law Triangle:

educobot.com 31
Learning Outcome: Students will gain a deep understanding of Ohm's Law and how it applies to
everyday electrical circuits. They will learn to calculate voltage, current, and resistance, under-
standing the relationship between these quantities. This knowledge is essential for designing and
analyzing circuits, forming a core principle of electronics and electrical engineering.

CHARGING & DISCHARGING OF


CAPACITOR

Activity: In this theoretical session, students will learn about the charging and discharging behavior of
capacitors in an electric circuit. They will understand how a capacitor stores energy in an electric field when
charged and how it releases energy when discharged. The concept of time constant (τ = R × C) will also be
introduced, explaining how it affects the rate of charging and discharging. Students will explore the
differences between charging and discharging curves and how resistors and capacitors work together to
regulate these processes.

educobot.com 32
educobot.com 33
Hands-On Activity: After the theory session, students will move on to a practical breadboard activi-
ty. They will assemble a simple RC (Resistor-Capacitor) circuit using a capacitor, resistor, and a
power source on the breadboard. The goal will be to observe the charging and discharging pro-
cess using a multimeter or LED as an indicator. Students will also measure the time it takes for the
capacitor to charge and discharge and calculate the time constant.

Learning Outcome: Students will gain a clear understanding of the charging and discharging pro-
cesses of capacitors. Through the hands-on activity, they will reinforce their theoretical knowledge
and see these principles in action. This activity will help them understand how capacitors function in
electronic circuits, and how the combination of resistors and capacitors can control timing and sig-
nal processing in various applications.

educobot.com 34
GETTING STARTED WITH ESP32:
PROGRAMMING A BUZZER
Activity: In this activity, students will be introduced to the ESP32 microcontroller and learn how to
use the eduCOBOT shield to interface with it. They will focus on programming the buzzer mounted
on the shield. By using the Innovator platform, students will create a simple program to control the
buzzer, making it turn on and off based on specific conditions. This activity helps students get
hands-on experience with ESP32 and basic programming concepts, reinforcing the connection be-
tween hardware and software.

Step-by-Step Instruction: Each


Code Insertion Options: Offers
step is broken down to simplify
choices to upload the code via
the learning process and ensure
WiFi or a cable.
understanding.

BUZZER

Circuit Design: This step-by-


step guide helps students
understand and create
connections effectively.

educobot.com 35
Circuit Design: The image shows a circuit
design interface for assembling components
and gaining visual learning experience.

Learning Outcome: Students will gain an understanding of the ESP32


microcontroller and how to interface it with external components, such as a
buzzer, using the eduCOBOT shield. They will learn how to write simple
programs that control hardware, providing a foundation for more complex
projects involving microcontrollers.

SMART LAMP: CONTROLLING


RGB WITH MICROCONTROLLER
Activity: In this project, students will assemble a lamp using MDF parts and mount an
RGB LED PCB. They will then connect the RGB LED to the microcontroller, which is
mounted on the eduCOBOT shield. Using the Innovator platform, students will write
a program to control the RGB LED, allowing them to turn the lamp on and change its
color by triggering different RGB combinations. This activity teaches students how to
control RGB LEDs using microcontrollers and how to use coding to control
hardware components in a practical setup.

educobot.com 36
MATERIALS REQUIRED:

STEP 1

STEP 2

educobot.com 37
STEP 3

STEP 4

STEP 5

STEP 6

educobot.com 38
STEP 7

Learning Outcome: Students will learn how to assemble a basic lamp project and control an RGB
LED using a microcontroller. They will gain experience with programming and understand how to
control color outputs based on coding logic. This project introduces them to practical applications
of LEDs, microcontrollers, and how they work together in real-world devices.

SMOKE DETECTION: TRIGGERING


BUZZER ON DETECTION
Activity: In this activity, students will learn how to use a smoke sensor to detect the presence of
smoke in the air. The sensor will be connected to the microcontroller, which is mounted on the
eduCOBOT shield. When smoke is detected, the sensor will trigger the buzzer to beep, alerting the
presence of smoke. Students will program the microcontroller using the Innovator platform to
respond to the sensor input and activate the buzzer. This activity helps students understand how
smoke sensors work and how to use them for safety-related applications.

educobot.com 39
Learning Outcome: Students will learn how to interface a smoke sensor with a microcontroller and
program it to trigger an output (buzzer) upon smoke detection. They will gain hands-on experience
in integrating sensors and actuators in safety systems, reinforcing their understanding of sensors
and event-driven programming in real-world applications.

educobot.com 40
FIRE ALARM SYSTEM:SMOKE
DETECTION IN HUT

Activity: In this activity, students will assemble a hut model using MDF parts and integrate a smoke sensor within the
model to create a fire alarm system. The smoke sensor will be connected to a microcontroller mounted on the
eduCOBOT shield. When smoke is detected, the sensor will trigger a buzzer or alarm to alert users, simulating a fire
alarm system. Students will program the microcontroller using the Innovator platform to make the buzzer sound
when smoke is sensed. This project combines model building with electronics to simulate a real-life fire alarm
system.

MATERIALS REQUIRED:

STEP 1

X1 X1 X2

STEP 2

X1 X2

educobot.com 41
STEP 3

X2

X3
X2 X1

STEP 4

STEP 5

Attach the Smoke Sensor (MQ2) inside the hole in the hut
cutout with its pins facing upwards for stability—no screws
needed.

STEP 6

educobot.com 42
STEP 7

Learning Outcome: Students will learn how to build a functional fire alarm system using a smoke sensor, microcon-
troller, and buzzer. They will gain hands-on experience in assembling physical models, integrating sensors for smoke
detection, and programming a microcontroller to control alarms in emergency scenarios. This activity helps develop
problem-solving skills and reinforces the importance of safety systems in everyday life.

PUMP CONTROL: AUTOMATING


WITH A MOTOR
Activity: In this activity, students will learn how to control a pump motor using a microcontroller mounted on the
eduCOBOT shield. The pump motor will be connected to the shield, and students will write a program on the Innovator
platform to control the motor, triggering it to start and stop based on specific conditions. This activity will help students
understand how motors work in automation systems and how to integrate them into practical applications like pumps
for water or fluid control.

Learning Outcome: Students will learn how to control a pump motor using a microcontroller. They
will gain experience in writing programs that interact with hardware, specifically motors, to auto-
mate processes. This activity introduces them to concepts in automation and motor control, which
are applicable in various industries such as agriculture, water management, and robotics.

educobot.com 43
WATER DISPENSER AUTOMATION

Activity: In this activity, students will build a simple water dispenser model and use a
microcontroller on the eduCOBOT shield to automate the dispensing process. By programming
the microcontroller on the Innovator platform, students will trigger the water to dispense for one
second and stop automatically. This project teaches students about controlling fluid systems and
automating processes using a microcontroller.

MATERIALS REQUIRED:

STEP 1

STEP 2

STEP 3

educobot.com 44
STEP 4

Place the pump motor in your own water source (not the glass shown in the im-
age) to suck water and pour it into a glass.

STEP 5

Learning Outcome: Students will learn how to automate the dispensing of water using a micro-
controller. They will gain experience in programming timed events to control hardware, applying
automation concepts to practical tasks.

educobot.com 45
INTRODUCTION TO IOT

Introduction to IoT:

• Definition and examples of IoT (e.g., smart homes, wearable devices, connected cars).
• How IoT devices communicate through the internet.
• Key components of an IoT system: Sensors, Actuators, Microcontrollers, and Cloud platforms.
Key Concepts:

• Sensors: Devices that collect data (e.g., temperature, humidity, motion).


• Actuators: Devices that take action based on sensor data (e.g., motors, lights, buzzers).
• Microcontroller: A small computer that processes information and controls devices (e.g., ES-
P32, Arduino).
• Connectivity: Communication between devices via Wi-Fi, Bluetooth, or other protocols.
• Cloud and Data Processing: Sending data to the cloud for analysis and control (e.g., using
platforms like ThingSpeak, Blynk).
IoT System Architecture:

• Sensing: Collecting real-world data through sensors.


• Processing: Using microcontrollers to analyze and process data.
• Action: Triggering actions based on the data, such as turning on a light or activating a motor.
• Communication: Sending data to other devices or cloud platforms for further action or moni-
toring.
Hands-On Activities:

• Basic IoT Circuit: Connecting sensors (e.g., temperature, light, motion) to a microcontroller
(e.g., ESP32, Arduino) and displaying data on a screen.
• Remote Control via App: Creating a system where students control devices (LEDs, motors)
from a mobile app using IoT platforms.
• Data Logging and Monitoring: Using sensors to collect data and display it on a cloud platform
for monitoring in real-time.
• Automation Projects: Building smart systems like automated lighting, temperature control, or
security systems that use sensors and IoT communication to act based on data.

educobot.com 46
Learning Goals:

• Understand the core components of an IoT system.


• Learn how to build IoT projects using microcontrollers and sensors.
• Develop basic programming skills for IoT applications.
• Gain experience in integrating physical devices with the internet for smart automation.
Safety and Best Practices:

• Importance of understanding wiring and connections in IoT devices.


• Ensuring safe handling of electronics and power supplies.
• Best practices for secure IoT systems to prevent hacking or misuse.

EXPLORING IOT DASHBOARD ON INNOVATOR

Activity: In this activity, students will be introduced to the IoT Dashboard on the Innovator platform. The IoT dash-
board provides a user-friendly interface for monitoring and controlling IoT devices remotely. Students will learn how
to navigate the dashboard, view real-time data from sensors, and control connected devices (like LEDs, motors, and
sensors) from the dashboard interface. By the end of this session, students will be comfortable using the Innovator

The IoT dashboard provides an overview of


projects, sensors, AI models, IoT variables,
and recent activities for efficient monitoring
and management.

educobot.com 47
SpongeBOT acts as an instant AI
assistant within the eduCOBOT
platform, providing on-the-spot
answers to coding, robotics, or
IoT-related queries. It eliminates
the need to wait for responses or
switch tabs to search, offering
real-time guidance by leveraging
its built-in knowledge and
context-specific understanding of

Build your own projects using the Innovator tools, and all the projects you create will
be saved and organized in the "My Projects" section for easy access and
management.

educobot.com 48
The Curriculum section provides access to various categorized lessons (e.g., IoT, AI, robotics)
where you can explore detailed instructions to code and design projects like IoT-based devices.
Simply navigate through the categories, select the desired lesson or grade, and open it to
understand the coding logic and design implementation for creating and monitoring your own
projects.

To create a project, enter the name and description, then


select the required development environments (e.g.,
Robotics, IoT, AI) using the checkboxes or "Select All."
Click Create Project to proceed with your chosen setup.

Drag and drop Widgets (switches, inputs, charts) to


design the monitor, then configure properties and link
them to your IoT devices via APIs. Save the setup and
test for proper remote control functionality.

educobot.com 49
Learning Outcome: Students will understand how to use the IoT dashboard on Innovator to monitor, control, and man-
age IoT devices. They will learn how to visualize sensor data and trigger actions, gaining practical skills in creating user-
friendly interfaces for their IoT projects. This activity also emphasizes the importance of dashboard-based interaction for
remote monitoring and control in IoT systems.

IOT BASED LED LIGHT CONTROL

Activity: In this activity, students will learn how to control an LED light remotely using the Innovator platform and an IoT
dashboard. By connecting an LED to a microcontroller (e.g., ESP32) and integrating it with the dashboard, students will
be able to switch the LED on and off from any location via the internet. Students will program the microcontroller on
Innovator to send and receive signals, allowing them to interact with the LED light in real-time. This activity helps stu-
dents understand the fundamentals of remote control systems in IoT.

This circuit connects an LED to the eduCOBOT shield via the D2 pin. The LED can be programmed to turn on or
off based on the project's logic. This circuit can also be utilized in IoT projects for remote monitoring and control
of the LED's state.

This code connects the ESP32 to the eduCOBOT IoT platform and allows remote control of an LED. It checks the
cloud variable LED Status:

• If LED Status is '1', the LED on pin 2 turns ON.

• If not, the LED stays OFF.

This demonstrates how to control hardware using IoT.

educobot.com 50
Select the widget that you would want to use for designing your monitor in this case we are
using Switch to toggle between on and off. Click on the edit icon to select the Variable name
which will store the data.

In the IoT project, a switch on the monitor


design will allow users to remotely toggle
the LED's state (on or off) via a user-
friendly interface. This switch
communicates with the device through the
cloud, enabling real-time control of the
LED from any location.

Learning Outcome: Students will gain hands-on experience in building and programming an IoT system that allows
remote control of an LED light. They will learn how to use a dashboard to send commands and control devices via the
internet, understanding the basics of IoT connectivity, control, and data exchange.

IOT WEATHER STATION WITH DHT11

Activity: In this activity, students will create an IoT Weather Station using the DHT11 temperature and humidity sen-
sor, connected to a microcontroller mounted on the eduCOBOT shield. The students will program the microcontrol-
ler using the Innovator platform to collect real-time temperature and humidity data from the DHT11 sensor. This data
will be displayed on the IoT Dashboard, allowing students to monitor environmental conditions remotely. The activity
introduces students to the concept of collecting and visualizing real-world data through IoT.

educobot.com 51
The DHT11 sensor is connected to an ESP32 shield:

• OUT (Signal) pin: D15 (or any other GPIO pin).

• VCC: 3.3V or 5V.

In this setup, the OUT (signal) pin of the DHT11 sensor is connected to the D15 (GPIO15) pin
on the ESP32. This pin reads the sensor's temperature and humidity data, which is then
processed in the code for IoT transmission.

educobot.com 52
This dashboard uses widgets to display real-time data from the DHT11 sensor. Numeric values
for temperature and humidity are shown via label widgets, while gauge widgets provide a
visual representation for easier interpretation.

Learning Outcome: Students will learn how to interface the DHT11 sensor with a microcontroller and program it to col-
lect and transmit temperature and humidity data. They will gain practical experience in creating an IoT-based weather
station and understand how sensors work in conjunction with microcontrollers to provide real-time data that can be
monitored remotely on an IoT dashboard. This activity reinforces concepts of data collection, programming, and remote
monitoring in IoT systems.

IOT DISTANCE MANAGEMENT

WITH ULTRASONIC SENSOR

Activity: In this activity, students will build an IoT Distance Sensor system using an Ultrasonic Sensor, connected to a
microcontroller mounted on the eduCOBOT shield. The students will program the microcontroller on the Innovator
platform to measure the distance between the sensor and an object in its path. The distance data will be displayed on
the IoT Dashboard in real-time, allowing students to monitor and track distances remotely. This activity introduces stu-
dents to the concept of distance measurement using ultrasonic sensors in an IoT system.

educobot.com 53
Here’s the pin configuration for connecting the ultrasonic sensor to the ESP32 as per your setup:

VCC : 5V (ESP32 Shield 5V Pin)

GND : GND (ESP32 Shield Ground Pin)

Trig : D4 (GPIO4)

Echo : D5 (GPIO5)

This setup allows the Trig pin to send signals and the Echo pin to receive reflected signals.

This code uses an ultrasonic sensor (HCSR04) to measure distance by sending a signal from
the trigger pin and receiving it back on the echo pin. The sensor's trigger pin (GPIO 4) sends the
signal, and the echo pin (GPIO 5) receives the reflected signal to calculate the distance. The
measured distance is then sent to an IoT platform for display.

educobot.com 54
Add a Label widget to the Innovator dashboard and bind it to a variable that receives the
distance data from the ultrasonic sensor. The label will automatically update to display the
detected distance in real-time.

Learning Outcome: Students will learn how to interface an ultrasonic sensor with a microcontroller
and program it to measure distance. They will understand how ultrasonic sensors work and how to
use them in IoT applications to capture and transmit real-time data. The activity will also help stu-
dents understand how to use an IoT dashboard for remote monitoring of sensor data and gain ex-
perience with IoT-based distance measurement systems.

SMART GARBAGE MONITORING WITH IOT

Activity: In this project, students will assemble a Smart Garbage Bin from MDF parts. The system will use an Ultrasonic
Sensor to measure the fill level of the garbage bin, connected to a microcontroller mounted on the eduCOBOT shield.
Students will program the microcontroller using the Innovator platform to monitor the fill level of the bin and trigger an
action, such as turning on a light or activating a buzzer, when the bin is full. The data will be displayed on the IoT Dash-

MATERIALS REQUIRED:

X1 X1

X1 X1

educobot.com 55
2

X1 X1

X1 X3

X1

X1

Insert the ultrasonic sensor in the hole provided on the lid of the bin directly without
nuts and bolts.

educobot.com 56
5

X2

UNDERSTANDING THE CIRCUIT

Ultrasonic Sensor Pin Configuration with eduCOBOT Shield:


1. GND: Connect the GND pin of the ultrasonic sensor to the GND port on the eduCOBOT
shield.
2. VCC: Connect the VCC pin of the sensor to the VCC port on the eduCOBOT shield (5V
supply).
3. Trig: Connect the Trig pin of the sensor to D4 on the eduCOBOT shield for sending
trigger signals.
4. Echo: Connect the Echo pin of the sensor to D5 on the eduCOBOT shield to receive

UNDERSTANDING THE CODE AND MONITOR

educobot.com 57
This code creates a Smart Bin system using an ultrasonic sensor, a buzzer, and IoT integration. Here's how it
works:

1. The ultrasonic sensor (connected to pins D4 and D5) measures the distance inside the bin.
2. If the distance is less than 10 cm (indicating the bin is full), the buzzer (on pin 27) buzzes, and the IoT
monitor displays "The bin is full".

3. If the distance is 10 cm or more (indicating the bin is empty), the buzzer stays off, and the IoT monitor
displays "The bin is empty".

4. The eduCOBOT IoT platform is used to send real-time messages about the bin's status, which are visible

The IoT Monitor’s label widget displays real-time messages like "The bin is full" or "The bin
is empty". Using the iot.sendData() function, the ESP32 sends these status updates to the
IoT platform via the secretKey and APIKey. The label updates automatically, allowing

educobot.com 58
Learning Outcome: Students will learn how to design and build a Smart Garbage Monitoring System using an ultrasonic
sensor to detect the fill level of a garbage bin. They will gain experience in IoT integration, programming microcontrollers,
and using sensors to collect data in real-time. This project introduces the concept of smart city solutions by using IoT to

IOT SMART DOORBELL WITH ACCESS CONTROL

Activity: In this project, students will build a Smart Door Bell system using a house model and a switch PCB. The sys-
tem will be connected to a microcontroller mounted on the eduCOBOT shield, and controlled via the IoT Monitor
Dashboard. When the button on the doorbell is pressed, the IoT Monitor Dashboard will display a notification indicating
a visitor at the door. The learner can then use a toggle button on the dashboard to either allow or deny access by
changing the state of an LED light on the system (green for allow, red for deny). This project introduces students to how
IoT can be used to remotely control access to a door and provides real-time feedback through the IoT dashboard.

MATERIALS REQUIRED:

STEP 1

X1 X1

X2

educobot.com 59
STEP 2

X1 X5

X2

X2 X1

STEP 3

X2

STEP 4

X2 X2

educobot.com 60
STEP 5

X2

Insert the RGB PCB in the given slot as


shown in the figure.

Front side

STEP 7

X1

educobot.com 61
UNDERSTANDING THE CIRCUIT

1. Touch Sensor:

• VCC is connected to the VCC port on the eduCOBOT shield.

• GND is connected to the GND port on the eduCOBOT shield.

• Signal pin is connected to the D15 port for input detection.


• RGB LED:

• VCC is connected to the VCC port on the shield.

• GND is connected to the GND port.

• Red, Green, and Blue pins are connected to D13, D14, and D12 ports respectively for controlling individual
colors.

UNDERSTANDING THE CODE AND MONITOR

educobot.com 62
This code creates a Smart House Doorbell System using a touch sensor, LEDs, a servo motor, and the
eduCOBOT IoT Monitor. When someone touches the sensor, the buzzer buzzes, and the IoT Monitor displays
"You Have a Visitor". If the user selects Allow, the servo motor opens the door (moves to 90°) and lights up the
green LED. If the user selects Disallow, the yellow LED turns on, and the door remains closed. After processing,
the system resets, and the monitor updates to "No Visitor At The Moment".
NOTE: This is not the complete code .

The Switch Widget is used to allow or disallow visitors, and the Label Widget displays the
notification status (e.g., "No Visitor At The Moment"). The Allow (green checkmark) and
Disallow (red cross) sections provide toggles for access control, making it an efficient IoT-
based visitor management system.

educobot.com 63
MRP | 65 Pages |

Mumbai: 6th Floor, 288 Shiv Sadan S V Road,

Bandra West, Mumbai, Maharashtra 400050

www.educobot.com

[email protected]

+91-7278517851

Published By Kritrima Prajna Innovations Pvt Ltd, Mumbai

educobot.com 64

You might also like