for the arduino code, there is a noisefilterbox.h file, that has a function called
filterNoiseReductionBox(float AnalogfloatSignalInput,int FilterMode, bool isItStable) it does a few things
AnalogfloatSignalInput is the signal to input into it.
FilterMode can be 0,1,2,3
FilterMode==0 is no filter so you can see default noise.
FilterMode==1 is 10x filter. it is still somewhat fast, but you can see ripples.
FilterMode==2 is 100x filter. it is very slow to respond, but noise free.
FilterMode==3 this is hybrid mode filter, it is quite fast and noise free.
here is an actual VL53L0x sensor with a case enclosure for sensor and sampling about 30 to 50 times a second. the plotter of Arduino outputs the data. i used a baud of 19200. you can see the noise is +/-6mm

here is what it looks like using FilterMode==1 a 10x sample filter

signal is still noisy but it is now a smaller scale, it is +/- 2
here is FilterMode==2

with 100x filtering noise is reduced to +/- 0.5mm but the slew rate, or rate of change is really slow. with 30-50 samples a second, it takes at least 1300 samples to become stable so between 26 to 43 seconds per
measurement.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.