Main Content

RC Servo

Radio control servomotor with PWM-based angular position tracking and fault modeling

  • RC Servo block

Libraries:
Simscape / Electrical / Electromechanical / Brushed Motors

Description

The RC Servo block represents a small DC motor with a gearbox and control circuitry, commonly used in quadcopters, radio-controlled planes and helicopters, and other mechatronic devices. RC servos provide angular position control of the output shaft over a limited angle range. The angle demand is set by the pulse width of a PWM signal applied to port s.

The RC Servo block models the following effects:

  • Torque-speed behavior based on DC motor equations

  • Position tracking based on the input PWM signal pulse width

  • Internal gear reduction ratio, including associated friction losses

  • Mechanical end stops, to prevent the output shaft being driven out of range by the load

  • Position measurement error

  • Fault modeling

The motor equations are the same as those used by the DC Motor block, except that the inductance is not modeled. The RC Servo block determines the equation parameters using the stall torque and no-load speeds, and makes a correction to take account of the backdrive torque.

Faults

To model a fault in the RC Servo block, in the Faults section, click the Add fault hyperlink next to the fault that you want to model. In the Add Fault window, specify the fault properties. For more information about fault modeling, see Fault Behavior Modeling and Fault Triggering.

The RC Servo block allows you to model several types of fault:

  • Fail off — No electrical torque.

  • Fail forward — Rotates in a positive direction to hit the upper end stop.

  • Fail reverse — Rotates in a negative direction to hit the lower end stop.

  • Failed winding — Torque is applied only if the motor rotor lines up with one of the two remaining functioning windings.

The block can trigger fault events:

  • At a specific time.

  • When a current limit is exceeded for longer than a specific time interval.

If you want to trigger a fault at a specific time, in the Fault Inspector window, set Trigger type to Timed. If you want to determine whether a system fails and, if so, when it fails, in the Fault Inspector window, set Trigger type to Behavioral.

Variables

To set the priority and initial target values for the block variables before simulation, use the Initial Targets section in the block dialog box or Property Inspector. For more information, see Set Priority and Initial Target for Block Variables.

Use nominal values to specify the expected magnitude of a variable in a model. Using system scaling based on nominal values increases the simulation robustness. Nominal values can come from different sources. One of these sources is the Nominal Values section in the block dialog box or Property Inspector. For more information, see System Scaling by Nominal Values.

Assumptions and Limitations

  • This block has no optional thermal port.

  • If you simulate the model with a fixed-step solver, for example, using a local solver, the step size must be small enough to get the required resolution of the input pulse width. For fast desktop simulation, use this block with variable step solvers.

Ports

Conserving

expand all

Electrical conserving port associated with the PWM control signal. The output shaft angle demand is set by the pulse width of the voltage applied to this port.

Electrical conserving port associated with the motor positive terminal.

Electrical conserving port associated with the motor negative terminal.

Mechanical rotational conserving port associated with the rotor.

Mechanical rotational conserving port associated with the stator (casing).

Parameters

expand all

Electrical Torque

Maximum load torque that the RC servo can move without stalling (stopping).

Time for the output shaft to turn 60 degrees when the motor is driving no load.

DC supply voltage used when measuring stall torque and time to travel 60 degrees.

Output shaft angular range of the RC servo.

Input pulse widths corresponding to the minimum and maximum output angles, as defined by the Rotational range parameter. Pulse widths outside of this range are clipped by the block to stay within this range.

Control

Threshold voltage for pulse control. The input pulse is detected as high when the voltage between the s and - ports is above this level.

Electrical impedance measured between the s and - ports.

Minimum error allowed between the demanded and measured output shaft angle. When the error between the demanded output shaft angle and measured output shaft angle drops below the angle resolution, the motor is powered off. This parameter models the hysteresis usually incorporated into an RC servo controller to prevent chatter around a set point.

Model error in angle measurement. This parameter allows you to model an angle measurement error, such as can happen due to a failing potentiometer angle sensor. For example, if you want to model the motor being powered against one of the hard stops, you can set a suitable angle measurement error to achieve this.

Mechanical

Load torque required to backdrive the motor when it is unpowered. The block uses this value to determine the gear friction parameters.

Reduction ratio from the DC motor shaft to the RC servo output shaft. This parameter affects only the impact of rotor inertia on equivalent inertia value at the output shaft. It has no impact on no-load speed. Therefore, the value does not have to be precise.

Inertia of the DC motor, plus inertia of the gearing reflected to the rotor (typically small if the gears are plastic).

Mechanical end stops prevent rotation of the output shaft beyond the specified range. The range specified by the end stop angles must be larger than that specified by the Rotational range parameter.

Stiffness of mechanical end stops.

Damping of mechanical end stops.

Faults

Option to add a fault to the RC servo.

To add a fault, click the Add fault hyperlink.

Type of fault to model:

  • Fail off — No electrical torque.

  • Fail forward — Rotates in a positive direction to hit the upper end stop.

  • Fail reverse — Rotates in a negative direction to hit the lower end stop.

  • Failed winding — Torque is applied only if the motor rotor lines up with one of the two remaining functioning windings.

Dependencies

To enable this parameter, add a fault to the RC Servo block by clicking the Add fault hyperlink in the Servo fault parameter.

After you create the fault, you can change the properties in the Fault Inspector window. When you open a block that has a fault, the Open Fault Inspector hyperlink appears instead of the Add fault hyperlink. For an example that shows how to include faults, see Analyze a DC Armature Winding Fault.

Simulation time at which the block enters the faulted state.

Dependencies

To enable this parameter, in the Fault Inspector window, set Trigger Type to Timed.

This parameter appears in the Trigger section of the Fault Inspector window. For more information, see Set Fault Triggers.

Current threshold to a fault transition. If the current exceeds this value for longer than the Time to fail when exceeding maximum permissible current parameter value, then the block enters the faulted state.

Dependencies

To enable this parameter, in the Fault Inspector window, set Trigger Type to Behavioral.

This parameter appears in the Trigger section of the Fault Inspector window. For more information, see Set Fault Triggers.

Maximum length of time that the current can exceed the maximum permissible value without triggering the fault.

Dependencies

To enable this parameter, in the Fault Inspector window, set Trigger Type to Behavioral.

This parameter appears in the Trigger section of the Fault Inspector window. For more information, see Set Fault Triggers.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2017b

expand all