Hi everyone.
I'm doing a project that involves the use of a distance sensor to detect "real time" distance of my hand from that sensor.
I used both the TeraRanger Multiflex laser infrared distance sensor and the famous HC-SR04 ultrasonic sensor.
I'm using these sensors in a small range max 400mm, after this value the sensor keeps working but doesn't send any output value.
They both work fine but there is one issue that I cannot explain:
While i'm removing the hand from the sensor('s field of view) keeping a stable distance (let's say 100mm) both sensor send out higher value.
for example
while my hand is on the sensor:
100
101
100
99
100
while i'm removing my hand:
115
130
120
no more output (no object within the range)
Now I know that the hand is not stable leading to some error but i I tried moving a piece of cardboard directly above the sensor by resting it on a ruler in order to maintain a constant distance, and still it introduced the same error.
Do you have any idea what this error is due to?
The code also has some optimization algorithms (Kalman etc..) but this issue remains although with a lower amplitude wrt to raw data.
PS:
Field of View according to the spec sheet:
TeraRanger Multiflex FoV: 20°
HC-SR04 FoV: 15°
At what point in your program development did the error first occur?
Paul
I will venture a guess outside your code. While my Chinglish is not great this is the data sheet for the HC-SR 04 module. Now where you mention field of view it's actually a measuring angle and it is conical so like a cone shape. The data sheet does mention:
"When tested objects, the range of area is not less than 0.5 square meters
and the plane requests as smooth as possible, otherwise ,it will affect the
results of measuring".
Something true of all ultra sonic sensors I have seen is the importance of target size in that cone. The real world response to an off angle target has a lot to do with the target size. At a given distance as you draw your hand back you are really slowly removing it from the ring of the cone. Incidentally the smaller the beam angle number the tighter the cone, just as a side note. So as your hand exits the actual target (your hand) gets smaller. This apparently has an effect on the echo.
Only a guess on my part.
Also acoustically soft surfaces (no clue what a hand is) often don't respond well as the sound waves don't bounce off as well. 
Ron
Thank you for your answers Paul and Ron.
Code is working properly, the issue is not there.
My concern was about knowing what is the name of the physical process that causes this artifacts. Is it multiple reflection? Is it about side lobes of the beamwidth of the ping? Is it related to false echo?
Why do they occur when i'm decreasing the target size that is covering the cone Area?
I think the behaviour you are describing is normal.
The Rangefinder Multiflex is a Time Of Flight (ToF) sensor and behaves as Ron described.
When you remove your hand from the sensor it measures part of your hand and part of the background. I guess the sensor is pointed somewhere farther than the maximum range.