# Light Measurement With Arduino, LDR and LCD

All we have done for the circuit is adding one LDR and 10K Ohm resister. We added three jumpers to three empty columns on the breadboard. Then connected GND of Arduino to one leg of LDR. Arduino’s A0 pin at the middle column where another leg of LDR and one leg of 10K Phd resistor inserted. Remaining one got connected to 5v of Arduino and the 10K Ohm resistor.
In our case equation to calculate Resistance of LDR, is [R-LDR =(R1 (Vin – Vout))/ Vout], where R1 = 10,000 Ohms, Vin = 5.0 Vdc, Vout = Output voltage from potential Divider, [Vout = Reading * (Vin / 1024)].
It will be extremely wrong to claim it as LUX. It is just a measurable unit

### Principle of Light Measurement With Arduino, LDR and LCD

The analog input pin of Arduino is capable of receiving the signal and printing the voltage on LCD. Omitting many steps, analog pin can send a value between 0-1023 to the Arduino. You’ll get total 1024 values. From V=IR, we can change the potential drop across the LDR and to limit the current, we used 10K Ohm resistor.

CODE

#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 8, 9, 10, 11 , 12);
float RLDR;
float Vout;
float Lux;
void setup() {
lcd.begin(16, 2);
}
void loop() {
Vout = (sensorValue * 0.0048828125);
RLDR = (10000.0 * (5 - Vout))/Vout;
Lux = (RLDR/500);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("LIGHT : ");
lcd.print(Lux);
delay(100);
lcd.setCursor(0, 1);
if ((Lux >= 0) && (Lux <= 5))
{
lcd.print("DARK");
}
else if ((Lux > 5) && (Lux <= 14))
{
lcd.print("DIM");
}
else if ((Lux > 14) && (Lux <= 50))
{
lcd.print("BRIGHT");
}
else
{
lcd.print("VERY BRIGHT");
}

delay(500);
}