taking high frequency noise and inverting it back into main signal output for distance is the way to go. the main source of the noise is from voltage spikes, and laser power variation. i will keep track of when laser measurements are out of spec, or out of control and flag them. i also will use the equivalent of a high frequency pass filter to allow the voltage noise thru, and be amplified and inverted.
this filter will allow noise thru that takes less than 50 samples or is spiking. so it is wide range.
output=sense
invertL=invertL*0.98+output*0.02;low pass averages 50 samples
invertH=invertH*0.99+output*0.01; low pass averages 100 samples
invert1=(invertL-invertH)*100;//we compare the curves of the 50 and 100 samples
//we limit the response to be within a set percent of output
if (invert1>output+0.1){invert1=output+.1;}
if (invert1<output-0.1){invert1=output-0.1;}
invertOffset=invertOffset*0.99+output*0.01;//we use this to generate the dc bias.
the yellow line below is raw data, with a noise removal adjustment. i still have some work to do since variation is still between 5-8mm in raw data with no additional filtering.
the green is the raw measurement data, the blue is the in spec data filtered by 10x
the yellow is the noise compensated raw output. i'm still optimizing gain which currently is set to 1.175
Serial.print(output-(invert1-invertOffset)*1.175,0);//raw output- inverted noise
this chart is from 2 seconds after sampling started at ~30-50 samples a second
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.