Difference between revisions of "ElectroBlocks/C2/Ultrasonic-Sensor/English"
(Created page with "{| border="1" |- || '''Visual Cue''' || '''Narration''' |- || <div style="color:#000000;">Show Slide: </div> <div style="color:#000000;">'''Title Slide'''</div> || Welcome to...") |
|||
| Line 1: | Line 1: | ||
| + | |||
{| border="1" | {| border="1" | ||
|- | |- | ||
| Line 4: | Line 5: | ||
|| '''Narration''' | || '''Narration''' | ||
|- | |- | ||
| − | || | + | || '''Slide 1''' |
| − | + | '''Title Slide''' | |
|| Welcome to the '''Spoken Tutorial''' on '''Ultrasonic Sensor''' using '''Electroblocks'''. | || Welcome to the '''Spoken Tutorial''' on '''Ultrasonic Sensor''' using '''Electroblocks'''. | ||
| − | |- | + | |- |
|| '''Slide 2''' | || '''Slide 2''' | ||
'''Learning Objectives''' | '''Learning Objectives''' | ||
|| In this tutorial, we will learn to, | || In this tutorial, we will learn to, | ||
| − | # | + | # Build a set of blocks for '''Ultrasonic sensor''' to detect an object in its range |
| − | # | + | # Check the output of the experiment using the simulator |
| − | |- | + | |- |
|| '''Slide 3''' | || '''Slide 3''' | ||
'''System Requirements''' | '''System Requirements''' | ||
| − | || To record this tutorial, I am using | + | || To record this tutorial, I am using the following setup: |
| − | |- | + | |- |
| − | || Slide 4 | + | || '''Slide 4''' |
Prerequisite | Prerequisite | ||
|| To follow this tutorial,learner should have a basic knowledge of | || To follow this tutorial,learner should have a basic knowledge of | ||
| − | * | + | * ElectroBlocks |
| − | |- | + | |- |
|| Type | || Type | ||
https://electroblocks.org/ | https://electroblocks.org/ | ||
|| Let us open the '''ElectroBlocks''' website in the chrome browser. | || Let us open the '''ElectroBlocks''' website in the chrome browser. | ||
| − | |- | + | |- |
|| Only narration | || Only narration | ||
|| Let us open a new blank project. | || Let us open a new blank project. | ||
| − | |- | + | |- |
| − | || '''Slide | + | || '''Slide 5''' |
| − | Required | + | '''Required Sections''' |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | || We will need the following | + | * Logic |
| − | |- | + | * Motion |
| + | * LED | ||
| + | * Time | ||
| + | * Math | ||
| + | |||
| + | || We will need the following sections for this experiment. | ||
| + | |- | ||
|| | || | ||
|| Switch back to the '''Electroblocks''' interface. | || Switch back to the '''Electroblocks''' interface. | ||
| − | |- | + | |- |
|| Show '''Circuit Diagram.png''' | || Show '''Circuit Diagram.png''' | ||
| Line 61: | Line 63: | ||
Otherwise the buzzer is turned OFF. | Otherwise the buzzer is turned OFF. | ||
| − | |- | + | |- |
|| | || | ||
|| Let us build this circuit using '''ElectroBlocks'''. | || Let us build this circuit using '''ElectroBlocks'''. | ||
| − | |- | + | |- |
|| '''Keep the loop block in the middle area ''' | || '''Keep the loop block in the middle area ''' | ||
| Line 73: | Line 75: | ||
Drag the '''if then else''' block and place inside the '''loop''' block. | Drag the '''if then else''' block and place inside the '''loop''' block. | ||
| − | |- | + | |- |
|| Narration | || Narration | ||
| Line 79: | Line 81: | ||
|| Now we will add an '''Ultrasonic sensor block.''' | || Now we will add an '''Ultrasonic sensor block.''' | ||
| − | Click on the '''Sensors''' section and | + | Click on the '''Sensors''' section and click on the '''Motion'''. |
| − | |- | + | |- |
|| Select the '''Setup Ultrasonic Sensor '''block and drag it in the working area. | || Select the '''Setup Ultrasonic Sensor '''block and drag it in the working area. | ||
| Line 87: | Line 89: | ||
The '''Setup Ultrasonic Sensor '''block is used to configure the '''Ultrasonic sensor '''in the circuit. | The '''Setup Ultrasonic Sensor '''block is used to configure the '''Ultrasonic sensor '''in the circuit. | ||
| − | |- | + | |- |
|| Point toward trigger pin and echo pin. | || Point toward trigger pin and echo pin. | ||
| Line 94: | Line 96: | ||
Point towards echo pin | Point towards echo pin | ||
| − | || | + | || In the '''setup block''', the '''trigger''' pin and '''echo''' pin are used for distance measurement. |
| − | + | '''Trigger''' pin emits ultrasonic sound waves. | |
| − | + | '''Echo''' pin receives the ultrasonic waves reflected from any object in its range. | |
| − | |- | + | |- |
|| Point to '''trigger''' pin and '''echo''' pin | || Point to '''trigger''' pin and '''echo''' pin | ||
| − | || Here, the '''trigger''' pin and '''echo''' pin are connected to '''pin 11 and 10 '''of the Arduino. | + | || Here, the '''trigger''' pin and '''echo''' pin are connected to '''pin 11'' and '''10 ''' of the Arduino. |
| − | |- | + | |- |
|| Only narration | || Only narration | ||
| Line 112: | Line 114: | ||
Point to the red rectangular box in front of the sensor. | Point to the red rectangular box in front of the sensor. | ||
| − | || We can change the distance by clicking on the '''Distance in | + | || We can change the distance by clicking on the '''Distance in Centimetres''' box. |
Click on the box and change the value to '''5.''' | Click on the box and change the value to '''5.''' | ||
| Line 120: | Line 122: | ||
This setting will set the distance of the object to 5 centimeters for all the 3 loops. | This setting will set the distance of the object to 5 centimeters for all the 3 loops. | ||
| − | In the simulation window, the | + | In the simulation window, the 5 cm distance is displayed on the ultrasonic sensor. |
Here the object is shown as a red rectangular box in front of the sensor. | Here the object is shown as a red rectangular box in front of the sensor. | ||
| − | |- | + | |- |
|| Only narration | || Only narration | ||
| Line 131: | Line 133: | ||
Place the block in the '''if '''section of''' if then else block.''' | Place the block in the '''if '''section of''' if then else block.''' | ||
| − | || We need a | + | || We need a comparison block. |
Click on the '''logic''' section. | Click on the '''logic''' section. | ||
| Line 140: | Line 142: | ||
This will compare the distance value of the object from the sensor. | This will compare the distance value of the object from the sensor. | ||
| − | |- | + | |- |
|| Only narration | || Only narration | ||
| Line 150: | Line 152: | ||
Click on the dropdown option and select '''less than''' '''equal to''' option from the list. | Click on the dropdown option and select '''less than''' '''equal to''' option from the list. | ||
| − | || Let us add a '''distance '''block'''. | + | || Let us add a '''distance '''block'''. |
Click on the '''Motion'''. | Click on the '''Motion'''. | ||
| Line 156: | Line 158: | ||
Drag the '''distance(cm)''' block and place this block in the '''first section '''of the '''comparison''' block. | Drag the '''distance(cm)''' block and place this block in the '''first section '''of the '''comparison''' block. | ||
| − | Click on the | + | Click on the drop down option and select '''less than equal to '''option from the list. |
| − | |- | + | |- |
|| click on the '''math''' option available on the left side on the screen. | || click on the '''math''' option available on the left side on the screen. | ||
| − | || Next, | + | || Next, click on the '''Math''' section. |
We will add the distance value. | We will add the distance value. | ||
| − | Drag and place the first '''number | + | Drag and place the first '''number block''' next to the '''less than equal to '''option. |
| − | |- | + | |- |
|| Click on the '''number''' block and change to 10. | || Click on the '''number''' block and change to 10. | ||
|| Click on the '''number''' block and change to 10. | || Click on the '''number''' block and change to 10. | ||
| − | |- | + | |- |
|| | || | ||
| Line 182: | Line 184: | ||
Drag and drop the '''Turn Passive buzzer''' block to the '''then''' section of the '''if then else''' block. | Drag and drop the '''Turn Passive buzzer''' block to the '''then''' section of the '''if then else''' block. | ||
| − | By default the '''Buzzer '''is '''ON '''and connected to pin 9 of the '''arduino | + | By default the '''Buzzer '''is '''ON '''and connected to pin 9 of the '''arduino'''. |
| − | |- | + | |- |
| − | || Right Click on the''' Turn a LED '''block and select the | + | || Right Click on the''' Turn a LED '''block and select the '''Duplicate''' option. |
Place this new block in the '''else''' section of the '''If then else''' block. | Place this new block in the '''else''' section of the '''If then else''' block. | ||
Click on the dropdown option in the''' Turn Passive LED '''block''' '''and select the "'''Off'''" state. | Click on the dropdown option in the''' Turn Passive LED '''block''' '''and select the "'''Off'''" state. | ||
| − | || Right click on the''' Turn Passive buzzer '''block and select the | + | || Right click on the''' Turn Passive buzzer '''block and select the '''Duplicate''' option. |
Place this new block in the '''else''' section of the '''If then else''' block. | Place this new block in the '''else''' section of the '''If then else''' block. | ||
| − | Change the state of the Buzzer to '''OFF''' from the | + | Change the state of the Buzzer to '''OFF''' from the drop down option. |
| − | |- | + | |- |
|| Click on the '''Code''' icon to view the auto-generated Arduino code for the experiment. | || Click on the '''Code''' icon to view the auto-generated Arduino code for the experiment. | ||
| Line 202: | Line 204: | ||
The code includes self-explanatory''' comments''' for better understanding. | The code includes self-explanatory''' comments''' for better understanding. | ||
| − | |- | + | |- |
|| Click the '''Home''' icon and press the '''Play button''' to start the simulation. | || Click the '''Home''' icon and press the '''Play button''' to start the simulation. | ||
| Line 213: | Line 215: | ||
We can see the '''Buzzer''' is turned ON. | We can see the '''Buzzer''' is turned ON. | ||
| − | In the block we have specified the distance as | + | In the block we have specified the distance as 5 centimeters and the range is less than 10 which is true. |
| − | |- | + | |- |
|| Only narration | || Only narration | ||
| Line 230: | Line 232: | ||
In the '''Setup Ultrasonic sensor''' block, change the distance to 20 Centimeters. | In the '''Setup Ultrasonic sensor''' block, change the distance to 20 Centimeters. | ||
| − | In the simulation window, note that the object has | + | In the simulation window, note that the object has moved to 20cms. |
Let us simulate and see the output again. | Let us simulate and see the output again. | ||
| Line 236: | Line 238: | ||
Drag the box above the play button to the start position. | Drag the box above the play button to the start position. | ||
| − | |- | + | |- |
|| Click on the play button | || Click on the play button | ||
| Line 243: | Line 245: | ||
|| Click on the '''Play''' button to see the output. | || Click on the '''Play''' button to see the output. | ||
| − | Notice that the '''Buzzer '''remains in OFF state as the distance is above | + | Notice that the '''Buzzer '''remains in OFF state as the distance is above 10 cms. |
| − | |- | + | |- |
|| Narration only | || Narration only | ||
|| The '''XML '''file of this experiment is provided in the code files for your reference. | || The '''XML '''file of this experiment is provided in the code files for your reference. | ||
| − | |- | + | |- |
| − | || '''Slide 6 | + | || '''Slide 6 ''' |
'''Summary''' | '''Summary''' | ||
In this tutorial, we learnt about, | In this tutorial, we learnt about, | ||
| − | # | + | # Build a set of blocks for Ultrasonic sensor to detect an object in its range |
| − | # | + | # Check the output of experiment using simulator |
|| This brings us to the end of this tutorial. Let us summarise. | || This brings us to the end of this tutorial. Let us summarise. | ||
| − | |- | + | |- |
| − | || '''Slide 7 | + | || '''Slide 7 ''' |
'''Assignment''': | '''Assignment''': | ||
| − | * | + | * Turn '''ON the Buzzer '''when the ultrasonic sensor detects a distance equals to 10 cm. |
| − | * | + | * Turn '''OFF the Buzzer '''if it is not 10 cms. |
| + | |||
| + | || As an assignment, please do the following. | ||
| + | |- | ||
| + | || '''Slide 8''' | ||
| − | + | ''' Thank You''' | |
| − | + | ||
| − | + | ||
|| Thank you for joining. | || Thank you for joining. | ||
|- | |- | ||
|} | |} | ||
Revision as of 16:04, 21 October 2025
| Visual Cue | Narration |
| Slide 1
Title Slide |
Welcome to the Spoken Tutorial on Ultrasonic Sensor using Electroblocks. |
| Slide 2
Learning Objectives |
In this tutorial, we will learn to,
|
| Slide 3
System Requirements |
To record this tutorial, I am using the following setup: |
| Slide 4
Prerequisite |
To follow this tutorial,learner should have a basic knowledge of
|
| Type | Let us open the ElectroBlocks website in the chrome browser. |
| Only narration | Let us open a new blank project. |
| Slide 5
Required Sections
|
We will need the following sections for this experiment. |
| Switch back to the Electroblocks interface. | |
| Show Circuit Diagram.png | This is the circuit diagram of an ultrasonic sensor experiment.
Here, when an object comes in the defined range of the sensor the buzzer is turned ON. Otherwise the buzzer is turned OFF. |
| Let us build this circuit using ElectroBlocks. | |
| Keep the loop block in the middle area
Click on the Logic section Point to if-then-else block |
Click on the Logic section.
Drag the if then else block and place inside the loop block. |
| Narration
Click on the Sensors section |
Now we will add an Ultrasonic sensor block.
Click on the Sensors section and click on the Motion. |
| Select the Setup Ultrasonic Sensor block and drag it in the working area.
Point to the Setup Ultrasonic Sensor block. |
Select the Setup Ultrasonic Sensor block and drag it to the working area.
The Setup Ultrasonic Sensor block is used to configure the Ultrasonic sensor in the circuit. |
| Point toward trigger pin and echo pin.
Point toward trigger pin Point towards echo pin |
In the setup block, the trigger pin and echo pin are used for distance measurement.
Trigger pin emits ultrasonic sound waves. Echo pin receives the ultrasonic waves reflected from any object in its range. |
| Point to trigger pin and echo pin | Here, the trigger' pin and echo pin are connected to pin 11 and 10 of the Arduino. |
| Only narration
Point towards the number box Click on the number box and change it to 5. Point to simulation window Point to the red rectangular box in front of the sensor. |
We can change the distance by clicking on the Distance in Centimetres box.
Click on the box and change the value to 5. Check the Copy All checkbox. This setting will set the distance of the object to 5 centimeters for all the 3 loops. In the simulation window, the 5 cm distance is displayed on the ultrasonic sensor. Here the object is shown as a red rectangular box in front of the sensor. |
| Only narration
Click on the logic option Select the (=) block and drag in the working area. Place the block in the if section of if then else block. |
We need a comparison block.
Click on the logic section. The third block represents the comparison block. Drag the comparison block and place it in the if section of the if then else block. This will compare the distance value of the object from the sensor. |
| Only narration
Click on the Motion,select distance (cm) block. Place this block in the first section of the logic block. Point to dropdown option Click on the dropdown option and select less than equal to option from the list. |
Let us add a distance block.
Click on the Motion. Drag the distance(cm) block and place this block in the first section of the comparison block. Click on the drop down option and select less than equal to option from the list. |
| click on the math option available on the left side on the screen. | Next, click on the Math section.
We will add the distance value. Drag and place the first number block next to the less than equal to option. |
| Click on the number block and change to 10. | Click on the number block and change to 10. |
|
Click on the LED option. Select the Turn a LED block. Place the block in the ‘then’ section of the if then else block. |
Next let us add a Buzzer to the circuit.
Click on the Add-ons and click on the Passive Buzzer. Drag and drop the Turn Passive buzzer block to the then section of the if then else block. By default the Buzzer is ON and connected to pin 9 of the arduino. |
| Right Click on the Turn a LED block and select the Duplicate option.
Place this new block in the else section of the If then else block. Click on the dropdown option in the Turn Passive LED block and select the "Off" state. |
Right click on the Turn Passive buzzer block and select the Duplicate option.
Place this new block in the else section of the If then else block. Change the state of the Buzzer to OFF from the drop down option. |
| Click on the Code icon to view the auto-generated Arduino code for the experiment.
Highlight the code on right side |
Click on the Code icon to view the automatically generated Arduino code.
The code includes self-explanatory comments for better understanding. |
| Click the Home icon and press the Play button to start the simulation.
Zoom and show the simulation area Highlight hand symbol and pressed word |
Click on the Home icon and press the Play button to start the simulation.
We can see the Buzzer is turned ON. In the block we have specified the distance as 5 centimeters and the range is less than 10 which is true. |
| Only narration
Point towards Setup Ultrasonic sensor block. Point towards Distance in the Centimeter box. Click on the box and change the value to 20 Point towards the simulation window. Point to square box.drag this square box to the start point of the simulation. |
Let us change the distance value and check the simulation output.
In the Setup Ultrasonic sensor block, change the distance to 20 Centimeters. In the simulation window, note that the object has moved to 20cms. Let us simulate and see the output again. Drag the box above the play button to the start position. |
| Click on the play button
Point to OFF state |
Click on the Play button to see the output.
Notice that the Buzzer remains in OFF state as the distance is above 10 cms. |
| Narration only | The XML file of this experiment is provided in the code files for your reference. |
| Slide 6
Summary In this tutorial, we learnt about,
|
This brings us to the end of this tutorial. Let us summarise. |
| Slide 7
Assignment:
|
As an assignment, please do the following. |
| Slide 8
Thank You |
Thank you for joining. |