analogRead value oscillate when less than 1.0V

Hello there,

I have been digging the past topics and googled so far but haven’t figured out the way.

I am trying to create an application where I use 470nm photodiode sensor to sense ‘harmful’ blue light from the screen. With my portable multimeter, I have somehow successfully observe the voltage increment, however when the sensor is read from Arduino A0 pin with analogReference(), the value seems to be far from correct.

Basically, when the value is less than 1.0V, input value suddenly seem to oscillate and when I apply the light torch directory, the number stays. I have tried to cover the sensing surface and this occurred as well.

For my setup, I am directory connecting anode of the photodiode to A0 followed by cathode to GND of Arduino.

If you tell me how can I get the stable value even when the voltage is not significant, please let me know!

That screen shot just shows some numbers (you could have just copy/pasted that - doesn’t make it any less meaningless).

What is the oscillation? Between which values? What frequency? What is your sampling frequency? Does the oscillation change as you change the sampling frequency?

Anyway, do go and read the sticky on top of the forum. It’s got listed more to post for an informed answer, and all that is missing (code, hardware, schematics).

kotaroabe: Hello there,

I have been digging the past topics and googled so far but haven't figured out the way.

I am trying to create an application where I use 470nm photodiode sensor to sense 'harmful' blue light from the screen. With my portable multimeter, I have somehow successfully observe the voltage increment, however when the sensor is read from Arduino A0 pin with analogReference(), the value seems to be far from correct.

Please provide a diagram of your circuit showing how its all connected.

wvmarle:
That screen shot just shows some numbers (you could have just copy/pasted that - doesn’t make it any less meaningless).

What is the oscillation? Between which values? What frequency? What is your sampling frequency? Does the oscillation change as you change the sampling frequency?

Anyway, do go and read the sticky on top of the forum. It’s got listed more to post for an informed answer, and all that is missing (code, hardware, schematics).

Hello wvmarle adn MarkT, thanks for the reply.

The code is here; which is Arduino preset code called ReadAnalogVoltage.

void setup() {
 // initialize serial communication at 9600 bits per second:
 analogReference(EXTERNAL);
 Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
 // read the input on analog pin 0:
 int sensorValue = analogRead(A0);
 // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
 float voltage = sensorValue * (1.58 / 1023.0);
 // print out the value you read:Ar
 Serial.println(voltage);
 delay(100);
}

I am using rough voltage of 1.58V to AREF pin in order to use this as a reference for analogPin.
The value oscillate from 0-1023 every one seconds (sorry I don"t have Oscilloscope with me) when there’s less than 0.5V, however when the light is applied and voltage increases the value stays stable.

Please post a schematic of your complete circuit.

wvmarle: Please post a schematic of your complete circuit.

I have attached the diagram created in Tinkercad. And for the components I am using Arduino Uno R3 and GaAsP Photodiode G6262 from Hamamatsu Photonics (http://akizukidenshi.com/download/ds/hamamatsu/s6262.pdf) which I could only find Japanese datasheet.

That's not a schematic, that's a Fritzing diagram. That photodiode (type number?) appears to miss a pull-up resistor. It won't work like that. When that's in place I would expect a 0-5V output range; so you don't need that voltage divider for Aref (which anyway offers you a very poor reference, you're better off without such a reference).

wvmarle: That's not a schematic, that's a Fritzing diagram. That photodiode (type number?) appears to miss a pull-up resistor. It won't work like that. When that's in place I would expect a 0-5V output range; so you don't need that voltage divider for Aref (which anyway offers you a very poor reference, you're better off without such a reference).

Ah sorry my fault. But anyways this photodiode seems register 0 - 1.9V in my environment (indoor with light torch) with my multimeter which I believe is precise enough to prove that this photodiode is working correctly since I can see the transition when light is shone against the sensing surface.

The only problem is that I can observe seemingly right value from the multimeter but when it's connected to A0 AnalogRead, the value simply seems to oscillate. As you suggested, I have tried using pull-up resistor (tried with 100/ 1k/ 20k) but it just ends up reducing the output voltage prominently (from 1.2V to 0.05V).

You may be reading 50 / 60 Hz mains flicker. How does it read under natural daylight, away from artificial lighting?

outsider: You may be reading 50 / 60 Hz mains flicker. How does it read under natural daylight, away from artificial lighting?

Hello there,

I have tried to cover the sensing surface and got a stable 0.005V but got 0 - 60 oscillating value in my serial port. But strangely this '0 - X' value seems to correspond to the intensity of light somehow; if it is under the fluorescent light, it oscillate 0-150 where as covered 0 - 60. Does it give any hints of what is going on?

Please take the sensor outside and read natural light.

jremington:
Please take the sensor outside and read natural light.

I just did and I saw a rather stable value of 243-245.

Again this oscillation is observed when the light is low; when the voltage read in multimeter is low.

Hello everyone who helps me with this. I really appreciate your kindness.

I have attached an image; first half with no light is applied (0.05V is measured with my multimeter) and second half when I shine the surface with light (1.3V - is measured.) As you can see, the value is keep oscillating in a similar manner.

It depends on how you have your photodiode wired exactly (can go both directions for either photovoltaic or photoconductive mode). Your image is ambiguous, it doesn't show how this is done, that's why we ask for a schematic diagram. Actual type of photodiode is also important. Your results and image imply you're using photovoltaic mode, as otherwise you'd need a pull-up resistor. Output in that mode will be very weak in low light, and that may result in the instability you see.

kotaroabe:
I am trying to create an application where I use 470nm photodiode sensor to sense ‘harmful’ blue light from the screen.

What screen, and since when is blue light harmful.
Do you mean UV light (<400nm).
There are special sensors to detect that, like this one or this one.
Leo…

Blue light is bad for sleeping at night. My phone even has an option to "filter" blue light (making its screen radiate less blue).

Don't you have your eyes closed when you sleep. I think moonlight is rather cool-white (lots of blue), and human learned to sleep with that. Morning-red is uhh, red (no blue), and that wakes me up. Once in a blue moon you hear nonsense like that that. Just wait until someone proves it wrong again. Leo..

OK I said that in a wrong way. It's supposedly the evening hours, before going to sleep, that looking at a screen emitting quite some blue light stops you from falling asleep easily when you finally go to bed. Harmful is still a big word for it, but I suppose that's what OP is referring to. Whether it's true or not I don't know. I'm used to staying up way too late after which falling asleep is usually no problem :-)

There is capacitance in the photodiode. You need to have an amplifier with feedback and get rid of the dc offset. It’s tricky to build. It will also need filtering and possibly shielding. Are you using your hands to shade it when you’re checking dark reading?

wolframore: There is capacitance in the photodiode. You need to have an amplifier with feedback and get rid of the dc offset. It’s tricky to build. It will also need filtering and possibly shielding. Are you using your hands to shade it when you’re checking dark reading?

Yes I am using my hand to cover the surface. And while I was doing this, I was checking the output voltage with my multimeter and saw a significant drop in the voltage (0.02V).

And as you suggested, I didn't know that there is capacitance in this sort of photodiode; perhaps this explains the oscillation when in low voltage? After seeing this post, I am trying to filter the value with this DSP filter. https://github.com/JonHub/Filters

Do you have any better solutions to get rid of this oscillation in values? For my application, precision is more important than response speed in general.