ElectroBlocks/C2/Temperature-Indicator/English

From Script | Spoken-Tutorial
Jump to: navigation, search
Visual Cue Narration
Slide 1:

Title Slide

Welcome to the Spoken Tutorial on Temperature indicator using Electroblocks.
Slide 2:

Learning Objectives

In this tutorial, we will learn how to
  • Build a set of blocks for Temperature Indicator
  • Check the output of the experiment using the simulator
Slide 3:

System requirement

  • Ubuntu Linux OS version 22.04
  • Google Chrome browser
  • A working internet connection to use Electroblocks
To record this tutorial, I am using the following setup.
Type

https://electroblocks.org/

Let us open the ElectroBlocks website using Chrome browser.
Only narration Let us open a new blank project.
Slide 4

Required Sections

  • Logic
  • Thermister
  • LED
  • Math
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 the Temperature indicator experiment.

Here, when the temperature value is greater than the defined value the LED is turned ON.

Otherwise the LED is turned OFF.

Let us build this circuit using ElectroBlocks.

Keep the loop block in the middle area (compulsory)

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.

Only narration.

Click on the Logic option available on the left hand side of the screen.

Click on the Logic section.

The third block represents the Comparison block.

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

Narration

Click on the Sensors section

Now we will add a Thermistor block.

Click on the Sensors section and Click on the Thermistor.

Select the Thermistor Setup block and drag it in the working area.

By default, this button will be connected to analog pin A0 of Arduino.

Point to Temp in C 23 value.

Click on the number box and change the value to 25.

We can change the temperature value to 25 by clicking on the temperature in °C box.

Note that, in the simulation window, the temperature changes to 25 °C as well.

Check the Copy All checkbox.

This setting will set the temperature of the thermistor to 25 degrees for all the 3 loops.

Only narration

Click on the Thermistor option.

Place this block in the 1st section of the comparison block.

Let's add a thermistor block to read the temperature.

Click on the Thermistor.

Select the Read temperature block and drag it in the working area.

Now place this block in the first section of the Comparison block.

Let us set the condition for the temperature reading for the thermistor.

Click on the dropdown option in the comparison block

select the condition to greater than equal to

Click on the dropdown option in the comparison block.

Select the condition to greater than equal to as shown.

Click on the Math option

Select the number block.

Click on the Math section.

Select the number block and place this block in the 2nd section of the Comparison block.

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

Click on the LED option.

Select and drag the Turn on LED.

Click on the Add-ons section and click on LED.

Select the Turn a LED ON block and place this block in the then section of the If then else block.

The LED is connected to pin 2 of the Arduino.

Click on Time section

Select the wait for 0.2 second block

Drag it in the working area.

Place this block below Turn a LED ON

Change the time to 1 second

Point to if then block

Click on the Time section.

Select the wait for 0.2 second block and place this block below the Turn a LED ON block.

Change the time in the wait block to 2 seconds.

We have set the blocks for LED to turn ON for 2 seconds if the temperature value is above 20 °C


Only narration.

Right click on the Turn on LED block and select the Duplicate option.

Drag and place this new block inside the else section of If then else block.

Click on the dropdown arrow and select OFF

Right click on the Turn a LED on block and select the Duplicate option.

Drag and place this block inside the else section of If then else block.

To change the state of the LED, click on the dropdown arrow and select OFF.

Now we have completed the block setup for this experiment.

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’s check the working of the temperature indicator using the simulator.
Click on Home page and click on the Play button Click on the Home icon and press the Play button to start the simulation.
Point to simulation window

In the thermistor setup block, change the temperature value to 15 oC.

play the simulation button to see the output.

We can see the LED turns ON for 2 seconds.

This is because the thermistor temperature is 25°C which is greater than the comparison block .

We will create a situation, where the thermistor reading is below 20oC.

In the thermistor setup block, change the temperature value to 15 oC.

Now, play the simulation again to see the output.

Notice, the LED remains OFF.

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 how to:

  • Build a set of blocks for Temperature Indicator
  • Check the output of experiment using the simulator
This brings us to the end of this tutorial. Let us summarise.
Slide 7:

Assignment:

  1. Connect a LED to pin 5
  2. Turn ON the LED when the temperature is below 25°C
As an assignment, please do the following
Slide 8:

Thank you

Thank you for joining.

Contributors and Content Editors

Madhurig, Nirmala Venkat