Servo Motors, how do they work?

The Engineering Mindset
23 Jan 202215:11

Summary

TLDREste video ofrece una visión detallada de cómo funcionan los motores servo y cómo programarlos. Los motores servo, utilizados en aplicaciones de ingeniería de precisión, convierten energía eléctrica en movimiento mecánico y se controlan con un controlador para alcanzar una posición precisa. El video, patrocinado por Private Internet Access, explica cómo estos motores, que pueden rotar hasta 360 grados y tienen un rango de torque, funcionan internamente con su sistema de engranajes y circuitos electrónicos. Además, se muestra cómo controlar un motor servo utilizando un Arduino y un potenciómetro, con un ejemplo práctico de conexión y código para que el espectador pueda replicar el proyecto en casa.

Takeaways

  • 🔧 El motor servo se utiliza en aplicaciones de ingeniería de precisión y emplea electrónica interna y engranajes mecánicos para lograr un control preciso.
  • 📺 El video ofrece una guía sobre cómo funcionan los motores servo y cómo programarlos, patrocinado por Private Internet Access, una VPN que protege la privacidad en línea.
  • 🔌 Los motores servo convierten energía eléctrica en energía mecánica y se controlan mediante un controlador para ajustar su posición, lo que los hace ideales para robótica y automatización.
  • 🔄 Los motores servo difieren de los motores DC convencionales en que no rotan inmediatamente; en su lugar, reciben señales que especifican la cantidad de rotación.
  • 🔄 Existen dos tipos de motores servo: los de bucle cerrado, que tienen un pin para detener la rotación, y los de bucle abierto, que pueden rotar un total de 360 grados.
  • ⚖️ Los motores servo tienen una valoración de torque, que indica la cantidad de fuerza que pueden aplicar, y esta se mide en kilogramocentímetros o onzainches.
  • 🔋 El voltaje aplicado afecta tanto al torque como a la velocidad de rotación del motor, pero hay límites superiores que, si se superan, pueden causar que el motor se bloquee y aumente el consumo de corriente.
  • 🛠️ Al abrir un motor servo, se pueden ver componentes clave como engranajes, un motor DC y una placa de circuito que controla la rotación y la dirección.
  • 🔄 La señal de control, que puede ser PWM (modulación de ancho de pulso), determina la posición a la que debe rotar el motor servo.
  • 💡 La placa de circuito del motor servo lee el cambio de resistencia en el potenciómetro, que se conecta al engranaje final, para obtener información sobre la posición actual del motor.
  • 🛠️ El tutorial también incluye cómo programar un Arduino para controlar un motor servo utilizando un potenciómetro, proporcionando un ejemplo práctico de cómo se puede usar esta tecnología.

