Hey guys, i’m just wondering when it comes to DDS, what sort of table length should I be looking at? I’d think that the longer, the better but that seems a tad silly, should a table be the length of the minimum frequency you’re trying to produce?

Using the brilliant tutorial on DDS for arduinos (http://interface.khm.de/index.php/lab/experiments/arduino-dds-sinewave-generator/), they use a table of length 256. The sample rate is 31.25kHz meaning that if the phase accumulator increments 1 every time, you’re going to get a frequency of 31250/256 = ~122Hz. If I wanted to produce a frequency lower than this, some form of interpolation would be required right? For any frequency higher than this, is interpolation really needed, as you’d be skipping loads of table entries anyway?

Say I wanted a frequency of 500Hz, my tuning word would be:

2^32*500/31250, or 68719477, this would then be bit shifted down by 24 to be used for the 8 bit table length, giving an increment of about 4 every time, so going through the table, it would take the 4th value every time and skip the others right?

On the other hand, if I wanted to produce say 15Hz, the increment would be 0.122 meaning it would have to ‘stick’ on the first value for about 8 cycles of the interrupt which at this point, I see why interpolation is required because you’d get a very stepped waveform.

If I was to increase the look up table to say a length of 2048, the ‘increment of 1 per interrupt trigger’ frequency would be ~15.3Hz, meaning that the lowest frequency produced by this look up table without interpolation would be 15.3Hz, right?

Now adhering to the nyquist theorem says that I can reproduce up to fs/2, does the term “oversampling” mean that say for example 4x oversampling, the maximum that I would reproduce would be ~3906Hz?

By knowing these two facts gives a kind of size of look up table required right? Like if I wanted a sine frequency range of 50Hz to 500Hz with 4x oversampling, I would want the lookup table to be long enough that the increment of 1 per interrupt trigger would be below 50Hz yet the sample rate would be atleast 2kHz?

Am I right in these assumptions?

Cheers,

Harris