Light meter, need propper formula, please read

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;
int LDRREADING4;
float Resistance = 10.0;
int val = 0;

void setup()
{
  
GLCD.Init(NON_INVERTED);   // load the GLCD library
GLCD.ClearScreen();
GLCD.SelectFont(System5x7);  // choose font to use (note this needs to match the #include above
  countdown(1);
  GLCD.ClearScreen();
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.Puts("#AMAZING LUX METER#");
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");
delay(900);
GLCD.ClearScreen();
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)
{
LDRREADING4 = analogRead(LDRPINA4);
float Vout5=LDRREADING4*0.0048828125;
int lux4=104.1*Vout5;
GLCD.CursorTo(12,3);
GLCD.PrintNumber(lux4);
delay(1000);

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');
    delay(1000);  
  }
}

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

Sixto

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

If you keep multi-posting I am going to have to eat you.

Please only post once in future.

mowcius: If you keep multi-posting I am going to have to eat you.

Please only post once in future.

I call the bones for soup. ]:D

Hi Poli,

Sometime ago, I was involve in a similar problem. Here you have the post: http://arduino.cc/forum/index.php/topic,37555.0.html

I think that you use this formula. However, take into account that the correct value will depends on the resistance of your LDR (notall of them have the same inner resistance), and the resistance that you include in the circuit. So, read the datasheet of your LDR and ajust the values on the formula that you could see in that post.

I never had the opportunity to check the values with a photometer, so if you have one, may be you could test and adjust the results. You could tray to experiment with different resistances and different light intensities an construct your own calibration curves.

Cheers

Poli - if you read here (http://www.emant.com/316002.page), using an LDR for "measuring" anything is a rather bad idea. These things are slow and show a large deviation from part to part. Other light sensors might do better, for example a phototransistor or a specialized IC like the TSL230R - which gives you directly the irradiance over a wide range of values (see the datasheet).

Have a look at this webpage http://roamingdrone.wordpress.com/2008/11/13/arduino-and-the-taos-tsl230r-light-sensor-getting-started/ and the follow-up, http://roamingdrone.wordpress.com/2008/11/28/arduino-and-the-tsl230r-photographic-conversions/ how the TSL230R could be used. You will also get more formulas for converting measurements to more or less meaningful values than you probably want to know... . (I did however not check the formulas given.)

Note especially that all light measuring devices do have a varying sensitivity for different wavelengths. For obtaining comparable results to a professional instrument, you have to make sure that the specific sensor you are using has the appropriate sensitivity curve for the specific measurement. For example, photographic exposure meters do feature a well-defined sensitivity curve making them much more sensitive to "green" colors than, for example, "red" or "blueish" colors (more correctly: to the wavelength corresponding to these colors). This kind of sensitivity curve matches the sensitivity of black-and-white film which, in turn, is based on the sensitivity curve of the human eye.

Note further that most semiconductor-based sensors (including LDRs!) are way too sensitive in the IR-range so they will not report the correct value in most situations without appropriate optical filters applied. A simple example for this IR-sensitivity is any digital camera out there - any webcam has an IR-filter in front of its lens. Yet, you can "see" your IR-remote flashing with a normal webcam because the filters used are normally not good enough.