Main Content

Standard Servo Write

Set shaft position of standard servo motor to angle specified in degrees

  • Library:
  • Simulink Support Package for Raspberry Pi Hardware / Basic

  • Standard Servo Write block


Use the Standard Servo Write block to control the shaft angle of a servo motor attached to a pulse width modulation (PWM) output pin on the Raspberry Pi™ hardware board.

During simulations without the hardware, this block does nothing. See Block Produces Zeros or Does Nothing in Simulation.



expand all

The value sent to the block at the input port determines the speed and direction of rotation of the standard rotation servo motor interfaced with the Raspberry Pi hardware board. For example:

  • An input value of 0 positions the shaft at 0 degrees.

  • An input value of 180 positions the shaft at 180 degrees.

  • Any input value between the [0, 180] range, for example 50, positions the shaft at 50 degrees.

  • Any input value out of the [0, 180] range, for example -2 or 188, positions the shaft at 0 and 180, respectively.

Data Types: double


expand all

Select your Raspberry Pi hardware board. You can find this information on the target hardware, product packaging, or product documentation.

Select the Raspberry Pi hardware board pin number to which the standard rotation servo write motor input signal is connected. To open the pin map of the Raspberry Pi board, click View pin map.


Do not assign the same pin number to multiple blocks within a model.

Set the minimum pulse duration of the servo signal in seconds.

Set the maximum pulse duration of the servo signal in seconds.

Version History

Introduced in R2016b