My aim is to control a DC servo motor through PWM. It has a motor controller attached to it that takes in some DC source and PWM for controlling the motors. I programmed/used a myRio (MCU) to produce PWM from one of its pins and connected it to the motor controller but it is not producing the expected results i.e only going in one direction. The MCU is programmed to produced a PWM at 10 kHz for duty cycles 0 to 50 % and then 50 % back down to 0 %. However, the motor does not change direction.

The MCU produces an output of 3.3 Vpeak for the PWM (checked on oscilloscope). The MCU digital pin output voltage can be programmed or changed.

In the datasheet of the motor controller (sabertooth 2X12) it states:

"In all cases, an analog voltage of 2.5 V corresponds to no movement. Signals above 2.5 V will command a forward motion and signals below 2.5 V will command a backwards motion."

So my college believes that a PWM voltage of 5 V is required based on those three lines of datasheet snippet I provided.

My main question is what does the datasheet snippet above mean? (Is it correct to assume a 5 Vpeak PWM signal is required)?

Datasheet full (see page 9): https://www.dimensionengineering.com/datasheets/Sabertooth2x12.pdf

  • 1
    \$\begingroup\$ Just below it says: "If switch 6 is in the UP position, the input signal range is from 0v to 5v, with a zero point of 2.5v. If switch 6 is in the DOWN position, 4x sensitivity mode is enabled. In this mode, the input signal range is from 1.875V to 3.125V, with a zero point of 2.5v." So yeah, your colleague seems to be correct (on one case). \$\endgroup\$
    – Max
    Commented Dec 3, 2021 at 13:05
  • 1
    \$\begingroup\$ As to why your motor doesn't change direction: Are you using the recomended low-pass filter for PWM mode? \$\endgroup\$
    – Max
    Commented Dec 3, 2021 at 13:11
  • 1
    \$\begingroup\$ It's an analogue input; not a PWM input. It clearly states that in the data sheet. \$\endgroup\$
    – Andy aka
    Commented Dec 3, 2021 at 13:13
  • \$\begingroup\$ @Max I can confirm my colleague did not use any RC filter. He misread the datasheet and thought the RC filter was not required. I will make sure it is used next time. \$\endgroup\$ Commented Dec 3, 2021 at 16:32
  • \$\begingroup\$ Your Ipk is only 50% more than Imax. A slow RC T will assist in preventing OCP \$\endgroup\$ Commented Dec 3, 2021 at 17:43

3 Answers 3


I've used Sabertooth and their sister SyRen controllers extensively. They are great quality devices, but they are NOT servo controllers. They are motor controllers, so they can change motor speed and direction, but they don't have feedback input and therefore cannot receive position commands.

The PWM signal is typically used in two ways:

  1. As low-current position control command for hobby servo controllers. In this case the width of a pulse defines target position and a servo moves motor to reach that position.

This has nothing to do with Sabertooth/SyRen controllers. They accept either analog or serial or R/C commands. You can convert your PWM signal into analog voltage (e.g. by using RC low-pass filter), which is cumbersome and imprecise, not to mention pointless. Or you can use mode 2 and send PWM signal at approximately 50-100 Hz frequency (not 10 kHz!).

In either case, your command will not control the position. It will only control motor speed and direction, even if you use R/C servo signal format. If you change the frequency of PWM in your MCU and configure the switches on Sabertooth accordingly you should be able to control the motor immediately.

  1. As high-current power to the motor. In this case the width of a pulse defines average current going through the motor and therefore direction and speed/torque. It is, indeed, typical for this signal to have 10-20 kHz frequency.

This kind of PWM is exactly what Sabertooth generates on its output. It does not require any PWM coming from MCU.

To answer you main question, the analog input is designed to receive stable (as in "not pulsed") DC voltage in a certain range. The simplest example would be a potentiometer between 5V and ground with wiper connected to analog input. Or, specifically in case of 2-channel Sabertooth controller, an analog joystick with its two axes connected to two analog inputs. This is exactly what Sabertooth is designed for, because it supports automatic mixing of these two channels into differential control of two wheels, also known as "tank" control.

