# Opt101

Discussion in 'The Projects Forum' started by potentialeemajor, May 30, 2014.

1. ### potentialeemajor Thread Starter New Member

May 27, 2014
3
0
Does anyone know how to set up an opt101 with an arduino? My project is to measure light intensity, so it's pretty straight forward.

Apr 5, 2008
18,899
3,718
Hello,

The datasheet gives you a lot of information:
http://www.ti.com/lit/gpn/opt101

I do not know the arduino, but I suspect it to have an ADC on the board, wich you can use the voltage related to the amount of light.

Bertus

3. ### djsfantasi AAC Fanatic!

Apr 11, 2010
3,639
1,321
The Arduino Uno has six analog/ADC inputs. From the Arduino site:

"The Uno has 6 analog inputs, labeled A0 through A5, each of which provide 10 bits of resolution (i.e. 1024 different values). By default they measure from ground to 5 volts, though is it possible to change the upper end of their range using the AREF pin and the analogReference() function."

4. ### DickCappels Moderator

Aug 21, 2008
5,071
1,552
This is a fine old Burr-Brown part.
Connect ground (3 and 8) to ground.
Connect pin 1 through a 100 ohm resistor to +5V.
Connect a 100 uf capacitor from pin 1 to pin 3.
Connect a 0.1 uf ceramic capacitor from Pin 1 to pin 3
Connect pin 5 to pin 4.
Do not connect pin 2 to anything yet.

Connect pin 5 to an A-to-D converter input; the rest is up to your programming skills.

If the sensor is too sensitive, connect a resistor from pin 5 to pin 2. Try 100k, if its still too sensitive, reduce the resistor further.

If you are using a 3.3 volt power supply, the instructions above still apply, just substitute "3.3 volt" for "5 volt"

KRSNA and potentialeemajor like this.
5. ### Fibonacci New Member

May 23, 2014
25
5
According with opt101 datasheets, it outputs a (Vs) - 1.3 V. If you set Vs = 5 V, then the output voltage from the photodetcor will be 5 - 1.3 = 3.7 V. The analogRead() instruction can measure between 0 - 5 volts, and return an integer between 0 and 1023 relative to the measurement. When Arduino detects 3.7 volts in A5, for example, it returns a value: (3.7/5)*1023 = 757. This number is what you need to decide what to do. There are several answers to this, for instance, turn on a LED, display a message in a LCD display or send to the PC to a COM port. Use a variable to read, for example, voltage =analogRead(5); then another to convert: actualvoltage=(voltage/3.7)*1023; no need to initialise input analogue pin, only outputs. In the void loop use an IF THEN ELSE structure to decide.

6. ### DickCappels Moderator

Aug 21, 2008
5,071
1,552
No. The output is with respect to the noninverting input, not the power supply pin.

7. ### potentialeemajor Thread Starter New Member

May 27, 2014
3
0
Thank you so much. This worked.

Now when I get the output voltage, how do I convert it to light intensity (irradiance).

I know that the area of the photodiode is 5.2mm^2. Since irradiance is W/m^2, do I get the power from Vout^2/Rload? Or would it be Vout^2/Rfeedback?

Thank you again

8. ### DickCappels Moderator

Aug 21, 2008
5,071
1,552
Doing that even half-right is not easy.

For starters, you have to measure the amount of light under the photopic curve http://en.wikipedia.org/wiki/CIE_1931_color_space

To do this, the light must pass through a color filter, the response of which when convolved with the spectral response of the Opt101 gives a photopic response. Alternatively, you can use a diffraction grating or even a prism to spread out the spectrum and step the angle of the grating to measure the light output at various wavelengths. Correct for both the OPt101's spectral response and the photopic curve and integrate all of the corrected measurement.

Now that you can measure in relative photmetric units, you need to use a diffusor that will collect light over 180° -half a white ping-pong ball should work for that.

The best way to calibrate the whole thing is to borrow an illuminance meter and try to get correlation with a few different kinds of light sources.

Simpler method: Skip all the correction according to wavelength and apply the ping-pong ball, then compare your insturment's readings to those of a calibrated illuminance meter for different light sources. As long as the spectral distribution of the light you measure is the same as that for which your instrument is calibrated, the calibration will be valid.

9. ### Benjamin Holland New Member

May 6, 2015
4
0
Hi, would you mind explaining to me the reason for the 2 capacitors between pins 1 and 3, and also the resistor in series with the power input? I don't see the resistor in the data sheet, and while using capacitors is referenced, I don't understand what these two do, and under what conditions they would be necessary, like what sorts of power supply characteristics, etc. Thanks so much.

10. ### DickCappels Moderator

Aug 21, 2008
5,071
1,552
The power source is unknown and one resistor helps remove noise if there is any on the power supply line (AVRs pull lots of peak current in fast rise and fall spikes) and it is not a high price to reduce the chances of the not having a good experience.

11. ### Benjamin Holland New Member

May 6, 2015
4
0
That makes sense. Much appreciated. What about that 100 uf capacitor you have between pins 1 and 3 in addition to the 0.1 uf capacitor. On figure 5 of the data sheet I only see "0.01 to 0.1 uf" listed.

12. ### DickCappels Moderator

Aug 21, 2008
5,071
1,552
I am not in any way responsible for the datasheet It is usually ok to improve on the datasheet recommendations.

The main reason is that the 100 uf assures that the amplifier sees a low impedance power supply across a wider range of frequencies than a .01 or .1 uf cap would.

May 6, 2015
4
0
Thank you.

14. ### Benjamin Holland New Member

May 6, 2015
4
0
Ok I have it all wired up and it is maxing out at about 850/1023, so about 4.15 volts. Above you say that output is with respect to the non-inverting input, not the supply pin voltage. How would I go about changing the high output to closer to 5V. It's not essential, but if it is easy I would like all the resolution I can get...