I added an SG90 micro servo to my RP2040 board and programmed a repeating sequence of positions. A servo uses a control signal to request a position and a separate power connection to move the motor. This makes the supply arrangement as important as the signal pin.
Our shared record reports a 5 V servo supply and currents of 10 mA at idle, 220 mA while moving and 550 mA for a stall/peak condition. With P = V × I, those correspond to 0.05 W, 1.10 W and 2.75 W. These are the group’s recorded values, rather than measurements from the individual demonstration below.
| Servo condition | Recorded current | Calculated power at 5 V |
|---|---|---|
| Idle | 10 mA | 0.05 W |
| Moving | 220 mA | 1.10 W |
| Stall/peak | 550 mA | 2.75 W |
Our measurement arrangement and comparison with an LCD are on our group assignment page. The changing servo load shows why we need to size a supply for movement and peaks as well as idle operation.
I connected the orange signal wire to D9, the red power wire to 5 V and the brown wire to GND. The servo and microcontroller need a common ground. The photographs record the wiring; the exact 5 V source used in this setup still needs to be identified before assigning it a verified power budget.
The sketch uses Servo.h and attaches the servo to D9 in setup(). The loop requests 0°, 90° and 180°, with a one-second hold at each position. These are commanded angles; they are not independent measurements of the shaft position. There is no sensor input or feedback-processing logic in this sketch.
#include <Servo.h>
Servo myservo;
void setup() {
myservo.attach(D9);
}
void loop() {
myservo.write(0);
delay(1000);
myservo.write(90);
delay(1000);
myservo.write(180);
delay(1000);
}
The video shows the servo moving through the programmed sequence. It gives a visible way to check that the board sends a control signal and that the motor responds. I have not recorded angle error, torque or current for this individual run.
I learned to separate the control path from the power path. A GPIO requests motion, but it does not supply the motor’s operating current. For a later mechanism, I would check the supply under the actual mechanical load and compare the requested positions with the movement required by the design.
I prepared a second source version with Codex assistance that keeps the 0°, 90° and 180° sequence and adds a serial log for each command. It uses elapsed time instead of blocking the whole loop with a one-second delay. The new version builds for the XIAO RP2040 using its bundled Servo library.
The log says what I requested; it does not measure the servo shaft. For the physical retest I will identify the 5 V supply and common ground, check that the required travel suits the actual servo/mechanism, and compare the requested positions with the movement. Supply current belongs to the particular idle or moving condition being measured. I will not copy the group's current values into this individual result.