0% found this document useful (0 votes)
27 views43 pages

© 2022 - BYJU'S Future School. Please Don't Share, Download or Copy This File Without Permission

The document provides details about a classroom session that will teach students how to use an ultrasonic sensor to measure the distance of objects. It outlines the goals, required resources, class structure and steps which include explaining what a sensor is and how ultrasonic sensors work, designing a circuit with an ultrasonic sensor and Arduino, and writing code to calculate distances.

Uploaded by

usha
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)
27 views43 pages

© 2022 - BYJU'S Future School. Please Don't Share, Download or Copy This File Without Permission

The document provides details about a classroom session that will teach students how to use an ultrasonic sensor to measure the distance of objects. It outlines the goals, required resources, class structure and steps which include explaining what a sensor is and how ultrasonic sensors work, designing a circuit with an ultrasonic sensor and Arduino, and writing code to calculate distances.

Uploaded by

usha
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/ 43

Topic ULTRASONIC SENSOR

Class Kids will learn and implement how to use Ultrasonic sensor for
Description calculating the distance of an object

Class ADV-C282

Class Time 60 mins

Goals
1. Learn about Ultrasonic sensor
2. Design a circuit and write code for calculating the distance of an
object using an Ultrasonic sensor.

Resources ● Teacher Resources:


Required ○ Use Gmail login credentials.
○ Laptop with camera
○ Earphone with mic
○ Notepad and Pen

● Student Resources:
○ Use Gmail login credentials.
○ Laptop with camera
○ Earphone with mic (optional)
○ Notepad and Pen

Class Warm Up 5 Mins


Structure Teacher-Led Activity 15 Mins
Student-Led Activity 30 Mins
Wrap Up 5 Mins
Project Pointers and Cues 5 Mins

Start the video call from H2H

Class Steps Say Do

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

1
Step 1: In the previous class 281, we learned
Warm up about creating the IoT based circuits
(5 mins) to run the codes by understanding the
functionality of components like
Arduino Uno, PIR sensor, Micro
Servo and LED

# include <servo.h> library is


used for controlling ____

# include <servo.h> library is


used for controlling servo motors.

Which sensor is used to detect


motion of an object?

PIR sensor is used to detect


motion of an object.

Which motor is the most precise


and accurate motor which actually
helps to control the speed, rotation
and angle?

Servo motor is the most precise


and accurate motor which actually
helps to control the speed, rotation
and angle

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

2
Well done!!

Teacher Initiates Screen Share

Step 2: NOTE: class outcomes are the


Teacher-Led activities which will give a idea
Activity of concept to be implemented so
(15 mins)
precisely convey it to learners
before the Teacher Activity
delivery

SAY: Kids will understand how


the ultrasonic sensor works and
emits the ultrasonic waves for
measuring the distance between
the object and sensor.

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

3
In the previous class we used PIR sensor

What is a sensor?

A sensor is a device that detects an event or change in its environment and sends the
information to other devices.
Sensors play an important role in creating solutions using IoT. Sensors are devices that
detect external information, and send signals to other connected devices.
Sensors are used to measure physical quantities such as temperature, light, pressure,
sound, humidity and distance. They send signals to the processor.
For example: a heat sensitive sensor can be used in high end computers. It is used to sense
the heat of the computer. If the temperature of the computer is very high then the heat
sensor gives the indication by warning alarm or emitting light.

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

4
What is the use of the PIR sensor ?

PIR sensor is used to detect motion of an object.

Why did we use the PIR sensor in our previous class?

We used the PIR sensor for detecting motion of an object, after detection we activated
the servo motor and turned on the LED.

In today’s class we are going to learn about another sensor which is called an Ultrasonic
sensor.

Ultrasonic sensor:
In today’s class we are going to learn about ultrasonic sensors. This sensor is used to
measure the distance of the object from the sensor. Like how far an object is from the
Ultrasonic sensor.
An ultrasonic sensor is a device that measures the distance of an object using ultrasonic
sound waves.

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

5
Here the ultrasonic sensor sends the signal(waves) and waits for its reflection after hitting
the object. After hitting the object the sensor gives the time duration taken for the signal to
come back after hitting the object. This time duration is used with a formula for calculating
the distance.

Example of Ultrasonic sensor :

1. Ultrasonic sensor used in cars :

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

6
Ultrasonic sensors are very useful in cars for various purposes. It is installed in the front and
back side of the car. It is used to detect distance between the car and other objects like walls
and inform the driver about the same.

2. Ultrasonic sensor used by bats :


Ultrasonic sensor logic is used by bats also. Bats have the capacity to keep sending
sound waves while flying and if any sound waves are reflected back then it means
there is some obstacle and they change their flying direction.

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

7
Using Arduino and Ultrasonic components we will be doing the following tasks:

1. Design a circuit using an Ultrasonic sensor with Arduino.


2. Write a program to calculate the distance of an object using an Ultrasonic sensor.

Circuit & Code Explanation

Let’s start the above mentioned tasks.

Open Teacher Activity - 1:

Open the url given Teacher Activity - 1 and complete the circuit by following the below
mentioned steps:

1. Sign In with the Google account .

2. After logging we will see the following interface

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

8
Note : Teacher-Activity-1, it has the complete code for Task 01.
You need to first explain and create the circuit of Task 01 (Be very careful while
making the connection). Then explain the complete code to the student.

Let’s start the above mentioned tasks:

Task 01:

Design a circuit using an Ultrasonic sensor with Arduino.

Task 01 : Components
Here we want you to make a connection between the Arduino and Ultrasonic sensor to find
distance. Components we are going to use are:

a. Arduino Uno
b. HC-SR04 Ultrasonic Distance Sensor

● The Arduino Uno component is already there when you open the project.

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

9
For Task 01, we are going to use Gnd pin, 5V pin, 2 pin and 3 pin.

Gnd (Ground):
This Gnd(Ground) pin is used as a negative terminal of the Arduino.
© 2022 - BYJU’S Future School.
Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

10
What is the use of Gnd pin in Arduino Uno?

Gnd pin is used for maintaining the current flow in the circuit.

D 2 pin:
This Digital 2 pin of Arduino is used here for controlling the digital output of the Ultrasonic
sensor. We are going to connect this with the Ultrasonic sensor’s trigger pin. We will see the
trigger pin while discussing the Ultrasonic sensor.

D 3 pin:
This Digital 3 pin of Arduino is used here getting the input of the Ultrasonic sensor. We are
going to connect this with the Ultrasonic sensor’s echo pin. We will see the echo pin while
discussing the Ultrasonic sensor.

5V pin:
This pin provides 5 Voltage power supply to the Ultrasonic sonic sensor. It acts as a positive
terminal of the Arduino.

HC-SR04 Ultrasonic Distance Sensor:


● Now add the HC-SR04 Ultrasonic Distance Sensor in the design area by clicking

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

11
● And type the component name ‘Ultrasonic distance sensor’ in the search area.

● Now click ‘HC-SR04 Ultrasonic Distance Sensor’ from the given option.
© 2022 - BYJU’S Future School.
Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

12
● HC-SR04 Ultrasonic Distance Sensor will be added in our design area.

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

13
Ultrasonic Sensor:

HC-SR04 Ultrasonic Distance Sensor has four terminals. They are:

VCC pin (Voltage Common Collector):

ultrasonic1:VCC - It is the first terminal, which acts as a positive terminal of the ultrasonic
sensor which will get the power supply from Arduino.

Trigger pin:

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

14
ultrasonic1:TRIG - It is the second terminal, which is used to start the ultrasonic sensor for
detecting and finding the distance of the object

Echo pin:

ultrasonic1:ECHO - It is the third terminal of the ultrasonic sensor, this pin will give us the
reading from the ultrasonic sensor about the distance of the object.

Ground pin:

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

