I have ldr module with 4 pins 1. Vin 2. Gnd 3. AO 4. DO
I want to know how can i take advantage of DO suppose i want to turn on lcd display when light falls on the ldr sensor!
enter image description here I have noticed when light falls on ldr sensor the Green led with DO written next to it lights up.
-
I bet if you look where you bought that little board from they have some sort of instructions on how to use it. They usually do.Delta_G– Delta_G2020年05月12日 23:10:04 +00:00Commented May 12, 2020 at 23:10
-
I bought it long time back i dont even remember now :(Ciasto piekarz– Ciasto piekarz2020年05月12日 23:37:05 +00:00Commented May 12, 2020 at 23:37
-
it is digital out ... do some experimentingjsotola– jsotola2020年05月12日 23:54:33 +00:00Commented May 12, 2020 at 23:54
-
So go look online for a similar one. Check and see if it has some numbers or something on it that you can google. Be smart about this.Delta_G– Delta_G2020年05月13日 00:14:46 +00:00Commented May 13, 2020 at 0:14
-
what is the problem? wire and code it as buttonJuraj– Juraj ♦2020年05月13日 05:11:43 +00:00Commented May 13, 2020 at 5:11
1 Answer 1
The DO pin gives a Digital Output that is HIGH when the light falling on the LDR is above a threshold, and LOW when it's below a threshold. Just connect it to a digital input pin and read that pin with digitalRead()
.
You can change the threshold by adjusting the small blue trimpot.
-
fwiw, this is problematic because the LDR can get "accustomed" to a light level and change responsiveness, so the threshold adjustment won't always keep the same objective light level (lux) setting as a trigger level, but it should be enough for "is it light or dark". It would be better done in software, so you can work around such fatigue and surging values from the LDR with debouching, self-calibration via computed averages, and actually seen high/low values as a min/max.dandavis– dandavis2020年05月13日 16:43:43 +00:00Commented May 13, 2020 at 16:43
-
@dandavis, for that there is AO (analog output). but why would one buy a module for LDR and one resistor.2020年05月14日 04:31:35 +00:00Commented May 14, 2020 at 4:31