Grade 8 - ST2 Textbook (1)
Grade 8 - ST2 Textbook (1)
GRADE 8
LESSON- 1
Introduction to ArduBlock Software
Boffin ESP32 ArduBlock Software is a graphical programming tool designed
specifically for the ESP32 microcontroller. It provides a drag-and-drop interface to create
Arduino-based programs without requiring text based coding knowledge. Users can visually
create logic flows and functionalities by arranging blocks. This makes it an easy-to-use tool
for beginners and students, allowing them to quickly design projects, such as controlling
motors and sensors, without the need to learn complex coding.
📌 Important Note:
Before starting programming in the Boffin ESP32 ArduBlock software, make sure to choose
the correct board, as shown at the top in the figure above. From the "Board" menu at the
top, change the default setting to Boffin ESP32. This step is important to upload the code
correctly to your model.
1. Block-Based Programming
Allows users to program the ESP32 using drag-and-drop blocks (e.g., loops,
conditional statements, input/output), eliminating the need for complex coding.
2. Beginner-Friendly
Designed for students and beginners to easily create projects without prior
programming experience.
3. ESP32 Compatibility
Fully supports the ESP32 microcontroller, enabling seamless integration with its
features and peripherals.
4. Arduino-Compatible: It generates Arduino code in the background, which can be
uploaded directly to an Arduino-Compatible Arduino board.
5. Hardware Control
Simplifies the process of controlling motors, sensors, LEDs, and other hardware
components.
Page | 1
6. Interactive Logic Building
Enables users to visually construct logic flows and functionalities for their projects.
7. Quick Prototyping
Speeds up the development process, making it ideal for educational and prototype
projects.
8. Error-Free Programming
Reduces common syntax and coding errors through its graphical interface.
9. Customizable Blocks
Offers pre-built blocks for common functions and allows advanced users to extend
functionality.
10. STEM Education: Widely used in schools and workshops to teach programming
concepts in a hands-on way.
Page | 2
The software offers multiple board categories, including Arduino Nano, Boffin Nano, Boffin
ESP, Arduino Nano (old), and ESP32. In general, we will be using the only Boffin ESP as the
microcontroller.
Boffin ESP likely refers to a specific software or hardware platform designed for working with
ESP microcontrollers, such as the ESP8266 or ESP32. Boffin ESP is aimed at developers with
ESP-based systems, possibly integrating sensors, actuators, and pre-built functionalities.
2.Sensors Block: The Sensors Block in Boffin ESP is primarily used to read the input from
various sensors connected to the ESP32. It simplifies the process of gathering data from
sensors and using it in a project.
Page | 3
3.Actuators Block: An Actuator takes an input signal (like a sensor reading or a command)
and uses it to create a physical output (such as movement, light, or sound).
4.Logic Block: The Logic Block in Boffin ESP is used to implement conditional operations and
decision-making in projects. It allows users to create if/else statements, comparisons (e.g.,
greater than, equal to), and use logical operators (AND, OR, NOT) to control actions based on
sensor inputs. Key uses include:
If/Else Blocks: To perform actions based on conditions (e.g., turn on a fan if the
temperature is above 30°C).
Comparison Blocks: To compare sensor values (e.g., check if temperature > 25°C).
Logical Operators: Combine multiple conditions (e.g., both temperature and humidity
must be high to activate the cooling system).
Loops: Repeat actions until a condition is met
Repeat Until: Repeats actions until a condition is true (e.g., "Repeat until temperature
> 30°C").
Repeat for: Repeats actions a fixed number of times (e.g., "Repeat 5 times with a 1-
second delay").
Page | 4
Forever: Repeats actions indefinitely (e.g., "Repeat turning on LED forever").
Repeat While: Repeats actions while a condition is true (e.g., "Repeat while
temperature > 25°C").
Break: Exits the loop before completing all iterations.
Continue: Skips to the next iteration.
Page | 5
7.Text Block: This section handles text in ArduBlock. You can create text, combine it, convert
variables (like numbers) to text, find text length, and check if specific text exists in a variable.
8.Time Block: This section in ArduBlock manages delays, timers, durations, and pin states.
Setup Block:
1. Runs once at the start of the program.
2. Used to initialize pins, variables, or settings.
Loop Block:
1. Runs continuously after the setup block finishes.
2. This is where the repetitive actions (like reading sensors or controlling outputs)
are placed.
Background: The Background Block provides a way to manage tasks in parallel,
making program more efficient and responsive.
Page | 6
10.Variable Block: This block is used to create a variable on its own for user purpose.
11.Array Block: The Array Block in Ardublock is used to create and manage arrays, which
store multiple values in a single variable. This are the uses:
Creating Arrays: You can define an array with a specific size and set initial values.
Accessing Elements: You access array elements using their index (e.g., array[0] for the
first element).
Modifying Values: You can change values in the array or use loops to work with all
elements.
Page | 7
13. Function Block: The Function Block in Ardublock is used to create custom functions for
reusable code. It allows you to group tasks into a function and call it multiple times, making
your program cleaner and more organized. Functions can also accept input parameters to
perform specific actions.
14.Serial Block: The Serial Block in Ardublock is used to send and receive data over the Serial
Port, allowing communication between the Arduino board and a computer or other devices.
It is commonly used for debugging, displaying information, or sending/receiving data. It is also
used to read, access and print the values. Most common used baud rate in serial monitoring
is 9600.
Baud Rate: Baud rate is the speed at which data is transmitted over a communication
channel, measured in bits per second (bps).
Page | 8
LESSON-2
Serial Monitoring:
Serial Monitoring is the process of displaying real-time data from a microcontroller
to a computer via a serial communication interface.
Model:
Page | 9
Block Program:
Imagine you're driving a car, and you approach a tunnel. Now, this tunnel has a
height limit, and there's a sign that reads, "If your car is taller than 7 feet, do
NOT enter. Else, proceed safely."
This program effectively creates a clap-activated light system, where the LED turns
on when a clap is detected and turns off otherwise.
Page | 10
Explanation:
Setup
print outputs data on the same line without moving to the next line.
println outputs data and moves to the next line after printing.
Page | 11
Lesson-3
Line Follower
Definition:
A line follower robot is a type of autonomous robot designed to follow a predefined
path or line on the ground. This line is usually a visible contrast, like black on white, that the
robot can detect using IR sensors. It continuously adjusts its movement based on sensor
feedback to stay on track.
Working:
Page | 12
Model:
Bottom View
Page | 13
Block Program:
This code controls a line follower robot that moves based on the input from two IR sensors
(IRL and IRR). The robot uses two DC motors (ML and MR) to navigate the path by following a black
line on a contrasting surface.
Explanation:
Setup
Page | 14
2. Connect IR sensor tagged IRR to Port 6:
• The right IR sensor (IRR) is connected to Port 6 on the microcontroller.
• It detects whether the right side of the robot is on the black line or the white
surface.
3. Connect DC motor tagged ML to Port 4:
• The left motor (ML) is connected to Port 4 of the motor driver.
• This motor controls the movement on the left side of the robot.
4. Connect DC motor tagged MR to Port 7:
• The right motor (MR) is connected to Port 7 of the motor driver.
• This motor controls the movement on the right side of the robot.
5. Set DC motor ML to speed 0% in counter-clockwise direction:
• The left motor (ML) is initially set to 0% speed, meaning it is not moving.
6. Set DC motor MR to speed 0% in clockwise direction:
• The right motor (MR) is also set to 0% speed, keeping the robot stationary at the
start.
Page | 15