Build it step by step
0 of 8 doneWire the three pots
Outer legs to 5V and GND, middles to A0, A1, A2.
Wire the servo signals
Orange or yellow wires to D9, D10, D11.
Wire the servo power
Red to the external 5 V plus, brown to its minus and to Nano GND.
Upload the sketch
Servos move to the knob positions.
Turn each knob
The matching servo follows.
Press the button once
All servos go to centre, good for fitting horns.
Press it again
All servos sweep slowly.
Open the serial monitor at 9600
Pulse widths scroll.
How do you build a three-channel servo tester?
Three knobs set three servos so you can test and centre them before installing in a model. You need Arduino Nano, SG90 Micro Servo × 3, Potentiometer 10 kΩ × 3, Tactile push button 6 mm, 5 V 2 A USB adapter and Breadboard 830 Tie Points. It takes 8 steps and about 120 minutes.
- Level
- Beginner
- Time
- About 120 min
- Parts
- 6
Parts list
- Development BoardsBuyArduino Nano × 1
- Motors & ActuatorsBuySG90 Micro Servo × 3
- PassivesBuy
- SwitchesBuy
- PowerBuy
- PrototypingBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| Three potentiometers, outer legs | Nano 5V and GND | Each makes a 0 to 5 V divider |
| Pot middle legs | Nano A0, A1, A2 | One knob per servo |
| Servo signal wires | Nano D9, D10, D11 | Pulse outputs |
| Servo red wires | External 5 V supply plus | Do not power three servos from the Nano |
| Servo brown or black wires | External supply minus and Nano GND | Grounds must be joined |
| Mode button | Nano D2 to GND | Internal pull-up, cycles modes |
Code
Hobby servos are driven by a pulse repeated about 50 times a second. The pulse width sets the position: roughly 1000 microseconds is one end, 1500 is the centre and 2000 is the other end. Servo.writeMicroseconds sends exactly that, which is better for testing than writing an angle. Three servos can pull well over an ampere between them when they move or stall, far more than the Nano can supply, so the servo power comes from a separate 5 V supply with its ground joined to the Nano ground. The button cycles between knob control, centre-all, which is handy for setting servo horns straight, and an automatic sweep for checking smooth travel. The range of 1000 to 2000 microseconds is safe for most small servos. Some can go further, but pushing past the end stops makes them buzz and heat up. Always test a servo on the bench before fitting it into a model.
Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
#include <Servo.h>
Servo sv[3];
const uint8_t SERVO_PIN[3] = {9, 10, 11};
const uint8_t POT_PIN[3] = {A0, A1, A2};
const uint8_t BTN = 2;
// Modes: 0 knobs, 1 centre all, 2 sweep all
uint8_t mode = 0;
bool lastBtn = HIGH;
void setup() {
for (uint8_t i = 0; i < 3; i++) sv[i].attach(SERVO_PIN[i], 500, 2500);
pinMode(BTN, INPUT_PULLUP);
Serial.begin(9600);
}
void loop() {
bool b = digitalRead(BTN);
if (lastBtn == HIGH && b == LOW) { mode = (mode + 1) % 3; delay(30); }
lastBtn = b;
int us[3];
if (mode == 0) {
for (uint8_t i = 0; i < 3; i++) // knob maps to 1000 to 2000 us
us[i] = map(analogRead(POT_PIN[i]), 0, 1023, 1000, 2000);
} else if (mode == 1) {
for (uint8_t i = 0; i < 3; i++) us[i] = 1500; // standard centre pulse
} else {
float phase = (millis() % 4000) / 4000.0; // 4 second sweep
float tri = phase < 0.5 ? phase * 2 : (1 - phase) * 2;
for (uint8_t i = 0; i < 3; i++) us[i] = 1000 + tri * 1000;
}
for (uint8_t i = 0; i < 3; i++) sv[i].writeMicroseconds(us[i]);
static unsigned long t0 = 0;
if (millis() - t0 > 500) {
t0 = millis();
Serial.print("mode "); Serial.print(mode);
Serial.print(" us "); Serial.print(us[0]); Serial.print(' ');
Serial.print(us[1]); Serial.print(' '); Serial.println(us[2]);
}
delay(10);
}What the serial monitor should show
Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual Arduino Nano with its sensors at their default values. Your numbers will follow your real readings, but the format should match.
mode 0 us 1501 1499 1500 mode 0 us 1499 1500 1500 mode 0 us 1500 1500 1500 mode 0 us 1500 1501 1500 mode 0 us 1500 1500 1500 mode 0 us 1499 1501 1500
Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Knob fully left | Pulse near 1000 us |
| Knob in the middle | Pulse near 1500 us |
| Knob fully right | Pulse near 2000 us |
| Centre mode | All servos at the same centre position |
| Sweep mode | Servos move smoothly back and forth every four seconds |
If it does not work
Servos jitter or the Nano resets
Power the servos from the external supply, not the Nano.
Nothing moves
Join the grounds of the supply and the Nano.
Servo hits the end and buzzes
Narrow the range, for example 1100 to 1900 us.
One servo does not respond
Check its signal wire is on the right pin.
Servo drifts at centre
The centre of some servos is not exactly 1500 us, adjust a little.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the three-channel servo tester?
Arduino Nano, SG90 Micro Servo × 3, Potentiometer 10 kΩ × 3, Tactile push button 6 mm, 5 V 2 A USB adapter and Breadboard 830 Tie Points.
How long does the three-channel servo tester take to build?
About 120 minutes for a beginner maker, in 8 steps.
How do I know the three-channel servo tester works?
Knob fully left: Pulse near 1000 us. Knob in the middle: Pulse near 1500 us. Knob fully right: Pulse near 2000 us.
Servos jitter or the Nano resets: what should I check?
Power the servos from the external supply, not the Nano.
Nothing moves: what should I check?
Join the grounds of the supply and the Nano.
Servo hits the end and buzzes: what should I check?
Narrow the range, for example 1100 to 1900 us.
One servo does not respond: what should I check?
Check its signal wire is on the right pin.
