Monday, 12 June 2017

HOW TO CONVERT THE LDR (Light Dependent Resistor) VALUE TO LUX

Q) What is LUX?

The lux (symbol: lx) is the SI unit of illuminance and luminous emittance, measuring luminous flux per unit area. It is equal to one lumen per square metre. In photometry, this is used as a measure of the intensity, as perceived by the human eye, oflight that hits or passes through a surface.

Q) What is LDR?

A photoresistor (or light-dependent resistor, LDR, or photoconductivecell) is a light-controlled variable resistor. The resistance of a photoresistor decreases with increasing incident light intensity; in other words, it exhibits photoconductivity. A photoresistor can be applied in light-sensitive detector circuits, and light- and dark-activated switching circuits.
LDR Sensor
LDR SYMBOL



We can connect the LDR to the Analog Pin of any micro-controller and in few steps we can directly convert the value to the illumination (lx).


Connection for LDR

Connection

  1. Connect LDR and Resistor in Series (Take resistance of value 10K).
  2. Now Ground one pin of the LDR (Which is not coonnected to Resistor).
  3. Connect one pin of the resistance to power supply that is not connected to LDR (Do not connect it to higher power supply than the micro-controller usually +5V).
  4. Connect the common pin of LDR and of RESISTOR to the Analog PIN of the micro-controller.

CALCULATIONS INVOLVED

  1. RL=500/lux
  2. V0=5*(RL/(RL+R))
  3. V0=LDR_value*ADC_value
  4. lux=(250/V0)-50
Where: 
  • RL is the resistance of LDR
  • R is the resistance connected to LDR
  • LDR_value is the Analog value read by micro-controller pin
  • ADC_value is system_voltage/Resolution of ADC
  • V0 is the analog measured voltage
  • lux is illumination calculated

A sample example using ARDUINO UNO micro-controller

CODE
OUTPUT


Copy the code


/*  RL=500/lux
 *  V0=5*(RL/(RL+R))
 *  V0=LDR_value*ADC_value
 *  lux=(250/V0)-50
 *  Author: Ashish Kumar 
    Org: INVOOTECH                  */
float lux=0.00,ADC_value=0.0048828125,LDR_value;

void setup() {

  pinMode(A0,INPUT);    //make analog pin A0 as input

  Serial.begin(9600);   //initialize serial monitor

}

void loop() {

  LDR_value=analogRead(A0);

  lux=(250.000000/(ADC_value*LDR_value))-50.000000;

  Serial.println(lux);

  delay(1000);

}


1 comment:

  1. If I use different values of resistor, can I still use the same formula for lux calculation?

    ReplyDelete

SERVO MOTOR CONTROL USING PIC16F877A (with 20MHz Crystal Oscillator)

SERVO MOTOR CONTROL USING PIC16F877A SERVO MOTOR Servo motors are used to control many things as it offers very precise rotation o...