15
ultrasonic1:GND - It is the fourth terminal, which acts as a negative terminal of the
ultrasonic sensor used to maintain the flow of the current.
Working of ultrasonic sensor:
Sensor sends the ultrasonic sound waves and waits for the reflected waves once the
reflected waves are received, then this time duration is considered for calculation of the
distance between the sensor and the object.

Task 01: Connections

● Now make a connection with the VCC pin of the Ultrasonic sensor to the 5 V pin of
the Arduino Uno.

Here we are connecting the VCC (Voltage Common connector) terminal of the
ultrasonic sensor to the 5 voltage terminal of the Arduino Uno to get power supply
from the arduino.
© 2022 - BYJU’S Future School.
Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

16
● Now make a connection with the trigger pin of the ultrasonic sensor to the 3 pin of the
arduino.

Here we are connecting the trigger terminal of the ultrasonic sensor to the 3 pin of the
arduino. This connection will help to trigger the ultrasonic sensor to start functioning.

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

17
● Now make a connection with the Echo pin of the ultrasonic sensor to the 2 pin of the
arduino.

Here we are connecting the echo pin of the ultrasonic sensor to the 3 pin of the
arduino. This connection will help to get the distance between the ultrasonic sensor
and the object.

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

18
● Now make a connection with the Gnd pin of the ultrasonic sensor to the Gnd pin of
the arduino.

Here we are connecting the Gnd (Ground) terminal of the ultrasonic sensor to the
Gnd (Ground) terminal of the Arduino Uno so that the flow of the current can be
maintained between the arduino and ultrasonic sensor.

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

19
How does it work?
1. Arduino sends a signal to the ultrasonic sensor via trigpin to get started
2. Then the ultrasonic sensor starts emitting the waves.
3. The waves are reflected back to the ultrasonic sensor after hitting the object.
4. And then the echo pin sends the time duration value to the arduino. This time duration
is nothing but the time taken for the wave to come back after hitting the object.

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

20
There you can see how the waves are emitted from an ultrasonic sensor and then
reflected back to the ultrasonic sensor after hitting the object.

Now the connection is ready, let’s start coding.

Task 01 : Coding

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

21
● Click on the sketch.ino to add the functionality of our design.

● First we will define the variables for holding the pin numbers and variables for holding
time and calculating distance values.
© 2022 - BYJU’S Future School.
Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

22
○ At line no. 1 We are defining a
variable ‘echopin’ using datatype 'int' and will store value ‘2’.

■ ‘int’ stands for integer data type and it is used to store the numbers.

■ Here we are storing the value 2 inside the echopin variable. Because
we have connected the echo pin of the ultrasonic sensor with pin 2 of
the Arduino and this pin will help us to get the readings (time taken by
the wave to come back after hitting the object) from the trigger
ultrasonic sensor.

○ At line no. 2 We are defining a


variable ‘echopin’ using data type ‘int’ and will store value ‘3’

■ Here we are storing the value 3 inside the trigpin variable. Because we
connected the trigger pin of the ultrasonic sensor with the pin 3 of the
Arduino and this pin will help to trigger the ultrasonic sensor to start
functioning.

○ At line no. 3 We are defining a variable


‘Time’ using data type ‘int’.

■ Here we are declaring a variable ‘Time’ for storing the travel time value.

○ At line no. 4 We are defining a


variable ‘Distance’ using data type ‘int’.

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

23
■ Here we are declaring a variable ‘Distance’ for holding the calculated
distance between the sensor and the object.

● Inside the void set() function, we are going to add the following:

● At line no. 8, We are


defining the pinMode() function to define the trigger pin for an ultrasonic sensor.

○ What is the use of the pinMode() function?

pinMode() function is used to set the mode of the pin as input or output.

○ We have passed the following parameters:

■ trigpin : As this parameter holds the value of the trigger pin.

■ OUTPUT : We are mentioning output because we want this trigger pin


to receive signals from the arduino.

● At line no. 9, We are defining


