Light meter project, get the right lux

Hi Everybody, I am Working on a light meter, I have Just “finished it” but I borrowed a real Lux meter and the values I get from the arduino are totally different… the formula I used is one I found in some other post.
This is the code I have used for the lux meter:

#include <ks0108.h> //  library for LCD
#include "SystemFont5x7.h"   // we need this for character display, included with ks0108.h download
int LDRPINA4 = 5;
float Resistance = 10.0;
int val = 0;

void setup()
GLCD.Init(NON_INVERTED);   // load the GLCD library
GLCD.SelectFont(System5x7);  // choose font to use (note this needs to match the #include above
GLCD.DrawRect(0, 0, 127, 63,BLACK);
GLCD.CursorTo(1, 1);
// set cursor to top left of LCD (uses character coordinates
// not pixel coordinates
GLCD.Puts("   Welcome To The"); // sends strings to LCD. Does not wrap to next line!
GLCD.CursorTo(1, 2);
GLCD.CursorTo(0, 3);
GLCD.Puts("Project Developed by:");
GLCD.CursorTo(1, 4);
GLCD.Puts("Sixto Llorens Zabala");
GLCD.CursorTo(1, 5);
GLCD.Puts("Student No: 08154978");
GLCD.DrawRect(0, 0, 127, 63,BLACK);
GLCD.CursorTo(1, 1);
GLCD.Puts("Lux Given in Lumens "); // sends strings to LCD. Does not wrap to next line!
GLCD.CursorTo(1, 3);
GLCD.Puts("       LUX\t=");
void loop(void)
float Vout5=LDRREADING4*0.0048828125;
int lux4=104.1*Vout5;

delay (20);

void countdown(int count){
  while(count--){  // do countdown  
    GLCD.CursorTo(10,3);   // first column, second row (offset is from 0)
    GLCD.PutChar(count + '0');

Please can anyone help me on it? can anyone suggest me where I went wrong? or what formula will be giving me the right answer?
By the way, I am using analog input A5… does that affect? This is because in the other posts everybody uses the analog input 0, but because I am using a GLCD my analog input 0 has been used for the screen.

I really want to get this project done as I have been working on it for quite a while now, has anyone attempted it? And got the right values?

Thanks in advance


Sorry for my english, Im spanish and I struggle to write it properly


What sensor are you using, and what is the information on it's response to different light levels???

Remember that the Analog reading will be between 0 and 1023. You need a clear understanding of how THAT relates to LUX and then do your calculation.

What colour light are you sensing? Lux is well defined for a particular wavelength of green light - different sensors will have different spectral sensisitivities (unless very expensive calibrated units). Cheap sensors will have poor accuracy and need calibrating anyhow.

No all analog inputs are the same, there is only on ADC unit on the chip.

find the attached picture, thats the LDR i am using, but i am not getting those value you where saying, my max value is about 515 and my min about 120, the thing is that when I used a 16x2 lcd I was getting the values you where saying… do u know why i am not getting those?

Kind Regards


There are many similar Photo Resistive sensors. Can you find the type number??

Maybe take a look at the spec sheet pointed to here:

Down a few pages and table of characteristics...

this is the datasheet

I dont know which of them it is as I got it given by university but they are simmilar together.


I dont know which of them it is as I got it given by university

Maybe you should ask the person you got them from ;)

is the norp 13.

what can I do now?

find the datasheet?

yes i did, here is the datasheet: