Loading...

Thursday, March 04, 2021

Control Servomotor Using Potentiometer & Arduino Uno

control servomotor using potentiometer
Hello Friends welcome back to “Diyprojectslab”, In this Video I’ll show you how to “Control Servomotor Using Potentiometer & Arduino.” In robotics servomotor is essential there are many applications of a servomotor in robotics. So in this tutorial, we how to connect a servomotor to Arduino & control it using a potentiometer. How it works ? Basically when a potentiometer increases gradually Arduino read its value & send output to servomotor & servomotor rotates gradually like potentiometer. So without wasting any time let’s get started……

MATERIAL REQUIRED

To Make this project we need some components, I provide Best Buy Link of products :-
  1. Arduino Uno X 1
  2. Servomotor (SG90) X 1
  3. Potentiometer (10K) X 1
  4. Breadboard X 1
  5. Jumper wires X 1

CIRCUIT DIAGRAM

control servomotor using potentiometer
Follow the circuit diagram for making connection.
Arduino To Servomotor Connection :-
5V – VCC
GND – GND
D11 – PWM
Arduino TO Potentiometer :-
5V – 1st Pin
A0 – 2nd Pin
GND – GND

ARDUINO CODE

Copy following code & Upload to arduino.
// Hello friends welcome to "TECHNO-E-SOLUTION"
// Here is a code for control servomotor using Potentiometer


#include <Servo.h>

Servo myservo;

int potpin = 0;  // analog pin used to connect the potentiometer
int val;    // variable to read the value from the analog pin

void setup() {
  myservo.attach(11);  // attaches the servo on pin 9 to the servo object
}

void loop() {
  val = analogRead(potpin);            
  val = map(val, 0, 1023, 0, 180);     
  myservo.write(val);                  
  delay(15);                           
}

DEMONSTRATION

If you Like This project Follow Us On :- 
YOUTUBE | INSTAGRAM | FACEBOOK | INSTRUCTABLES | DAILYMOTION | HACKSTER

Leave a Reply

Your email address will not be published. Required fields are marked *