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
    May 12, 2020 at 23:10
  • I bought it long time back i dont even remember now :( May 12, 2020 at 23:37
  • it is digital out ... do some experimenting
    – jsotola
    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
    May 13, 2020 at 0:14
  • what is the problem? wire and code it as button
    – Juraj
    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
    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.
    – Juraj
    May 14, 2020 at 4:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.