I am trying to make a light sensing circuit which has hysteresis.
I want an op-amp (LM358) to output logic 1 (12v) when the light level rises above 250 lux, and output logic 0 (0v) when the light level drops below 100 lux. The hysteresis should be enough to prevent small, insignificant changes (~1v) in the light level from abruptly flipping the output.
I made a simple potential divider to get my threshold voltages for the LDR I was using:
simulate this circuit – Schematic created using CircuitLab
I measured:
- At 250 lux, the voltage is 5.27v.
- At 100 lux, the voltage is 3.4v.
I have then created the following Schmitt Trigger circuit schematic:
My problem is that I have no idea how to calculate R2 and R3, and I don't know what Vref I should pick! I would much appreciate some guidance on how to create this circuit.
Thank you