Interface digital LDR sensor module with NodeMCU


  • Interface a digital LDR sensor module with NodeMCU
  • View the output of the sensor


  1. NodeMCU board (quantity: 1 no.)
  2. Micro USB cable A to B (quantity: 1 no.)
  3. Breadboard (quantity: 1 no.)
  4. LDR sensor module (quantity: 3 no.)
  5. Jumper wire – male to male (quantity: 5 no.)
  6. Arduino IDE on your computer

Let’s begin!

A Light Dependent Resistor (LDR) is a special type of resistor whose resistance value changes depending on the amount of light falling on it. It can be used to measure the amount of ambient light present.

We use a digital LDR module. It has an on-board potentiometer that is used to set a threshold. If the light in the room is above a threshold, it outputs a HIGH signal. Else, it gives a LOW output.

Interfacing digital LDR sensor module to NodeMCU


Interfacing digital LDR sensor module to NodeMCU


Final Code

To copy the code, right click on view raw at the bottom of the code, click on open link in new tab and then copy the code.

There you go!


Loader Loading...
EAD Logo Taking too long?
Reload Reload document
| Open Open in new tab

We would love to see what you build out of these learnings!

Click here to submit your projects, share it with the world and stand a chance to be rewarded.


Knowledge and Content by Li2 Technologies | © 2021 NASSCOM Foundation | All rights reserved