> From: Edson Brusque[SMTP:brusque@HOTPOP.COM] > Sent: Friday, January 02, 2004 3:58 PM > To: PICLIST@MITVMA.MIT.EDU > Subject: [EE]: How to measure light? Phototransistor? > Hello everyone, > I'm scratching my head for some days but still haven't found a > simple and working solution to measure the light level on a given ambient. > I've been trying it with this circuit: > +5V > | > C > E(phototransistor) > | > +----ADC(PIC) > | > 10k(resistor) > | > GND > > But the results haven't been that good. Lots of noise and very poor > linearity. Also, I've tried I->E (current->voltage) converters using > opamps but still nothing have convinced me. > To easy the implementation simplicity is very desirable. I don't > need a precision circuit and I don't need to convert the readings in lux > or any other real-word value. Phototransistors convert photons to electrons, which means current output. You really should use a current-to-voltage converter. A simple one could be made by connecting the emitter of the phototransistor (in your circuit above) to the base of a transistor which has its emitter grounded. Put a resistor from the collector to +5 volts. The collector voltage will be +5 volts minus the product of the collector resistor and the collector current. The collector current will equal the photo current times the beta (hfe) of the converter transistor. One problem would be saturation of the transistor by the ambient light current. This can be taken out with a resistor from base to ground (emitter). This will subtract a constant from the collector voltage; adjust this resistor so that ambient light puts the collector voltage at +2.5 volts. Also, protect both transistors with a resistor in series with the photo transistor. A good opamp solution can be made with the LM3900. It works from 5 volts and has current sinking inputs. Connect the phototransistor to the plus input of one of the amplifiers (the chip has 4), and a feedback resistor from the output to the inverting input. Additional current into the inverting input will subtract an offset from the output, and choosing the value of the feedback resistor will allow setting the gain. John Power -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.