the pinMode() function to define the echopin for an ultrasonic sensor.
Inside the pinMode() function we have passed the following parameters:
- echopin : As this parameter holds the value of echo pin number.
- INPUT : We are mentioning input because we want this echo pin to give the
arduino the reading of the ultrasonic sensor about the distance of the object.
© 2022 - BYJU’S Future School.
Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

24
● At line no. 10, We are defining the
Serial.begin() function inside this we are passing a value 9600.

- serial.begin() : It is the method which is actually used to transfer the data from
one device to the other connected device.
For example: Sending and receiving data Arduino Uno and the Ultrasonic
sensor.
- 9600 : It is the transfer rate(speed), means at 9600 rate transferring of data will
happen between the connected devices

● At line no. 11,

We
are printing a message ‘Ultrasonic Distance:...”.

- serial.print() : This function is used for printing the message.


- Ultrasonic Distance:... : This message will be displayed on the console.

● Inside the loop() function, we are going to add the following:

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

25
● Now we will write the logic of resetting the ultrasonic sensor, this will help in starting
the ultrasonic sensor. The logic of resetting ultrasonic sensor is:
○ We will stop the functioning of ultrasonic sensor
○ We will start the functioning of ultrasonic sensor

● At line no. 17, We are


defining a digitalWrite() function to stop the functioning ultrasonic sensor by setting
the trigger pin to low.

○ What is the use of the digitalWrite function and what parameters does it
take?

digitalWrite() is the function which is used to control the components.


It takes 2 parameters.
- The pin on which the component is connected
- The action needs to be taken on those components.

So we will be passing parameters like:


○ trigpin variable holds the pin value where the ultrasonic sensor is connected.
© 2022 - BYJU’S Future School.
Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

26
○ LOW - We are setting the power supply as LOW, as we want the ultrasonic
sensor trigger pin connection to turn OFF and to stop receiving signal from the
arduino
We are turning OFF the trigger pin of the ultrasonic sensor, so that the
ultrasonic sensor stops working.

● At line no. 18, We


are defining a digitalWrite() function to start functioning by setting the trigger pin to
high
We will be passing parameters like:
○ trigpin - This variable holds the pin value where the ultrasonic sensor is
connected.
○ HIGH - We are setting the power supply as HIGH, as we want the ultrasonic
sensor trigger pin connection to turn ON and to start receiving signal from the
arduino.
We are turning ON the trigger pin of the ultrasonic sensor, to trigger the
ultrasonic sensor to start working to find the object.

● At line no. 19
We will write a pulseIn() function to get the time taken by the sound wave to reflect
back after hitting the object, and using this time value we will be calculating the
distance value. For now we will store this value inside the Time variable.
○ pulseIn() function is used to read the signal coming from an ultrasonic sensor.
It takes 2 parameters.
■ The pin on which the component is connected.
■ The action needs to be taken on those components.

So we will be passing parameters like:


○ echopin - This variable holds the pin value where the ultrasonic sensor is
connected.
○ HIGH - We are setting the power supply as HIGH, as we want the ultrasonic
sensor echo pin connection to turn ON and to start sending signals(time taken
by the sound wave to reflect back after hitting the object) to the arduino.

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

27
● At line no. 20, We
are calculating the distance between the sensor and the object using the distance
formula.
Distance Formula:
Distance = Time * 0.0172
- Here Time is the duration taken but the ultrasonic waves hit the object and
come back.
- 0.0172 is the number which we need to use for finding the distance of any
object. This formula will be constant whenever you need to find the distance
you can use this formula.

● At line no. 21, We are


printing a message “Time:”.
- Serial.print() : This function is used for printing data.
Time: : This message will be displayed on the console.

● At line no. 22, We are


printing the variable time.

- Serial.print() : This function is used for printing data.


Time: It prints the time value in microseconds.This variable holds the time
value.

● At line no. 23,


We are printing a unit of duration “microseconds”.

- Serial.print() : This function is used for printing data.


microseconds: This microseconds will be displayed on the console.

● At line no. 24, We are defining a


delay() function

- What is the use of delay() function?

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

28
delay() function is used to delay the program and it takes 1 parameter in
milliseconds.

We have passed 1000 inside this function:


- 1000 - It is the time in milliseconds for which the program will be delayed i.e
1000 means for 1 second.

● At line no. 25,


We are printing a message “,Distance:”.

- Serial.print() : This function is used for printing data.


Distance : This message will be displayed on the console.

● At line no. 26, We are


printing the calculated variable Distance.

- Serial.print() : This function is used for printing data.


- Distance : The Distance value will be printed on the console. This variable
holds the calculated ‘Distance’ value.

● At line no. 27, We are printing a


message “cm”.

- Serial.println() : This function helps to print the next statement in the next line.
cm : This message will be displayed on the console.

● At line no. 28, We are defining a


delay() function.

- What is the use of delay() function?

delay() function is used to delay the program and it takes 1 parameter in


milliseconds.

We have passed 1000 inside this function:

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

29
- 1000 - It is the time in milliseconds for which the program will be delayed i.e
1000 means for 1 second.

It’s time to simulate the code.

Task 01: Simulation

● Let’s simulate the code.

● Click on button which is located on the top left side of the design area.

Output:

We can see the Time and Distance value on the console:

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

30
Now click on the ultrasonic sensor and you will get a small box of ‘Editing Ultrasonic
Distance Sensor’.

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

31
As we adjust the distance of the ultrasonic sensor, we can see the updated distance and
time value on the console.

NOTE: Make the student understand about the correlation of distance and
duration it is very important:

If I change the value of distance the value of duration is also changed and we can see in this
console such that:
If the distance is higher the duration is higher and vice versa.

Q: What can be the reason for this correlation between distance and duration?
A: It’s simple as we know the distance is calculated using the duration value(time taken by
the waves to reflect back after hitting the object), hence we can see this correlation.

Now it's time you have to perform it.

Teacher Stops Screen Share

Now it is your turn.

● Ask the Student to press the ESC key to come back to the panel.
© 2022 - BYJU’S Future School.
Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

32
● Guide the Student to start Screen Share.
● The Teacher gets into Fullscreen.

Step 3: Student-Activity-1- WOKWI


Student-Led
Activity Student Activity 2 - CODE
(30 mins) DIAGRAM

Login to Wokwi:

1. Open the URL given in Student Activity - 1.

2. Open the URL given in Student Activity - 1.

3. After opening click on Sign In with your gmail account.

4. As we are going to work with the Arduino Uno board, click on the Arduino Uno board.

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

33
5. As you click on Arduino Uno, You will get the interface as shown below.

Now perform the below mentioned tasks:

Task 01: Design a circuit with Arduino and Ultrasonic sensor

1. Add the HC-SR04 ultrasonic sensor by clicking button in the design area of
the wokwi project.

2. Make the Connections between Arduino Uno and HC-SR04 ultrasonic sensor.

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

34
Task 02: Write a program to calculate the distance of an object using an Ultrasonic
sensor:
3. Add the codes in sketch.ino file.

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

35
4. Simulate the circuit by changing the distance of the ultrasonic sensor and we can see
the measurement of an object i.e time and distance of the ultrasonic sensor in the
bottom of the simulation.

Output:
© 2022 - BYJU’S Future School.
Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

36
Submitting the Activity - 1 Link:

As you complete the Circuit creation and Testing now to share the project link you need
to perform the below mentioned task.

a. Click on button to save the project.

b. Now At Top Left Corner, Click on the Button.

c. Now click on option to get the Link.

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

37
d. As you copy the link, you will get the Wokwi link which contains the created
circuit design.

e. Now share and submit this copied link in the Student Dashboard panel against the
correct class number.

Teacher Guides Student to Stop Screen Share

Step 4: You did great today as well. (Give at least 2 hats offs)
Wrap-Up Great! You have two hats off. Press the Hats Off Icon for
(5 mins) Creatively Solving Activities.

.
Press the Hats Off Icon for Great
Why did we use an ultrasonic Question.
sensor today?

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

38
We used an ultrasonic sensor
for finding the distance between the
sensor and object.

What is the formula to calculate Press the Hats Off Icon for
“Strong Concentration”.
distance?

Distance = Time * 0.0172

If you don’t have time to


perform additional activities,
ask the student to perform all
the additional activities after
the class. Additional activities
are VERY important for kids, so
that they are ready for the next
module. And some challenging
concepts are coming ahead.

Also remind the student to refer


to the Student Reference activity
for increasing his/her
knowledge. This should also be
done.

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

39
Teacher Initiates Screen Share

Step 5: RGB LED WITH SENSOR Open the Project Solution link
Project and showcase the output.prin
Pointers and Goals of the Project:
Cues In today’s class we learned to
(5 mins) program for detecting the distance
between the sensor and the object
using an ultrasonic sensor.

RGB LED WITH SENSOR:


In this project, we want you to
create a circuit by using Arduino
Uno, Ultrasonic Sensor and RGB
LED and write a program to control
RGB LED on the basis of the
distance value.

Story:
Magnum lights is a light based
project company. They are doing
innovative works with lights for
homes, festivals, TV shows and so
on. They are in the research and
development stage and planning to
add an ultrasonic sensor on their
RGB LEDs such that when a person
is near to the RGB LED, RGB LEDs
should glow automatically. Can you
help them to create a circuit design
with code using ultrasonic sensor
and RGB LED ?

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

40
Good Luck!

For the solution of all the Additional Activity, open Teacher-Activity-3 and navigate to
class number C282

Additional Activity 1 -
Run Additional-Activity-1 from the panel.
The TASK and HINTS are mentioned on the website itself.

Additional Activity 2 -
Run Additional-Activity-2 from the panel.
The TASK and HINTS are mentioned on the website itself.

Additional Activity 3 -
Run Additional-Activity-3 from the panel.
The TASK and HINTS are mentioned on the website itself.

Additional Activity 4 -
Run Additional-Activity-4 from the panel.
The TASK and HINTS are mentioned on the website itself.

Additional Activity 5 -
Run Additional-Activity-5 from the panel.
The TASK and HINTS are mentioned on the website itself.

Teacher Clicks

Activity Activity Name Links

Teacher Activity 1 TASK CODE https://wokwi.com/arduino/projects/31983


1339906892370

Teacher Activity 2 CODE DIAGRAM https://docs.google.com/document/d/e/2P


ACX-1vSnkieBlfrxG1X3ez5Iristb34TCiFG
QUdiD2tTfNBC44M7pFqnOs5XmLL6DK

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

41
xUMAmzkpICkqNqTjpd/pub

Teacher Activity 3 ADDITIONAL ACTIVITY https://mahdihat791.github.io/v2/addition


al_activities_solution.html

Student Activity 1 WOKWI https://wokwi.com/

Student Activity 2 CODE DIAGRAM https://docs.google.com/document/d/e/2P


ACX-1vSnkieBlfrxG1X3ez5Iristb34TCiFG
QUdiD2tTfNBC44M7pFqnOs5XmLL6DK
xUMAmzkpICkqNqTjpd/pub

Student Reference ARDUINO SKETCHES https://docs.arduino.cc/learn/programmin


Activity 1 g/sketches

Student Reference ULTRASONIC SENSOR https://www.cuidevices.com/blog/the-basi


Activity 2 cs-of-ultrasonic-sensors

Project solution https://docs.google.com/document/d/e/2P


RGB LED WITH SENSOR ACX-1vQcvqXq0W9ZQ98ZAmFtdkG__h
Y21iYM4ojE0Dsq4HHsR07oORcN5kCR
9-OizPHFYPc0nAQg-Y-Y-MU4/pub

© 2022 - BYJU’S Future School.


Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

42
© 2022 - BYJU’S Future School.
Note: This document is the original copyright of BYJU’S Future School.
Please don't share, download or copy this file without permission..

43

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy