Robotics/electronics

Microcontroller Servo Pointer

Turn a knob to position a low-voltage servo pointer and calibrate command values against measured angles.

A potentiometer creates a variable voltage, the microcontroller converts it into a number, and a servo closes its own internal position loop to point at a matching angle.

Difficulty
Beginner
Build time
45-70 min
Estimated cost
$0-$18
Age range
11-16
Workspace
A clear table about 90 cm wide

The finish line

What you will build

The pointer tracks five labeled knob positions from 20 to 160 degrees with average error below 8 degrees.

Learning goals

  • Identify how potentiometer shaft angle produces servo pointer angle.
  • Construct and explain a analog rotation-to-commanded angular position system.
  • Measure how number of analog samples averaged changes performance.
  • Diagnose losses caused by servo backlash and potentiometer noise.

Before you build

Materials, tools, and safety

Reuse-material cost: Usually under $5 with an existing kit. Supervision: Adult guidance recommended for wiring and cutting.

Tools

  • Small screwdriver
  • Wire stripper
  • Multimeter
  • Low-temperature glue gun or tape

Low-cost swaps

  • Use alligator-clip leads for a no-solder version.
  • Build and test the mechanism manually before adding electronics.
  • Use two pushbuttons to step the pointer if a potentiometer is unavailable.

Wiring table

FromToPurpose
Potentiometer ends5 V and GNDCreate reference voltage range
Potentiometer wiperAnalog A0Measure knob position
Servo signalPWM pin 9Send position pulse
Servo powerRegulated 5 V and GNDSupply servo current
Controller GNDServo supply GNDCreate common signal reference

Project-specific safety

  • Use only the listed low-voltage battery supply; never use mains electricity.
  • Disconnect power before changing wires and stop if a motor, wire, or battery becomes warm.
  • Use only 5 V, connect common ground, keep fingers clear of the servo horn, and set software angle limits before attaching the pointer.

Orient the build

Place the build so potentiometer shaft angle is on your left and servo pointer angle is on your right. Call the side facing you the front, the far side the back, the tabletop the bottom, and the opposite face the top.

Build it

Step-by-step instructions

  1. Step 1

    Build the dial

    Mount the potentiometer through a card panel and add five knob marks.

    Prevent the body from rotating.

  2. Step 2

    Mount the servo

    Fix the servo behind a protractor with its shaft centered at the origin.

    Leave horn access.

  3. Step 3

    Wire the input

    Connect potentiometer ends to 5 V and ground and the wiper to A0.

    Check resistance with power off.

    Builder checkpoint: After wire the input, the first subassembly should stay aligned when handled gently.

  4. Step 4

    Wire servo power

    Use regulated 5 V for the servo and join grounds with the controller.

    Connect signal to pin 9.

    Watch for: If this stage binds or drifts, inspect mount movement before adding more parts.

  5. Step 5

    Upload safe mapping

    Map analog values to 20-160 degrees and add a short delay.

    Test without the pointer.

  6. Step 6

    Attach at center

    Set the knob and servo to midpoint, then attach the pointer at 90 degrees.

    Tighten without bending the horn.

    Builder checkpoint: After attach at center, operate the build slowly and confirm that servo pointer angle begins without binding.

  7. Step 7

    Calibrate five marks

    Record measured angle at five knob positions.

    Note backlash when approaching from each direction.

  8. Step 8

    Reduce error

    Average several readings or adjust endpoint values.

    Repeat the five-point test.

    Builder checkpoint: At the final checkpoint, The pointer tracks five labeled knob positions from 20 to 160 degrees with average error below 8 degrees.

See the engineering

Why it works

Input
potentiometer shaft angle
Output
servo pointer angle
Motion
analog rotation-to-commanded angular position
Energy losses
servo backlash, potentiometer noise, pointer flex, mount movement
Microcontroller Servo Pointer concept diagram with labeled input, output, and motion arrows.
The analog rotation-to-commanded angular position motion path, with the main efficiency losses called out.

Why this works

Input mapping

The analog-to-digital converter measures knob voltage from 0 to its maximum count. Code maps that range to safe servo angles, and the servo's internal controller holds the requested position.

Look for: Move the knob slowly through five marks and compare commanded angle with a paper protractor.

