Papers on the Mathematical Basis for Using PWM for Sine-Wave Generation

In summary: Not an exact comparison, but here is an old 16W transformer power supply (1172 grams) and modern 12.5W switching supply (70 grams).
  • #36
@sophiecentaur I'll describe it with a little more detail.
-
I was using an 8 bit D/A with sine values stored in ROM. The address of the sine lookup table was also 8 bits wide but was derived from a 24 bit (or wider, can't recall) counter. I simply took the most significant 8 bits from this counter every 50 microseconds and used this as the address for the sine lookup table. Depending on how I stepped through the 24 bit counter would determine the frequency I wanted to synthesize. If you hadn't put it together yet, it's a numerically controlled oscillator.
-
Now where it got interesting is if I stepped through the counter in such small steps that the sine value didn't change from one 20 microsecond step to the next. I didn't really worry about it since the frequencies I wanted to synthesize were not in the range this occurred.
 
Engineering news on Phys.org
  • #37
Averagesupernova said:
I was using an 8 bit D/A
Averagesupernova said:
50 microseconds
I see. You were using a sample rate of 20kHz and a quantisation of 1/28 relative to maximum value. For synthesising a 50Hz sinusoid, that would be very healthy. That makes 400X oversampling (or perhaps you could say 200X). Not surprising that many of the samples were 'repeated', near +1 and -1. The value of sin x doesn't change a lot around max and min. With 200X oversampling, you can throw away a lot of the resolution per sample.

Single bit DACs generate (of course) a lot of quantisation noise (distortion) but the power spectrum is spread out over the gap between zero and the sampling frequency. The final low pass filtering reduces the amount of noise power pro-rata, according to the base band bandwidth. Very low demands on the filter, in many cases if you can handle the high sample frequency.

As a matter of interest, what sort of maximum frequency will your synthesiser deliver?
 
  • #38
I generally don't need it to generate anything above 3 KHz so the filter was set up to start cutting slightly above this. If I recall it was a 4 pole salen-key. However, that is not to say that if you plug the right numbers into it you can generate above that. It can go down into millihertz but there was really no need. Down to 75 or 80 Hertz was good enough.
-
Edit: For those following this, you probably realize that if there is no need to go down to millehertz then you may wonder why the counter is so large at 24 bits. After all, it takes forever to overflow a counter that size clocking through one count at a time every 50 uSeconds. The reason is for fine resolution within the band of interest. Numerically controlled oscillators are a fascinating subject. To me at least.
 
Last edited:
  • Like
Likes sophiecentaur
  • #39
Probably seems like beating a dead horse here, but I thought I'd share this image as well.

mpx96wav.jpg


-
What you are seeing is a stereo MPX signal without the pilot. The MPX signal consists of baseband audio and a double sideband suppressed carrier at 38 KHz. The signal in the link shows both left and right channels carrying the same tone. So the 38 KHz signal is carrying the same tone as the baseband audio. Notice how similar it looks to a stepped waveform. The spectrum looks similar except the 38 KHz does not have any harmonics.
-
Comment about stepped waveforms having a modulation effect is spot on.
 

Similar threads

Back
Top