¡Hola compañeros de Hive!
Hoy les traigo un tutorial para que aprendan cómo programar el movimiento de un servomotor controlado por un potenciómetro utilizando una placa Arduino Uno. Este es un trabajo practico que a mis alumnos les encanta hacer , es bastante didáctico y divertido.
Circuito eléctrico:


¿Qué necesitamos?
Arduino Uno: Nuestra placa de microcontrolador favorita.

Servomotor: Un motor que puede girar a posiciones específicas.

Potenciómetro: Una resistencia variable en mi circuito use de 5k , tambien podria ser de 10k.

Cables de conexión: Para conectar todo.

Fuente de alimentación: Generalmente la del propio Arduino sirve(Aunque si exigimos que el servomotor haga mucha fuerza , vamos a necesitar una fuente externa SI o SI)

Video de como funciona el programa de mis alumnos:
Programación:
#include <Servo.h>
Servo servito;
int angulo;
int lectura;
void setup() {
servito.attach(9);
}
void loop() {
lectura=analogRead(A0);
angulo=map(lectura,0,1023,0,179);
servito.write(angulo);
delay(20);
}
Espero que puedan disfrutar experimentando con este proyecto. Las conexiones y la programación son bastante simples, así que estoy seguro de que lo lograrán sin problemas. Si tienen alguna pregunta o necesitan ayuda, no duden en dejarla en los comentarios.
Un abrazo compañeros!
Hello fellow Hive!
Today I bring you a tutorial so you can learn how to program the movement of a servomotor controlled by a potentiometer using an Arduino Uno board. This is a practical job that my students love to do, it is quite educational and fun.
Electrical circuit:


What do we need?
Arduino Uno: Our favorite microcontroller board.

Servomotor: A motor that can rotate to specific positions.

Potentiometer: A variable resistor in my example I used a 10k linear pot

Connection cables: To connect everything.

Power supply: Generally the Arduino itself works (Although if we require the servomotor to exert a lot of force, we will need an external source YES or YES)

Video of how my students' program works:
Programming:
#include <Servo.h>
Servo servito;
int angulo;
int lectura;
void setup() {
servito.attach(9);
}
void loop() {
lectura=analogRead(A0);
angulo=map(lectura,0,1023,0,179);
servito.write(angulo);
delay(20);
}
I hope you can enjoy experimenting with this project. The connections and programming are pretty simple, so I'm sure you'll get it done without a problem. If you have any questions or need help, don't hesitate to leave them in the comments.
A hug colleagues!
Congratulations @tecnotronics! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)
Your next target is to reach 30 posts.
You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word
STOP