Pages: [1]   Go Down
Author Topic: Light meter project, get the right lux  (Read 1300 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 34
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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:
Code:
#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


Logged

Red Sea, Saudi Arabia
Offline Offline
God Member
*****
Karma: 12
Posts: 579
..On The Red Sea
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

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.
Logged

Regards, Terry King  ..On the Red Sea at KAUST.edu.sa
terry@yourduino.com  LEARN! DO! (Arduino Boards, Sensors, Parts @ http://yourduino.com

0
Offline Offline
Shannon Member
****
Karma: 214
Posts: 12406
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

[ I won't respond to messages, use the forum please ]

0
Offline Offline
Newbie
*
Karma: 0
Posts: 34
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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


* DSC_00013.jpg (285.76 KB, 2048x1536 - viewed 21 times.)
Logged

Red Sea, Saudi Arabia
Offline Offline
God Member
*****
Karma: 12
Posts: 579
..On The Red Sea
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Maybe take a look at the spec sheet pointed to here: http://arduino-direct.com/sunshop/index.php?l=product_detail&p=135

Down a few pages and table of characteristics...
Logged

Regards, Terry King  ..On the Red Sea at KAUST.edu.sa
terry@yourduino.com  LEARN! DO! (Arduino Boards, Sensors, Parts @ http://yourduino.com

0
Offline Offline
Newbie
*
Karma: 0
Posts: 34
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

this is the datasheet
http://www.datasheetarchive.com/NORP-11-datasheet.html

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

Regards
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 220
Posts: 13836
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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 smiley-wink
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

0
Offline Offline
Newbie
*
Karma: 0
Posts: 34
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

is the norp 13.

what can I do now?
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 220
Posts: 13836
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

find the datasheet?
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

0
Offline Offline
Newbie
*
Karma: 0
Posts: 34
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

yes i did, here is the datasheet:

http://www.datasheetarchive.com/NORP-11-datasheet.html
Logged

Pages: [1]   Go Up
Jump to: