Is there a way to smooth output values to DAC?

I am now sending potentiometer values through a pair of XBee’s via serial communication. If I try to use 0-1023 instead of mapping to 0-255 the XBee’s become exponentially latent until the potentiometer stops moving. Even at 0-255 I need to cull some value samples to keep the latency down. I can do this with a Delay (which I don’t want to use) and not printing values unless they exceed a delta value.

The problem this causes on the receiving end, where a digital potentiometer or a DAC then controls a parameter in a digital amp, is stepping. The resolution is not high enough in that the values jump too far.

So, if a transmission consisted of <255><249><201><146><94> etc, dependant upon how fast the potentiometer was moved, is there a way to process these numbers so that the output would include the missing values would be ‘filled in’ resulting in <255><254><253><252><251>? Even if the jumps between differentials were smaller, that would help in smoothing out the DAC.

Thanks in advance,

This code is a digital low pass filter, it will smooth data.

unsigned int smooth(unsigned int newVal) {
  static unsigned int oldVal = 0;
  unsigned long sum;
    //  optimize sum = (oldVal * 3 + newVal) / 4;
    sum = ( (oldVal << 1) + oldVal + newVal) >> 2;
  oldVal = sum;
  return oldVal;
  // example use
  smoothedValue = smooth( analogRead(A0) );


Thank you for your reply, aarg. I’m ok with smoothing on the input side. I need to fill in the missing integers before values are printed to the DAC. I’m going to try the audio subcategory as this is a problem with MIDI values also to avoid stepping.

It’s 100% possible I’m not seeing your solution.