Maker.io main logo

Servo Motor Positioning-calibration How to Tutorial

2026-10-26 | By Ron Cutts

Share

License: GNU Lesser General Public License Microcontrollers PWM Servo Arduino ESP32

We will learn how to position or calibrate a servo motor. This is often useful in robotics, where we need to center a servo motor at a certain position before mounting it.

We will display an analog value from the potentiometer and servo degrees on the OLED display.

Watch the video.

Learn more about Visuino: What is Visuino

What You Will Need

What You Will Need

What You Will Need photo 2

What You Will Need photo 3

What You Will Need photo 4

What You Will Need photo 5

What You Will Need photo 6

What You Will Need photo 7

The Circuit

  • Connect Servo motor "Orange" (signal) pin to Arduino Digital pin[7]

  • Connect Servo motor "Red" pin to Arduino positive pin[5V]

  • Connect Servo motor "Brown" pin to Arduino negative pin[GND]

  • Connect potentiometer pin [DTA] to arduino analog pin [A0]

  • Connect potentiometer pin [VCC] to arduino pin [5V]

  • Connect potentiometer pin [GND] to arduino pin [GND]

  • Connect OLED Display pin[VCC] to Arduino pin[5V]

  • Connect OLED Display pin[GND] to Arduino pin[GND]

  • Connect OLED Display pin[SDA] to Arduino pin[SDA]

  • Connect OLED Display pin[SCL] to Arduino pin[SCL]

The Circuit

Start Visuino, and Select the Arduino UNO Board Type

The Visuino: https://www.visuino.eu also needs to be installed. Download the free version or register for a Free Trial.

Start Visuino as shown in the first picture. Click on the "Tools" button on the Arduino component (Picture 1) in Visuino. When the dialog appears, select "Arduino UNO" as shown on Picture 2

Start Visuino, and Select the Arduino UNO Board Type

Start Visuino, and Select the Arduino UNO Board Type photo 2

In Visuino Add Components

  • Add "Multiply Analog By Value" component

  • Add "SSD1306/SH1106 OLED Display (I2C)" component

  • Add "Servo" component

In Visuino Add Components

In Visuino Add Components photo 2

In Visuino Add Components photo 3

In Visuino Set Components

  • Select "MultiplyByValue1" and in the properties set Value to 180

Double click on the "DisplayOLED1" and in the Elements Window:

  • drag "Draw Text" to the left side and in the properties window set size to 2 and text to SERVO

  • drag "Draw Text" to the left side and in the properties window set Y to 20 and text to Degree:

  • drag "Text Field" to the left side and in the properties window set size to 2 X to 40 and Y to 20

  • drag "Draw Text" to the left side and in the properties window set text to Value: and Y to 40

  • drag "Text Field" to the left side and in the properties window set size to 2 X to 40 and Y to 40

Close the Elements window

In Visuino Set Components

In Visuino Set Components photo 2

In Visuino Set Components photo 3

In Visuino Set Components photo 4

In Visuino Set Components photo 5

In Visuino Set Components photo 6

In Visuino Connect Components

  • Connect Arduino Analog pin 0 Out to MultiplyByValue1 pin In

  • Connect Arduino Analog pin 0 Out to Servo1 pin In

  • Connect Arduino Analog pin 0 Out to DisplayOLED1 > Text Field2 pin In

  • Connect MultiplyByValue1 pin Out to DisplayOLED1 > Text Field1 pin In

  • Connect Servo1 pin Out to Arduino digital pin 7

  • Connect DisplayOLED1 pin I2C Out to Arduino I2C In

In Visuino Connect Components

In Visuino Connect Components photo 2

Generate, Compile, and Upload the Arduino Code

In Visuino, at the bottom click on the "Build" Tab, make sure the correct port is selected, then click on the "Compile/Build and Upload" button.

Generate, Compile, and Upload the Arduino Code

Play

If you power the Arduino UNO module and slide a potentiometer, the servo motor will spin, and on the OLED display you will be able to see degrees and a potentiometer analog Value.

Congratulations! You have completed your project with Visuino. Also attached is the Visuino project that I created for this. You can download it and open it in Visuino: https://www.visuino.eu

Downloads

Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.