Q & A

  • ¿Qué es un motor servo y para qué se usa?

    -Un motor servo es un dispositivo que convierte energía eléctrica en energía mecánica y se utiliza en aplicaciones de ingeniería de precisión para control preciso. Se encuentra en robots, automatización e incluso en la dirección de autos de control remoto.

  • ¿Cómo se diferencia un motor servo de un motor DC estándar?

    -Mientras que un motor DC conectado a una fuente de alimentación gira constantemente, un motor servo no gira instantáneamente. En su lugar, recibe señales que le indican exactamente hasta dónde debe girar, típicamente hasta 180 grados, pero se pueden obtener valores más pequeños o más grandes.

  • ¿Qué es un bucle cerrado en un motor servo y cómo se relaciona con el control?

    -Un bucle cerrado es un tipo de motor servo que tiene un pin interno para detener físicamente la rotación del motor más allá de cierto punto, proporcionando así un control óptimo. Estos son más comunes que los motores de bucle abierto, que pueden rotar un total de 360 grados.

  • ¿Qué indica el valor de peso en un motor servo y cómo se mide?

    -El valor de peso en un motor servo no indica el peso del motor, sino la torque o la cantidad de fuerza que puede aplicar. Se mide en kilogramocentímetros o onza pulgadas y representa la fuerza que el servo puede aplicar a una palanca a diferentes distancias del eje.

  • ¿Cómo se relaciona la tensión de alimentación con el rendimiento del motor servo?

    -Cuanto mayor sea la tensión aplicada, mayor será la torque y, por lo tanto, el rendimiento del motor. Sin embargo, el motor tiene límites y se bloqueará si excede estos límites, lo que hace que la corriente disminuya drásticamente.

  • ¿Cómo se mide la velocidad de rotación de un motor servo?

    -La velocidad de rotación de un motor servo se mide en segundos tomados por 60 grados de rotación. Cuanto mayor sea la tensión aplicada, más rápido rotará el motor.

  • ¿Qué partes principales se encuentran dentro de un motor servo y cómo contribuyen al funcionamiento del mismo?

    -Dentro de un motor servo se encuentran engranajes apoyados por cojinetes, un circuito pequeño que controla la rotación y la dirección del motor DC, y un potenciómetro conectado a la rueda de salida del servo, que actúa como un resistor variable para proporcionar retroalimentación de posición.

  • ¿Cómo funciona la señal de control de un motor servo?

    -Un controlador envía una señal de modulación de ancho de pulso (PWM) al motor servo, que determina la posición a la que debe rotar. La anchura de la pulso varía y determina la posición del servo, moviendo el servo hacia la izquierda o la derecha según la anchura de la pulso.

  • ¿Cómo se puede controlar un motor servo utilizando un Arduino?

    -Se puede controlar un motor servo con un Arduino mediante un programa que envía señales de PWM al motor servo. También se puede utilizar un potenciómetro conectado al Arduino para controlar manualmente la posición del servo.

  • ¿Qué materiales se necesitan para crear un proyecto de Arduino que controle un motor servo con un potenciómetro?

    -Para este proyecto se necesita un Arduino, una placa de ensamblaje, un motor servo, un potenciómetro, algunos cables y una fuente de alimentación.

  • ¿Cómo se conecta un potenciómetro a un Arduino para controlar un motor servo?

    -Se conecta un cable del puerto de cinco voltios al lado izquierdo del potenciómetro, el lado derecho al rail de tierra, y el pin central al puerto A0 del Arduino. El potenciómetro actúa como un dispositivo de entrada analógica que envia una señal de voltaje al Arduino.

Outlines

00:00

🔧 Funcionamiento y control del motor servo

El primer párrafo introduce el motor servo, una pieza clave en la ingeniería de precisión que utiliza electrónica interna y engranajes mecánicos para un control preciso. Se menciona que se aprenderá a programar estos motores en el video, y se promueve un servicio de VPN de Private Internet Access. El motor servo convierte energía eléctrica en mecánica y se puede controlar su posición con un controlador, lo que lo hace ideal para aplicaciones en robótica, automatización y coches遥控. Los motores cerrados de circuito son los más comunes y ofrecen el mejor control. Se discuten los valores de peso en los motores servo, que representan el torque y la fuerza que pueden aplicar. Además, se explora el funcionamiento interno del motor, incluyendo su conexión a un suministro de voltaje y cómo esto afecta su rendimiento y consumo de energía.

05:02

🔄 Compuesto de engranajes y señal de control del motor servo

El segundo párrafo se enfoca en la arquitectura de los engranajes dentro del motor servo y cómo convierten una alta velocidad y baja torque en una baja velocidad y alta torque. Se describe el sistema de transmisión de engranajes compuesto y cómo esto se relaciona con el rendimiento del motor. También se explica cómo un circuito impreso dentro del motor controla la rotación y la dirección, junto con un potenciómetro que proporciona información de posición. Se discuten los mecanismos de señal de control, como la señal de modulación de ancho de pulso (PWM) que el controlador envía al motor para determinar su posición. Se ilustra cómo la anchura de los pulsos de voltaje en la señal PWM afecta la posición del motor y cómo se puede medir y ajustar esta señal con un osciloscopio o un probador de servo.

10:07

🛠 Programación de un Arduino para controlar un motor servo

El tercer párrafo detalla cómo programar un Arduino para controlar un motor servo utilizando un potenciómetro como dispositivo de entrada. Se proporciona una guía paso a paso para conectar los componentes necesarios, como el Arduino, el motor servo, el potenciómetro, un tablero de ensamblaje y un suministro de energía. Se describe el proceso de escritura y envío de código al Arduino, utilizando la biblioteca de Servo y declarando objetos para el control del servo y la lectura del potenciómetro. Se explica cómo el código convierte la señal analógica del potenciómetro en una posición de rotación deseada para el servo y cómo este último se ajusta en consecuencia. Finalmente, se invita a los espectadores a seguir aprendiendo sobre ingeniería y a suscribirse a las redes sociales y el sitio web del canal.

Mindmap

Keywords

💡servo motor

Un servomotor es un tipo de motor que convierte energía eléctrica en energía mecánica y es utilizado para el control preciso en aplicaciones de ingeniería de precisión. En el video, el servomotor es el tema central, ya que se discute cómo funciona y cómo programarlo. Se menciona que el servomotor utiliza electrónica interna y engranajes mecánicos para lograr un control preciso, y se conecta a diferentes accesorios para lograr esta precisión.

💡control preciso

El control preciso se refiere a la capacidad de un dispositivo, en este caso un servomotor, de ejecutar acciones de manera exacta y determinada. Es fundamental para las aplicaciones de ingeniería de precisión y se destaca en el video como una de las características principales del servomotor. Se ejemplifica cómo se controla la posición del servomotor mediante un controlador para aplicaciones en robótica, automatización e incluso en la dirección de autos de control remoto.

💡electrónica interna

La electrónica interna hace referencia a los componentes electrónicos que están dentro del servomotor y que son esenciales para su funcionamiento. En el video, se indica que la electrónica interna, junto con los engranajes mecánicos, permite el control preciso del servomotor. Es una parte integral del sistema de control del servomotor.

💡engranajes mecánicos

Los engranajes mecánicos son componentes que se utilizan para transmitir la energía y motion de un eje a otro, permitiendo el movimiento preciso del servomotor. En el video, se describe cómo los engranajes mecánicos, junto con la electrónica interna, trabajan en conjunto para lograr el control preciso del servomotor.

💡controlador

Un controlador es un dispositivo que se utiliza para gobernar la posición de un servomotor. En el video, se menciona que el control de la posición del servomotor se realiza mediante un controlador, que puede ser un Arduino o incluso un simple probador de servo. El controlador envía señales que indican al motor cuánto debe rotar.

💡DC motor

Un motor DC, o motor de corriente continua, es un tipo de motor que se conecta a una fuente de alimentación y gira constantemente. En el video, se contrasta con el servomotor al indicar que mientras un motor DC gira continuamente, un servomotor recibe señales que le dicen exactamente cuánto debe rotar.

💡bucle cerrado

Un bucle cerrado se refiere a un sistema que tiene un mecanismo para detener físicamente el movimiento del motor más allá de un punto determinado, proporcionando así un control óptimo. En el video, se describe cómo los servomotores de bucle cerrado son los que se utilizan comúnmente y son los que se enfocan en el tutorial.

💡torque

El torque es la fuerza de fricción que un motor puede aplicar a un eje. En el video, se menciona que en el lado del servomotor se encuentra un valor de peso que representa el torque del motor, es decir, cuanta fuerza puede aplicar. Se ejemplifica cómo este valor varía en diferentes servomotores y cómo se mide en kilogramocentímetros o onzainches.

💡potenciación

La potenciación es la relación entre la fuerza que puede aplicar un servomotor y la distancia a la que se aplica esta fuerza. En el video, se ilustra cómo la potenciación disminuye a medida que aumenta la distancia del eje, y se menciona que esta información se puede encontrar en el hoja de datos del servomotor.

💡Arduino

Arduino es una plataforma de prototipado de hardware y software de código abierto que se utiliza para desarrollar proyectos electrónicos. En el video, se menciona el uso de un Arduino como un posible controlador para enviar señales de posición al servomotor, permitiendo así controlar su posición.

💡potenciometro

Un potenciometro es un dispositivo que varía su resistencia al girar un eje, lo que permite medir la posición angular de un eje en relación con un voltaje de referencia. En el video, se describe cómo un potenciometro se puede usar para controlar manualmente la posición del servomotor y cómo se conecta a un Arduino para recibir señales de posición.

💡programación

La programación es el proceso de escribir código que le da instrucciones a un dispositivo, como un Arduino, para que controle otros dispositivos, como un servomotor. En el video, se muestra cómo programar un Arduino para controlar un servomotor utilizando un potenciometro, lo cual es un paso clave para el proyecto presentado.

Highlights

A servo motor is used in precision engineering applications and utilizes internal electronics and mechanical gears for precise control.

The video is sponsored by Private Internet Access, offering a VPN service with a special deal for viewers.

Servo motors convert electrical energy into mechanical energy and are used for precise control in robotics, automation, and remote control cars.

Unlike DC motors, servo motors receive signals that dictate the exact rotation distance instead of constant rotation.

Servo motors are either closed loop, with a pin to limit rotation, or open loop, allowing full 360-degree rotation.

Closed loop servo motors provide better control and are more commonly used.

The torque rating on a servo motor indicates the force it can apply, measured in kilogram centimeters or ounce inches.

The torque of a servo motor increases with higher voltage but is limited to prevent stalling and excessive current.

Servo motors consume more power when moving and less when holding position.

The rotation speed of a servo motor is measured in seconds per 60 degrees of rotation.

Larger servo motors have higher torque ratings due to the need for larger gears and electrical motors.

Inside a servo motor, there are gears, bearings, and a DC motor connected to a circuit board that controls rotation and direction.

A potentiometer connected to the output gear provides feedback on the position of the servo motor.

A controller sends pulse width modulation signals to determine the servo motor's position.

The width of the pulse in the signal determines the servo motor's position, with wider pulses moving it to the left and narrower pulses to the right.

An Arduino or servo tester can be used to control the servo motor's position.

The servo's circuit board converts the signal to voltage, which is then used to control the DC motor's rotation and direction.

The potentiometer acts as a voltage divider, providing feedback to the circuit board to ensure the servo motor is in the correct position.

The video will demonstrate programming an Arduino to control a servo motor using a potentiometer.

The tutorial includes a list of required components and a step-by-step guide to set up the circuit.

Arduino code is provided to demonstrate how to read values from the potentiometer and control the servo motor's position.

The video concludes with an invitation to follow the channel on social media and the website for more engineering lessons.

Transcripts

play00:00

This is a servo motor.

play00:02

It's used in precision engineering applications

play00:05

and it uses internal electronics

play00:07

as well as mechanical gears to achieve precise control.

play00:11

So we're going to learn how they work and also how to programme one.

play00:16

In this video, which is sponsored by Private Internet Access,

play00:19

you can get a three year subscription with four extra months for free

play00:24

for only $1.98 per month using the link in the video description.

play00:29

Their VPN service helps safeguard your online Privacy and can protect up to ten devices at a time

play00:36

to let you browse the web with increased anonymity.

play00:39

It works with all major streaming services

play00:41

and it runs on Windows, Mac, Android, iOS and even Linux.

play00:45

They offer a 30 day money back guarantee, so do check them out.

play00:50

I'll leave a link for you in the video description down below.

play00:55

A servo motor looks something like this.

play00:58

It converts electrical energy into mechanical energy.

play01:02

This type of motor is used for precise control

play01:05

and we can connect different attachments to achieve this.

play01:09

We control the position of a servomotor by using a controller.

play01:13

So we often find it used in robotics and automation

play01:17

