I'm working on a speed control circuit for a brushed dc motor (24v, 500rpm, 2A, 4kgcm).

The main components that I plan to use are PIC16f873, 4n25 optocoupler, IRFZ44N MOSFET, BY 500 - 800 diode(for free wheeling).

  • What is the criteria behind choosing the PWM frequency?
  • What are the effects of very high & very low PWM frequencies on the system?
  • What are the drawbacks and improvements to be made in the hardware provided here?



2 Answers 2


There are several issues effected by the PWM frequency when driving a motor:

  1. The pulses need to come fast enough so that the mechanical system of the motor averages them out. Usually a few 10s of Hz to a few 100 Hz is good enough for this. This is rarely the limiting factor.

  2. In some cases, it is important that whining can't be heard at the PWM frequency. Even if the mechanical system as a whole doesn't react to single pulses, individual windings of a coil can. A electric motor works on magnetic forces, with every loop of wire in a coil arranged to create these forces. That means every bit of wire in a winding has a sideways force on it proportional to current, at least part of the time. The wire in the windings can't move far, but it can still vibrate enough for the result to be audible. 1 kHz PWM frequency may be fine in all other respects, but if this is going into a end user device the whining at that frequency could be unacceptable. For this reason, PWM for end consumer motor control is often done at 25 kHz, being just a bit beyond what most people can hear.

  3. Average coil current. This can be a tricky issue. Individual coils of the motor will look mostly inductive to the driving circuit. You want the current through the coils to be mostly what you'd expect from the average applied by the PWM and not go up and down substantially each pulse.

    Each coil will have some finite resistance, which causes lost power proportional to the square of the current through it. The losses will be higher at the same average current when there is a large change in current over a pulse. Consider the extreme example of the coil reacting to the pulsed voltage almost instantly and you are driving it with a 50% square wave. The resistive dissipation will be 1/2 of driving the coil full on all the time, with the average current (therefore resulting motor torque) also being 1/2 of full on. However, if the coil were driven with a steady 1/2 current instead of pulses, the resistive dissipation would be 1/4 of full on but with the same 1/2 of full scale current and therefore torque.

    Another way to think about this is that you don't want significant AC current on top of the average DC level. The AC current does nothing to move the motor, only the average does that. The AC component therefore only causes resistive losses in the coils and other places.

  4. Switching losses. The ideal switch is either fully on or fully off, which means it never dissipates any power. Real switches don't switch instantaneously and therefore spend some finite time in a transition region where they dissipate substantial power. Part of the job of the drive electronics is to minimize this transition time. However, no matter what you do there will be some time per edge where the switch is not ideal. This time is usually fixed per edge, so its fraction of the total PWM period goes up with frequency. For example, if the switch spends a total of 1 µs in transition each pulse, then at 25 kHz PWM frequency, which is 40 µs period, the transition time is 1/40 of the total. That may be acceptable. However, if the switching frequency were increased to 100 kHz, which means 10 µs period, then the transition time would be 10%. That will likely cause problems.

As for your circuit, my biggest concern is how slowly Q1 will be driven. Opto-isolators are notoriously slow (relative to most other components like individual transistors), especially when turning off. You only have R2 (although I can read its value) pulling down on the FET gate to turn it off. That's going to be slow. That may be OK if you can tolerate a slow PWM frequency, considering all the other trade-offs I mentioned above.

You might consider putting a PIC on the motor side of the opto. You can communicate digitally with that PIC via a UART interface or something that doesn't have to run at the PWM frequency. That PIC then generates the appropriate PWM locally and drives Q1 hard on and off with extra circuitry for that purpose. That way the high speed signals and fast edges don't go across a opto isolator.

  • \$\begingroup\$ It may be worth emphasizing point #3. Torque will be proportional to average current, while resistive power dissipation in the motor will be proportional to the average of the current squared [not the square of the average current]. If a non-moving motor's DC resistance is one ohm and it has 1A flowing through it continuously, it will dissipate one watt. If the current were 2A half the time and 0A half the time, the torque would be about the same but the power dissipation would be two watts. That extra power will manifest itself as increased supply current. \$\endgroup\$
    – supercat
    Apr 30, 2013 at 15:19
  • \$\begingroup\$ @olin Lathrop , what if I replace opto coupler with a suitable transistor to drive mosfet in order to achieve the higher switching speed. \$\endgroup\$
    – raforanz
    Apr 30, 2013 at 16:42
  • 1
    \$\begingroup\$ @rafo: Then you don't have isolation anymore. If you don't actually need isolation, then what was the point of the opto in the first place? \$\endgroup\$ Apr 30, 2013 at 17:14
  • \$\begingroup\$ I just thought of an isolation since it is dealing with a motor. But you said it cannot handle high frequencies. \$\endgroup\$
    – raforanz
    May 2, 2013 at 4:52
  • \$\begingroup\$ It may be worth noting that in many cases there will be two good ranges of frequency where one can drive a motor--a high range where motor current is essentially continuous, and a low range where motor current swings all the way from its DC maximum to zero every cycle. At high frequencies, the flyback diode will waste energy proportional its voltage drop and the motor current. At low frequencies, the flyback diode will waste a fixed amount of energy per cycle. In some cases, replacing the flyback diode with a MOSFET may improve efficiency. \$\endgroup\$
    – supercat
    Apr 25, 2014 at 16:30

I would recommend opto-isolated gate driver like this: https://www.fairchildsemi.com/datasheets/FO/FOD3182.pdf I've used something like this in class D amplifier at ~200kHz switching frequency.

Also, to comment on winding resistance, the current in the motor will keep rolling thru the diode, and it will exponentially rise when switched on, and exp. decay when switched off, so the heat in the windings will not be as bad.


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