
Reading a Photoresistor — SIK Circuit 6
Інструкції
Parts & Introduction
Parts & Introduction
A photoresistor (or LDR — Light Dependent Resistor) changes resistance based on light levels. Combined with a fixed resistor, it forms a voltage divider that the Arduino can read as an analog value. You'll use this to control LED brightness automatically.
Parts Needed
- 1x Arduino Uno + USB cable
- 1x Breadboard
- 1x Photoresistor
- 1x LED (any color)
- 1x 330Ω Resistor
- 1x 10KΩ Resistor (for voltage divider)
- 6x Jumper Wires
Матеріали для цього кроку:
SparkFun Inventor's Kit - V3.21 набірНеобхідні інструменти ({count})
Computer with Arduino IDEHardware Hookup
Hardware Hookup
Wiring Instructions
- Connect one side of the photoresistor to 5V.
- Connect the other side to Analog Pin A0.
- Connect a 10K resistor from Analog Pin A0 to GND (this completes the voltage divider).
- Connect the LED positive leg to Digital Pin 9 (PWM-capable).
- Connect the LED negative leg through a 330Ω resistor to GND.
The voltage divider produces a voltage proportional to light level, which the Arduino reads as 0-1023.
Матеріали для цього кроку:
Breadboard1 штука
Jumper Wires5 штукArduino Code
Arduino Code
Open the Arduino IDE and upload the following sketch to your Arduino board.
Матеріали для цього кроку:
Arduino Uno R31 штукаНеобхідні інструменти ({count})
Computer with Arduino IDETest & Experiment
Test & Experiment
What You Should See
The LED brightness changes based on ambient light. Cover the photoresistor to dim or brighten the LED (depending on orientation).
Troubleshooting
- LED stays dark: Check LED polarity. Also verify the photoresistor is in the circuit correctly.
- Not responding to light: The photoresistor spacing is non-standard — make sure both legs are making good contact.
- Subtle changes: Try using a flashlight or covering the sensor completely for more dramatic results.
Experiments to Try
- Uncomment
autoTune()to let the Arduino automatically calibrate to your lighting conditions. - Use the sensor to trigger actions at specific light thresholds (e.g., turn on a "night light" when dark).
Матеріали
8- SparkFun Inventor's Kit - V3.210% комісія1 набір$108.84
- від$9.76
- від$4.27
- від$27.80
- 1 штукаЗаповнювач
- від$3.66
- 1 штукаЗаповнювач
- від$1.22
Необхідні інструменти
1- Заповнювач
CC0 Суспільне надбання
Це креслення випущено під ліцензією CC0. Ви можете вільно копіювати, змінювати, поширювати та використовувати цю роботу для будь-яких цілей без запиту дозволу.
Підтримайте мейкера, купуючи продукти через його креслення, де він отримує Комісію мейкера встановлену вендорами, або створіть нову ітерацію цього креслення та включіть його як зв'язок у власне креслення для розподілу доходу.