I am trying to make a simple motion detector for objects within a few feet in a very small footprint with minimal parts. I don't need to know much info about the motion just simply if there was motion and the rate of the motion. I do not need to know the absolute level of light.
So far I have had pretty good luck doing this using a basic photo-transistor circuit and a micro-controller ADC with integrated gain.
The issue arises when I change light levels from a dark room to light room to cloudy day, the photo-transistor can easily saturate depending on overall light level.
A way to avoid this would obviously be to use a variable resistor type circuit, like a digital potentiometer or a voltage controlled JFET. These circuits are a little more complicated then I was hoping and would require constant checking and adjusting of the resistance.
My question is, since I do not need to know the absolute light level, is there any circuit that can automatically control the photo-transistor so that It remains out of saturation in any light level?
(I'm not too experienced in electronics, but is there a way to provide feedback with some hysteresis to a jfet or other resistance like device that would keep the photo-transistor between VCC and GND while allowing some high frequency fluctuations? (movement)