Maker Pro
Maker Pro

Light sensing with BPW34, TL074, and Arduino

Hi all, long time no see :)

I'm wondering if I can please get some help: I'm trying to make "accurate" (as in highly granular / large range of values) light readings from a BPW34 photodiode, through a TL074, in to an Arduino Mega. Refer attached image for circuit.
IMAG0211.jpg
The approach I'm going for is using the op amp as a transimpedance opamp: the BPW34 apparently has a very linear current response to light, so I'm wanting to convert that current signal in to a voltage of 0v to 5v (which the Arduino analogue input would interpret as values from 0 to 1024)

As it is, the arduino reports about 920 in ambient light, and 850 with a bright lamp shining right at the diode and nothing i do to alter the gain seems to make any difference. The fact it's inverted doesn't bother me so much.

Note the 5K resistor in my circuit diagram: it's my understanding that is meant to adjust my gain: looking at the BPW34 datasheet, and using the Wiki page on transimpedance amps, I see the maximum current is about 1000uA, so using the formula:

233f883c2b91deef893d904959d59735.png

I get a value of 5k for my gain resistor. I've tried a range of resistors though: 500R, 2k, 10k, 50k, and there doesn't seem to be much difference: the Arduino still reads 920 to 850. I tried switching the direction of the diode (just in case) and it just sits at 820 or so when reversed

What I'm expecting to see is a range of values from, say, 100 to 900? 100 to 500 even would be better.. I'm expecting to see a BIG difference from halving or doubling my gain resistor though: that way I can "tune" it to the range of light I will be dealing with.

The fact that it is inverted even though I'm using the non-inverting input doesn't really bother me though I don't exactly understand...

I'm wondering if my problem is related to the unused pins on the TL074. I will eventually use three of the op amps on the chip but for the mean time, I have three unused op amps on the chip: the negative input is connected to the output, and the positive input is connected to ground. (shown in circuit diagram too)

I can see there are alternate ways to wire my op-amp, where I connect the positive leads of diode to Vcc for reverse bias but I believe that decreases the range of sensitivity doesn't it? In other news: the voltage created by the diode goes between 200mv to 400mv.

Thanks for your help!
 

Harald Kapp

Moderator
Moderator
The TL074 is not suitable for this application with only a single power supply. The input common mode range is VCC- +4V, which results in +4V as Vcc-=0V in your design.

What can you do to remedy the issue?
  1. Use a dual power supply with at least -5V...+8V. You'll neeed additional protection to avoid putting a negative voltage or a positive voltage higher tahn 5V on the arduino's input.
  2. Use another opamp which as rail-to-rail inputs and outputs. This type of opamp can be used in a single supply configuration with VCC-=0V.
It is also recommended to connect the "+" inputs of unused opamps in the same package to 1/2*Vcc (with a single supply) to avoid driving the output into limitation (the closed loop from out to "-" input as you show is o.k.)
 
hmm thanks Harald! Much appreciate your time.

That's very impressive you were able to determine the +4V output... I'll read up on what "common mode range" means :)

I thought I had read that the TL074 was suitable for single and dual supply but I guess I would need quite a different circuit to make it work?

So if I find the right op-amp, do you think my circuit is theoretically "OK" (as long as I make those changes to + inputs) ?

A quick Google search shows me that they also make a "TLC074" which is specifically for single supply... and actually searching on "BPW34 single supply op amp" lead me here http://www.instesre.org/construction/TransimpedanceAmplifier/TransimpedanceAmplifier.htm which recommends an LTC1050

Thanks again Harald! I'm glad I've got a way forward once again (with a different op-amp!)
 
Thanks Bluejets: funnily enough I was reading that the other day. That's fine except it only reads a small range: I actually tested this on my Mega, i got values between 40 and 110 or so (from memory) which is probably not coincidentally the same range I am getting with circuit above :) I.e. it's only reading the difference between 200 and 400mV

That would be fine for "on/off" type light sensing but not for what I want to do which requires a bigger resolution/range. Also I want to take advantage of the linear current per light properties of the BPW34. Thanks for searching for me though! Much appreciated
 

Harald Kapp

