Activa JavaScript para disfrutar de los vídeos de la Mediateca.
Arduino: temperature sensor (native speaker) - 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 today we
00:00:03
are going to learn how to control
00:00:06
a temperature sensor with the arduino board
00:00:08
okay we have our board and the
00:00:12
first thing we need is a temperature
00:00:13
sensor
00:00:15
you will find it in the library
00:00:16
the basic components library down here
00:00:19
there it is so click and drag
00:00:25
like always onto the protoboard
00:00:27
and this temperature sensor has three connectors
00:00:30
the first one has to be connected
00:00:32
to five volts the third one or
00:00:34
the other one on the end is
00:00:37
connected to the ground using the black
00:00:39
wire to the ground connector on the
00:00:41
arduino board
00:00:43
and the second one or this one
00:00:45
in the middle is going to be
00:00:46
connected to analog input a zero for
00:00:48
instance like today and it's the one
00:00:51
that's going to read the voltage from
00:00:54
the sensor and the arduino board will
00:00:55
read the temperature using this wire and
00:00:57
this voltage
00:01:00
so the connection is really easy but
00:01:02
how do we program it
00:01:05
so let's open the code
00:01:09
and for now just forget about the
00:01:12
second part the important thing here is
00:01:14
this purple one this one is a
00:01:16
specific input for a temperature sensor and
00:01:19
what it means is that we are
00:01:22
reading from this connector we can read
00:01:24
from a one a two a three
00:01:27
a four or a five and we're
00:01:29
choosing a zero
00:01:31
just for this example
00:01:32
and the unit we want is degrees
00:01:35
in Celsius
00:01:38
so the moment we have this block
00:01:40
we can store the reading in a
00:01:41
variable called temperature and then we can
00:01:43
send it to the serial monitor using
00:01:47
the block we have already used in
00:01:49
several other exercises
00:01:51
so the connection and the programming are
00:01:55
both very simple now let's look at
00:01:57
the simulation
00:01:59
so if I start the simulation
00:02:05
nothing happens at first but the reading
00:02:09
is here in the serial monitor
00:02:12
right now the sensor is reading twenty
00:02:15
four degrees why because if we click
00:02:17
on the sensor
00:02:21
this bar will appear and we can
00:02:24
decide what the temperature it is reading
00:02:27
from outside
00:02:29
so if we go up to forty
00:02:31
nine here then that means the arduino
00:02:33
board will read forty nine in the
00:02:34
monitor
00:02:36
we go up to seventy six or
00:02:39
seventy eight then the board will read
00:02:41
the same seventy eight so the simulation
00:02:43
works your exercise will be a little
00:02:46
bit more complicated but just a little
00:02:49
bit I'm going to show you the
00:02:52
program in real life
00:02:54
so here's the program and I have
00:02:57
my arduino board here and the temperature
00:02:59
sensor
00:03:01
is over here it's very small over
00:03:03
here so it's hard to see but
00:03:06
we're reading it now you can see
00:03:08
the measurements here in the serial monitor
00:03:09
right now it says the room is
00:03:12
twenty two degrees
00:03:13
now if I touch it with my
00:03:18
fingers
00:03:20
the temperature will rise will go up
00:03:22
that makes sense
00:03:24
now it's reading twenty four so the
00:03:26
device is working
00:03:29
now I've had to make a modification
00:03:31
because this reading is slightly different if
00:03:33
we have a look at the text
00:03:37
taken from the code on the computer
00:03:38
let me show you the text
00:03:43
this line here is different temperature equals
00:03:45
minus forty plus number multiply by analog
00:03:50
read minus twenty this line is not
00:03:52
the same as this one here now
00:03:55
this is because I have a different
00:03:59
temperature sensor but it's not a problem
00:04:01
because if you look for information
00:04:03
can you look up the type for
00:04:05
instance and the sensor I'm using is
00:04:07
the l m thirty five so if
00:04:10
I look this up online I will
00:04:12
find how to connect it and I
00:04:14
will find out how to read it
00:04:16
using the arduino board
00:04:18
all the information is here so this
00:04:21
is the only line that i have
00:04:23
modified now there's another modification too because
00:04:24
I have added something to control a
00:04:28
buzzer do remember
00:04:31
now the buzzer is over here
00:04:34
on my screen this is the buzzer
00:04:39
and if you remember the buzzer makes
00:04:42
sound you already know how to program
00:04:44
it and if you don't remember you
00:04:46
can go back to the exercise when
00:04:48
we used it
00:04:49
so we have a specific output just
00:04:51
to remind you there's a specific output
00:04:54
in the library so let me take
00:04:56
you back to the output library
00:04:59
we have a block here
00:05:03
we use this block and then a
00:05:07
wait block so you can control the
00:05:09
buzzer
00:05:11
now back to my real circuit so
00:05:16
I have the arduino board here
00:05:18
I have a buzzer
00:05:21
and I have my temperature sensor here
00:05:23
so let's have a look at how
00:05:27
my sensor works
00:05:28
right now we're reading twenty two
00:05:30
if I touch it like before
00:05:34
the temperature will rise
00:05:39
and I've programmed the circuit so that
00:05:42
if the temperature is higher than twenty
00:05:44
five the buzzer will produce sound so
00:05:46
I will touch it twenty twenty two
00:05:48
twenty three twenty four twenty five twenty
00:05:51
six
00:05:54
do you have
00:05:56
can you hear it?
00:05:58
the buzzer okay so my circuit is
00:06:00
working now if I remove my hand
00:06:02
from the device the moment the temperature
00:06:04
becomes lower it doesn't buzz anymore so
00:06:06
this is the exercise you will have
00:06:10
to program using the simulator you only
00:06:11
need to click and drag the buzzer
00:06:15
you need to connect it to ground
00:06:18
and to one of the digital devices
00:06:20
and using this block for sound and
00:06:24
the weight block remember adding them together
00:06:27
here
00:06:29
and you will also need the condition
00:06:31
the conditional the if block if and
00:06:33
a temperature so for example if the
00:06:36
temperature is higher than twenty five or
00:06:39
fifty or whatever you want
00:06:42
then the buzzer will produce sound now
00:06:44
you should already know all the blocks
00:06:48
you need and your simulation will work
00:06:49
the same way my real circuit has
00:06:51
worked so think about how to program
00:06:53
this and good luck
00:06:55
- Idioma/s:
- Autor/es:
- David Gonzalez Arroyo, Alyssa Fantel
- Subido por:
- David G.
- Licencia:
- Reconocimiento - No comercial - Compartir igual
- Visualizaciones:
- 50
- Fecha:
- 3 de abril de 2022 - 20:43
- Visibilidad:
- Público
- Centro:
- IES MARIE CURIE Loeches
- Duración:
- 06′ 58″
- Relación de aspecto:
- 1.78:1
- Resolución:
- 1920x1080 píxeles
- Tamaño:
- 23.08 MBytes