Controlling Servo with a Potentiometer.

In this experiment, we will learn to Control servo using Potentiometer.

Components Used: 

  • 1 x Arduino Uno ( You can use other boards also )
  • 5 x Jumper Wires M-M
  • 1 x Ultrasonic Sensor
  • 1 x Breadboard
  • 1 x Servo Motor
  • 1 x 10k ohm potentiometer


  • The principle of ultrasonic distance measurement is the same as that of RADAR.
  • The Ultrasonic module has two Transducers, one for  Transmit & the other for Receive. Both are fixed on a single PCB with the control circuit so that it can be easily used in your Robo projects. Ultrasonic distance sensor provides precise, non-contact distance measurements from about 2 cm to 400cm. Ultrasound is a high-frequency sound of frequency 40 KHz (we can’t hear this frequency, but animals can).



  1. Take Breadboard.
  2. Fix the potentiometer onto the breadboard as the nob facing towards your side.
  3. Connect the +5V of Arduino to the vertical side at any point using the jumper wire and GND to another vertical side on the breadboard.
  4. Now take the servo motor and it has 3 wires normally red, brown and yellow.
  5. Now connect the Brown wire on the GND vertical line and Red to the +5V vertical line on the breadboard.
  6. Now connect the yellow wire to the digital pin 9 in the Arduino.
  7. Now for potentiometer connect the  right side pin to the +5v on the vertical side and the left pin on the GND side on the breadboard.
  8. Now connect the middle pin of the potentiometer to the analog pin (A0) in Arduino.
  9. Thus the connection is ready.
  10. Connect Arduino to your Laptop/PC by USB Cable. ( we use A to B USB cable for Arduino which is also used in printers )
  11. Open Arduino IDE ( You can download it from here or you can use online platform Arduino Web editor )
  12. Type the code Below given.
  13. Check program and then upload it.

Previous article Check Distance in Serial Monitor
Next article Change LED colour with Button