This project builds a four-axis servo controller on Arduino Uno that accepts commands over serial to position high-torque metal gear servos. The guide covers wiring four MG90D servos to PWM pins, adding power conditioning with a capacitor, and integrating an LED status indicator. Builders will receive a complete wiring diagram, parts list with power specifications, and the full firmware source code.
The controller uses pulse-width modulation to command each servo independently across the 1200–1800 microsecond range, with serial commands to arm the system, center all axes, and move individual servos to target positions. Assembly involves securing bench mounts, routing control signals cleanly, and verifying servo travel before operation. This foundation supports adding external targeting logic or sensor feedback in future iterations.
Wiring diagram

Gather all the parts
Assemble it in 6 steps
1. Secure the bench mounts
Clamp two lightweight pan-and-tilt brackets to the bench. Use one pair of MG90D servos for a lightweight camera mock-up and the other pair for the LED. Leave horns off for initial centering. Support the camera and fiber cable separately; do not load these small servos with the unknown camera assembly.
- This is not flight hardware. Keep fingers away from moving linkages.
2. Wire the four control signals
With all power disconnected, connect camera pan SIGNAL to D3, camera tilt to D5, LED pan to D6, and LED tilt to D9. These wires carry aiming commands.
3. Connect separate motor power
Use the regulated 5 V 4 A adapter with an insulated USB-C power breakout cable. Connect its +5 V output to all four red servo VCC wires. Connect its ground to all four brown/black servo ground wires AND Uno GND. Use a screw-terminal distribution connection, not thin breadboard power tracks. The Uno gets its own power through computer USB. Never join adapter +5 V to Uno 5V, VIN, or USB power.
- Use an enclosed certified adapter; never open it or work on mains wiring. Disconnect servo power immediately if any motor buzzes, binds, or becomes hot.
4. Add the power reservoir
Connect the 1000 uF capacitor across the servo supply near the distribution point: plus to servo +5 V, striped negative lead to ground. Insulate exposed connections.
- Reversed electrolytic capacitor polarity can cause rupture.
5. Wire the symbolic pointer
Connect D7 through the 330 ohm resistor to the LED long leg (anode). Connect the LED short leg/flat side to ground. Attach the LED to its tilt bracket with flexible wires and enough slack for movement. This is an indicator, not a focused projector.
6. Fit centered horns and check travel
Support both mounts. After electrically centering the servos, disconnect motor power before fitting horns at the middle position. Move in small increments and check cable slack and mechanical clearance. Power can cause an initial centering jump. Removing control pulses does not physically restrain a mount; support it before stopping.
Review all connections
1. Connections between "camera_pan" and "Arduino"
2. Connections between "camera_tilt" and "Arduino"
3. Connections between "led_pan" and "Arduino"
4. Connections between "led_tilt" and "Arduino"
5. Connections between "servo_supply" and "Arduino"
6. Connections between "reservoir" and "Arduino"
7. Connections between "led_resistor" and "Arduino"
8. Connections between "pointer" and "Arduino"
Deploy the firmware
#include <Arduino.h>
#include <Servo.h>
#include <string.h>
Servo axes[4];
const uint8_t pins[4]={3,5,6,9};
int position[4]={1500,1500,1500,1500};
int target[4]={1500,1500,1500,1500};
bool armed=false;
char line[48];
uint8_t used=0;
bool overflow=false;
unsigned long lastStep=0;
void stopMotion(){
for(uint8_t i=0;i<4;i++) { axes[i].detach(); target[i]=position[i]; }
digitalWrite(7,LOW); armed=false;
}
void command(){
if(!strcmp(line,"ARM")){
for(uint8_t i=0;i<4;i++){axes[i].writeMicroseconds(position[i]);axes[i].attach(pins[i],1200,1800);}
armed=true; Serial.println(F("OK armed")); return;
}
if(!strcmp(line,"STOP")){stopMotion();Serial.println(F("OK stopped; mounts may go limp"));return;}
if(!strcmp(line,"CENTER")){
for(uint8_t i=0;i<4;i++)target[i]=1500;
Serial.println(F("OK center requested"));return;
}
if(!strcmp(line,"LED 0")){digitalWrite(7,LOW);Serial.println(F("OK"));return;}
if(!strcmp(line,"LED 1") && armed){digitalWrite(7,HIGH);Serial.println(F("OK"));return;}
int axis=0,pulse=0; char extra;
if(sscanf(line,"SET %d %d %c",&axis,&pulse,&extra)==2 && axis>=0 && axis<4 && pulse>=1200 && pulse<=1800 && armed){
target[axis]=pulse;Serial.println(F("OK"));return;
}
Serial.println(F("ERR: ARM | STOP | CENTER | LED 0/1 | SET axis(0..3) us(1200..1800)"));
}
void setup(){
pinMode(7,OUTPUT);digitalWrite(7,LOW);
Serial.begin(115200);
Serial.println(F("Bench controller ready, outputs disabled. ARM enables servos."));
}
void loop(){
while(Serial.available()){
char c=Serial.read();
if(c=='\r')continue;
if(c=='\n'){
line[used]=0;
if(overflow)Serial.println(F("ERR line too long"));else if(used)command();
used=0;overflow=false;
}else if(used<sizeof(line)-1)line[used++]=c;else overflow=true;
}
unsigned long now=millis();
if(armed && now-lastStep>=20){
lastStep=now;
for(uint8_t i=0;i<4;i++){
int difference=target[i]-position[i];
position[i]+=constrain(difference,-4,4);
axes[i].writeMicroseconds(position[i]);
}
}
}Remix this project
Make it yours in one click
Open a full copy of this project in your own Schematik workspace, diagram, code, parts, and assembly steps included. Swap the sensor, add features, or redesign the whole thing with AI. The author's original stays untouched.




