To minimize the effect of environment light you have to pulse the IR emitter maybe in KHz range often in IR example circuits you can see a 555 timer doing this job.
So is this, in a way, self calibrating by sampling the light initially on every loop cycle or have I misunderstood your explanation? Just watched this tonight. I must have missed my notification when you published it!
I'm keeping the last 20 samples, then each time I take a new reading, I sort the 20 into ascending order so that I can pull out a median value for the 20. In this way it should be self-calibrating, since the median will adjust over time.
To minimize the effect of environment light you have to pulse the IR emitter maybe in KHz range often in IR example circuits you can see a 555 timer doing this job.
So is this, in a way, self calibrating by sampling the light initially on every loop cycle or have I misunderstood your explanation? Just watched this tonight. I must have missed my notification when you published it!
I'm keeping the last 20 samples, then each time I take a new reading, I sort the 20 into ascending order so that I can pull out a median value for the 20. In this way it should be self-calibrating, since the median will adjust over time.