at the beginning (time < 500), both sensors are working fine
when I turned a light off (400 < time < 700), both sensors returned lower values, but the output values do not overlap
when it is dark (700 < time < 1000), both output values are very closed to zero
After I turned on the light (1000 < time < 3100), output values of LDR light sensor jumped to 76x, even I turned a light off, LDR light sensor can not output lower values
dark again (time > 3100), both output values are very closed to zero
My LDR light sensor, is a new sensor, never returns values higher than 76x. I have two LDR light sensors, they are all have the same problems.
Anyone could tell me what's the problem of my LDR light sensor? Am I bought bad sensors? Should I need to change my code, which is simply the analogRead(LDR_LIGHT_PIN)?
IMHO, the problem is in design LDR brick light-sensor, even I don't have complete schematic of their unit, but what they say on page http://arduino-info.wikispaces.com/Brick-LightSensor
LM324 - used as amplifier, which isn't rail-to rail. Data sheet for OPA says that maximum output voltage for power +5V is 3.3 / 3.5V, this is why you can't get more than 76X .
Are the any reason you need to keep this shield instead of connected separate LDR (I mean just light sensitive resistor) and resistor? You always can calibrate your setup by adjusting external resistor or use a pot.
The value is stable or not is not my key focus point. Thank you for giving me the hint for solving the future problem.
Now I know the reason why my LDR light sensor can only reach max 76x. But there is still a question......I don't understand why the LDR light sensor can work properly at the beginning, but after I turned off lights and then turn on the light, it cannot work properly anymore.... the return value is always 76x no matter how many lights has been turned on, that is, the illumination of the room is changed, but the LDR sensor always ouput 76x........ the only exception is when the room is totally dark, it returns 0.
Wish I could use the LDR light sensor instead of the LDR + 1k Ohm resistor + breadboard.
Effect, as you described it, likely related to big time constant of the circuitry. Which is completely LDR sensor bias resistor fault selection , or could be some on-board electrolytic cap If there is any, as I don't have a schematic and can't see reverse side of the board. (probably you can post high resolution pictures both side of the board).
Ether way, it's design flow, prototype should be tested thoroughly before production.
The UNO and the Sensor Shield are the Arduino official products. The Phidget light sensor works fine. So, I think you need the picture of LDR light sensor.
Let me know, if I need to provide more detailed information.
Shield isn't the same with shield you posted a link to in first post. I was hoping get better quality pictures, can't see a trace. IMHO, it's unlikely, you can do anything in order to fix it.
The image of my LDR light sensor (the latter one) is different my first post. Do you mean you need the image from different angles?
I used a 100K ohms resistor + LDR and get the following results http://alturl.com/dt2zt
I'm not sure whether the lux equation is correct or not. Here is my code:
#define LDR_LIGHT_PIN A1
#define PHID_LIGHT_PIN A4
/*----( SETUP: RUNS ONCE )----*/
void setup()
{
pinMode(LDR_LIGHT_PIN, INPUT); // for LDR light sensor
pinMode(PHID_LIGHT_PIN, INPUT); // for Phidget lighet sensor
Serial.begin(9600); // Enable the Serial data output
Serial.println("#------- Test Light Sensors ---------");
Serial.println("#time (sec), LDR, Phidget Precision--");
}
/*--(end setup )---*/
/*----( LOOP: RUNS CONSTANTLY )----*/
void loop()
{ char str[40]; // string for results printing
// calculate the voltage, v_out = analog reading * 5V / 1024
float v_out = analogRead(LDR_LIGHT_PIN) * 0.0048828125;
// calculate the illumination, 100K Ohms,
int lux = 500 / ( 100.0 *( (5.0 - v_out) / v_out ) );
// print the luminous
sprintf( str, "%06ld, %4d, %4d \0", millis()/1000, lux, analogRead(PHID_LIGHT_PIN) );
Serial.println( str );
delay(5000); // Wait 5 second
}
/*--(end loop )---*/
Don't think this is correct equation.
Basically, there are two variable:
LDR resistance , which is depends on specific chemistry of the sensor. You should make your research on what material LDR made from, how resistance of given sensor depends on LUX. Most cases it isn't linear, but could be approximated to linear with log scale. If you get a formula
R = f (LUX), next task would be transform resistor values to voltage, that arduino can measure.
Voltage output of resistor divider, composed of LDR and constant resistor. Voltage output is depends of both resistors values, and is not linear too.