I've composed a schematic for measuring ambient light intensity using a BPW34 photo diode (Osram brand) and a TLC271ACP opamp. The output will be read using an ADC entrance of an MCU, so VDD = 5V here. Being a digital engineer, I have a hard time understanding the workings of the opamp, but this is what I came up with after googling my way through internet (I understand it's called an inverting amplifier):
I've built the circuit on a breadboard and it almost works: I'm seeing the voltage on IN- change from 0 to 400mV when increasing light intensity, but the OUT signal remains at 0V. Until I remove the resistor and capacitor that is, after which the output reads 2.25V in the dark and moves to 0V when turning up the light. Shouldn't the voltage go up to 3.8V (for a non-rail-to-rail opamp)? (I tried using a 100k and a 10k resistor instead, but I only get a non-0V output when leaving the resistor out)
Instead of a light sensor the circuit now behaves more like a darkness sensor: the voltage starts to go up only when it's starting to get dark, but independent of the light intensity being medium or bright, it always reads 0V when there is a minimal amount of light. How to fix this?
And I don't know what to do with the BIAS_SELECT and OFFSET pins: bias is now low (by connecting BIAS to 5V, but switching it to GND doesn't make a difference that I see. And I don't think I need the OFFSET (nulling) function, so I left them open for now. Or should I connect them both to GND using 12k resistors (putting the "pot-meter" in the middle, so to say)?
Update: turns out the diode indeed was switched: I read 'cathode marked' in the datasheet and assumed it was the little dot on top, while it actually was on the pin.
After that I did some dimensioning on the resistor (I'm sure there is a formula for that) and it turns out that 200k works best, giving a response from 0V for very dark up to 4.2V for very bright light. All set! Tnx all!