01/19/2021 at 11:53 •
included files for filter_Sensor. includes example vl53l0x and my own noisefilterbox.h that has a function that reduces noise. this is from actual data from a lidar sensor VL53L0x with noise +/- 0.5mm at 30-50 samples a second. no tweaking the registers of the device yet.
this is using filter in Filtermode==3 and has an stable time of down to 4 seconds for a change of 150mm
here is same device at a different time without any filtering
this filter adjusts quickly to change.
01/18/2021 at 23:40 •
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
01/18/2021 at 06:41 •
when using the lowpassfilter.py code you can see from the pulsed data, and increase in frequency that there is a limit to how good of filtering we can do and get a quick enough response for data to be useful.
here is a second set of python code called bandpassfilterwdetectionofstability.py that can detect when a signal is stable and not changing more than a set percentage. from this data graph it can be seen that when a lot of filtering is done, even though there is no noise, it takes a long long time for sample to stabilize, and in the 100x filtering the signal rarely stabilizes within the times allowed for in simulation.