Predictive digital filtering for first order systems

Today measurements must be fast, cheap and accurate at the same time.
These requirements are not easy to achieve.

This post describes a simple but very efficient software method to make a slow measurement faster.

Let’s look at a simple temperature measurement example.

The temperature sensor sits in a protective metal cover.

This sensor is at room tempeature, and we would like to measure the temperature of boiling water.

The example is very simple but it will clearly show the operation of the computing method.

When we put the sensor into the boiling water, we know that the measured value jumps from 20 °C to 100 °C.

but the sensor’s output rises slowly since the protective cover needs time to heat up.

This heat up phenomena acts as a first order filter function.

The first order filter function is described as:

where T(t) is the measured temperature at a given t time, T(final) is the final value (100 °C in this example), T(0) is the starting temperature (20 °C in this example) and Tau is the time constant of the filter.

It may seems a little complicated, but plotting a graph gives a very clear demonstration of how it works.


The problem here is that we know that the measured temperature momentarily rises as the sensor goes into the boiling water, but the measurement shows a slow rising to the final value.

As mentioned above it is almost exactly the first order function.

We know T(t) value (this is the actual measurement value), we know t (because we know the measurement time) and we know T(0) (it is the first measured value).

We would like to find T(final), but in order to solve the above shown first order filter function equation, Tau must be determined.

Doing some maths:
Starting with:




Taking natural logarithm (after taking the absolute value to prevent the negative values):


Derivate again:



It may seem a little bit complicated, but since derivating in digital domain means substraction:
In order to get Tau:


Once we have Tau, we can solve the original equation:
f to get T(final):
With this simple and powerful method only 3 measured sample is enough to get the final value well before the measured value reaches it.
To sum it up:
This method only works if:
– the real value changes rapidly (following a step function),
– the measured value reacts with first order function to this step input,
– the measurement is not noisy.
If the measured value has some noise in it, determining Tau needs more than 3 samples (determining Tau from 3 samples and averaging the resulting Taus).
Even if some nonlinearity or noise is present in the signal, much less time is needed to get the final value.
In case of (for example) a handheld thermocouple thermometer, the measurement is usually fast (the real measured temeperature is displayed immediately) but the measured signal is noisy.
This noisy signal must be smoothened with a (first order) analogue or digital filter.
But by using a filter, the measurement speed becomes low (there will be a high settling time).
This algorithm restores the measurement speed almost to its original value.
So at the end, the noise is cancelled by the (known) filter, and the the measurement speed is restored by the predictive algorithm.
Of course this method has some limitations, but in particular cases it is extremely useful in speeding up measurement.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s