Saturday, December 21, 2024
ESPHow ToIoT HardwaresSensorsTutorials/DIY

Interface LDR module with NodeMCU

In this Tutorial we will learn how to Interface LDR module with NodeMCU. We need Arduino IDE and LDR Sensor only for this tutorial. this is simple tutorial. We print value on serial console only.

What is a Light Dependent Resistor or a Photo Resistor?

A Light Dependent Resistor (LDR) or a photo resistor is a device whose resistivity is a function of the incident electromagnetic radiation. Hence, they are light sensitive devices. They are also called as photo conductors, photo conductive cells or simply photocells. They are made up of semiconductor materials having high resistance.

We are using LDR module in this tutorial.

 

ldr moduleHardware Required:

  • NodeMCU
  • LDR / photoresistor
  • Breadboard
  • Micro USB cable
  • Connecting Wires

Software Required:

We are using LDR module So you can connect to the A0 pin of the NodeMCU. We are using Analog pin in this tutorial.

Arduino IDE Sketch for Interface LDR module with NodeMCU:

/*
* Interface LDR with NodeMCU
* By TheCircuit
*/
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}

void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);

// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
float voltage = sensorValue * (5.0 / 1023.0);

// print out the value you read:
Serial.println(voltage);
}

Connections:

LDR                   NODEMCU

VCC        ==>       3.3V

GND      ==>       GND

A0         ==>        A0

 


Thanks for reading. If you like this post probably you might like my next ones, so please support me by subscribing my blog.

You may like also:

 

Harshvardhan Mishra

Hi, I'm Harshvardhan Mishra. Tech enthusiast and IT professional with a B.Tech in IT, PG Diploma in IoT from CDAC, and 6 years of industry experience. Founder of HVM Smart Solutions, blending technology for real-world solutions. As a passionate technical author, I simplify complex concepts for diverse audiences. Let's connect and explore the tech world together! If you want to help support me on my journey, consider sharing my articles, or Buy me a Coffee! Thank you for reading my blog! Happy learning! Linkedin

One thought on “Interface LDR module with NodeMCU

  • Hi,
    what are you using the 10k ohm resistor for?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *