Two servos fight over one switch

One switch, one LED and two servos that disagree. The orange arm keeps turning the light on, the blue arm keeps turning it off, and every push of the round comes faster than the last.

  • 8 parts
  • 7 wiring steps
  • Arduino code
  • 5 V supply

Quick answer

The short version. Every pin is in the full wiring below.

What you need

  • Arduino Nano
  • SG90 micro servo, two of them
  • MTS-102 mini toggle switch, SPDT
  • 5 mm red LED
  • 220 ohm resistor, in series with the LED
  • 1000 uF 25 V electrolytic capacitor on the servo supply
  • 5 V 2 A USB power adapter
  • A small box with slots in the lid

How to wire it

  1. Adapter plus to the Nano's 5V pin, both servo red leads, the 220 ohm resistor and the plus of the 1000 uF capacitor.
  2. Adapter minus to the Nano GND, the left servo's brown lead and the capacitor's stripe.
  3. The toggle's middle lug and the right servo's brown lead to the Nano's other GND pin.
  4. Toggle lug A to D7.
  5. Toggle lug B to the LED cathode.
  6. Left servo orange lead to D10.
  7. Right servo orange lead to D1 (the TX pin).

Before you power it: All 5 V. The servos never push at the same time and each stops when the switch flips; even with both stalled the draw would be about 1.3 A from a 2 A supply. The sketch's own safety choices: one supply with a common ground, a 1000 uF capacitor and arms that stop at the switch.

A clear box holding two SG90 servos with a blue and an orange arm, a toggle switch, a red LED with a 220 ohm resistor, an Arduino Nano and a 1000 microfarad capacitor, fed by a 5 V 2 A adapter
The circuit as wired in the Short. Every wire end is a real pin; the netlist was checked before the video went out.

Parts list

  • Arduino Nano
  • SG90 micro servo, two of them (one turns the light off, one turns it on)
  • MTS-102 mini toggle switch, SPDT
  • 5 mm red LED
  • 220 ohm resistor, in series with the LED (about 14 mA)
  • 1000 uF 25 V electrolytic capacitor on the servo supply
  • 5 V 2 A USB power adapter
  • A small box with slots in the lid, two plastic arms and jumper wires

Wiring, step by step

  1. Adapter plus to the Nano's 5V pin, both servo red leads, the 220 ohm resistor and the plus of the 1000 uF capacitor. VIN needs 7 to 12 V, so it stays empty.
  2. Adapter minus to the Nano GND, the left servo's brown lead and the capacitor's stripe.
  3. The toggle's middle lug and the right servo's brown lead to the Nano's other GND pin.
  4. Toggle lug A to D7.
  5. Toggle lug B to the LED cathode. The LED anode goes through the 220 ohm resistor to 5 V.
  6. Left servo orange lead to D10.
  7. Right servo orange lead to D1 (the TX pin). Keep USB unplugged while the 5V pin is fed, and unplug this wire to upload the sketch.

How it works

  1. The toggle does two jobs. In one position it lights the LED straight through the 220 ohm resistor, with no code needed.
  2. In the other position it connects D7 to ground, and the LED is off.
  3. The Nano reads D7, knows whether the light is on and sends out the servo that hates that state: the left arm turns it off, the right arm turns it on.
  4. Each push gets faster: the sketch's step times shorten over eight pushes. An arm stops the moment the switch flips, so neither servo ever pushes against a stop.

The code: servo_fight.ino

The Arduino code for this circuit is in the Wirecora Discord, in the channel #arduino-code (owner’s choice, 14 October 2026: the code lives where you can ask about it). It is a plain .ino file you can download there.

From the Short's own checked drawing; it needs only the Servo library that comes with the Arduino software. It was checked by simulation, not run on a real box. The arm angles come from our drawing: tune L_HIT and R_HIT on your own box.

Get the code in #arduino-code

What the video simplifies

  • The box front is clear and the arms are coloured so you can tell them apart. The LED stands in front of the arms' path.
  • The speed-up over eight pushes is set in the sketch, and the slow first push is slowed on purpose.
  • The servo currents, lever travel and the force a mini toggle needs are typical values, not measured. The LED is drawn larger and the adapter and capacitor smaller than life. The sounds are real recordings.
  • This was checked by simulation and datasheets, not built.

You found this by searching. Here's the whole path.

  1. Read how it works
  2. See it work
  3. Build it
  4. Show it
Next: see it work

Thirty seconds of video shows the circuit doing its job.

Then build it

All 5 V. The servos never push at the same time and each stops when the switch flips; even with both stalled the draw would be about 1.3 A from a 2 A supply. The sketch's own safety choices: one supply with a common ground, a 1000 uF capacitor and arms that stop at the switch.

Then show it

Built it, or stuck halfway? Post a photo in the Wirecora Discord. Questions get an answer every day.