I'm working with a distance sensor that gives erratic readings when an object is <2". Here's a plot of MCU ADC counts (orange) and voltage input to ADC (blue).

My first thought is to monitor the dv/dt after we cross the 2" threshold and ignore anything that doesn't have a linear increasing slope.
Has anyone dealt with this issue and have some advice?

My first thought is to monitor the dv/dt after we cross the 2" threshold and ignore anything that doesn't have a linear increasing slope.
Has anyone dealt with this issue and have some advice?