I'm building a brightness meter using the Arduino UNO. I'm reading the output of the photodiode using a multimeter and getting good stable readings. Increases with light, decreases with less light as it should. But when I try reading with the Arduino serial monitor, the readings don't make any sense. Random fluctuations nothing stable, nor correlating with light levels.
int sensorPin = A0; // select the input pin for the potentiometer
int sensorValue = 0; // variable to store the value coming from the sensor
float temp = 0;
void setup() {
Serial.begin (115200);
analogReference(DEFAULT);
}
void loop() {
// read the value from the sensor:
sensorValue = analogRead(sensorPin);
temp = (analogRead(sensorPin) * 5.0)/1024;
Serial.println(temp);
// stop the program for 1000 milliseconds:
delay(1000);
}
Fluorescent lights? They flicker faster than your eye can see. Some LED lights may also flicker... but probably at a higher frequency but still not too fast for a photodiode.
Your meter will tend to smooth the readings but with the Arduino you'd have to add that to your hardware or software. (And the delay will "kill you" if you are just reading one flickering sample per second.)
Okey. The symbol for a photo diode is usually a diode with and a flash arrow pointing to it as I remember....
Suppose You have used a good application note.
As @DVDdoug DVDdoug says, other light sources likely interfere.