Activa JavaScript para disfrutar de los vídeos de la Mediateca.
Arduino: temperature sensor - Contenido educativo
Ajuste de pantallaEl ajuste de pantalla se aprecia al ver el vídeo en pantalla completa. Elige la presentación que más te guste:
Hello! In this video tutorial, in this exercise, we are going to learn how to
00:00:00
use a... how to control a temperature pressure, temperature sensor, I'm sorry,
00:00:04
with the Arduino board, ok? And the first thing we need is a temperature sensor
00:00:11
and you will find it in the library, the basic library, where is it? Here,
00:00:17
temperature. So just click and drag, put it on the protoboard. This sensor temperature
00:00:23
has three connectors. The first one has to be connected to 5 volts, the third one is
00:00:31
connected to ground using the black wire and to the ground connector of the Arduino board,
00:00:39
and the third one, the one in the middle, is the one that is going to be connected to
00:00:43
analog input, A0 for instance, and this is the one that is going to read the voltage from the sensor and the Arduino board will
00:00:48
will know the temperature, will read the temperature using this this wire and this voltage, okay?
00:00:57
So the connection is really really easy as you can see.
00:01:03
How can we program it? It's really easy too.
00:01:07
Forget about the second block. The important thing here is the purple one. The purple one is an input,
00:01:10
It is a specific input for a temperature sensor.
00:01:15
And the thing we do is leer el sensor de temperatura en el pasador A0.
00:01:21
It means we read from this connector.
00:01:25
We can read from A1, A2, A3, A4 or A5.
00:01:27
We are going to choose A0 just because we want.
00:01:31
And this is the unit we want to use, degrees, Celsius degrees.
00:01:34
So the moment we have this block, we can store the reading in a variable called temperature,
00:01:40
and then we can send it to the monitor series, serial monitor, I'm sorry, using the block
00:01:48
we have already used in several exercises, okay?
00:01:55
Really really easy the connection, really really easy the programming.
00:01:59
Let's have a look at the simulation.
00:02:02
If I start the simulation, nothing happens apparently, but the reading is here in the
00:02:05
serial monitor.
00:02:12
Now this sensor is reading 24 degrees.
00:02:14
Why?
00:02:20
Because if we click on it here, on this bar, we can decide what's the temperature outside,
00:02:21
or what the temperature is outside.
00:02:28
And 49 here means that the Arduino board will read 49, 76 or 78, it means that the Arduino
00:02:31
board will read 78, ok?
00:02:39
So the simulation works.
00:02:42
Your exercise will be a little bit more complicated, but just a little bit.
00:02:45
I'm going to show you the program in real life, as usual, as always, I have my Arduino
00:02:52
over here and I have a sensor here. You can't see it because it's small but
00:02:59
believe me it's here. And we are reading it. You can see the measure in the
00:03:05
serial monitor. Now in this room there are 22 degrees, okay? If I touch it
00:03:12
temperature will rise. It makes sense. 23, 24, okay. It works. My device is working.
00:03:19
I have had to make a modification because this reading is different.
00:03:27
If we have a look at the text taken from the computer, this line is different.
00:03:36
Can you see?
00:03:43
Temperatura equals minus 40 plus number multiplied by analog read minus 20.
00:03:44
This line is not the same than this one.
00:03:51
This is because I have a different temperature sensor, but it's not a big problem because
00:03:57
if you look for information, for instance here, the sensor I'm using is the LM35-1.
00:04:02
If I look for information, I will find how to connect it and I will find how to read
00:04:12
it using the Arduino board, okay?
00:04:18
So this is the only line I have modified.
00:04:24
another modification too, because I have added something to control a buzzer.
00:04:27
The buzzer is here. The buzzer, the speaker, it makes sounds, it makes sound.
00:04:36
You already know how to program it and if you don't remember, go back to the
00:04:42
exercise when we use it, okay? It's really easy to do. We have a specific
00:04:46
output, I want to remind you, here there is a specific output in the library, let's
00:04:54
go back to the library, Salida, we have a block here, Reproducer Altavoz, okay?
00:05:01
Using this one and a weight you can control the the buzzer, okay? So let's go
00:05:06
back to my circuit, the real one, so I have the Arduino board here, the big
00:05:12
I have my buzzer and I have my temperature here, my temperature sensor,
00:05:17
okay? And let's have a look how my sensor works. Now we are reading 22. If I touch
00:05:24
it, temperature will rise. And I have programmed the circuit that if
00:05:31
temperature is higher than 25, the buzzer, this one, will produce sound. Let's have
00:05:35
I touch it. 22, 23, 24, 25, 26. Can you hear it? So my circuit is working. If I remove my hand from the device, the moment the temperature becomes lower, it doesn't sound anymore.
00:05:40
So this is the exercise you have to program using the simulator.
00:06:03
The simulator, yes.
00:06:07
It's really easy.
00:06:08
You only need to click and drag.
00:06:09
You need to click and drag the buzzer.
00:06:14
You need to connect it to ground and to one of the digital devices.
00:06:16
And using this block, the reproducer altavoz,
00:06:20
and the block that is the weight, okay, remember,
00:06:23
and adding them here.
00:06:27
And you will also need the condition, the if block.
00:06:29
You remember the if block?
00:06:34
Be if and a temperature.
00:06:35
So if something happens, then if temperature is higher than 25, for instance, or 50, whatever,
00:06:36
then the buzzer will produce sound, okay?
00:06:43
I think it's really, really easy.
00:06:49
You know all the blocks.
00:06:50
You already know all the blocks you need, okay?
00:06:51
And your simulation will work the same way my real circuit has worked, okay?
00:06:53
So think about it, it's not complicated, and good luck.
00:06:59
- Autor/es:
- David Gonzalez Arroyo
- Subido por:
- David G.
- Licencia:
- Reconocimiento - No comercial - Compartir igual
- Visualizaciones:
- 157
- Fecha:
- 10 de enero de 2021 - 18:39
- Visibilidad:
- Público
- Centro:
- IES MARIE CURIE Loeches
- Duración:
- 07′ 05″
- Relación de aspecto:
- 1.78:1
- Resolución:
- 1920x1080 píxeles
- Tamaño:
- 26.99 MBytes