Part 7 of 15

Light sensor (LDR)

Light sensor (LDR)

Measures how light or dark it is

In your kit: 1×

🔎 What is it?

This sensor measures how much light there is. Your Arduino reads a number between 0 and 1023. In bright light you get a different number than in the dark. This way your Arduino knows if it is day or night.

🔌 This is how you connect it

  • S to an analog pin, for example A0
  • + to 5V
  • − to GND

Wiring diagram

From To
Arduino UNO · A0 Light sensor (LDR) · S
Arduino UNO · 5V Light sensor (LDR) · +
Arduino UNO · GND Light sensor (LDR) · -

✨ What can you do with it?

  • A night light that turns on by itself
  • A light meter
  • An alarm that goes off when someone opens the drawer

💡 Tip

Look in the serial monitor to see which number you get. Then hold your hand above the sensor. This way you can see which number means "dark".

Projects with this part

⬇️ Download this page as a PDF 📚 Download the complete tutorial (PDF)

Codey Online is a product of OTRONIC

Build your Arduino or ESP32 project with AI

Describe what you want to build. Codey Online writes the code, draws the wiring diagram, compiles it and flashes your board straight from the browser.

Start for free