Moderator
Moderator
"TLC074" which is specifically for single supply
Single supply: yes, but no rail-to-rail output.
Min. common mode input voltage is still 0.5V and min. output voltage is 0.18V. At low lighting (= low current from the sensor didoe) the output may not be able to drive the input voltage differential to 0V, thus driving the opamp into saturation.
The LTC1050 looks promising.
Also this page shows a selection of suitable amplifiers (you may have to set checkmarks for rail-to-rail IN and OUT), other manufacturers have similar selection pages.
 
Thanks all. I love this forum :)

That's a handy function Bluejets I'll keep that in mind but probably wont suit this particular task, i get what yer saying though. I might only be reading, say "81 or 82" and that function could map it to, say 1020 and 1060 or whatever but i still wouldn't get the "inbetween" levels that I'd get from more accurate sensing at the start.

Cheers Harald that's a handy tool! I like where you said the LTC1050 looks promissing: that's enough for me to give it a go i think :) Will let yall know how i get on.
 
With "map" you can take your 850 to 920 range and map it to give 0 to 1023.
The readings may still jump as your sensor is the governing factor in the sensitivity.
You may have to use the suck it and see approach I guess.
 
I got it working! Posting reply for those finding this thread in future and partly just because I'm excited :)

So I went with the LTC1050... FYI if you order some chips from aliexpress and they say "LT1050" they still work (they're probably knock offs!?)

I'm not sure what my "other pins" in my picture at top is for?? ignore that...

And I don't think the orientation of my photodiode is correct above... while the cathode (- negative) is normally the "line" end in the drawing, we're measuring the current flowing in the reverse direction, so that's really the anode (+ positive) in this scenario... so should be the other way round...

The BPW34 has a little "dot" on one side: this is the side I fed to ground/"+ in"

Went with 43k resistor in the end because I want to measure low "inside" light levels. Cover diode with finger: 0v. Shine a light directly at it: 4.9V, and every variation in between... I haven't tested how linear it is, but in theory it should be as linear as the current response.
 
Sorry, one more thing... put a 10 or 100nF non-polar capacitor from Vout to "- in/negative in" when hooking up to Arduino to get rid of analogue read fluctuations (for me it was fluctuating by ±1V or so)
 
Sorry, one more thing... put a 10 or 100nF non-polar capacitor from Vout to "- in/negative in" when hooking up to Arduino to get rid of analogue read fluctuations (for me it was fluctuating by ±1V or so)
I got it working! Posting reply for those finding this thread in future and partly just because I'm excited :)

So I went with the LTC1050... FYI if you order some chips from aliexpress and they say "LT1050" they still work (they're probably knock offs!?)

I'm not sure what my "other pins" in my picture at top is for?? ignore that...

And I don't think the orientation of my photodiode is correct above... while the cathode (- negative) is normally the "line" end in the drawing, we're measuring the current flowing in the reverse direction, so that's really the anode (+ positive) in this scenario... so should be the other way round...

The BPW34 has a little "dot" on one side: this is the side I fed to ground/"+ in"

Went with 43k resistor in the end because I want to measure low "inside" light levels. Cover diode with finger: 0v. Shine a light directly at it: 4.9V, and every variation in between... I haven't tested how linear it is, but in theory it should be as linear as the current response.
Hi @Simon101, I am doing a similar project as the one you posted here, in which i am using BPW34 as light sensor with arduino uno, could you please share with or describe for me the circuit you used to amplify the output to 0-4.9V.
thank you
 

bertus

Moderator
Hello,

Do you get enough sensitivity?
The feedback resistor you use is rather small.
Normaly you would see values from 100K and above.
I have attached a PDF with more info.

Bertus
 

Attachments

  • sboa122_Transimpedance Considerations for High-Speed Amplifiers.pdf
    193.3 KB · Views: 5
This was a while ago for a once off project so I must admit the knowledge has completely escaped me :) But from memory, the circuit originally posted was essentially the same as I used with the LT1050... And I think I found the guidance for that by googling "rail to rail photo diode amp" or something like that...

As for the 43k resistor: that suited my range for "indoor lighting": the 100k suggested might be more suitable for outdoor use? *shrug* good luck I'm sure some actual experts on here can assist :) (i.e. I'm really just a hack haha)
 
Top