Where the energy goes

Efficiency and losses

The ideal model leaves out servo backlash, potentiometer noise, pointer flex, mount movement. These effects turn some input energy into heat, sound, vibration, or unwanted motion, so measured performance will be lower than an ideal calculation.

Look for: Run the build slowly and locate the first place where servo backlash becomes visible or audible.

Math bite

Map an analog value

Formula: angle = 20° + reading / 1023 × 140°

  • Reading = 512
  • Output span = 140°

Substitute: angle = 20 + 512 / 1023 × 140 ≈ 90°

Result: A midpoint reading commands about 90 degrees.

Endpoint limits protect the mechanism.

ADC noise and servo calibration change real angle.

servo_pointer.ino

A complete filtered analog-to-servo mapping with conservative endpoints.

#include <Servo.h>
Servo pointerServo;
void setup(){ pointerServo.attach(9); pointerServo.write(90); delay(500); }
void loop(){
  long total=0;
  for(int i=0;i<8;i++){ total += analogRead(A0); delay(2); }
  int reading=total/8;
  int angle=map(reading,0,1023,20,160);
  pointerServo.write(constrain(angle,20,160));
  delay(15);
}
Brick-building meme reading: Chuck Norris does not build LEGO; he roundhouses the bricks into sculptures.
The pointer reached 90 degrees and requested that everyone stop touching the knob.Image supplied by the site owner.

Make it behave

Test, troubleshoot, and tune

Controlled test

Start here: Move the servo with no pointer through 20, 90, and 160 degrees.

Success looks like: Five output positions have average absolute error below 8 degrees.

Measure: Commanded angle, measured angle, error, jitter, and direction of approach.

Change: number of analog samples averaged

Keep constant: servo, supply, pointer, protractor, endpoints, and knob marks

  1. one sample
  2. five-sample average
  3. ten-sample average
Troubleshooting guide
SymptomLikely causeConfirm itFix
The servo jittersInput voltage is noisy or ground missingHold knob still and log valuesJoin grounds and average samples
Angles are reversedPotentiometer ends are swappedTurn clockwise and watch readingSwap the two end connections
Pointer hits the frameLimits are too wide or horn misalignedTest with pointer removedReduce endpoints and recenter horn
Controller resetsServo supply sagsWatch power indicator during movementUse rated separate 5 V servo supply with common ground

Choose your tradeoff

Use measured safe endpoints and attach the pointer only after centering. More averaging reduces jitter but adds response delay.

Keep experimenting

Try another version

Easier

Three presets

Use buttons for 30, 90, and 150 degrees.

Performance

Calibration curve

Correct systematic error at five points.

Advanced

Rate limit

Move toward target gradually to control pointer speed.

Build together

Classroom and access options

Classroom version

Teams can compare number of analog samples averaged while keeping servo, supply, pointer, protractor, endpoints, and knob marks. Assign builder, tester, recorder, and explainer roles; have each team predict the result before collecting three trials.

Access adaptations

  • Color-code and label every wire at both ends.
  • Use clip leads, larger controls, and pre-crimped connectors when fine motor work is difficult.
  • Use a large knob, tactile position marks, and an optional five-button preset control.

Reflect on the design

  1. How did number of analog samples averaged change the measured result?
  2. Where did servo backlash affect the build most strongly?
  3. What evidence shows that input mapping explains the motion?
  4. Which change would improve servo pointer angle without creating a new problem?
Glossary
Input mapping
The analog-to-digital converter measures knob voltage from 0 to its maximum count.
Input
The action or energy supplied to a system; here it is potentiometer shaft angle.
Output
The useful response produced by a system; here it is servo pointer angle.
Efficiency
The fraction of input energy that becomes useful output instead of friction, sound, heat, or unwanted motion.

Build your dreams

One build can start the next.

Share what you learned, change one variable, and help another builder understand what worked.

Explore more guides

Sources and build notes

A platform-agnostic low-voltage robotics or electronics project with original assembly guidance.

  • Low-voltage design review: Battery voltage, polarity, component roles, current paths, and motor or LED protection were editorially checked.

Written and edited by BrickLabClips. Published 2026-07-22; updated 2026-07-22.

Next builds

Related guides