Subsection 13.1.5 Where the Servo’s Power Comes From
The servo runs on 4.8 to 6 V and draws about 250 mA while moving, and much more if it is stalled. Because of that current draw, the servo is powered from a separate supply and never from the Nucleo’s 3.3 V or 5 V pin. We use the same regulator board as we did for the motor (Figure 11.2.21): the servo’s power lead goes to the board’s 5 V pin, and the board and the Nucleo share a ground, because the pulse from PA7 is a voltage measured against the Nucleo’s 0 V and without a shared ground the servo has nothing to measure it against. Only the signal lead goes to the STM32C031C6, at PA7 (D11). Never connect the servo’s power lead to the board’s Vin pin: Vin carries the adapter’s raw, unregulated voltage, up to 12 V, far above the servo’s 6 V maximum.
The servo has three leads. The SG90 datasheet’s wiring drawing colors them brown for ground, red for power and orange for the signal, and those are the colors on the servo in your kit. In general, on a hobby servo the center lead is power, the darker of the two outer leads is ground, and the remaining lead is the signal.
