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.
Hardware Required:
- NodeMCU
- LDR / photoresistor
- Breadboard
- Micro USB cable
- Connecting Wires
Software Required:
- Arduino IDE (with ESP8266 Library installed) Visit this : Arduino Support for ESP8266 with simple test code
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:
- Dynamic WLAN configuration for ESP32 Board | AutoConnect
- ESP32 BLE on Arduino IDE with UART Test
- ESP32 Bluetooth Low Energy (BLE) on Arduino IDE
- ArduinoOTA ESP32: Wi-Fi (OTA) Wireless Update from the Arduino IDE
- ESP32 with LoRa using Arduino IDE
- How To Use Grove-LCD RGB Backlight with NodeMCU
- NodeMcu to DHT Interface in Blynk app
- How To ON/OFF a bulb by Google voice assistant
- Arduino IDE | Arduino | Open Source Hardware/Softawre | Arduino Vs RPi
- WiFi LoRA 32 (V2) ESP32 | Overview | Introduction
- DHT11 sensor with ESP8266/NodeMCU using Arduino IDE
- Arduino Support for ESP8266 with simple test code
Hi,
what are you using the 10k ohm resistor for?