# PWM sampling frequency versus sample resolution

Status
Not open for further replies.
R

##### Guest Is there an ideal ratio (or any more complex formula) between the sampling frequency and the sample resolution (steps) of a PWM signal used to generate a sine wave?

For example, I want to generate a sine wave with a frequency of 1Hz and a peak voltage of 1V.

If I choose a sampling rate (frequency) of 1khz (1000 x 1Hz) and a sample resolution of 2-bit (4 discrete values) surely the generated sine wave will be distorted.

If I choose a sampling rate of 10Hz (10 x 1Hz) but the sample resolution would be 8-bit (256 discrete values) the output signal might be less distorted.

What's the mathematical approach of this issue?

#### KlausST

##### Super Moderator
Staff member Hi,

If you can 1000Hz and 2bits, thats 4000 steps.

I don't know the ideal choice, but i'd try the sqrt(4000) = about 64.
--> 1Hz x 64 = 64 Hz and 64 steps = 6 bits resolution.

But with microcontrollers you could go up to 4MHz.
Sqrt(4M) = 2k. Pwm frequency 2000Hz and 11bits resolution. Is this possible?

Klaus

V
Points: 2
R

##### Guest Thanks for your suggestion, Klaus. Now that you mention that square root, it looks like an optimum ratio, indeed.

Actually, I don't need to generate a 1Hz waveform (was just an example). I was trying to find out the best ratio for a sine wave inverter (50Hz output).

Not knowing about the ratio you just mentioned, I made some calculations before. I have decided that the shortest pulse width will be around 1us (being equal with the switching deadtime) hence there will be 10,000 time slots for a half wave (10ms). Once again, not using any formula but the common sense, I've decided that the sampling ratio will be 100 time slots (100us = 10kHz) and the sample resolution should be 100. And now I find that 100 is sqrt(10,000) actually!

Anyway, I wonder if I could further increase the sampling rate to 15,625Hz and lower the sample resolution to 64 (6-bit)..

#### KlausST

##### Super Moderator
Staff member Hi,

Another thing to consider...
The higher the pwm frequency the easier or more effective is the filtering.
The filter could be expensive.
To improve the costs it may be good to increase pwm frequency.

Klaus

R

##### Guest I know that, but it's a high power inverter (5kW) with a low frequency output transformer (50Hz) and I don't think I could increase the switching frequency too much (otherwise the switching loses will become important).

Actually, I've already built a similar inverter (2kW) some times ago using a switching frequency of 10 kHz and 100 steps/sample with good results. The only downside is the audible whine of the bulk transformer but that's not a real issue.

This time I'm going to make further tests with various switching frequencies for an optimum result. Once again, thanks for your input.

Status
Not open for further replies.

Replies
4
Views
2K
Replies
2
Views
1K
Replies
0
Views
979
Replies
2
Views
7K
Replies
1
Views
2K