Saltar navegación

Activa JavaScript para disfrutar de los vídeos de la Mediateca.

Arduino: servo (native speaker) - Contenido educativo

Ajuste de pantalla

El ajuste de pantalla se aprecia al ver el vídeo en pantalla completa. Elige la presentación que más te guste:

Subido el 7 de marzo de 2022 por David G.

102 visualizaciones

Descargar la transcripción

Hello. In this video tutorial I 00:00:00
am going to show you how to 00:00:07
use a servo motor this type of 00:00:08
motor that you can see here it's 00:00:11
not the usual type of motor that 00:00:14
keeps turning and turning it works in 00:00:16
a slightly different 00:00:19
way 00:00:20
so using one command block like this 00:00:21
one 00:00:24
to turn the servo by a certain 00:00:26
amount of degrees we can send a 00:00:27
command to the motor this one that 00:00:30
is connected to pin ten 00:00:33
and the command instead of continuously turning 00:00:35
is saying here that the servo has 00:00:39
to place itself in position at zero 00:00:40
degrees 00:00:43
so for instance here the motor is already 00:00:46
in zero degrees it starts there on 00:00:48
zero so the servo is connected with 00:00:50
this green wire on the left side 00:00:53
and it's in pin number ten but 00:00:55
it could be eleven nine whichever you 00:00:58
prefer and there are also two other 00:01:00
connectors the red 00:01:03
one the one in the middle is 00:01:05
connected to the power source 00:01:06
and the one on the right the 00:01:10
black like always is connected to ground 00:01:11
so here we have an extra component 00:01:15
we haven't used before this is the 00:01:17
power supply the servo motor you'll find 00:01:20
here in the basic library but if 00:01:23
you look for the power source you 00:01:26
can't find it here so you will 00:01:27
have to look in the standard library 00:01:29
that contains all of the components listed 00:01:31
and just keep scrolling down until you 00:01:38
find it 00:01:40
here yet here you have the power 00:01:48
source and the reason that we need 00:01:50
a power source is that the arduino 00:01:52
board here can't provide enough energy to 00:01:54
the servo motor and just as a 00:01:57
reminder don't forget the arduino board also 00:01:59
needs to have the ground connection the 00:02:03
ground of the arduino 00:02:05
is connected to the ground of the 00:02:07
motor and the ground of the power 00:02:09
source this way the three of them 00:02:11
will have a common point of reference 00:02:13
this is also their reference of voltage 00:02:16
so yes it is the way that 00:02:19
we close the circuit and that is 00:02:20
important but it's also a common point 00:02:22
of reference for voltage 00:02:24
so now I have briefly explained why 00:02:29
the red wire is connected here and 00:02:32
why the black wire is connected here 00:02:34
because the power to move the servo 00:02:38
is going to be provided by the 00:02:39
power source so now I will explain 00:02:43
the program that you will have to 00:02:46
create but I'm not going to show 00:02:47
you the code I'm just going to 00:02:50
show you how the program should behave 00:02:51
and you will code it 00:02:54
so let's start the simulations you can 00:02:58
see so the program starts here at 00:03:00
zero degrees and it will keep turning 00:03:03
and turning because our code will send 00:03:06
commands to make the motor rotate to 00:03:08
different positions 00:03:11
so we start in zero degrees and 00:03:13
we move up or it looks like 00:03:15
to the left 00:03:17
and then once once we reach ninety 00:03:19
degrees we start moving down or back 00:03:22
to the right 00:03:25
but down in degrees ninety eighty five 00:03:28
eighty and so on until we finish 00:03:31
back in zero degrees again 00:03:34
and this over here is the intensity 00:03:39
that is being read and the intensity 00:03:40
provided by the power source and then 00:03:43
the moment we arrive back to zero 00:03:46
degrees it doesn't move anymore and the 00:03:48
program stops 00:03:50
so the first thing you need to 00:03:54
do is connect the circuit this way 00:03:55
with the arduino board the servo and 00:03:57
the power source 00:03:59
I hope you understand now why the 00:04:02
power source is needed and of course 00:04:03
you have the blocks for the code 00:04:06
and I'm just going to show you 00:04:08
the main idea instead of the whole 00:04:09
thing so the first thing we need 00:04:10
is a block like this one with 00:04:12
this block you're saying that the servo 00:04:14
is connected to number ten and it's 00:04:16
going to start at zero degrees we 00:04:18
always need to start somewhere so we 00:04:21
need to be sure that our servo 00:04:23
will start at zero otherwise we don't 00:04:24
know where it will be 00:04:27
it could be in forty five or 00:04:28
fifty or thirty degrees 00:04:30
so the first command is always starting 00:04:33
at zero degrees 00:04:35
and then we will have to wait 00:04:38
for instance one second every time we 00:04:40
make the servo turn we always need 00:04:43
to wait to give the servo time 00:04:46
to move 00:04:48
so this is the first part of 00:04:50
the code and then there will be 00:04:51
a second part that will look something 00:04:52
like that 00:04:55
now this part is taken from the 00:04:58
previous exercise 00:05:00
and this is not what we are 00:05:04
going to use to move the servo 00:05:05
but it's going to be really similar 00:05:07
to the first time you move upwards 00:05:09
you will for instance turn or jump 00:05:11
every five degrees from zero to ninety 00:05:14
remember this from the simulation that you've 00:05:17
already seen 00:05:19
and then you will send the order 00:05:21
to move and again we will use 00:05:22
a variable the same way we use 00:05:25
the variable to send a frequency to 00:05:26
the buzzer we will use a variable 00:05:28
to send an angle with degrees to 00:05:31
the servo and then again we'll have 00:05:34
to wait for a certain amount of 00:05:36
time 00:05:38
so this one will be the second 00:05:41
part of the program and there will 00:05:43
be a third part really similar to 00:05:45
the second one but instead of moving 00:05:47
upwards with degrees we will move downwards 00:05:49
again jumping every five degrees from ninety 00:05:53
to zero and again we'll send commands 00:05:55
to the server to this 00:05:58
servo using a variable for the angle 00:06:00
and then every time we make it 00:06:03
move we will wait for one second 00:06:04
so this is the program you will 00:06:07
need the first part then something similar 00:06:09
to this one for the second part 00:06:12
and something similar to that for the 00:06:14
third part and if you program it 00:06:15
properly it will behave the same 00:06:18
the way you have seen in the 00:06:20
simulation okay so it shouldn't be too 00:06:21
difficult but just make sure to follow 00:06:24
these instructions with this structure okay good 00:06:27
luck 00:06:31
Idioma/s:
en
Autor/es:
David Gonzalez Arroyo, Alyssa Fantel
Subido por:
David G.
Licencia:
Reconocimiento - No comercial - Compartir igual
Visualizaciones:
102
Fecha:
7 de marzo de 2022 - 21:34
Visibilidad:
Público
Centro:
IES MARIE CURIE Loeches
Duración:
06′ 32″
Relación de aspecto:
1.78:1
Resolución:
1920x1080 píxeles
Tamaño:
58.83 MBytes

Del mismo autor…

Ver más del mismo autor


EducaMadrid, Plataforma Educativa de la Comunidad de Madrid

Plataforma Educativa EducaMadrid