Finally, analog signal is not the best way to control Sabertooth if you want to use it with MCU. Its main selling feature is support for a simple 1-byte serial protocol, as well as more advanced addressable protocol that allows connection of multiple controllers to a single UART port.

Having said that, you can build a servo driver using analog input. For this you need a sensor connected to the comparator circuit that generates analog command for controller. The comparator would compare sensor voltage (actual servo position) with analog signal from MCU (target position) and move motor to reduce the difference.

This is not a trivial task to design and tune up. And it would probably cost more than buying hobby servo of suitable size.

  • \$\begingroup\$ So if just put through a potentiometer to the pin that was previously taking in PWM and connect the motor correctly, can the speed and direction be controlled by increasing/decreasing motor's voltage +-2.5V , that will work without the need for RC filter? I'm not sure how to do the 1-byte serial protocol from MCU. Apart from reading the datasheets can you give advice regarding programming the MCU to do just that(1-byte serial protocol). \$\endgroup\$ Commented Dec 3, 2021 at 20:06
  • \$\begingroup\$ Yes, using potentiometers is one easy way to do it, no filter required. You can also use 5V BEC on the Sabertooth to supply power for potentiometer, so no external power supply either. It is shown in Figure 2.1 in the datasheet. Don't forget to configure Mode 1 on the DIP switch. \$\endgroup\$
    – Maple
    Commented Dec 3, 2021 at 20:20
  • \$\begingroup\$ To use Standard Simplified Serial protocol all you have to do is configure UART port to the same baud rate as set by DIP switches. Then you send a single byte 1..127 to control motor 1 (64 means stop) and 128..255 to control motor 2 (191 means stop). If it does not work right away try to reverse UART Tx polarity, as some controllers use inverted logic signals. \$\endgroup\$
    – Maple
    Commented Dec 3, 2021 at 21:14
  • \$\begingroup\$ Yeah that makes sense. This seems to be easier than using PWM which you pointed out was not a good idea. The Baudrate configuration part I understand okay. The MCU has two pins called 'UART.TX' and 'UART.RX'. From what I understand is that to spin/rotate motor 1 in one direction a value of 1-63 is written to UART.TX pin and to do the opposite direction write 65-127, and then change numbers for motor 2(i.e 128-255)? Is my thinking correct? \$\endgroup\$ Commented Dec 4, 2021 at 9:23
  • \$\begingroup\$ Yes, that is correct. You don't need to configure UART Rx or use that pin. The communication is one way. As for PWM, I said that using PWM output from MCU only to convert it into analog using RC filter is a bad idea. You can still use PWM with R/C frequency without filter, if you wish. But sending digital command over UART is more precise anyway, although it has lesser resolution than analog. \$\endgroup\$
    – Maple
    Commented Dec 4, 2021 at 10:35

