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.
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.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
Thank you so much. This worked.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"
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.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"