Dual-Servo Feedback Control
DEGREE OBJECTIVE 3
Develop mechanical control systems by implementing transducers, actuators, feedback, vision and sensing systems, and other mechanical systems into robotic platforms.
How it meets the objective: A potentiometer transducer and debounced buttons drive two servo actuators in real time—sensor in, motion out —with every input feeding directly into mechanical motion.
Live control: the mode button selects the active servo, button presses step Servo 1 in 15° increments, and the potentiometer drives Servo 2 in real time.
A two-servo Arduino system driven by operator input: a mode button selects the active servo, a second button steps Servo 1 in 15° increments with automatic direction reversal at the limits, and a potentiometer positions Servo 2 in real time. Built in RBT205 with Arduino C++ and modeled in Tinkercad.
How it works
The loop runs non-blocking on millis() — no delay() calls in normal operation. A mode button toggles which servo is active. In Servo 1 mode, each debounced button press moves the servo 15°; the step direction flips automatically when the angle clamps at 0° or 180°. In Servo 2 mode, the potentiometer is read continuously and mapped to the servo range, so the horn tracks the knob directly. Serial output is rate-limited so the monitor stays readable while the pot moves.
Engineering highlights
Edge-detected, debounced inputs: presses register on the HIGH-to-LOW transition with a 40 ms debounce window, using internal pull-ups so the buttons need no external resistors.
Bounds-safe stepping: the next angle is computed in a signed int before clamping, so negative math can't wrap the angle variable, and direction reversal happens exactly at the limits.
Non-blocking design: all timing comparisons use millis() timestamps, keeping both the servos and the serial monitor responsive.