From the data sheet, I presume you are using it in Mode 1
It says" the PWM output of a microcontroller (with an RC filter)" [my emphasis]. Without this filter you are not supplying an analogue input, rather a signal that is either 0V or 3.3V depending on the time, and this probably will not be interpreted correctly by the controller. The output of the MCU is 10kHz PWM, so you need a simple RC filter that will smooth this out. I leave it to you to calculate the values.
You also say that the MCU can only put out 3.3V. Can it even get to 3.3V which I presume is it's supply voltage? Your colleague is quite right, in order to achieve full control you need a 5V signal and a duty cycle of 0 to 100%. If you can provide this then at 50% duty cycle, after the RC filter you will have 2.5V and the motor will not move. As the duty cycle drops towards 0% (average < 2.5V), the motor should rotate backwards whilst as it increases towards 100% (average >2.5V) it should rotate forwards.
Further down the data sheet it discusses the switch settings. I've just noticed that switch 6 increases the sensitivity by a factor of 4, "In this mode, the input signal range is from 1.875V to 3.125V, with a zero point of 2.5v.". This may be of use to you, as your 3.3V PWM signal will be just enough to get to full forward rotation with 0.175 V to spare. Assuming that it can supply a 3.3V peak-to-peak signal then, in order to achieve a full range of speeds you would have to change the programming to output from 56.8% (= 1.875V average = full reverse speed) to 94.7% (= 3.125V average = full forward speed).
Also read the notes on the switch settings for mode 1. You will see that, amongst other useful data, the source impedance of the input signal should be <= 10k ohms. On pg 10 it discusses your very setup and suggests R=10k ohms and C= 0.1uF.

  • \$\begingroup\$ thanks makes sense. I think it is best to use the 4X sensitivity mode(switch 6) and then add that low pass RC filter. Is the purpose of the RC filter is to convert digital signal (PWM) to analogue, so it kind of acts like a DAC? \$\endgroup\$ Commented Dec 3, 2021 at 16:36
  • \$\begingroup\$ The RC filter is just a very simple 1st order low pass element. It removes all the high frequency components of the PWM signal. You can consider it as taking the average of the PWM signal. So, yes, it does convert the PWM to analogue, but it is not a DAC. A DAC takes digital information in the form of multi-bit data words and outputs a voltage equivalent to the magnitude of that word. The number of bits in the word depends on the design and purpose of the DAC. I suggest you Google DAC. \$\endgroup\$ Commented Dec 3, 2021 at 16:58
  • \$\begingroup\$ Further to my main answer, there are several other modes of operation which you should explore as an inquisitive student. For example sending serial data 8-bit control words. One bit selects the output channel (the controller has 2) and the other 7 (0 - 127) select the speed, from fully backward (0) to fully forward (127) \$\endgroup\$ Commented Dec 3, 2021 at 17:03

You must use switch 6 in the DOWN position = 4x sensitivity mode

1.875V to 3.125V, with a zero point of 2.5v. This is useful for building analog feedback loops using 2.5V = offset for null with a sensitivity of 625 mV full scale in each direction.

You should consider using the RC low pass filter for analog control with at least 30 dB attenuation.

Using PWM with fast rise times the skew from 3.3/2 average voltage at 50% duty cycle to 5V/2 at same will be minimal. e.g. ~10ns/50us risetime/half cycle @ 10kHz. Their input logic hysteresis and logic level thresholds are undefined so presumeably 5V/2 +/-25% for full temp range.

It is also important to note you cannot use an LDO which is unidirectional for current. It must be a push-pull regulator with low ESC bulk cap or a battery with ESR << motor coil DCR.

I suspect the latter problem is your issue.


I didn't read all the user manual, but using the internal BEC speed controller with a UART for digital speed control is the easiest speed control method. The internal 35kHz SMPS is ~1A current limited with servo volecity, is safe and will have the fastest response, unless you need more current with external power.

  • \$\begingroup\$ The low pass RC filter needs to have a cut off frequency of the PWM frequency right? So cut off at 10kHz and then -30dB/decade roll off rate is this what you mean? \$\endgroup\$ Commented Dec 3, 2021 at 16:34
  • \$\begingroup\$ No Cutoff 30dB before PWM so if 1st order, fo~ fsw/30 is what I suggested. Latency will be 1/T for 300 Hz cutoff. @ -20dB/dec . You can choose whatever works best for acoustic noise and response time slower or faster.. \$\endgroup\$ Commented Dec 3, 2021 at 17:29
  • \$\begingroup\$ If you do not control ramp rate and thus acceleration and thus current surge, consider dV/dt to match desired dI/dt on motor like 0.1 to 1 second. Where I presume Vin control RPM but dV/dt controls acceleration indirectly from current , Vavg-BEMF and RPM \$\endgroup\$ Commented Dec 3, 2021 at 17:32
  • \$\begingroup\$ Or you can use slow rise time and fast fall time for braking with dual reversed diodes +Rs in parallel with slow RC using high R , small C for low diode Vf ...otherwise Imax is up to 100x idle no load current at full RPM or 10x rated current of motor at full load +/- tolerances for Ron and motor Vmax/DCR \$\endgroup\$ Commented Dec 3, 2021 at 17:38
  • 1
    \$\begingroup\$ I would upvote your answer but I can't because I need at least 15 reputation. \$\endgroup\$ Commented Dec 4, 2021 at 10:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.