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
  • 10k ohm resistor
  • 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. I am a tech blogger and an IoT Enthusiast. I am eager to learn and explore tech related stuff! also, I wanted to deliver you the same as much as the simpler way with more informative content. I generally appreciate learning by doing, rather than only learning. Thank you for reading my blog! Happy learning! Follow and send tweets me on @harshvardhanrvm. If you want to help support me on my journey, consider sharing my articles, or Buy me a Coffee!

Leave a Reply

%d bloggers like this: