I have this simple project where I am using two LDRs to detect whether two respective light sources are switched on. They are connected to digital pins as I am only interested in whether the signal is On or Off.
The issue I'm having is figuring out how to calibrate the circuit so that the LDRs become less sensitive to light in case of ambient light. I would like the option of raising the threshold of light required to trigger the ~3V required for an On signal on the digital pins. I can of course change the resistance of the resistors. But I would instead like to find a way to adjust both LDRs simultaneously using some universal control like a single potentiometer.
Is there a way to achieve this? My experiments with potentiometers have led to the LDRs being MORE sensitive to light and also leading the LDRs to no longer act independently; causing light to trigger an ON signal for both digital pins despite light only shining on one LDR.
Please post the code, using code tags. Since according to the drawing, the LDRs are connected to pins capable of analog input, you could use analogRead() and have any threshold you like between 0 and 1023 (on an Uno R3).
LDR's are resistors. Take them off your breadboard and measure the resistance under various levels of light. Once you know what the resistance is at given light levels, you can select the right resistors for your voltage dividers.