I'd like to experiment with SPWM, as used in motor control applications. But instead of modulating the duty cycle with a single frequency, I'd like to use a mix of frequencies.

I've been searching for a examples of this and a place to start, but I haven't been able to find any. In fact, I'm not even sure what terminology to use. Internet searches presented me with many examples which use the PWM output of a microcontroller, but I think they wouldn't have the power needed to create a mixed signal. A DSP chip like the Microchip dspic33 series seems like a good possibility, but that would present me with a steep learning curve of learning DSP programming.

I think the place I would like to start is generating the signal in analog form and then converting that to SPWM. It would kind of be like an FM signal generator, where the input signal modulates the frequency of the carrier, but in my case it would be the duty cycle of a square wave. But...I can't find any examples of that to study, and I don't even know if that's possible or if anyone has done it.

Does anyone have any thoughts on this, or can point me to some examples? Would my analog-first idea even work, or is DSP the way to go? Or are there other ways?


1 Answer 1


It's possible you got stuck in the meaning of SPWM (sinusoidal pulse-width modulation), but what you're talking about is just plain PWM: usually there is a ramp, or triangle, and a signal which is compared to the ramp/triangle, generating a variable-width pulse of fixed frequency. There are also fixed-width, variable frequency modulators, and they're just another flavour of PWM.

This question deals with about the same principle. It doesn't matter how your signal looks as long as its bandwidth is less than twice the carrier's frequency (for a proper Nyquist sampling).

  • \$\begingroup\$ Ok, I've seen a number of references to that but I didn't take the time to look into it further. I looked at the link, and although I have little experience with Spice, I think I see what's going on. That's very ingenious. Probably old school, but it's new to me {smirk}. I see where the input waveform crosses the triangle calculates the width of the current pulse of the square wave. Would the triangle wave be better referred to as a sawtooth wave? Wouldn't the trailing side need to be as perpendicular as possible? Also, what is this process or type of circuit called? \$\endgroup\$
    – spinjector
    Sep 27, 2020 at 18:46
  • \$\begingroup\$ @spinjector There are various advantages and disadvantages for both the ramp and the triangle, but PWM is quite a large topic. Try reading about it on wikipedia. I just skimmed through it, but it looks like it touches the basic points. \$\endgroup\$ Sep 27, 2020 at 21:59
  • \$\begingroup\$ I read through that Wikipedia page a couple weeks ago. And I already understand PWM, but...I just looked at that page again, and I see it covers the triangle wave technique. So now I'm going to read through it more carefully. Also, after I left my previous comment, the gears in my head started turning and I have some ideas how to do the signal processing in code. I think it could be pretty straightforward, and might not even need an analog section. And thanks for the tip on avoiding Nyquist Distortion. I know some FFT but I might've run into the bandwidth problem. \$\endgroup\$
    – spinjector
    Sep 28, 2020 at 0:08

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.