Difference between revisions of "ElectroBlocks/C2/Automatic-Gate-Opener/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with "{| border="1" |- || '''Visual Cue''' || '''Narration''' |- || '''Slide 1''' '''Title Slide''' || Welcome to the '''Spoken Tutorial''' on '''Automatic Gate Opener '''using '''E...")
 
Line 7: Line 7:
 
'''Title Slide'''
 
'''Title Slide'''
 
|| Welcome to the '''Spoken Tutorial''' on '''Automatic Gate Opener '''using '''Electroblocks'''.
 
|| Welcome to the '''Spoken Tutorial''' on '''Automatic Gate Opener '''using '''Electroblocks'''.
|- style="border:1pt solid #000000;padding:0.176cm;"
+
|-  
 
|| '''Slide 2:'''
 
|| '''Slide 2:'''
  
 
'''Learning Objectives'''
 
'''Learning Objectives'''
 
|| In this tutorial, we will learn how to,
 
|| In this tutorial, we will learn how to,
# <div style="margin-left:1.27cm;margin-right:0cm;">Build a set of blocks to create an '''Automatic Gate opener'''</div>
+
# Build a set of blocks to create an '''Automatic Gate opener'''
# <div style="margin-left:1.27cm;margin-right:0cm;">Check the output of the experiment using the simulator</div>
+
# Check the output of the experiment using the simulator
  
|- style="border:1pt solid #000000;padding:0.176cm;"
+
|-  
 
|| '''Slide 3:'''
 
|| '''Slide 3:'''
  
 
'''System requirement'''
 
'''System requirement'''
 
|| To record this tutorial, I am using the following setup.
 
|| To record this tutorial, I am using the following setup.
|- style="border:1pt solid #000000;padding:0.176cm;"
+
|-  
 
|| '''Slide:4'''
 
|| '''Slide:4'''
  
Required section
+
Required Sections
* <div style="margin-left:1.27cm;margin-right:0cm;">Logic</div>
+
* Logic  
* <div style="margin-left:1.27cm;margin-right:0cm;">Motion</div>
+
* Motion  
* <div style="margin-left:1.27cm;margin-right:0cm;">Servo</div>
+
* Servo  
* <div style="margin-left:1.27cm;margin-right:0cm;">Math</div>
+
* Math  
* <div style="margin-left:1.27cm;margin-right:0cm;">Time</div>
+
* Time  
  
 
|| We will need the following sections for this experiment.
 
|| We will need the following sections for this experiment.
  
|- style="border:1pt solid #000000;padding:0.176cm;"
+
|-  
 
|| '''Show '''
 
|| '''Show '''
  
Line 43: Line 43:
  
 
Otherwise, the gate remains closed.Let us build this circuit using''' ElectroBlocks'''.
 
Otherwise, the gate remains closed.Let us build this circuit using''' ElectroBlocks'''.
|- style="border:1pt solid #000000;padding:0.176cm;"
+
|-  
 
|| Type  
 
|| Type  
  
 
'''https://electroblocks.org/'''
 
'''https://electroblocks.org/'''
 
|| Let us open the''' ElectroBlocks''' website using '''Chrome''' browser.
 
|| Let us open the''' ElectroBlocks''' website using '''Chrome''' browser.
|- style="border:1pt solid #000000;padding:0.176cm;"
+
|-  
 
||  
 
||  
 
|| Let us open a new blank project.
 
|| Let us open a new blank project.
|- style="border:1pt solid #000000;padding:0.176cm;"
+
|-  
 
||  
 
||  
  
Line 60: Line 60:
  
 
Drag the '''if then else''' block and place it inside the '''loop''' block.
 
Drag the '''if then else''' block and place it inside the '''loop''' block.
|- style="border:1pt solid #000000;padding:0.176cm;"
+
|-  
 
|| Narration
 
|| Narration
  
Line 67: Line 67:
  
 
Click on the '''Sensors''' section and click on the '''Motion'''.
 
Click on the '''Sensors''' section and click on the '''Motion'''.
|- style="border:1pt solid #000000;padding:0.176cm;"
+
|-  
 
|| 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 73: Line 73:
 
|| Select the '''Setup Ultrasonic Sensor '''block and drag it to the working area.
 
|| Select the '''Setup Ultrasonic Sensor '''block and drag it to the working area.
  
|- style="border:1pt solid #000000;padding:0.176cm;"
+
|-  
 
|| 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 pin 10 '''of Arduino.
 
|| Here, the '''trigger''' pin and '''echo''' pin are connected to '''pin 11 and pin 10 '''of Arduino.
|- style="border:1pt solid #000000;padding:0.176cm;"
+
|-  
 
|| Only narration
 
|| Only narration
  
Line 96: Line 96:
  
 
This will set the distance of the object from the ultrasonic sensor to 5 cm for all the 3 loops.
 
This will set the distance of the object from the ultrasonic sensor to 5 cm for all the 3 loops.
|- style="border:1pt solid #000000;padding:0.176cm;"
+
|-  
 
|| Only narration
 
|| Only narration
  
Line 112: Line 112:
 
Drag the''' comparison''' '''block''' and place it in the''' if '''section''' '''of''' if then else block.'''
 
Drag the''' comparison''' '''block''' and place it in the''' if '''section''' '''of''' if then else block.'''
  
|- style="border:1pt solid #000000;padding:0.176cm;"
+
|-  
 
|| Only narration
 
|| Only narration
  
Line 129: Line 129:
  
 
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.
|- style="border:1pt solid #000000;padding:0.176cm;"
+
|-  
 
|| 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.
  
Line 135: Line 135:
  
 
Drag and place the first '''number''' '''block,''' next to the '''less than equal to '''option.
 
Drag and place the first '''number''' '''block,''' next to the '''less than equal to '''option.
|- style="border:1pt solid #000000;padding:0.176cm;"
+
|-  
 
|| 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 the value to 10.
 
|| Click on the '''number''' block and change the value to 10.
|- style="border:1pt solid #000000;padding:0.176cm;"
+
|-  
 
|| Only narration
 
|| Only narration
  
Line 152: Line 152:
  
 
Notice the servo motor is connected to pin 2 of the arduino.
 
Notice the servo motor is connected to pin 2 of the arduino.
|- style="border:1pt solid #000000;padding:0.176cm;"
+
|-  
 
|| Point to rotate servo number block  
 
|| Point to rotate servo number block  
  
Line 164: Line 164:
 
Click on the number block and change the value to 90 degrees.
 
Click on the number block and change the value to 90 degrees.
  
|- style="border:1pt solid #000000;padding:0.176cm;"
+
|-  
 
|| Only narration
 
|| Only narration
  
Line 181: Line 181:
  
 
Change the time to''' 2''' seconds.
 
Change the time to''' 2''' seconds.
|- style="border:1pt solid #000000;padding:0.176cm;"
+
|-  
 
|| Only narration
 
|| Only narration
  
Line 196: Line 196:
  
 
Place this duplicate block in the '''else''' section of the '''if then else''' block.
 
Place this duplicate block in the '''else''' section of the '''if then else''' block.
|- style="border:1pt solid #000000;padding:0.176cm;"
+
|-  
 
|| Click on the '''number''' block and change to 0.
 
|| Click on the '''number''' block and change to 0.
 
|| Click on the '''number''' block and change the value to 0 degrees.
 
|| Click on the '''number''' block and change the value to 0 degrees.
|- style="border:1pt solid #000000;padding:0.176cm;"
+
|-  
 
|| Only narration
 
|| Only narration
  
Line 210: Line 210:
  
 
Click on the number block and change the number to 1.
 
Click on the number block and change the number to 1.
|- style="border:1pt solid #000000;padding:0.176cm;"
+
|-  
 
|| 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 217: Line 217:
  
 
The code includes self-explanatory''' comments''' for better understanding.
 
The code includes self-explanatory''' comments''' for better understanding.
|- style="border:1pt solid #000000;padding:0.176cm;"
+
|-  
 
||  
 
||  
 
|| Let us check the desired result using the simulator.
 
|| Let us check the desired result using the simulator.
|- style="border:1pt solid #000000;padding:0.176cm;"
+
|-  
 
|| Click on '''Home''' icon on the tool bar and click on the '''Play''' button
 
|| Click on '''Home''' icon on the tool bar and click on the '''Play''' button
 
|| Click on the '''Home''' icon and press the '''Play button''' to start the simulation.
 
|| Click on the '''Home''' icon and press the '''Play button''' to start the simulation.
|- style="border:1pt solid #000000;padding:0.176cm;"
+
|-  
 
|| Point to simulation window
 
|| Point to simulation window
 
|| The visual representation of the simulation shows that :  
 
|| The visual representation of the simulation shows that :  
Line 236: Line 236:
  
 
Notice that after increasing the distance, the servo motor rotates back to '''0 degrees'''.
 
Notice that after increasing the distance, the servo motor rotates back to '''0 degrees'''.
|- style="border:1pt solid #000000;padding:0.176cm;"
+
|-  
 
|| 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.
|- style="border:1pt solid #000000;padding:0.176cm;"
+
|-  
 
|| Slide:
 
|| Slide:
  
Line 246: Line 246:
 
In this tutorial, we learnt about
 
In this tutorial, we learnt about
  
# <div style="margin-left:1.27cm;margin-right:0cm;">Build a set of blocks to create Automatic Gate opener</div>
+
# Build a set of blocks to create Automatic Gate opener
# <div style="margin-left:1.27cm;margin-right:0cm;">Check the output of experiment using simulator</div>
+
# 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.  
|- style="border:1pt solid #000000;padding:0.176cm;"
+
 
 +
Let us summarise.  
 +
|-  
 
|| Slide:
 
|| Slide:
  
 
'''Assignment''':
 
'''Assignment''':
* <div style="margin-left:1.27cm;margin-right:0cm;">Open a new blank project</div>
+
* Open a new blank project
* <div style="margin-left:1.27cm;margin-right:0cm;">Add an '''LED''' and connect it to '''pin 9'''</div>
+
* Add an '''LED''' and connect it to '''pin 9'''
* <div style="margin-left:1.27cm;margin-right:0cm;">When motion is detected within a '''20 cm range''', the '''servo motor rotates to 90°''' and the '''LED turns ON'''</div>
+
* When motion is detected within a '''20 cm range''', the '''servo motor rotates to 90°''' and the '''LED turns ON'''
* <div style="margin-left:1.27cm;margin-right:0cm;">When no motion is detected, the '''servo motor returns to 0°''' and the '''LED turns OFF'''</div>
+
* When no motion is detected, the '''servo motor returns to 0°''' and the '''LED turns OFF'''
  
 
|| As an assignment, please do the following
 
|| As an assignment, please do the following
  
|- style="border:1pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.206cm;padding-right:0.191cm;"
+
|-  
 
|| '''Slide :'''
 
|| '''Slide :'''
  
Line 268: Line 270:
 
|-
 
|-
 
|}
 
|}
<div style="margin-left:-1.905cm;margin-right:-1.905cm;"></div>
 

Revision as of 12:14, 8 December 2025

Visual Cue Narration
Slide 1

Title Slide

Welcome to the Spoken Tutorial on Automatic Gate Opener using Electroblocks.
Slide 2:

Learning Objectives

In this tutorial, we will learn how to,
  1. Build a set of blocks to create an Automatic Gate opener
  2. Check the output of the experiment using the simulator
Slide 3:

System requirement

To record this tutorial, I am using the following setup.
Slide:4

Required Sections

  • Logic
  • Motion
  • Servo
  • Math
  • Time
We will need the following sections for this experiment.
Show

Circuit Diagram 1 .png

Circuit Diagram 2 .png

This is the circuit diagram of Automatic Gate opener.

Here we will observe that the gate opens whenever an object is detected by the sensor.

Otherwise, the gate remains closed.Let us build this circuit using ElectroBlocks.

Type

https://electroblocks.org/

Let us open the ElectroBlocks website using Chrome browser.
Let us open a new blank project.

Click on the Logic section

Point to if-then-else block

Click on the Logic section.

Drag the if then else block and place it 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.
Point to trigger pin and echo pin Here, the trigger pin and echo pin are connected to pin 11 and pin 10 of 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.

Let us change the distance to 5 by clicking on the Distance in Centimetres box.

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.

Check the Copy All checkbox.

This will set the distance of the object from the ultrasonic sensor to 5 cm for all the 3 loops.

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 to check the distance between the sensor and the object.

Click on the logic option.

The third block represents the comparison block.

Drag the comparison block and place it in the if section of if then else block.

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

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 the value to 10.
Only narration

Click on the Add-ons option

Click on the Servo option.

Let us add a Servo motor block.

Click on the Add-ons section and Click on the Servo.

Select the Rotate servo block and place this block in the then section of the if then else block.

Notice the servo motor is connected to pin 2 of the arduino.

Point to rotate servo number block

Only narration

Only narration

In the Rotate Servo block, the default angle is 50.

It indicates that the servo motor rotates to 50 degrees by default.

Click on the number block and change the value to 90 degrees.

Only narration

Only narration

Click on the Time section.

Then drag and drop the Wait for 0.2 seconds block and place it below the Rotate servo block.

change the time to 0.02 seconds.

The wait block is required to ensure the servo motor rotates smoothly.

Click on the Time section.

Then drag the Wait for 0.2 seconds block and place it below the Rotate servo block.

Change the time to 2 seconds.

Only narration

Right click on the rotate servo block.

Select the duplicate option.

Place this duplicate block in the else section of the if then else block.

We need the servo motor to stop rotating when no motion is detected.

Right click on the rotate servo block.

Select the duplicate option.

Place this duplicate block in the else section of the if then else block.

Click on the number block and change to 0. Click on the number block and change the value to 0 degrees.
Only narration

Right click on the wait for 2 seconds block.

Select the duplicate option

Let us add a wait block.

Duplicate the wait for 2 seconds block and place it below the Rotate servo block.

Click on the number block and change the number to 1.

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.

Let us check the desired result using the simulator.
Click on Home icon on the tool bar and click on the Play button Click on the Home icon and press the Play button to start the simulation.
Point to simulation window The visual representation of the simulation shows that :

The servo motor rotates 90 degrees when the motion is detected within a 10 cm range.

We will create a situation, where the motion is detected above 10 cm range .

In the Setup Ultrasonic Sensor , change the distance to 15 by clicking on the Distance in Centimetres box.

Now, play the simulation again to see the output.

Notice that after increasing the distance, the servo motor rotates back to 0 degrees.

Narration only The XML file of this experiment is provided in the code files for your reference.
Slide:

Summary

In this tutorial, we learnt about

  1. Build a set of blocks to create Automatic Gate opener
  2. Check the output of experiment using simulator
This brings us to the end of this tutorial.

Let us summarise.

Slide:

Assignment:

  • Open a new blank project
  • Add an LED and connect it to pin 9
  • When motion is detected within a 20 cm range, the servo motor rotates to 90° and the LED turns ON
  • When no motion is detected, the servo motor returns to 0° and the LED turns OFF
As an assignment, please do the following
Slide :

Thank you

Thank you for joining.

Contributors and Content Editors

Madhurig, Nirmala Venkat