Home » Arduino Servomotor using Potentiometer

Arduino Servomotor using Potentiometer

by Online Tutorials Library

Arduino Servomotor using Potentiometer

The Potentiometer will be used to control the position of the servo motor. The connection will be similar to the last servo motor project, except the added Potentiometer.

Let’s start with the project with Arduino.

Hardware Required

The components required for the project are listed below:

  • 1 x Mini Servo motor
  • Arduino UNO R3 board (We can take any Arduino board).
  • Jump wires
  • 1 x 10K Ohm potentiometer

Mini Servo Motor: It is defined as a tiny motor that can approximately rotate up to 180 degrees. It works similar to the usual servo motor, but smaller in size.

Principle

The project allows us to control the shaft at angles between 0 and 180 degrees. We can also set the rotation of the shaft at different speeds.

Servo motor has three terminals signal, power, and ground.

The power pin of the servo motor is connected to the PWM pin of the Arduino board. Here, we have connected the power terminal to pin 9 of the Arduino UNO R3 board.

Structure of the project

The structure of the connection or project is shown below:

Arduino Servomotor using Potentiometer

Sketch

Consider the below code:

Steps to upload the code to the board

The steps are listed below:

  • Open the Arduino IDE.
  • Select the type of board from Tools -> Board -> Arduino UNO.
  • Select the port from Tools -> Port -> COM..
  • Upload the above sketch to the connection diagram.

We can also modify the code to modify the performance of the servo motor accordingly.

Connection

The steps to set up the connection are listed below:

  • Connect the signal terminal of the servo motor to the 5V pin of the Arduino board.
  • Connect the power terminal of the servo motor to pin 9 of the Arduino board. We can connect the power terminal of the motor to any digital PWM pin on the Arduino board.
  • Connect the ground terminal of the servo motor to the GND pin of the Arduino board.
  • One outer pin of the Potentiometer is connected to the ground (GND), and other external pin is connected to 5V of the Arduino board.
  • The middle terminal of the Potentiometer is connected to the analog input pin A0 of the board.

Connection Diagram

We will show the connection using the Simulator so that the connections become clearer and more precise.

We can make the same connection using the hardware devices.

Arduino Servomotor using Potentiometer

Output

The shaft will rotate at angles between 0 and 180 degrees and again in the reverse direction.

We can also modify the code by specifying it only in one direction from 0 to 180 degrees. Hence, we can make changes according to the requirements.


Next TopicArduino DC motor

You may also like