Misurare la luce con un LDR
Colleghi un partitore di tensione per leggere la luminosità.
Misurare la luce con un LDR è una lezione Arduino & IoT Academy gratuita su CoddyKit. Questa è la lezione 2 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento Arduino & IoT Academy, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso Arduino & IoT Academy include 4 lezioni in totale.
Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.
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.
Domande Frequenti
La lezione «Misurare la luce con un LDR» è gratuita?
Sì — il testo completo di «Misurare la luce con un LDR» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso Arduino & IoT Academy, passa a CoddyKit PRO. Il corso Arduino & IoT Academy include 4 lezioni in totale.
Cosa imparerò in «Misurare la luce con un LDR»?
Colleghi un partitore di tensione per leggere la luminosità. Eserciti Arduino & IoT Academy con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.
Ho bisogno di esperienza per iniziare Arduino & IoT Academy?
Non è richiesta alcuna esperienza precedente. Arduino & IoT Academy su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 2 di 4.
Quanto tempo richiede la lezione «Misurare la luce con un LDR»?
La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.
Posso scrivere ed eseguire codice in questa lezione Arduino & IoT Academy?
Sì. Ogni lezione Arduino & IoT Academy include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.
Tutte le lezioni di questo corso
- Leggere un sensore di movimento PIR
- Misurare la luce con un LDR
- Impostare una soglia di luminosità
- Luce notturna automatica