Let's investigate light bulb efficiency using the //code.Node.
[Light Bulb Efficiency]
What type of light bulbs do you have in your home?
Have you ever considered that you have some types
that are much more energy-efficient than others?
How can you test the efficiency of LED and older incandescent light bulbs?
You can do just this, by measuring the thermal energy that radiates off the bulb.
[Setup]
For this activity, you'll need a //code.Node, an incandescent bulb, and an LED,
and a ring stand with a holder.
If you don't have the ring stand, you can use a tape measure.
Just hold the //code.Node approximately 15 cm above the bulbs.
You can use various wattage levels of light bulbs but make sure they're equivalent.
For example, today, I'm using a 14-watt LED bulb and a 100-watt incandescent light bulb.
The incandescent light bulbs get extremely hot to the touch,
so make sure you're using lamp clamps to avoid having to change the bulbs and risking a burn.
[Data Collection]
Let's get started.
First, I'm going to turn on the //code.Node.
I'm going to select Sensor Data in my SPARKvue software.
You'll see that my device is paired.
For this demonstration, we're going to be measuring the heat
that's radiating off of the bulb.
I'm going to choose the Temperature sensor here to get ambient temperature.
Then I'm going to click on the Graph display.
You should have temperature over time, which we do.
I'm going to start with the LED bulb.
Turn that on.
There's one other thing I want to do before I get started.
Down here, you'll see where it's set at 20 Hz.
For my sampling, I want that to be 1 Hz so I get a data point for every second.
All right, temperature over time, LED bulb on.
Let's start.
We're going to run this for four minutes.
We're going to go ahead and speed up the data for you.
I expanded my graph so my data is clearer to read.
I'm going to stop recording my data.
I'll move the //code.Node over to the incandescent bulb.
I'm going to click Start, and we're going record for another four minutes.
Again, we'll speed it up for you.
Heidi: We've hit the four-minute mark, and we stopped collecting data.
[Analysis]
Now that we collected our data, I've pulled up run one first, and this was our LED bulb.
Run two was using our incandescent bulb.
Remember, we were measuring thermal output here.
It's pretty evident that the incandescent bulb is giving off much more heat than the LED,
which is equating to a lower efficiency because we're losing light to heat.
The reason we did this is it's going to help me with a data point that I'm going to use
in a Blockly code program we're going to do right now.
[Coding]
Now that we've seen how the //code.Node can be used to collect data, let's now create
a Blockly coding program that will identify higher and lower efficiency light bulbs.
We can use the data we collected to help us with our code creation.
I'm looking at run one and run two, and I can see here that the incandescent lightbulb
increased in temperature pretty steadily, getting up to about 26°C.
I know because of the amount of thermal output coming off this incandescent bulb,
it's a lower efficiency.
That's important.
To create the code, I'm going to click on the Code icon.
Let's build our program.
Start with a loop, while true...I need to put in my conditionals, my statements.
I'm going to pull the hardware out.
This is temperature, if you ever need to adjust, you can just click here,
but we focused on temperature so I'm going to leave that.
I'm pulling in a math block for my temperature reading.
We're going to set this up if it gets above a certain temperature,
it is going to make a sound, so I'm going to pull in my speaker in here.
I'll set that at about 500 Hz.
I'm going to duplicate that block because if it doesn't hit that certain temperature,
it's not going to do anything at all.
I'm going to create some text output.
To do that, I clicked code output, and create text.
I'm going to give this a name that makes it easy for me to reference later.
I'm just doing lightbulb efficiency, abbreviated.
Now, I can pull this out.
If it goes over a certain temperature,
I know that's going to indicate a lower efficiency light bulb.
Duplicate again.
If it doesn't get too warm, it's going to be a higher efficiency bulb.
Let's make sure our code is set.
I've got my loop, while true.
This is where the temperature comes into play.
Remember, we looked at the data before, it got up to about 20°C.
It took a little bit of time to get there.
For the sake of this demonstration, I'm going to set the temperature lower.
I can see what it's reading right now.
It says 25.4.
Let's set this at 25.7.
I'm going to turn on my incandescent lightbulb,
that's the only one you would really need for this demonstration.
Let's see if it works.
I forgot one thing.
If you want to see the text output, you have to add an additional page.
I'm going to do that right now.
I'm going to pick the two-page layout.
I want the temperature to be visual.
Then to get to that text output you created, you go into User-entered,
and I gave it a name to easily reference, and I'm good to go.
Let's start this again.
So far, so good.
I'm reading higher efficiency because I'm below that threshold.
Heidi: There you go, I hit the number I needed to.
My speaker is going off, and I'm getting a text output of lower efficiency.
That's one demonstration that you can do using the //code.Node.
Thank you.