and even for the steering of remote control cars.

play01:21

Usually when we connect a DC motor to a power supply, it just rotates constantly.

play01:27

But a servo motor is different.

play01:29

These will not instantly rotate.

play01:32

Instead, these are sent signals which tell the motor exactly how far to rotate.

play01:38

Typically the motor will rotate just 180 degrees,

play01:42

but we can get smaller or larger values.

play01:45

These are closed loop type.

play01:48

There's usually a pin inside to physically stop the motor rotating further.

play01:53

Some servo Motors will not have this

play01:55

and are able to rotate the fall of 360 degrees.

play02:00

These ones are known as open loop type.

play02:03

Closed loop provides the best control and these are more commonly used.

play02:07

So we will focus on this type in this video.

play02:10

On the side of the servo motor, we usually find a weight value.

play02:16

This is not the weight of the motor,

play02:18

it represents the torque of the motor or how much force it can apply.

play02:23

This small motor has a rating of 9 grams.

play02:27

This larger one has a rating of 25 kilograms.

play02:31

This is how much force the servo motor can apply to a lever.

play02:35

We normally find this measured in kilogram centimetres or ounce inches.

play02:40

What does this mean?

play02:42

Well, for example, this servo motor is rated for 25 kg.

play02:47

So at 1cm from the shaft it can support 25 kg.

play02:53

But at 2cm it can only support 12.5kg

play02:58

and at 3cm it can only support 6.25 kg

play03:03

we can find more information on the data sheet.

play03:06

In this example.

play03:07

We see it can be connected to a supply of between 4.8 and 7.2 volts.

play03:12

The higher the voltage applied,

play03:15

the higher the torque will be, so the stronger the motor will perform.

play03:20

But as we can see,

play03:21

the motor has limits and it will stall if it exceeds these limits.

play03:26

When the motor stalls, we can see the current dramatically increases.

play03:31

The operating current depends on the load applied as well as the voltage.

play03:37

The motor consumes more power when moving.

play03:40

It uses very little to hold its position.

play03:43

The higher the voltage applied, the faster the motor will rotate.

play03:47

We measure this rotation in seconds taken per 60 degrees of rotation.

play03:52

The physical size of the servo motor increases with the torque rating.

play03:58

That's because it needs larger gears and a larger electrical motor.

play04:01

To achieve this, let's look inside one

play04:04

to see the main parts and understand how it works.

play04:08

By the way, we have also covered stepper Motors and DC Motors.

play04:11

Previously do check them out links down below.

play04:17

When we look at a servo motor,

play04:19

we see the main housing with the electrical connections entering the side.

play04:24

In this case, the red wire is the positive voltage wire, the Brown wire is the ground

play04:29

and the Orange wire is the pulse width modulation signal wire.

play04:34

These colours do vary by manufacturer.

play04:36

On the top we find a small splined gear.

play04:40

We can connect various attachments to this to make use of the rotation.

play04:44

Inside the unit we first find a number of gears

play04:48

and these are supported by some bearings.

play04:51

On one side we have the output and on the other side we have the input.

play04:56

The input is connected to a DC motor which will drive the gears.

play05:01

This setup is known as a compound gear train.

play05:05

The gears are arranged in this way to ensure a compact design.

play05:09

The motor has a high rotational speed but a low torque,

play05:13

so the gears help convert this into a low speed but high torque output.

play05:18

In this example, there is an eleven tooth pinion gear on the motor.

play05:23

This connects to a 61 tooth gear which is directly joined to a twelve tooth gear.

play05:29

This connects to a 48 tooth gear which is directly connected to a 13 tooth gear.

play05:35

This connects to a 47 tooth gear which is joined to a 13 tooth gear

play05:40

and this connects to the final gear which has 42 teeth.

play05:44

So for this example,

play05:46

using some arbitrary numbers, if the input was 259 rpm with 1 Nm of torque,

play05:55

then the output would be 1 rpm but 259 Nm of torque.

play06:01

Therefore, we have converted high speed low torque into low speed high torque.

play06:07

There are losses which I've purposely ignored for this example.

play06:11

We have covered how to calculate this in our previous video on gear trains.

play06:16

Do check that out links down below.

play06:18

The DC motor is connected to a small circuit board inside the unit.

play06:23

This controls the rotation of the motor as well as the direction of rotation.

play06:28

Also connected to the circuit board is a potentiometer.

play06:32

This connects to the output gear of the servo.

play06:36

This is just a variable resistor.

play06:38

As the final gear rotates, it rotates the potentiometer

play06:42

which changes the resistance and the circuit board reads this to know the position of the output.

play06:48

Let's see how this works.

play06:50

But first, where have you seen these Motors use or what would you use them for?

play06:54

Let me know in the comments section down below.

play06:59

A controller sends a signal to the servo motor

play07:03

which determines which position it should rotate to.

play07:07

The controller could be something like an Arduino or even a simple servo tester.

play07:13

This is a pulse width modulation signal,

play07:15

which means it sends pulses of voltage down the wire.

play07:19

The width of the pulse can be varied.

play07:22

It's similar to if we pressed a switch to turn the light on and off.

play07:26

The longer we press the switch, the longer the pulse of electricity.

play07:31

These pulses are sent every 20 milliseconds,

play07:35

so we have around 50 pulses per second or 50 Hz.

play07:39

We can use an oscilloscope to see these pulses.

play07:43

For example, this is the signal sent by an Arduino.

play07:46

And this is the signal sent from the servo tester.

play07:51

The width of the pulse determines the position of the servo.

play07:55

If we send a wide pulse, the servo moves to the left.

play08:00

If we send a small pulse, it rotates to the right.

play08:04

We can move to any position between these two points

play08:08

by simply changing the width of the pulse.

play08:11

As long as the pulse remains the same, the motor will hold its position.

play08:16

As soon as there is a change, the servo motor moves.

play08:20

We can see here that when I rotate the dial on the servo tester,

play08:24

it's changing the width of the pulse

play08:26

and the servo Motor's position changes to align with this signal.

play08:31

As I increase the voltage for the power supply, the height of the pulse also changes,

play08:37

but the position of the motor remains the same.

play08:41

If we use an Arduino board,

play08:43

we can run a programme to control the position,

play08:46

or we can even use a potentiometer to control the position manually ourselves.

play08:52

We will learn how to build this later on in the video.

play08:55

The signal enters the Servo's circuit board and is converted to a voltage.

play09:00

It passes through a comparator and then to a motor driver.

play09:05

The motor driver controls the rotation of the DC motor.

play09:09

It uses an internal H bridge circuit to control the direction of rotation,

play09:14

either clockwise or counterclockwise to get to the required position.

play09:19

This rotation causes the gears to rotate,

play09:22

which causes the final gear and servo arm to also rotate.

play09:28

Connected to the final gear is the potentiometer.

play09:32

You might recognise a potentiometer to look more like this.

play09:36

They essentially work exactly the same.

play09:39

The resistance increases and decreases

play09:42

between a minimum and a maximum value as the arm is rotated.

play09:47

You can see here that the multimeter is

play09:49

measuring the resistance and when I turn the shaft, the resistance changes.

play09:53

This acts as a voltage divider.

play09:56

If we apply a voltage across the potentiometer, for example 5 volts,

play10:01

we can then measure the change in voltage due to the varying resistance.

play10:06

This change is proportional to its position.

play10:09

When the arm is turned fully to the left, the voltage is 5 volts.

play10:14

At the centre it is 2.5 volts

play10:17

and when turned fully to the right it is 0 volt.

play10:21

The potentiometer is also connected to the comparator in the internal circuit board

play10:27

and the voltage is monitored to provide feedback.

play10:31

We know that the resistance changes between a minimum and a maximum value

play10:36

as the potentiometer dial is turned,

play10:38

so the comparator is going to compare

play10:41

the voltage of the potentiometer to the voltage of the controller signal.

play10:46

If there is a difference,

play10:47

then the motor will turn until the difference is close to zero.

play10:52

Then the servo knows it is in the correct position,

play10:55

so it will wait there until there is another change.

play10:59

We will learn how to control a servo motor in just a moment,

play11:03

but I just want to remind you to check out our sponsor private internet access

play11:07

using the link below where our viewers can get a three year subscription

play11:11

with four extra months for free for just $1.98 per month.

play11:15

With this, you can enjoy safer internet access across ten devices.

play11:20

Click the link in the video description down below.

play11:25

We're going to learn how to programme an Arduino

play11:28

to control a servo using a potentiometer.

play11:32

For this project you'll need an Arduino, a breadboard, a servo motor,

play11:37

a potentiometer, some wires and a power supply.

play11:41

First, connect a wire from the five volt port

play11:44

to the positive rail of the breadboard.

play11:48

Then connect another wire from the ground Port to the ground rail.

play11:53

Now connect from the 5 volts rail to the left side of the potentiometer.

play11:59

Then connect the right side to the ground rail.

play12:03

Then connect the centre pin to Port A0.

play12:07

Next, connect from the five volt rail to the servo motor.

play12:12

Then connect the ground wire to the servo

play12:16

and finally connect the signal wire to Port 9 of the Arduino.

play12:21

The circuit should look something like this.

play12:24

So now we need to connect the Arduino to our PC so we can write the code.

play12:29

You can download my Arduino code for free links down below for that.

play12:34

The basic code is very easy.

play12:36

We just type this at the top.

play12:38

This tells the Arduino that we are using commands from the Pre-made Servo library.

play12:44

Then we need to create an object.

play12:47

Basically we declare the name of the servo so that we can tell it what to do.

play12:52

I will call this servo1.

play12:54

Then we tell the Arduino which of its pins is connected to the servo motor.

play12:59

In our case we have pin 9.

play13:02

So we type that.

play13:03

Now as we are using an external potentiometer as an input device

play13:07

to control the servo motor, we will need to declare this also.

play13:12

So we type this

play13:13

which just lets the Arduino know which Port it will receive a signal on.

play13:18

Then we type this line of code in.

play13:21

This just links the name Servo to the pin which we have also declared.

play13:26

Next we type this code in

play13:28

this is saying that we need to read the value from the analogue input

play13:32

of the potentiometer which is connected to Port A0

play13:37

the Arduino reads the voltage through this pin

play13:40

but it doesn't understand voltage because this is an analogue signal Port

play13:45

so it will generate a number between zero and 1023 depending on the voltage.

play13:52

When the potentiometer is all the way to the left

play13:56

it receives the full voltage so it is 1023.

play14:00

When it is turned all the way to the right

play14:03

it is at 0 volt so we read zero. The value changes as we turn the dial.

play14:09

The servo doesn't understand these numbers though

play14:12

it wants to know a rotational degree between zero and 180 degrees.

play14:18

So this is creating a map or conversion scale

play14:21

to say that if the signal is zero then the position is zero degrees.

play14:26

If the signal is 1023 then the position should be 180 degrees.

play14:32

The final line just sends the information to the servo

play14:35

it writes to the servo to let it know what to do.

play14:39

So then we send the code to the Arduino

play14:42

and shortly after we will be able to control the servo position with the potentiometer.

play14:47

Once you understand this you can make more advanced circuits.

play14:52

Check out one of the videos on screen now

play14:54

to continue learning about engineering

play14:56

and I'll catch you there for the next lesson

play14:59

don't forget to follow us on Facebook, Twitter, Instagram LinkedIn TikTok and TheEngineeringMindset.com.

Rate This

5.0 / 5 (0 votes)

Related Tags
Motor de ServoIngeniería PrecisiónControl PrecisoProgramaciónRobóticaAutomatizaciónArduinoPotenciometroElectronesIngeniería
Do you need a summary in English?