I want to make a light detector using a phototransistor. To do that I connected a phototransistor and apotentiometer to the open drain comparator as in the diagram below.
When the light is dim, everything is OK, but when light is bright (normally or even slightly bright) then the LED lights even when voltage of the potentiometer is more than 700mV higher than the voltage of the phototransistor.
Specifically, when I turn the potentiometer knob, the voltage between the voltage source and the comparator output rises gradually until it hits maximum around the point where comparator inputs values are equal and then it remains constant.
So my problem is that comparator doesn't work like a step function, but more like a gradually increasing function.
What am I doing wrong?
simulate this circuit – Schematic created using CircuitLab