0Pricing
Arduino & IoT Academy · Lesson

Measure Light with an LDR

Wire a voltage divider to read brightness.

Measure Light with an LDR is a free Arduino & IoT Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Arduino & IoT Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

What an LDR Is

An LDR is a light-dependent resistor. Its resistance drops in bright light and climbs high in the dark.

Resistance Tracks Light

Cover an LDR and its resistance soars; shine a lamp on it and resistance falls. That change is what you measure.

It Cannot Be Read Alone

The Arduino reads voltage, not resistance. So an LDR by itself gives no voltage the board can sense directly.

Pair It With a Resistor

Combine the LDR with a fixed resistor to form a voltage divider. Together they turn light into a readable voltage.

Pick a 10k Partner

A 10k ohm resistor is a solid default partner for most LDRs. It keeps your readings spread across a useful range.

Tap the Middle Point

Connect the junction between the LDR and the resistor to an analog pin like A0. That midpoint voltage is your signal.

Read the Brightness

Call analogRead on the divider pin to get a 0 to 1023 number that rises and falls with the light.

int light = analogRead(A0);

Wiring Sets Direction

Which side the LDR sits on decides whether bright gives a high or low number. Test it and note your result.

Watch It Live

Print the value so you can wave your hand over the sensor and see the number react with Serial.println.

Serial.println(analogRead(A0));

Smooth Out Flicker

Lights flicker faster than your eye sees. Averaging a few readings gives a steadier brightness value.

A Cheap, Useful Sensor

The LDR is a cheap way to add light awareness. It powers night lights, plant monitors, and auto-dimming displays.

Quick Check

Why cant an LDR connect to an analog pin on its own?

Recap: Reading Light

You built an LDR voltage divider with a 10k resistor, tapped the midpoint to A0, and read brightness with analogRead.

Frequently asked questions

Is the “Measure Light with an LDR” lesson free?

Yes — the full text of “Measure Light with an LDR” is free to read here on the web, and the Arduino & IoT Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Arduino & IoT Academy course, upgrade to CoddyKit PRO.

What will I learn in “Measure Light with an LDR”?

Wire a voltage divider to read brightness. You practise Arduino & IoT Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Arduino & IoT Academy?

No prior experience is required. Arduino & IoT Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Measure Light with an LDR” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Arduino & IoT Academy lesson?

Yes. Every Arduino & IoT Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Read a PIR Motion Sensor
  2. Measure Light with an LDR
  3. Set a Light Threshold
  4. Automatic Night Light
← Back to Arduino & IoT Academy