Back to all tutorials

Motion tutorial

RC Servo Control

Set an RC servo angle with a PWM output from a Velocio PLC.

Tutorial overview

RC Servo Control

Set an RC servo angle with a PWM output from a Velocio PLC.

PWM motion

Set an RC servo angle with pulse width modulation.

RC servos are commonly limited to about 180 degrees and use ground, power, and control wires. The PWM signal on the control wire determines the requested angle. Most servos use a 20,000-microsecond period, equivalent to 50 Hz.

Read the PWM reference
PWM period and on-time diagram
PWM period and on-time determine the commanded servo position.

Velocio PLC outputs are sinking, so conventional high-voltage ON-time values must be inverted. Typical PLC ON times are about 19,000 to 18,000 microseconds, with approximately 18,500 microseconds at center.

One servo can be controlled per digital output. All servos share the same period, while each can have an independent ON time. The sample state machine sets the 20,000-microsecond period in State 1, then scales an analog input and starts PWM in State 2.

Review state machines

Video walkthrough

Follow the tutorial.

Watch the steps, then use the downloadable files when available to inspect the finished project.

RC Servo Example

Project files

Download the example.

Use the original project files as a reference or starting point for your own application.

Keep building

Continue with another practical example.

Browse the full tutorial library or download vBuilder to put the example to work.