
Reading a Photoresistor — SIK Circuit 6
Instruções
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
Materiais para este passo:
SparkFun Inventors Kit - V3.21 kit
Arduino Uno R31 peça
Breadboard1 peça
Photoresistor1 peça
5mm LED1 peça
330 Ohm Resistor1 peça
10K Ohm Resistor1 peça
Jumper Wires5 peçasFerramentas necessárias:
Hardware 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.
Materiais para este passo:
Photoresistor1 peça
5mm LED1 peça
330 Ohm Resistor1 peça
10K Ohm Resistor1 peça
Breadboard1 peça
Jumper Wires5 peçasArduino Code
Arduino Code
Open the Arduino IDE and upload the following sketch to your Arduino board.
Materiais para este passo:
Arduino Uno R31 peçaFerramentas necessárias:
Test & 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).
Materiais
8- R$545.00
- 1 peçaReferência
- 1 peçaReferência
- 1 peçaReferência
- Referência
- R$14.00
- R$14.00
- R$22.00
You can swap these in
Can't get one of the materials? Swap it for an equivalent — these work just as well.
- Instead of Arduino Uno R3, try:
Prototyping Shield for Arduino Uno (3-Pack)
Arduino Uno R3 Board
Arduino Uno - Instead of 5mm LED Assortment Kit (300pcs, 5 Colors), try:
WS2812B NeoPixel LED Strip (1m, 60 LEDs)
Diffused LED - 10mm
RGB LED Strip 5050 (5m, Non-Addressable)
LilyPad Tri-Color LED
SMD LED 0603 - Strip of 25
LilyPad LED - 5 pcs - Instead of Photoresistor, try:
LDR Photoresistor (20-Pack) - Instead of Resistor 330 Ohm 1/6 Watt PTH - 20 pack, try:
AVR ISP Shield - PTH Kit - Instead of Breadboard, try:
Solder-able Breadboard
Recommended for this build
Products makers often use with builds like this one.
Push Button - 33mmFrequently used with this build's materials
SoftPot Membrane Potentiometer - 50mmUsed in similar builds
LED - RGB Diffused Common Cathode - 5mmUsed together and in similar builds
PotentiometerUsed together and in similar builds
Diode KitFrequently used with this build's materials
BC547 NPN Transistor (50-Pack)Frequently used with this build's materials
Jumper Wire Kit (350pcs, M-M / M-F / F-F)Frequently used with this build's materials
USB CableFrequently used with this build's materialsRelated blueprints
Other builds that share materials, tools, or techniques with this one.






CC0 Domínio Público
Este blueprint é liberado sob CC0. Você é livre para copiar, modificar, distribuir e usar este trabalho para qualquer finalidade, sem pedir permissão.
Apoie o Maker comprando produtos através do Blueprint, onde ele ganha uma Comissão Maker definida pelos vendedores, ou crie uma nova versão deste Blueprint e inclua-o como conexão no seu próprio Blueprint para compartilhar receita.