
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 အစုံလိုအပ်သော ကိရိယာများ:
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 ခုလိုအပ်သော ကိရိယာများ:
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 ခုနေရာယူပစ္စည်း
- မှစ၍$1.22
လိုအပ်သော ကိရိယာများ
1- နေရာယူပစ္စည်း
CC0 အများပိုင်
ဤအစီအစဉ်ကို CC0 အောက်တွင် ထုတ်ဝေထားသည်။ ခွင့်ပြုချက်မလိုဘဲ ကူးယူ၊ ပြင်ဆင်၊ ဖြန့်ဝေ နှင့် အသုံးပြုနိုင်သည်။
အစီအစဉ်မှတစ်ဆင့် ကုန်ပစ္စည်းများဝယ်ယူ၍ ဖန်တီးသူကို ပံ့ပိုးပါ ဖန်တီးသူ ကော်မရှင် ရောင်းချသူက သတ်မှတ်သည်၊ သို့မဟုတ် ဤအစီအစဉ်၏ ဗားရှင်းအသစ်ဖန်တီး၍ ဝင်ငွေခွဲဝေရန် သင့်အစီအစဉ်တွင် ချိတ်ဆက်မှုအဖြစ် ထည့်သွင်းပါ။