Grade 9 Coding and Robotics
Grade 9 Coding and Robotics
educobot.com 1
ROBOTICS INDEX
1 Revision of Basics 26
2 Active and Passive Components 26
3 Breadboard Circuit—Building And Gate 28
4 Breadboard Circuit—Or Gate / Not Gate 29
5 Introduction to IOT 33
6 Exploring IoT Dashboard on Innovator 34
7 IOT Based LED Light Control 37
8 IoT Weather Station with dht11 38
IoT Distance Management with Ultra-
9 40
sonic Sensor
10 Smart Garbage Monitoring with IoT 42
11 IoT Smart Bell With Access Control 46
12 Introduction to AI and ML 51
13 Introduction to Model Training 58
14 Smart House with AI 60
15 7 Segment Display with AI 65
educobot.com 2
EXPLORING NEW HORIZON
Welcome to Grade 9! This year, we're going to expand our computing skills and explore exciting
new areas, from controlling graphics with code to getting a taste of data science and artificial in-
telligence!
• While Loops: You already know how to repeat actions with loops. This year, we'll learn about
while loops, which let us repeat actions until a certain condition is true. This is like saying, "Keep doing
this while this is happening." This will give us more con-
trol over how our programs run.
• Turtle Graphics: Get ready to draw with code!
We'll be using the Turtle library to create colorful
shapes, patterns, and even animations. You'll be able
to write code that tells a "turtle" (a little cursor) where
to move and what to draw.
• Introduction to Data Science: We'll get a
glimpse into the world of data science, where we use
computers to analyze and understand large amounts
of information. We'll learn how data scientists use pro-
gramming to find patterns and insights.
• NumPy and Pandas Libraries: We'll explore two important tools for data science: NumPy and
Pandas. NumPy helps us work with numbers efficiently, and Pandas helps us organize and analyze
data in tables, kind of like a spreadsheet.
• A Touch of AI: We'll explore some basic concepts of artificial intelligence (AI) and see how com-
puters can learn and make decisions. This will give you a first look at this exciting field.
• Coding Connections: Throughout the year, we'll see how all these concepts connect to cod-
ing. You'll be using your coding skills to control the Turtle, work with data, and even explore some
AI ideas.
Learning Outcomes:
Get ready for a year of exciting exploration! You'll be discovering new ways to use computers to
create, analyze, and learn!
educobot.com 3
WHILE LOOP
The concept of loops, including the while loop, originates from early programming
languages developed in the 1950s and 1960s. , the creator of FORTRAN, introduced
structured programming concepts, which later influenced the development of loops.
Over time, languages like C, Java, and Python incorporated while loops as an essen-
tial feature for repetition and automation in programming.
print(num)
num += 1 # Increases num by 1 in each iteration
educobot.com 4
Output
1
4
Explanation:
• num = 1 The loop starts with num as 1.
• while num <= 5 The condition is checked before running the loop.
• Inside the loop, num is printed and then increased by 1.
• Once num reaches 6, the condition num <= 5 becomes False, and the loop stops.
1.5 Why Are While Loops Important in Coding?
• Automation: Reduces manual work by executing repetitive tasks.
• Dynamic Execution: Runs until a condition is met, making it useful for unknown repetitions.
• User Interaction: Keeps programs running based on user input (like login attempts).
• Game Development: Used for real-time loops in video games (like player movements).
WHILE LOOP-01
Task: In this lesson, we will use print() function to display Hello 5 time on the output screen.
educobot.com 5
WHILE LOOP-02
Task: In this lesson, we will use While loop to our previous code instead of printing it separately for 5 time
and understand how While loop can make our task easier.
WHILE LOOP-03
educobot.com 6
Task: In this lesson, we will use While loop to our previous code instead of printing it separately for 5 time.
WHILE LOOP-09
Task: In this lesson, we will use While loop along with condition to check whether numbers from 0 to 5 are
lesser than 5 or not
educobot.com 7
In this activity, we will use a
while loop and a condition to
check whether numbers from
0 to 5 are less than 5. If the
condition is true, we will print
[number] is less than 5.
APPLN-12
Task: In this lesson, we will use While loop to make a dice roll and get a random output.
educobot.com 8
The code simulates rolling
two dice using a while loop. It
continues rolling as long as
the user inputs "yes." Howev-
er, there is an error: randint
(i,6) should be randint(1,6)
since i is not defined.
QUIZ TIME
Q3. What happens if you forget to update the loop variable inside a while
loop?
The loop executes only once
educobot.com 9
SHORT ANSWER QUESTIONS
Q1. What is while loop used for in Python?
Q2. Can a while loop have an else statement? If yes, when does it execute?
Q3. Write a simple while loop that prints numbers from 1 to 5.
TURTLE PROGRAMMING
· Event Handling: Control the turtle using keyboard and mouse inputs.
· Looping & Functions: Create complex drawings with loops and functions.
educobot.com 10
2.3 Basic Concepts in Turtle Programming
(a) The Turtle Window
When using the Turtle module, a window opens, displaying a turtle (represented by an arrow or a
custom shape). This turtle can move around based on commands.
TURTLE BASIC
Task: In this lesson, we will create a basic square using Turtle programming.
educobot.com 11
This code uses Python's Turtle module to draw a square. Here's how it works step by step:
TURTLE BASIC
Task: In this lesson, we will create a basic circle using Turtle programming.
This Python Turtle code draws a red circle with a radius of 45 pixels. Here's how it works:
This code simply makes the turtle draw a red circle on the screen.
educobot.com 12
TURTLE BASIC
Task: In this lesson, we will learn how to move the arrow in forward direction according to the pixel value.
This Python Turtle code moves an arrow forward by 100 pixels. Here's how it works:
The arrow starts at its default position and moves straight ahead by 100 pixels.
TURTLE WHILE
Task: In this lesson, we will learn how to create a circle pattern without actually creating a circle
educobot.com 13
This Python Turtle program creates a circular pattern using repeated forward and backward
movements with rotations. Here's how it works:
Code Breakdown:
1. import turtle :Imports the Turtle module.
2. turtle.pencolor('orange') :Sets the drawing color to orange.
3. i = 0 :Initializes a counter variable i.
4. while i < 32: :Runs the loop 32 times.
• turtle.forward(50) :Moves the turtle 50 pixels forward.
• turtle.right(90) :Rotates the turtle 90 degrees to the right.
• turtle.backward(50) :Moves the turtle 50 pixels backward.
• turtle.left(20) :Rotates the turtle 20 degrees to the left.
• i += 1 :Increments i to ensure the loop runs 32 times.
•
Pattern Explanation:
• The forward and backward movement creates short lines.
• The left rotation (20 degrees) after each iteration makes the lines spread out in a circular
pattern.
• Repeating this 32 times (32 × 20° = 640°) creates a starburst or sun-like shape.
FOR– 44
Task: In this lesson, we will learn how to draw a square using for loop
This Python Turtle program is designed to draw a square using a for loop.
Code Breakdown:
1. import turtle :Imports the Turtle module.
2. turtle.pencolor('black') :Sets the drawing color to black.
3. for i in range(4): :Loops 4 times to draw the four sides of the square.
• turtle.forward(100) :Moves the turtle 100 pixels forward.
• turtle.right(90) :Turns the turtle 90 degrees to the right.
educobot.com 14
Pattern Explanation:
• The turtle moves forward by 100 pixels and then turns 90 degrees to the right.
• Repeating this 4 times completes the four sides of a square.
• The for loop ensures that the code is concise and efficient.
This is a great beginner-friendly Turtle graphics example for learning loops and basic shapes!
FOR– 52
Task: In this lesson, The Turtle module will draw overlapping circles, forming a circular or spirograph-like
pattern.
· import turtle – This imports the Turtle module, which helps in drawing.
· turtle.left(0) – Normally, this command changes the direction of the turtle, but here, left(0)
does nothing.
FOR– 54
Task: In this lesson, we will learn how to draw a square using for loop making it more colorful and creative.
educobot.com 15
This Python Turtle program is designed to draw a square with multiple colors by changing the
pen color for each side.
Code Breakdown:
1. import turtle :Imports the Turtle module.
2. wn = turtle.Screen() :Creates a screen window.
3. wn.bgcolor('pink') :Sets the background color to pink.
4. t = turtle.Turtle() :Creates a turtle object.
5. t.penup() & t.goto(100, 0) & t.pendown() :Moves the turtle to position (100,0) without drawing
and then places the pen down.
6. for c in ['red', 'green', 'yellow', 'blue']: :Iterates through a list of colors.
• t.color(c) :Changes the pen color for each side.
• t.forward(75) :Moves the turtle 75 pixels forward.
• t.left(90) :Turns the turtle 90 degrees left.
Pattern Explanation:
• The loop ensures that each side of the square is drawn in a different color.
• The turtle moves 75 pixels and turns 90 degrees at each iteration.
• This results in a colorful square on a pink background.
QUIZ TIME
Q1. Which command is used to move the turtle forward by a specified distance?
turtle.forward(distance)
turtle.move(distance)
turtle.step(distance)
educobot.com 16
Q3. Which command is used to move the turtle forward by a specified distance?
turtle.up()
turtle.stop()
turtle.penup()
Data science is about uncovering hidden stories within data. Imagine you have a giant box of
puzzle pieces. Data science gives you the tools to sort through those pieces, find the patterns,
and put the puzzle together to see the big picture. We use computers to help us do this because
often, the "box of puzzle pieces" is enormous!
Data science helps us answer questions and make better decisions. For example:
• A store can use data science to figure out which products are most popular and how to
best stock their shelves.
• Doctors can use data science to identify patterns in patient records and develop more
effective treatments.
• Scientists can use data science to analyze climate data and understand how the Earth's
climate is changing.
educobot.com 17
3.2 What We'll Do in Data Science:
This year, we'll learn the basic steps involved in a data science project:
1. Asking Questions: Data science starts with asking interesting and important questions. What do
we want to learn? What problems are we trying to solve?
2. Gathering Data: Sometimes data is already collected for us. Other times, we might need to find
it ourselves. Think of it like getting all the puzzle pieces out of the box. Data can come from many
sources, like surveys, experiments, or online databases.
3. Cleaning and Organizing Data: Data can be messy! We need to clean it up, remove errors, and
organize it so it's easy to work with. This is like sorting the puzzle pieces by color or shape.
4. Exploring and Analyzing Data: We'll use tools and techniques to explore the data and look for
patterns, trends, and relationships. This is like trying different puzzle pieces together to see what fits.
We might use charts, graphs, and calculations to help us. This is where our data science tools come
in!
5. Visualizing Data: Creating charts and graphs helps us understand the data better and communi-
cate our findings to others. This is like seeing the picture start to emerge as you put the puzzle to-
gether.
6. Drawing Conclusions: Finally, we'll use what we've learned to draw conclusions and answer the
questions we started with. This is like seeing the complete puzzle and understanding the story it
tells.
3.3 Data Science Tools: NumPy, Pandas, and Matplotlib
In data science, we use special tools to help us work with data. Three important tools are NumPy,
Pandas, and Matplotlib.
• NumPy: NumPy is like a powerful calculator for numbers. It's really good at doing math quickly,
especially with large sets of numbers. We use NumPy for calculations like finding averages, sums,
or other statistical measures.
• Pandas: Pandas helps us organize data into rows and columns, like a spreadsheet. It makes it
easy to clean, manage, and analyze data. We use Pandas to structure our data so we can easily ex-
plore it and find patterns.
• Matplotlib: Matplotlib is our go-to tool for creating visualizations. We use it to make charts,
graphs, and other visual representations of our data, which helps us understand the data better
and communicate our findings effectively. Think of it as the tool we use to bring our data to life vis-
ually.
The best way to learn data science is by doing! We'll work on projects that will take us through
the data science process, from gathering and cleaning data to visualizing it and drawing conclu-
sions. These projects will help you understand how data science is used in the real world and
give you hands-on experience with the tools of the trade. Here are some examples:
educobot.com 18
• Analyzing Student Survey Data: We could collect data from
student surveys and use data science techniques to analyze things
like favorite subjects, after-school activities, or study habits. We
might use Pandas to organize the survey responses and NumPy to
calculate statistics.
Data science starts with asking questions. Our question is: "Which car brands are the most popular?"
We'll look at data about car sales to figure this out.
Phase 2: Gathering Data
To answer our question, we need data! I've got a file here called car_sales.csv that has information
about car sales. It has the car brand, the number of cars sold, and the car type (like Sedan, SUV, or
Hatchback). We'll use this data to find out which brands are popular.
print("First few rows of the data:") # This line prints a message to the screen.
print(df.head()) # This line shows the first few rows of the DataFrame, so we can
get a quick look at the data.
educobot.com 19
print("\nData types and info:") # This prints a message.
print(df.info()) # This line shows us information about the DataFrame, like what
type of data is in each column (text, numbers, etc.) and if there are any missing
values.
print("\nMissing values:") # This prints a message.
print(df.isnull().sum()) # This line counts how many missing values are in each
column. Missing values are when we don't have information for a particular entry.
df.dropna(inplace=True) # This line removes any rows that have missing values. The
`inplace=True` part means the changes are made directly to the `df` DataFrame.
THE OUTPUT FOR THIS STEP - after you run the code
After running the code in Phase 3, students will see output similar to this (the exact order of
columns might be slightly different):
First few rows of the data:
Brand Cars Sold Car Type
0 Maruti Suzuki 150000 Hatchback
1 Hyundai 120000 Hatchback
2 Tata Motors 80000 Hatchback
3 Mahindra 60000 SUV
4 Kia 90000 SUV
First few rows of the data:
Brand Cars Sold Car Type
0 Maruti Suzuki 150000 Hatchback
1 Hyundai 120000 Hatchback
2 Tata Motors 80000 Hatchback
3 Mahindra 60000 SUV
4 Kia 90000 SUV
Missing values:
Brand 0
Cars Sold 0
Car Type 0
dtype: int64
This shows the first few rows, the data types (object for text, int64 for integers), and confirms that
there are no missing values after the dropna() command.
educobot.com 20
Phase 4: Exploring and Analyzing Data
Let's see what the data tells us!
brand_sales = df.groupby('Brand')['Cars Sold'].sum() # This line groups the data
by car brand and then calculates the total number of cars sold for each
brand. The result is stored in a new variable called `brand_sales`.
THE OUTPUT FOR THIS STEP - after you run the code
Total cars sold by brand:
Brand
Audi 8000
BMW 10000
Ford 40000
Honda 70000
Hyundai 120000
Jaguar 3000
Jeep 2000
Kia 90000
Land Rover 2000
MG 15000
Mahindra 60000
Maruti Suzuki 150000
Mercedes-Benz 12000
Nissan 10000
Porsche 1000
Renault 20000
Skoda 5000
Tata Motors 80000
Toyota 50000
Volkswagen 30000
Name: Cars Sold, dtype: int64
Total cars sold by brand (sorted):
Brand
Maruti Suzuki 150000
Hyundai 120000
Tata Motors 80000
Honda 70000
Mahindra 60000
Toyota 50000
Ford 40000
Volkswagen 30000
Renault 20000
MG 15000
educobot.com 21
Mercedes-Benz 12000
BMW 10000
Nissan 10000
Kia 90000
Audi 8000
Skoda 5000
Jaguar 3000
Jeep 2000
Land Rover 2000
Porsche 1000
Name: Cars Sold, dtype: int64
This shows the total cars sold for each brand, then the brands sorted by sales, and finally, the most
popular brand.
sorted_sales.plot(kind='bar') # This line creates a bar chart of the sorted sales data
Each bar represents a car brand, and the height of the bar shows how many cars were sol
plt.title("Total Cars Sold by Brand") # This line adds a title to the chart.
plt.xlabel("Brand") # This line labels the x-axis (the bottom of the chart) with "Bran
plt.ylabel("Cars Sold") # This line labels the y-axis (the side of the chart) with "Ca
Sold."
THE OUTPUT FOR THIS STEP - after you run the code
Look at the chart! Which brand is most popular? (The one with the tallest bar!) Now, write a
sentence or two explaining what you found. For example: "Maruti Suzuki is the most popular
car brand because they sold the most cars."
educobot.com 22
To create the data file:
Maruti Suzuki,150000,Hatchback
Hyundai,120000,Hatchback
Tata Motors,80000,Hatchback
Mahindra,60000,SUV
Kia,90000,SUV
Honda,70000,Sedan
Toyota,50000,SUV
Ford,40000,SUV
Volkswagen,30000,Sedan
Renault,20000,Hatchback
MG,15000,SUV
Nissan,10000,Sedan
Skoda,5000,Sedan
Jeep,2000,SUV
BMW,10000,Sedan
Audi,8000,Sedan
Mercedes-Benz,12000,Sedan
Jaguar,3000,Sedan
Land Rover,2000,SUV
Porsche,1000,Sports Car
Hi everyone! You've done a great job loading and cleaning our car sales data! Now, let's talk
about something sneaky that can mess up our analysis: duplicate data.
educobot.com 23
Here's what I want you to do:
1. Instructions: "Open the car_sales.csv file in a text editor. Copy the first row of the car_sales.csv file
(Maruti Suzuki) and paste it at the very end of the file. Now you have a duplicate row. Save the file."
2. Explanation: "Run the Python code again. Does the total number of cars sold look correct? Is it
higher than it should be? Why might having duplicate data be a problem?" (Guide them to under-
stand that duplicates inflate the sales numbers, giving a wrong impression of popularity and poten-
tially skewing other calculations).
3. The Fix: "Add the following lines of code after you read the CSV file, and before you do any calcu-
lations (like grouping by brand):
df.drop_duplicates(inplace=True)
print("\nData after removing duplicates:")
print(df.info()) #Print the info again to check the change in the number of entries
Run the code again. Does the total number of cars sold look better now? How many rows are there
now? This shows how drop_duplicates() helps us clean the data."
• Clear Instructions: The instructions are concise and specific, telling them exactly what to do.
• Targeted Explanation: The explanation focuses on the specific problem of duplicate data and
its impact on the analysis.
• Direct Solution: The code snippet is provided, so students can directly see how to fix the issue.
• Reinforced Learning: After the challenge, discuss what they learned about duplicate data and
why it's important to remove them. Ask them: "What would happen if we didn't remove the dupli-
cates? How would it affect our conclusions about which car brand is most popular?
By concentrating on this single, important concept, you'll give your students a solid under-
standing of how duplicate data can affect their analysis and how to use drop_duplicates() to
clean their data effectively. This focused approach is particularly helpful for introducing data
cleaning concepts.
Challenge 2: Exploring Car Types and Visualizing the Data – Let's Dig Deeper!
Hi everyone! Great job completing the first challenge and cleaning up our car sales data! Now that
our data is nice and tidy, let's see what else we can discover!
We've learned about which brands are most popular. But what about the types of cars? Are people
buying more Hatchbacks, SUVs, or Sedans? Let's find out!
Here's what I want you to do:
• Once you've calculated the total sales for each car type, print the results to the screen so you
can see them.
educobot.com 24
2. Visualize Car Type Sales:
• Now, let's make a bar chart to see these results in a more visual way. Remember how we used
plot(kind='bar') before? You can use that same code, but make sure you're using the data you just
calculated (the sales by car type).
• Don't forget to add a title to your chart so everyone knows what it's about! And it's always good
to label the x and y axes so it's clear what the chart is showing. Use plt.title(), plt.xlabel(), and
plt.ylabel() for this
• To group by 'Car Type' and calculate the sum, use the same groupby() and sum() functions you
used before. Just change the column you're grouping by from 'Brand' to 'Car Type'.
• Creating the bar chart is easy! You can use the same plot(kind='bar') code. Just make sure you're
using the data you calculated for car type sales.
• Labeling your chart is super important so people can understand it. Remember plt.title(),
plt.xlabel(), and plt.ylabel().
Still stuck? Here's the code to help you:
import pandas as pd
import matplotlib.pyplot as plt
# ... (Your previous code to load and clean the data) ...
car_type_sales.plot(kind='bar')
plt.title("Total Cars Sold by Car Type")
plt.xlabel("Car Type")
plt.ylabel("Cars Sold")
plt.show()
Once you've run the code, take a good look at the output and the chart. Which car type is the
most popular? Does anything surprise you? Think about what else you could learn from this data!
Maybe you could even combine what you learned about car types with what you learned about
brands! The possibilities are endless! Let me know what you discover!
By the end of this year, you'll have a good understanding of the data science
process and be able to use tools like NumPy and Pandas to work with real-
world data. You'll be able to tell stories with data and discover insights that
would be impossible to see otherwise!
A graphical representation in data science helps visualize data patterns, trends, and relationships
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 analyze and
derive insights.
educobot.com 25
REVISION OF BASICS
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.
1 2
Learning Outcome: Students will refresh their knowledge of breadboarding and circuit-building
basics. They will improve their skills in connecting components correctly and gain hands-on expe-
rience in designing and testing simple circuits. This revision will reinforce their understanding of
circuit connections and component placement, laying the foundation for more advanced electron-
ics projects.
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 26
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.
educobot.com 27
BREADBOARD CIRCUIT –BUILDING
AND GATE
Activity: In this activity, students will learn how to build an AND gate circuit on a
breadboard using basic electronic components like transistors, resistors, and LEDs.
The focus will be on understanding the logic behind the AND gate, where the output
is "high" (ON) only when both inputs are "high" (ON). Students will wire the compo-
nents and test the circuit to see how the logic gate functions, reinforcing the concept
of binary logic and its real-world applications in digital electronics.
The LED will light up only if both input points (connected to 5V) are active at the same
time.
Understanding the Behavior
To see how an AND gate works using an LED:
• Connect one wire to 5V (Input A) on the breadboard.
• Connect another wire to 5V (Input B) on the breadboard.
• Connect the other end of the LED (cathode) to GND.
• Connect the anode of the LED to a point where both wires (Input A and Input B)
are connected to 5V.
educobot.com 28
This demonstrates the AND gate's behavior where the output (LED) is ON only when
both inputs are ON (connected to 5V).
Learning Outcome: Students will understand how an AND gate works and how to
build a simple logic gate circuit on a breadboard. They will gain hands-on experience
with digital logic circuits and learn the fundamentals of binary operations, which are
foundational to digital electronics and computer systems
Activity: In this activity, students will learn how to build both an OR and a NOT gate
circuit on a breadboard using basic electronic components such as transistors, resis-
tors, and LEDs. For the OR gate, the output will be "high" (ON) when any one or both
of the inputs are "high." For the NOT gate, the output will be the inverse of the input—
if the input is "high," the output will be "low," and vice versa. Students will wire the
components, test the circuits, and observe the behavior of both gates, reinforcing
concepts of binary logic and digital circuits.
What is an OR Gate?
An OR gate is another fundamental logic gate in electronics. It produces an output
when at least one of its inputs is true (or high).
How Does an OR Gate Work with an LED?
Imagine you have a setup on a breadboard where an LED behaves like an OR gate:
• Regular LED Setup: When you connect the LED to 5V through a resistor, the LED
lights up. When you disconnect it, the LED goes dark.
educobot.com 29
Simple Example
Let's use an LED on a breadboard to demonstrate the OR gate behavior.
Inputs: You have two points on the breadboard where you can connect to
5V.
Output: An LED with a resistor is directly connected to the output point.
The LED will light up if at least one of the input points (connected to 5V) is
active.
Truth Table
This table shows that the LED turns ON (lights up) if Input A is 5V OR Input
B is 5V, or both.
Building an OR Gate Circuit with an LED
You can build a simple OR gate circuit using an LED and resistors on a
breadboard.
Components Needed:
1 LED
1 resistor (220Ω or similar)
Breadboard
Connecting wires
5V power supply
Steps:
Connect the LED:
educobot.com 30
Insert the LED into the breadboard. Connect its cathode (shorter leg) to a
ground rail on the breadboard.
Connect the Resistor:
Connect one end of the resistor to the anode (longer leg) of the LED.
Setup Inputs:
Identify two points on the breadboard where you can connect 5V for Input A
and Input B.
Connect the Outputs:
Connect the other end of the resistor (opposite to the LED) to the point where
you'll observe the LED output.
Operating the Circuit:
Connect 5V to either Input A or Input B:
The LED will light up because the OR gate condition (either Input A or Input B
is 5V) is met.
Connect 5V to both Input A and Input B:
The LED will still light up because the OR gate considers any input being high
enough to turn on the LED.
Summary
An OR gate produces an output when at least one of its inputs is true. It's like
having multiple choices where picking any one leads to action!
I hope this helps you understand the concept of an OR gate using an LED on
a breadboard. If you have any more questions or want to explore other logic
gates or electronics topics, feel free to ask!
educobot.com 31
NOT GATE
What is a NOT Gate?
A NOT gate is a basic building block in electronics and computers. Its job is to flip or
invert a signal.
How Does a NOT Gate Work?
Imagine you have a special LED circuit on a breadboard that works like a NOT gate:
Regular LED Circuit: When you connect it to 5V, the LED lights up. When you connect
it to GND, the LED goes dark.
NOT Gate LED Circuit: When you connect it to 5V, the LED goes dark. When you
connect it to GND, the LED lights up.
Simple Example
Let's play a game with a NOT gate and an LED on a breadboard.
Input: You connect either 5V or GND to the circuit.
Output: The LED will do the opposite of what the input is.
If you connect 5V, the LED is OFF.
If you connect GND, the LED is ON.
So, the NOT gate makes sure the LED shows the opposite of what the input is!
Truth Table
A truth table helps us see what happens with different inputs. Here's the truth table
for a NOT gate:
Learning Outcome: Students will understand the working principles of OR and NOT
gates and how to build and test them on a breadboard. They will gain practical experi-
ence with logic circuits and learn how basic digital logic operations are implemented
in electronics, laying the foundation for more complex digital systems.
educobot.com 32
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:
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.
Learning Goals:
educobot.com 33
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
platform to interact with their IoT projects, view sensor readings, and send control signals to their devices.
educobot.com 34
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.
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.
educobot.com 35
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.
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.
educobot.com 36
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:
educobot.com 37
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.
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.
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 38
The DHT11 sensor is connected to an ESP32 shield:
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 39
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.
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 40
Here’s the pin configuration for connecting the ultrasonic sensor to the ESP32 as per your setup:
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 41
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.
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-
board, allowing for remote monitoring of the bin's status.
MATERIALS REQUIRED:
X1 X1
X1 X1
educobot.com 42
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 43
5
X2
educobot.com 44
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
on the IoT monitor.
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
students to monitor the bin's status remotely over the internet.
educobot.com 45
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
monitor waste management and provides students with a practical understanding of how to automate everyday systems.
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 46
STEP 2
X1 X5
X2
X2 X1
STEP 3
X2
STEP 4
X2 X2
educobot.com 47
STEP 5
X2
Front side
STEP 7
X1
educobot.com 48
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.
•
• Servo Motor:
• VCC is connected to the VCC port on the shield.
• GND is connected to the GND port.
• Signal pin is connected to the D23 port for movement control..
educobot.com 49
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 50
INTRODUCTION TO ARTIFICIAL INTELLIGENCE
AND MACHINE LEARNING
Have you ever wondered how your phone unlocks just by looking at you? Or how a website
seems to know exactly what you want to buy? These amazing feats of technology are often
powered by two exciting fields: Artificial Intelligence (AI) and Machine Learning (ML). In this
introduction, we'll explore what these terms mean and how they're changing the world
around us.
Think of AI as a broad goal: creating intelligent machines. It's like a big umbrella that covers
many different techniques and approaches.
Machine Learning is one way to achieve Artificial Intelligence. It's a technique that allows computers
to learn from data without being explicitly programmed for every single task. Instead of writing a set
of rules, we feed the computer lots of examples, and it figures out the patterns itself.
Think of it like teaching a puppy a new trick. You don't tell it exactly how to do it; you show it what
you want it to do, and you reward it when it gets it right. The puppy learns to associate the action
with the reward. Machine Learning works in a similar way:
• Data is the Key: We give the computer lots of data, which acts like the examples we show
the puppy.
• Finding Patterns: The computer analyzes the data to find patterns and relationships, just
like the puppy learns to connect the action with the reward.
• Making Predictions: Once the computer has learned the patterns, it can use them to make
predictions or decisions on new, unseen data.
educobot.com 51
For example, imagine you want to teach a computer
to identify different types of fruit. You could give it
lots of pictures of apples, bananas, and oranges, and
label each picture with the correct fruit name. The
computer would analyze the pictures, looking for
features like color, shape, and size, and learn to dis-
tinguish between the different fruits. Then, if you
showed it a new picture of a fruit, it could use what it
learned to predict what type of fruit it is.
Machine Learning is a powerful tool because it allows computers to learn and adapt without
needing to be programmed for every single possibility. It's a key ingredient in many of the AI
applications we use every day.
Imagine you're trying to teach a robot to play soccer. That's like Artificial Intelligence (AI) –
making robots smart enough to do things humans do. AI is the big goal: creating intelligent ma-
chines.
Now, you could try to tell the robot exactly what to do in every situation: "If the ball is here, kick it
that way. If another player is there, move to the left," and so on. But that would take forever!
Instead, you could show the robot lots of examples of people playing soccer: "Here's a video of
someone kicking the ball. Here's a video of someone scoring a goal." The robot watches all
these videos and starts to figure out the rules of soccer by itself. That's Machine Learning (ML)
– teaching computers by giving them examples. ML is one way to reach our AI goal.
Deep Learning (DL) is like having a super-smart robot soccer coach. This coach can watch
thousands of soccer videos and learn even the trickiest moves and strategies. Deep Learning uses
special networks (like a robot brain) to understand all that information. It's really good at learning
from lots and lots of examples. DL is a super-smart way of doing ML.
educobot.com 52
Now that we understand the basic ideas behind AI and Machine Learn-
ing, let's explore a fun and relatable example: predicting video game
genres! Imagine you're building a video game recommendation system.
You want the computer to suggest games to players based on their
preferences. How can we use Machine Learning to do this?
Let's say we're building a video game recommendation system. We want the computer to guess
what genre of game someone might like (Action, Adventure, Puzzle, etc.). We can use Machine
Learning for this!
• Average User Rating (out of 10): How much players liked the game.
• Number of Players: Is it single-player, multiplayer, or massively multiplayer?
• Platform: Is it on PC, PlayStation, Xbox, Nintendo Switch, etc.?
• Year Released: When the game came out.
These pieces of information are called features. They're the clues our ML model will use to make its
prediction. What we want the model to predict – the game's genre – is called the target.
1. Training: We start by giving the ML model a bunch of examples. We show it games with their
features and their genres. The model looks for patterns. Maybe games with high ratings and lots of
players tend to be Action games. This is called training the model.
2. Predicting: Once the model is trained, we give it new games – games it hasn't seen before. We
give it the features (rating, players, platform, year), but we don't tell it the genre. The model uses
what it learned during training to predict the genre.
educobot.com 53
Now, we have a new game: Rating 7, Multiplayer, Console, 2023. What genre do you think it is?
Probably Action, right? You used the patterns you saw in the first three games to make your
prediction. That's exactly what a machine learning model does, but it does it automatically and
with much more data!
From Manual Prediction to Machine Learning – Let's See the Code!
Machine learning models automate the process you just did manually. They learn the patterns in
the data so they can make predictions automatically. We use special computer code (Python!) to
do this. We'll use two helpful tools: pandas (for working with data) and scikit-learn (for machine
learning). Here's the code we'll use, and here's how to get the data:
1. Copy the Data: Copy the text below, starting with "Rating,Players,Platform,Year,Genre". This is
your video game data.
Rating,Players,Platform,Year,Genre
8,Multiplayer,PC,2022,Action
9,Single Player,Console,2021,Adventure
7,Multiplayer,PC,2023,Action
6,Single Player,Console,2020,Adventure
9,Multiplayer,PC,2022,Action
5,Single Player,Mobile,2019,Puzzle
8,Multiplayer,PC,2023,Action
7,Single Player,Console,2021,Adventure
9,Multiplayer,PC,2022,Action
6,Single Player,Mobile,2020,Puzzle
7,Multiplayer,Console,2023,Action
8,Single Player,PC,2021,Adventure
9,Multiplayer,PC,2022,Action
6,Single Player,Mobile,2020,Puzzle
7,Multiplayer,Console,2023,Action
8,Single Player,PC,2021,Adventure
9,Multiplayer,PC,2022,Action
6,Single Player,Mobile,2020,Puzzle
7,Multiplayer,Console,2023,Action
8,Single Player,PC,2021,Adventure
2. Open Notepad (or a similar text editor): Open Notepad (on Windows) or TextEdit (on Mac) or
any plain text editor.
3. Paste the Data: Paste the copied data into the Notepad window.
educobot.com 54
4. Save the File: This is the crucial step. Go to "File" -> "Save As...".
• File name: Type video_games.csv (make sure you include the .csv part).
• Save as type: Choose "All Files" (or ensure it saves as plain text, not Rich Text Format or
anything else).
2. The Python Code:
from sklearn.linear_model import LogisticRegression # Imports the Logistic Regres-
sion model from scikit-learn (our ML tool).
import pandas as pd
games_data = [
{"Rating": 8, "Players": "Multiplayer", "Platform": "PC", "Year": 2022,
"Genre": "Action"},
{"Rating": 9, "Players": "Single Player", "Platform": "Console", "Year": 2021,
"Genre": "Adventure"},
{"Rating": 7, "Players": "Multiplayer", "Platform": "PC", "Year": 2023,
"Genre": "Action"},
{"Rating": 6, "Players": "Single Player", "Platform": "Console", "Year": 2020,
"Genre": "Adventure"},
{"Rating": 9, "Players": "Multiplayer", "Platform": "PC", "Year": 2022,
"Genre": "Action"},
{"Rating": 5, "Players": "Single Player", "Platform": "Mobile", "Year": 2019,
"Genre": "Puzzle"},
{"Rating": 8, "Players": "Multiplayer", "Platform": "PC", "Year": 2023,
"Genre": "Action"},
{"Rating": 7, "Players": "Single Player", "Platform": "Console", "Year": 2021,
"Genre": "Adventure"},
{"Rating": 9, "Players": "Multiplayer", "Platform": "PC", "Year": 2022,
"Genre": "Action"},
{"Rating": 6, "Players": "Single Player", "Platform": "Mobile", "Year": 2020,
"Genre": "Puzzle"},
{"Rating": 7, "Players": "Multiplayer", "Platform": "Console", "Year": 2023,
"Genre": "Action"},
{"Rating": 8, "Players": "Single Player", "Platform": "PC", "Year": 2021,
"Genre": "Adventure"},
{"Rating": 9, "Players": "Multiplayer", "Platform": "PC", "Year": 2022,
"Genre": "Action"},
{"Rating": 6, "Players": "Single Player", "Platform": "Mobile", "Year": 2020,
"Genre": "Puzzle"},
{"Rating": 7, "Players": "Multiplayer", "Platform": "Console", "Year": 2023,
"Genre": "Action"},
{"Rating": 8, "Players": "Single Player", "Platform": "PC", "Year": 2021,
"Genre": "Adventure"},
{"Rating": 9, "Players": "Multiplayer", "Platform": "PC", "Year": 2022,
"Genre": "Action"},
{"Rating": 6, "Players": "Single Player", "Platform": "Mobile", "Year": 2020,
"Genre": "Puzzle"},
{"Rating": 7, "Players": "Multiplayer", "Platform": "Console", "Year": 2023,
"Genre": "Action"},
{"Rating": 8, "Players": "Single Player", "Platform": "PC", "Year": 2021,
"Genre": "Adventure"},
]
df = pd.DataFrame(games_data)
educobot.com 55
df = pd.get_dummies(df, columns=['Players', 'Platform']) # Converts text data in
'Players' and 'Platform' to numbers using one-hot encoding.
1. Save the Code: Save the Python code above in a file named game_predictor.py (or any name
you like, but make sure it ends in .py). Save this file in the same folder where you saved vid-
eo_games.csv.
2. Open a Terminal or Command Prompt: On Windows, search for "cmd" or "Command Prompt".
On Mac, open "Terminal".
3. Navigate to the Folder: Use the cd command to navigate to the folder where you saved the
files. For example, if you saved them in a folder called "AI_Project" on your Desktop, you might
Now that we've learned the basics of machine learning and how to predict video game genres, it's
your turn to become a genre expert!
Your Mission:
You will expand our video game database and then use our machine learning model to make pre-
dictions on the new data. This will test your data handling skills, your ability to modify code, and
your analytical thinking.
educobot.com 56
• For each new game, include the following information, separated by commas, just like the
existing data:
• Rating (a number out of 10)
• Players (Multiplayer or Single Player)
• Platform (PC, Console, Mobile, or any new platforms you want to add, like "Nintendo
Switch")
• Year (the year the game was released)
• Genre (the actual genre of the game – this is what the model will learn from)
• Important: If you add any new platforms that aren't already in the data (like "Nintendo
Switch"), you'll need to make a small change to the Python code in the next step.
1. Modify the Code:
• Open the game_predictor.py file (the Python code we've been using).
• If you added any new platforms in the data (like "Nintendo Switch"), find the line that
says:Pythondf = pd.get_dummies(df, columns=['Players', 'Platform'])You might need to add the
new Platform names. For example, if you added "Nintendo Switch," the line might be-
come:Pythondf = pd.get_dummies(df, columns=['Players', 'Platform', 'Nintendo Switch']) # If it is a
new column.
• Save the game_predictor.py file.
2. Run the Code and Analyze the Results:
• Run the Python code. You should see the model's predictions for the genres of your new
games.
• Now, the important part: Look at the predictions. Do they make sense? Why or why not?
Think about the features of the games you added and how they might have influenced the
model's predictions.
• Write a short paragraph (2-3 sentences) explaining your observations. Did the model do a
good job? Were there any surprises? What did you learn about how machine learning models
make predictions?
Example:
9,Multiplayer,Nintendo Switch,2023,Action
7,Single Player,Xbox,2022,Adventure
6,Multiplayer,Mobile,2024,Puzzle
8,Multiplayer,PC,2023,Strategy
10,Single Player,PlayStation,2024,RPG
That's it! Have fun becoming a video game genre expert! Don't be afraid to experiment and
see what happens. The more you work with the data and the code, the more you'll learn
about machine learning!
educobot.com 57
INTRODUCTION TO MODEL TRAINING
The image provides a step-by-step guide for creating and saving a machine learning model,
which can be particularly useful for users working with AI and machine learning technologies.
It helps users follow a clear process to train and deploy their models efficiently.
educobot.com 58
Class Sections
In this section, users can add image samples for different classes that the model needs to recog-
nize. Each class, such as "Tarun," "Other," and "Environment," has its own dedicated area where
users can either use a webcam to capture images or upload images from their devices. This al-
lows the model to learn and distinguish between the different classes. Additionally, there is an
option at the bottom to "Add a class," enabling users to create more classes as needed for their
specific use case.
Training Section
This section contains the essential controls for training the model. The "Train Model" button initi-
ates the training process using the images provided in the class sections. There is also an
"Advanced" dropdown that offers additional training options, allowing users to customize the
training process to better suit their needs. This section is crucial for developing a robust model
that accurately identifies the specified classes.
Preview Section
Before utilizing the model, users must train it. This section provides a message stating, "You must
train a model on the left before you can preview it here." Once the model is trained, users can
preview its performance in this section. Additionally, the "Export Model" button allows users to
save and share the trained model, making it accessible for deployment in various applications.
This layout demonstrates how Teachable Machine streamlines the process of creating, training,
and deploying image classification models, providing an intuitive interface that caters to both be-
ginners and experienced users in machine learning.
educobot.com 59
The export section of the Teachable Machine interface provides users with the tools to export their trained machine
learning models efficiently. This section includes options for exporting the model using various formats such as Ten-
sorFlow.js, TensorFlow, or TensorFlow Lite. Users can choose to upload the model to obtain a shareable link, down-
load the model, or update an existing cloud model. This flexibility is particularly useful for developers who want to
integrate their models into web applications or other platforms quickly and effectively.
Additionally, this section offers code snippets that demonstrate how to use the exported model in different program-
ming environments. Users can find sample code for both JavaScript and p5.js, with each snippet designed to help in-
tegrate the Teachable Machine model into a web application. The provided code includes essential elements for ini-
tializing the model, starting it, and displaying relevant information such as webcam feeds and labels. This organized
and user-friendly export section streamlines the process of deploying machine learning models, making it accessible
for a wide range of practical applications.
MATERIALS REQUIRED:
STEP 1
X1 X2
X1
STEP 2
X1 X2
X2 X1 X5
educobot.com 60
STEP 3
X2
STEP 4
X2 X2
STEP 5
X2
Front side
educobot.com 61
Hardware Required:
1.eduCOBOT Shield
2. RGB PCB
3. Servo Motor
Pin Configuration:
esp32 RGB esp32 Servo Motor
VCC VCC GND GND
D14 B
Circuitry:
This circuit features an eduCOBOT shield connected to an RGB LED and a servo motor. The RGB
LED has four wires: VCC, GND, Red (R), Green (G), and Blue (B). VCC is connected to the 3.3V pin on
the eduCOBOT shield, and GND is connected to a GND pin. The Red, Green, and Blue wires are
each connected to separate GPIO pins on the shield, allowing individual control of the LED's color
channels. The servo motor has three wires: VCC, GND, and Signal. VCC is connected to the 5V pin
on the eduCOBOT shield, GND is connected to a GND pin, and the Signal wire is connected to an-
other GPIO pin. This setup allows the eduCOBOT shield to control the RGB LED's colors and oper-
ate the servo motor.
The environment depicted in the image is a virtual circuit designing tool. This online tool enables
users to design and test electronic circuits without physical components. It's ideal for prototyping
and learning about electronics, as it provides a user-friendly interface to experiment with various
configurations and components. Using such a designing environment, users can gain valuable in-
sights into their circuit designs, troubleshoot issues, and refine their projects before implementing
them in real-world scenarios.
educobot.com 62
UNDERSTANDING CODE AND CODING ENVIRONMENT
Block-Based Code
The block-based coding interface allows users to drag and drop blocks to form logical structures
easily. In this scenario, you would use:
1. WiFi Connection Block: To connect the eduCOBOT shield to the WiFi network by entering
the SSID and password.
2. Servo Motor Control Blocks: To control the servo motor’s position by setting it to angles
such as 0°, 90°, or 180°, based on specific conditions.
3. RGB LED Control Blocks: To manage the RGB LED, setting various colors by adjusting the
intensities of the Red, Green, and Blue channels.
4. Loop and Conditional Blocks: To create loops and conditions that control the program’s
flow, such as moving the servo motor and changing the RGB LED’s color based on sensor input
or specific triggers.
By using the MicroPython code editor, you can easily switch between block-based and syntax-
based coding to suit your preferences and project requirements. This setup helps in prototyping
and refining your smart house project before implementing it in a real-world scenario.
The Smart House project with AI focuses on enhancing home security and automation using
face recognition technology. The key components of this project include a camera for face de-
tection, an AI model trained to recognize authorized faces, an eduCOBOT shield, an RGB LED,
and a servo motor. Here's a step-by-step explanation of the project:
1. Data Collection: Collect images of authorized faces and label them accordingly. These
images will be used to train the face recognition model.
2. Model Training: Use a face recognition algorithm (e.g., OpenCV, TensorFlow, or other
machine learning frameworks) to train the model on the collected images. The model learns
to identify and classify faces based on the given data.
3. Real-Time Detection: Once the model is trained, it can be deployed to detect faces in
real-time using a camera. The camera captures the image and processes it through the
trained model to identify if the face belongs to an authorized person.
educobot.com 63
Door Control and LED Indication
1. WiFi Connectivity: Connect the eduCOBOT shield to a WiFi network to enable remote
control and monitoring of the system.
2. Face Detection and Action:
• Authorized Face: If the detected face matches the trained model's authorized class, the
eduCOBOT shield sends a signal to the servo motor to open the door. Simultaneously, the
RGB LED turns green to indicate successful access.
• Unauthorized Face: If the detected face does not match any authorized class, the door
remains closed. The RGB LED turns red to signal unauthorized access.
3. Servo Motor Control: The servo motor, connected to the eduCOBOT shield, controls the
door mechanism. It moves to a specific angle to open or close the door based on the face
recognition result.
4. RGB LED Indication: The RGB LED provides a visual indication of the access status. Green
indicates successful access, while red indicates unauthorized access.
The image presents an AI logic environment where logic is written to compare class names
with the real-time output of an AI model, performing actions on hardware via WiFi functions.
Logic Environment:
1. Condition Blocks:
• Condition 1: If the result of getFinalPrediction() equals Tarun, the system verifies the
class name and signals the hardware to perform an action (e.g., opening the door via the
servo motor).
• Condition 2: If the result equals Other, the system signals the hardware as verified.
• Condition 3: If the result equals Environment, the system signals the hardware as not
verified.
2. Action Blocks:
• Opening the Door: When the class name matches Tarun, the servo motor is activated
to open the door.
• LED Indication: The RGB LED is set to green when access is granted (class matches
Tarun), and red if access is denied (other classes).
educobot.com 64
Real-Time Output:
• The model’s output section displays a label (e.g., "Other") and a bar graph with probability per-
centages for classes Tarun, Other, and Environment. The bar graph shows the highest probability
for the "Other" class, indicating the current prediction.
This environment exemplifies how AI predictions can integrate with hardware actions, enhancing
automated home security systems by responding based on real-time data analysis.
SUMMARY:
By integrating face recognition with home automation, the Smart House project provides en-
hanced security and convenience. AI technology is employed to recognize authorized individuals
through face detection. When a recognized face is detected, the system automatically opens the
door using a servo motor, while an RGB LED turns green to indicate successful access.
On the other hand, if an unauthorized face is detected, the door remains closed, and the RGB LED
turns red to indicate access denial. This real-time response ensures that only authorized individu-
als can enter the house, providing a seamless and automated solution for home security.
MATERIALS NEEDED
X1 X1 X1 X2
X1 X1 X2
STEP 1
educobot.com 65
STEP 2
STEP 3
X1 X2
STEP 4
Hardware Required:
1.eduCOBOT Shield
2. Seven Segment
Pin Configuration:
esp32 7 Segment esp32 7 Segment
VCC VCC D26 D
D21 A D32 E
D22 B D33 F
D25 c D5 G
educobot.com 66
Circuitry:
The image showcases a circuit design environment where an eduCOBOT shield is connected to a
seven-segment display. The eduCOBOT shield is mounted on a breadboard-like base, providing
various connection points for different components. The seven-segment display is connected to
the shield via a set of wires, each corresponding to a segment of the display. This setup highlights
how the eduCOBOT shield can interface with display components to visualize numerical data, con-
trolled by the underlying microcontroller.
The environment depicted in the image is a digital circuit designing tool. This tool allows users to
design and test electronic circuits virtually before physically building them. It provides a user-
friendly interface for placing and connecting components, making it a valuable resource for educa-
tion, prototyping, and learning about microcontroller-based projects. The right side of the image
shows a selection of various input and output sensors, which can be incorporated into the design,
further enhancing the learning experience.
The Python code editor on the right side translates the visual logic into Python code. The code
snippet shown is not complete but provides an overview of the process. It imports necessary li-
braries, sets up WiFi credentials, and defines a function to connect to the WiFi network. It handles
connection attempts and saves the configuration to a JSON file. The code also includes logic for
starting a server and controlling the seven-segment display based on server requests. The com-
plete code would include additional elif conditions for "display-1," "display-2," "display-3," "display-
4," and "display-5," each corresponding to displaying digits on the seven-segment display based
on the server input.
educobot.com 67
This dual-interface environment demonstrates how visual programming can be converted into tra-
ditional code, making IoT development accessible and versatile for both beginners and advanced
users. This setup allows users to write and test logic for smart devices, integrating AI predictions
and hardware actions seamlessly.
The image shows an AI logic environment where we write logic to compare class names and real-
time outputs from a model, and then perform actions on hardware using functions called on hard-
ware with WiFi. On the left side of the image, there is a block-based programming interface with
conditional statements. Each statement checks if the function getFinalPrediction() equals a spe-
cific class name, such as "Class 1." When the condition is true, the hardware performs an action,
like setting the display to 'display-1' or 'display-5' on the seven-segment display.
On the right side of the image, there is a real-time camera feed showing a hand gesture (index fin-
ger pointing up) and a bar graph displaying the probability percentages for five different classes.
The highest probability is for "Class 1," around 55%. This environment demonstrates how AI models
can be integrated with hardware to perform specific actions based on real-time predictions, useful
for applications in automation, robotics, and smart devices. The code snippet shown is not com-
plete; it would include additional elif conditions for "display-1," "display-2," "display-3," "display-4,"
and "display-5," each corresponding to displaying digits on the seven-segment display based on
server input. This setup allows users to seamlessly integrate AI predictions and hardware actions,
enhancing the development of smart devices.
SUMMARY:
The content depicts a circuit setup in a digital circuit designing tool, featuring an eduCOBOT shield
connected to a seven-segment display. This virtual environment allows users to design and test
electronic circuits before implementing them physically.
Another part of the content showcases an AI logic environment with a block-based programming
interface on the left and a Python code editor on the right. This setup compares class names with
real-time model outputs to perform actions on hardware, like setting the seven-segment display
to different values via WiFi.
educobot.com 68
Additionally, it includes a real-time camera feed showing a hand gesture and a bar graph of
probability percentages for five classes. This environment demonstrates AI model predictions
and corresponding hardware actions. The code snippet indicates logic to match predictions and
trigger hardware responses
educobot.com 69
MRP | 71 Pages |
www.educobot.com
support@educobot.com
+91-7278517851