Collection: Light Sensors

Light sensors let a project react to how bright or dark it is: night lamps, dusk-to-dawn switches, plant monitors, laser tripwires and UV monitors.

  • LDR (photoresistor): the simplest. Its resistance falls as light rises, so it goes in a voltage divider with a fixed resistor (10 kΩ suits indoor light) and you read the voltage on an analog pin.
    • An LDR gives relative light levels, not lux.
    • It responds in tens of milliseconds, fine for switching but too slow for data.
  • LDR modules: add an LM393 comparator with a potentiometer, so DO switches HIGH or LOW at a set brightness, while AO still gives the raw level.
  • Digital light sensors such as the BH1750 report calibrated light levels over I2C.
  • The VCNL4010: combines ambient light with proximity sensing over I2C.
  • The GUVA-S12SD: measures UV-A and UV-B, as an analog voltage you can convert to an approximate UV index.

How to choose:

  • Pick an LDR for on/off decisions.
  • Pick a digital sensor for real lux readings.
  • Pick a UV sensor for sun exposure.

On an ESP32, read analog light sensors on ADC1 pins (such as GPIO34), which keep working with Wi-Fi on.

Frequently asked questions

Does an LDR measure lux?

No. It gives relative levels. For calibrated lux use a digital sensor such as the BH1750.

What resistor goes with an LDR?

A 10 kΩ resistor in a divider suits typical indoor light. Pick one close to the LDR's resistance at your usual light level.

What is the difference between DO and AO on a module?

DO switches at the potentiometer's threshold. AO is the raw analog light level.

Is a DIY UV sensor accurate?

It is a relative indicator. The module ships uncalibrated, so keep using an official UV forecast for sun safety.

Guides

Reference pages on soldr.ai

Describe your build on Soldr and it picks the parts, writes and compiles the code, and shows how to wire them. Sign in and get 100 credits free.