Skip to content

Dynamic Window Filter (DWFilter) is an Ultra-Lightweight library for filtering and smoothing Slow-Rate data (from slow sensors, etc) without time lag and delay.

License

Notifications You must be signed in to change notification settings

FarhanKhosravi/Dynamic_Window_Filter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dynamic Window Filter (DWFilter) arduino-library-badge

"Dynamic Window Filter" is an Innovative Method with an Ultra-Lightweight library for filtering and smoothing Slow-Rate incoming data (from slow sensors, etc.) without time lag and delay. It is best used with slow sensors like Temperature, Humidity, etc. (e.g. MAX6675 for Thermocouple reading); and uses a very small number of clock cycles due to its simple, yet practical function.

It also suppresses unwanted direction changes in the input data, making it ready for sensitive measurements like PID Systems (as the D term is very sensitive to sudden changes)

There are a few examples below for further clarification:

How It Works :

This method uses a Window Size specified by user, to create a window of that size. When new data is received, if it falls within the window range, the window remains unchanged, and the output value is set to the midpoint of the window. Otherwise, the window shifts up or down accordingly.

The Window Size should be chosen based on how much your data scatters. It is best to select a size slightly larger than the noise range.

Here is an example of appropriate Window Size selection: Screenshot (327)

How it Improves measurements like PID:

As you know, When using a common temperature sensor (like MAX6675) new data is available only every 250ms and it often has a significant scatter. This prevents typical averaging methods from being effective due to time lags and slow responses. For smooth PID Control, a stable input is essential. and this method helps you to eliminate noises and even increase accuracy of your data.

In the image below, you can see raw sensor readings, which still fluctuate even when using a moving average. The filtered data, however, moves consistently in a single direction, making measurements like PID much more reliable: Screenshot (700)

This Makes your D Term in PID to work correctly; and not taking derivate on false movements (that makes PID unstable).

the result of correctly tuned PID with PWFilter, even with a low-res thermocouple reader like MAX6675 will be something like this: Screenshot (67f)

In the end, we achieved stable precision down to one decimal place with that sensor too! Feel free to use it in your project—just be sure to select the right window size.

About

Dynamic Window Filter (DWFilter) is an Ultra-Lightweight library for filtering and smoothing Slow-Rate data (from slow sensors, etc) without time lag and delay.

Topics

Resources

License

Stars

Watchers

Forks

Languages