From PWM Output to Large Motor Control
Most VFDs (variable frequency drives) designed for industrial applications have a 0 - 10 V speed control input. Your MCU is unlikely to have a 0 - 10 V output but most are capable of 3.3 V or 5 V PWM. By low-pass filtering the PWM signal we can generate a DC voltage to feed to the drive. The maximum voltage we could feed to the drive would be 3.3 V or 5 V with the pulse width at 100%.







simulate this circuit &ndash; Schematic created using CircuitLab

Figure 1. Simple PWM filter. Set RC time constant to about 3 to 10 times the pulse width time.



Figure 2. PWM to analog conversion with RC filter. Red = desired speed. Blue = PWM. Green = actual output from filter. Source: Piano with RTOS.

Depending on the VFD this might be adequate if you are able to scale up the maximum frequency. For example:


Our application requires motor speed adjustable from 0 to 50 Hz.
Our PWM filtered signal is 5 V at 100% pulse width.
Set the VFD max motor frequency to 100 Hz.


Now at 5 V in the VFD will run at 50 Hz and all should be well. If this isn't acceptable, for some reason, you would need to amplify your filtered PWM analog signal by 2 (5 V) or 3 (3.3 V) to achieve full 0 - 10 V control.


  What would we normally need to supply to the VFD to drive the motor? 


A filtered version of the PWM to convert it into a (fairly) steady DC signal level.


  How would it know which direction the motor needs to travel in? 


Usually a separate direction digital signal. You might find a drive with a -10 to +10 control signal or -5 to +5.


  Does a PWM signal alone provide this information?


PWM can only go from 0% to 100% so unless the drive can be programmed to be at 0 Hz at 5 V in so that 0% = full speed reverse and 100% = full speed forward the answer is no.



PWM to bipolar


  I've come across many drives that use a -10 to 10 volt control signal. I take it this means &lt;0 is reverse direction and >0 is forward direction?


Correct.


  Let's say the MCU outputs both a PWM signal for speed and uses 1 pin to indicate direction (1=forward,0=reverse), how could this be converted to the -/+10v signal we need? 


It might be easier to re-scale the one output as discussed below.







simulate this circuit

Figure 3. 0 to 100% PWM to +10 to -10 analog. Note inversion.

The circuit of Figure 3 has an output given by

$$ V_{OUT} = - \frac {R_f}{R_i} V_{IN} + (1 + \frac {R_f}{R_i}) V_{REF} $$

where \$V_{REF}\$ is the reference voltage and \$V_{IN}\$ is the voltage after R1-C1. With the values shown in the schematic we have \$V_{REF}\$ = 2 V and \$\frac {R_f}{R_i}\$ = 4. Our formula simplifies out to

$$ V_{OUT} = - 4 V_{IN} + 5 V_{REF} = - 4 V_{IN} + 10 $$

Testing for 0%, 50% and 100% PWM we get:


0% -> \$V_{IN}\$ = 0 V   -> \$ V_{OUT}\$ = +10 V.
50% -> \$V_{IN}\$ = 2.5 V -> \$ V_{OUT}\$ =   0 V.
100% -> \$V_{IN}\$ = 5 V   -> \$ V_{OUT}\$ = -10 V.


Since the circuit is inverting you have several options to obtain the correct direction:


Add another inverting amplifier with a gain of -1.
Invert the PWM analog out in the MCU logic.
Invert the signal in the VFD, if it allows it.
Swap two phases on the motor three-phase connection.