Shop OBEX P1 Docs P2 Docs Learn Events
OPT101 PHOTODIODE+OP AMP use as a light meter? — Parallax Forums

OPT101 PHOTODIODE+OP AMP use as a light meter?

SiteRnrSiteRnr Posts: 2
edited 2011-12-13 19:43 in BASIC Stamp
Hello,

I was wondering if anyone knew how to hook up a opt101

(www.alldatasheet.com/datasheet-pdf/pdf/BURR-BROWN/OPT101.html)

to the BS2p ... I am trying to use the opt101 as a light meter and to get basic understanding of the bs2p with analog stuff .. any

info on it ... hardware and software side would be great ... also I want to next hook it up to a AD chip and learn about that aswell

I have been playing around with rctime command but as of yet have not been able to figure out how to hook it up and what to

program to get it to work correctly.


Thank You for your help,
Edgar Cornette

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-02-21 14:59
    If you construct the circuit in the OPT101 datasheet, Figure 1, and run it using +5V,·then you can·connect its output into the circuit that I made at this link:
    http://forums.parallax.com/showthread.php?p=571402
    (at the bottom of the page.)

    ·
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2006-02-21 16:54
    The OP101 is a photodiode/op amp combination and it is meant to provide a voltage output. In that mode it is best applied with an ADC to measure the voltage output.

    It is easy to use raw photodiodes in an RCTIME circuit, because they have a current output that can charge a capacitor.

    The OP101 gives you access to several nodes in the circuit, and I am thinking it would be possible to set it up as an integrator, and read the integration time via RCTIME. The configuration that comes to mind is to connect a capacitor from the op-amp output back to the inverting input. Also connect the op-amp output to Stamp pin p0 (for example). You need a means to reset the integrator. Connect the OP101 internal 1 meg resistor to Stamp pin p1. Making p1 high will reset the integrater and bring the output to p0 low. Releasing p1 to an input will allow the integration. So the program would look something like this:

    INPUT 0
    HIGH 1
    DO
    INPUT 1
    RCTIME 0,0,result
    HIGH 1
    DEBUG DEC result
    PAUSE 1000
    LOOP

    The capacitor would be chosen to give an integration time of something like 10000 microseconds. I have not tried this--just thinking.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2006-02-22 18:29
    Edgar,

    What I was thinking of was something along the lines of the following schematic:

    attachment.php?attachmentid=40568

    -- edited original image to show correct (+) and (-) op-amp inputs.

    The circuit inside the dashed line is contained within the OPT101 chip (including the photodiode, which looks out through the transparent case.

    The capacitor from pin 5 to pin 2 integrates the photocurrent, and produces a rising voltage on the Stamp pin P0.

    The 1M resistor that would normally provide feedback is instead tied to a second Stamp pin. Making that pin an input allows the integrator to operate, but bringing it HIGH forces current into the summing Node and resets the integrator.

    I already posted the code I think will work. The difference from normal usage of RCTIME is that the reset is done on a different Stamp pin, so there is a little delay before the RCtime command starts. The capacitor has to be large enough, which will depend on the light level. And the extra delay has to be taken into account in the calculation.

    I haven't tried this circuit yet, but I do have some OPT101s and might get around to it. Let me know if it works{!}, if you do try it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com

    Post Edited (Tracy Allen) : 2/22/2006 7:01:32 PM GMT
    226 x 183 - 5K
  • SiteRnrSiteRnr Posts: 2
    edited 2006-02-23 00:43
    Hey,

    Thanks for all the info guys... Yes I am going to try that tonight Tracy if I get a chance... I went ahead and ordered some ADC's from digikey just in case i cant get this opt101 to work wel without one... my main goal with this was to be able to tell if a the lights in the room are on or off and to also use one to detect sunrise and sunset and also to make a light meter that will let me check my 1,000 watt high pressure sodium light to see how it puts out with the current reflector and maybe to tel when to replace the bulb as its output lowers with time and it gets to a point that its not putting out near what it was new. well i can think of several more ideas to use this for aswell... if i can just get a handle on how to get what i need out of it ... just take me some time to get up to speed on some of the newer stuff ... i went to school for electronics .. and when i was done .. there was no jobs i wanted to do .. i loved computers (vic-20, commodore 64 , ti994a, my first apple was built by hand). but at the time there was no computer courses anywhere .. so i took the basic building blocks of them ... electronics ... then after school i learned on my own and then when they had courses i got my computer and network engineering degrees.. so now i am back learning some of the stuff i missed in the electronics side [noparse];)[/noparse] so forgive me if i am alittle slow sometimes to catch up.


    Thank You,
    Ed
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2006-03-09 17:56
    It's been a while since this thread was active, but yesterday I tried out the circuit I suggested, and it didn't work. The RCTIME command always returned a value of 1, which means it was crossing the threshold immediately. The oscilloscope revealed that the output was oscillating at a high frequency. That means the op amp is not stable for the unity gain high frequency feedback through the integration capacitor. I tried a couple of compensation schemes, and the one that worked is shown in the new diagram. It is simply a 1st order lowpass filter on the output. The signal input to p0 on the Stamp is taken from the output of the lowpass filter, which is also the connection point for the integration capacitor. The microamp level current develops less than one millivolt across the 470 ohm resistor, so the filter does not affect the accumulation of charge on the integration capacitor, shown as 0.01 uf. That capacitance is good for indoor light levels.

    attachment.php?attachmentid=40776

    I also extended the program with an inner DO loop, because indoor light levels extend over several orders of magnitude. Multiple RCTIME commands in the loop detect longer intervals in dim light.

    wt0 VAR Word
    wt1 VAR Word  ' for extended time acquisition
    INPUT 0
    HIGH 1
    DO
      PAUSE 64  ' pause to reset integrator
      wt1=-1
       DO
          wt1 = wt1+1    ' will show how many RCTIME timeouts occurred
          INPUT 1
          RCTIME 0,0,wt0
       LOOP UNTIL wt0   ' RTTIME times out with wt0=0, repeat loop until it is not 0
      HIGH 1   ' reset integrator
      DEBUG DEC wt1,".",DEC5 wt0,CR
      PAUSE 1000
    LOOP
    





    Edit: added optional R=1kohm for faster reset in bright light, and option of larger capacitor, also for bright light.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com

    Post Edited (Tracy Allen) : 3/9/2006 7:12:34 PM GMT
    247 x 200 - 4K
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2006-03-09 19:08
    I edited my previous post to include an optional 1kohm resistor and an optional larger value of capacitor. Those are needed for bright light, where the photodiode inside the OPT101 will produce a relatively large photocurrent. The 1 megaohm resistor inside the OPT101, connected in this circuit to Stamp p1, will only supply 5 microamps from Stamp pin p1. The optional 1kohm resistor is in parallel with the internal 1 Mohm and allows Stamp p1 to source more current to reset the integrator. The larger capacitor is necessary to slow down the integration in bright light.

    In average indoor room light, the 0.01uf capacitor and the 1Mohm resistor suffice.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • RabeeRabee Posts: 8
    edited 2011-12-13 18:49
    Hi All;
    I am a Ph.d student and part of my project (underwater optical wireless communication) is to design an optical wireless system.

    I am using OPT101 in a reciver circuit based on FSK modulation. I got a problem with the effect of the strong ambient light. Even, I put an optical filter on the OPT101 but the problem still which is the strong ambient light affect the circuit from receiving the correct data. However, with the room light the circuit is working fine and reciving the data correctly but with the strong ambient light the circuit stop reciving data and sometimes just reciving rubbish data.
    I am using XR2206 as FSK modulator at the transmitter and XR-2211 as FSK demodulator at the receiver. Also, I am using the green light at 520nm.

    Any suugesstions and feedback will be appreciated.

    Thanks all
  • ercoerco Posts: 20,256
    edited 2011-12-13 19:43
    Q: Does IR work well under water? It's much better than visible light in air. I'd be tempted to try standard 38 kHz modules under water and see how they work. Some of those are optimized for daylight (ambient sunlight) use.
Sign In or Register to comment.