Article Overview
To connect a light sensor module like an LDR or LM393 to an Arduino, connect VCC to 3.3–5V, GND to ground, and use the AO (analog) or DO (digital) pins to read light levels or detect light thresholds.
Pin Connections
Most light sensor modules have four pins:
- VCC: Connect to 3.3V or 5V on the Arduino .
- GND: Connect to Arduino ground (0V), .
- AO (Analog Output): Provides a continuous voltage proportional to light intensity. Connect to an analog input pin (e.g., A0) to measure light levels .
- DO (Digital Output): Provides a HIGH or LOW signal depending on a light threshold. Connect to a digital input pin if you want to detect light/dark events . For a simple LDR without a module, you can use a voltage divider: connect the LDR in series with a fixed resistor between 5V and GND, and read the voltage at the junction with an analog pin .
Wiring Example
- LDR Module (LM393):
- VCC → 5V
- GND → GND
- AO → A0 (analog reading)
- DO → D2 (digital reading, optional)
- Basic LDR with resistor:
- 5V → LDR → junction → analog pin A0 → resistor → GND
Programming Basics
- Analog Reading: Use
analogRead(A0)to get a value between 0 (dark) and 1023 (bright), . - Digital Reading: Use
digitalRead(D2)to detect if light is above or below the threshold set by the module's potentiometer . - Example to turn on an LED when it's dark:
CppCopyint sensorPin = A0;int ledPin = 13;int sensorValue;void setup() { pinMode(ledPin, OUTPUT); Serial.begin(9600);}void loop() { sensorValue = analogRead(sensorPin); Serial.println(sensorValue); if(sensorValue < 300) { // adjust threshold digitalWrite(ledPin, HIGH); } else { digitalWrite(ledPin, LOW); } delay(200);}
Tips
- Adjust the potentiometer on LM393 modules to set the light threshold for digital output .
- Use AO for precise light measurement and DO for simple light/dark detection .
- Ensure proper voltage levels to avoid damaging the sensor. By following these steps, you can reliably connect a light sensor module to an Arduino and use it for projects like automatic lighting, alarms, or light intensity monitoring .
Raspberry Pi
Learn how light sensor works, how to connect light sensor to Raspberry Pi, how to code for light sensor, how to program Raspberry
LDR Module
Learn how a LDR light sensor module works, how to connect the LDR light sensor module to ESP32, how to program ESP32 to
Arduino Photoresistor Module KY-018 (HW-486) — Pinout, Wiring
Wire the KY-018 (HW-486) photoresistor/LDR module to Arduino, read light levels, and build a light-triggered LED.
How to connect a light sensor? ️
Have you ever wondered how to connect a light sensor? Don''t worry, you''re in the right place! With technology
Light Sensor including Photocell and LDR Sensor
Photojunction devices are specifically designed for detector application and light penetration with their spectral response tuned to the
Rain Drop Sensor Module Pinout, Working, Interfacing with Arduino
Rain Drop Sensor Module Interfacing with Arduino – Rain Detector Circuit Today''s tutorial is about the interfacing of Rain drop
How to Use Light Sensors With Arduino
In this tutorial, we''ll explore what light sensors are, how they work, and then we''ll build a project where an LED
Arduino UNO R4
Discover how to use Arduino UNO R4 with an LDR light sensor module. You will also learn how to program the Arduino UNO R4 to
LDR Light Sensor – Arduino Tutorial
Light Sensor with Arduino Connect the LDR to the Arduino using the analog pin specified in the LDR''s documentation.
How to Use Light Sensor: Examples, Pinouts, and Specs
The Light Sensor module is an electronic component designed to detect the presence and intensity of light in the surrounding
Arduino
Learn how a LDR light sensor module works, how to connect the LDR light sensor module to Arduino, how to program Arduino to
Photoresistor Sensor Module with Arduino – Step by Step Guide
The Photoresistor Sensor module, also known as a Light Dependent Resistor (LDR), is an essential component for
Interfacing LDR Sensor with Arduino
This basic blog tutorial helps us to understand how to connect the LDR sensor module with Arduino, how to reads
ESP8266
Learn how a LDR light sensor module works, how to connect the LDR light sensor module to ESP8266, how to program ESP8266 to
How to Use LDR Module 3 pin: Examples, Pinouts, and Specs
The Charan Light Dependent Resistor (LDR) Module is an electronic sensor that detects the intensity of light. As the ambient light
Light Sensor
Learn: how light sensor works, how to connect light sensor to ESP32, how to code for light sensor, how to program ESP32 step by
How to Wire an Outdoor Light Sensor: A Step-by-Step Diagram Guide
Learn how to wire an outdoor light sensor with a detailed wiring diagram. This article provides step-by-step instructions and tips for
LM393 Light Detection Sensor Module Tutorial: Analog
You will learn how the module works internally, how to wire it correctly, how to tune the sensitivity, and how
Arduino Nano
Learn how light sensor works, how to connect light sensor to Arduino Nano, how to code for light sensor, how to program Arduino
How to detect light using an Arduino
Using an Arduino board, we can easily interface with various sensors and components to
Arduino Light Sensor – Circuit and Code Example
This is a quickstart guide to the Arduino light sensor circuit. You''ll learn how to connect the circuit on a breadboard
ESP32 MicroPython Light Sensor | ESP32 MicroPython Tutorial
Learn how to connect and use an LDR light sensor with a ESP32 and MicroPython, how to write MicroPython code for ESP32 to
LDR sensor module | How LDR Sensor Works
LDR sensor module is a low-cost digital sensor as well as analog sensor module, which is capable to measure and
Arduino
Learn how to use the light sensor module in Arduino Sensor Kit with step-by-step instructions and examples for your projects.
Raspberry Pi
This tutorial instructs you how to use an Raspberry Pi and an LDR light sensor module to find out the amount of light in an area. We
How to detect light using an Arduino
In this tutorial, we have learned how to detect light using an Arduino and explored various applications of light
Photoresistor Sensor Module with Arduino – Step by Step Guide
In this step-by-step guide, we''ll show you how to set up the Photoresistor Sensor module with an Arduino and create
Raspberry Pi
Learn how a LDR light sensor module works, how to connect the LDR light sensor module to Raspberry Pi, how to program
Arduino
Learn: how light sensor works, how to connect light sensor to Arduino, how to code for light sensor, how to program Arduino step by
Related Resources
- Wall Fiber Optic Socket Panel Installation Diagram
- Distribution box and overhead power lines
- Protection of electrical distribution boxes inside the building
- 200x100 Cable tray elbow
- Well-known domestic brands of relay protection
- Galvanized Green Cable Trays
- Temporary room for distribution box
- How is fiber optic sensing direction determined
- Tunisian Integrated Power Cabinet Manufacturer
- France ONT Optical Network Terminal LPO
- Industrial Switches for Small and Medium-Sized Companies
- Working principle of high-speed optical cables
- 47u Network Cabinet Brand
- Nauru Straight-through Channel Cable Tray
- Wiring method for suction cup distribution box
- Indonesia Fiber Optic Composite Guided Cable
- Retailer-compatible pluggable optical module QSFP28
- Terminal boxes inside the rack
- Price of horizontal bends in cable trays
