0% found this document useful (0 votes)
9 views

Grade 8 - ST2 Textbook (1)

The document introduces Boffin ESP32 ArduBlock Software, a graphical programming tool designed for the ESP32 microcontroller, enabling users to create Arduino-based programs without text coding. It features block-based programming, compatibility with ESP32, and is beginner-friendly, making it suitable for educational purposes. The document also outlines practical applications, such as controlling LEDs with sound sensors and programming line-following robots.

Uploaded by

Sid Gupta
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)
9 views

Grade 8 - ST2 Textbook (1)

The document introduces Boffin ESP32 ArduBlock Software, a graphical programming tool designed for the ESP32 microcontroller, enabling users to create Arduino-based programs without text coding. It features block-based programming, compatibility with ESP32, and is beginner-friendly, making it suitable for educational purposes. The document also outlines practical applications, such as controlling LEDs with sound sensors and programming line-following robots.

Uploaded by

Sid Gupta
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/ 15

ST2 TEXTBOOK

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.

Features of Boffin ESP32 ArduBlock Software:

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.

Pin Configuration Table for ESP32 Ports:

Overview of the ArduBlock software:


Boffin is an organization focused on creating educational tools for STEM learning,
specializing in robotics, electronics, and IoT. They customized ArduBlock to support their
hardware, such as Boffin ESP and Nano boards, by adding specialized block categories like
ESP_Server, WEB, and Flash Memory. These changes include pre-loaded libraries, improved
UI for beginners, and optimized code uploading for ESP32 boards, enabling easy use of
advanced features like Wi-Fi and Bluetooth.

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.

Reference to the visual layout of software.

Explanation of Each Block


1.Boffin Block: It refers to the blocks or modules in this platform that represent different
functions or commands, like controlling sensors, motors, or other components in a project.

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

5.Loops Block: They are the following comments in loops:

 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.

6.Math Block: Explanation of the blocks:

 Numbers: Basic inputs like 0, 90°.


 Arithmetic: Perform operations like R + 1 (addition, subtraction, etc.).
 Random Integers: Generate random numbers within a range (0 to 100).
 Mapping: Scale values (R from 0-1023 to 0-255).
 Conversion: Convert R to a specific data type (e.g., byte).
 Even/Odd Check: Verify if a number is even or odd.
 Modulo: Get the remainder of X ÷ Y.
 Limit Values: Restrict R to a range (10 to 20).
 Square Root: Calculate the square root of a number.
 π (Pi): Use the constant π for geometry or trigonometry

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.

9.Structure Block: The primary structure consists of two main blocks:

 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

LED control using Sound sensor


Objectives:
A sound sensor is used to detect variations in sound levels and convert them into
electrical signals. By programming the sensor to monitor sound levels via serial
communication, it can be used in real-time applications such as a Clap-Activated Light, where
the sensor detects a clap and triggers an LED based on predefined sound intensity thresholds.

Serial Monitoring:
Serial Monitoring is the process of displaying real-time data from a microcontroller
to a computer via a serial communication interface.

Features of Serial Monitoring:


 Real-time Data Display: Shows sensor readings and program outputs as they occur.
 Debugging Tool: Helps identify errors in code by printing variables and program
states.
 Data Logging: Allows storing and reviewing sensor values over time.
 Bi-directional Communication: Enables sending data between the computer and
microcontroller for interactive control.
 Baud Rate Control: Allows adjusting the speed of data transfer between the
microcontroller and the computer. (The baud rate must be set to 9600, any other
value may cause communication issues).

Model:

Page | 9
Block Program:

“Setup”: Here set up is used to define all the components which


are attached to the controller, their port and their mode of
operation which is input or output.
“loop”: We add the instructions which we want to get executed in
the loop.

"If & Else block" - Conditional Statements


"if" and "else" are like the road signs of programming, guiding our code on
which path to take, based on certain conditions.

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

1. Connect Sound Sensor Tagged S1 to Port 1:


o The sound sensor (S1) is connected to Port 1 of the microcontroller.
o This sensor detects sound levels and converts them into digital input signals.
2. Connect LED Tagged L1 to Port 2:
o The LED (L1) is connected to Port 2 of the microcontroller.
o This LED will be controlled based on the detected sound levels.
3. Port Monitor - Connection (Rx/Tx) Speed 9600:
o Serial communication is established with a baud rate of 9600.
o This allows real-time monitoring of the sensor values in the serial console.

Difference between print and println:

 print outputs data on the same line without moving to the next line.
 println outputs data and moves to the next line after printing.

Loop (Repeats the Actions Indefinitely)

1. Read and Print Digital Input Value of S1:


o The sound sensor’s digital input value is read and displayed on the serial
monitor.
o This helps track the detected sound levels.
2. If Sound is Detected (S1 = 1):
o When a sound is detected (e.g., a clap), the value of S1 becomes 1.
o The LED (L1) is turned ON (HIGH).
3. Else (No Sound Detected, S1 = 0):
o If no sound is detected, the value of S1 remains 0.
o The LED (L1) is turned OFF (LOW).

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

1. Connect IR sensor tagged IRL to Port 2:


• The left IR sensor (IRL) is connected to Port 2 on the microcontroller.
• This sensor detects whether the left side of the robot is on the black line or the
white surface.

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.

Loop (Repeats the actions indefinitely)

1. If both IR sensors detect the line (IRL = 1, IRR = 1):


• The robot moves forward at 80% speed.
• ML (Port 4): 80% in counter-clockwise direction.
• MR (Port 7): 80% in clockwise direction.
2. If only the left sensor detects the line (IRL = 1, IRR = 0):
• The robot turns right to correct its path.
• ML (Port 4): Stops (0% speed).
• MR (Port 7): 80% in clockwise direction.
3. If only the right sensor detects the line (IRL = 0, IRR = 1):
• The robot turns left to stay on track.
• ML (Port 4): 80% in counter-clockwise direction.
• MR (Port 7): Stops (0% speed).
4. If both sensors do not detect the line (IRL = 0, IRR = 0):
• The robot stops completely as it has lost the path.
• ML (Port 4): 0% speed.
• MR (Port 7): 0% speed.

Page | 15

You might also like