← Back to Course
Light Sensors (LDR) for Solar and Greenhouse
☀️ Light Sensors - LDR and BH1750 for Solar Monitoring
Light sensors help optimize greenhouse lighting, track solar radiation, and predict plant growth rates.
🔌 LDR (Light Dependent Resistor) Wiring:
LDR Circuit (Voltage Divider):
3.3V → LDR → A0 → 10kΩ resistor → GND
📖 LDR Light Reading:
#define LIGHT_PIN 34
void setup() {
Serial.begin(115200);
}
void loop() {
int lightValue = analogRead(LIGHT_PIN);
// Higher value = more light (dark = low, bright = high)
int lux = map(lightValue, 0, 4095, 0, 1000);
Serial.printf("☀️ Light intensity: %d lux\n", lux);
if (lux < 100) {
Serial.println("🌙 Very dark - Plants need supplement light");
} else if (lux < 500) {
Serial.println("☁️ Cloudy - Low light conditions");
} else if (lux > 800) {
Serial.println("☀️ Very bright - High solar radiation");
}
delay(60000);
}
📊 BH1750 Digital Light Sensor (I2C):
#include#include BH1750 lightMeter; void setup() { Serial.begin(115200); Wire.begin(); lightMeter.begin(); Serial.println("Digital Light Sensor Ready"); } void loop() { float lux = lightMeter.readLightLevel(); Serial.printf("📊 Light intensity: %.1f lux\n", lux); // Greenhouse recommendations if (lux < 2000) { Serial.println("⚠️ Low light - Turn on grow lights"); } else if (lux > 80000) { Serial.println("⚠️ Extreme brightness - Apply shade cloth"); } delay(60000); }
💡 Light Requirements by Crop:
- High light (40,000-80,000 lux): Tomatoes, peppers, melons
- Medium light (20,000-40,000 lux): Basil, lettuce, spinach
- Low light (10,000-20,000 lux): Mushrooms, some herbs
💡 Key Takeaways:
- Apply these concepts directly to your farm or project.
- Take notes on important details for the quiz.
- Use the button below to track your progress.
×