Let me preface my answer with a disclaimer: All of my experience PWM'ing motors is with speed control of cooling fans. Your application will certainly differ, at least a little bit.
The way I find the minimum duty cycle, I look for the minimum that will allow the motor to start spinning. With standard muffin fans, this is about 40%. Then I add a small margin just to be safe. I find this by applying 0% duty cycle and slowly ramping it up until the motor starts spinning.
This startup power is higher than the amount of power required to keep the motor spinning once it has already spun up. With fans, this is somewhere in the 20-30% range. In other words, if I wanted to spin a fan really slow, I would have to apply 40% to get it moving and then I could back down to 20-30%.
Normally, just to be safe, I do not go below the startup power. That way I can be sure that the motor is spinning, although it does limit the minimum speed that I can do.
There are problems with this, however. Many things can affect the startup power requirements. Temperature, motor loading, age, dust, different motor lots, etc. You have to take all this into account, and built in some power margin.
Alternatively, you have to monitor your motor through a tachometer or something similar. Then have some motor control software do the appropriate thing if the motor is spinning too fast or too slow. Good motor control software will automatically take into account the startup power and other things.
If you don't want to write motor control software then you have little choice but to empirically measure what the startup power requirement is for your system and then add some more for margin. And hope that you added enough.
So I solved the problem. I built an opto-isolator using an IRED and phototransistor and some black tubing. This effectively eliminates the EMI and gives me a clean square wave. Note that some applications may require a resistor on the base of Q1, but in this application the resistor is already present on the control board as shown in the previous schematic.
For the phototransistor I used some left-over GE L14GX536 parts in my bin.
Here's a schematic of the final product, in case it's helpful to someone:
Best Answer
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 – 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:
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.
A filtered version of the PWM to convert it into a (fairly) steady DC signal level.
Usually a separate direction digital signal. You might find a drive with a -10 to +10 control signal or -5 to +5.
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
Correct.
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:
Since the circuit is inverting you have several options to obtain the correct direction: