Photodiode Measurement with PIC, Help

Thread Starter

atakan1907

Joined Jan 23, 2011
9
Hi,
Im trying to measure light using a standard LED, an OPAMP a feedback resistor and PIC16F690. When i connedted the led to opamp, it shows good values. Then i connected its output to pic, and measure, it fails. Altought i read the actual value as 5mv aproximately, the pic measurements are 0, 0, 130, 0, 150, ----- (of 1024). I'm working for two days but nothing changed. The circuit i built like below. (the led reversed in mine) The feedback resistor is 20MΩ. Maybe i can extend the hold capacitor charging time in pic. Please tell me the problem.
 

Attachments

mcgyvr

Joined Oct 15, 2009
5,394
You have a 10bit ADC in your PIC micro.. You should be getting values from 0 to 1023.. You need to write code in the pic for converting that back to a voltage. Sounds to me like its working as it should.
 

Thread Starter

atakan1907

Joined Jan 23, 2011
9
I attached the required part of the circuit. There is a LCD also. Where this noise come from? How can i supress it. I used a software filter also but it failed too. I collected 8 samples and sorted lower to higher, ignored first and last two values and take the average of other 4 samples. But still absurd values came frequently.
Then added the dashed components, the rc filter help some but not exactly.
 

Attachments

Thread Starter

atakan1907

Joined Jan 23, 2011
9
Ok, i got stable results by connecting 100uF and u1F to ±9v supply and one 3n3F across 10MΩ feedback. I used to connect 100pF before. As i told, im using a software filter;
1)sample 8times,
2)sort samples in ascending order,
3)average the middle 4 numbers
Now everything looks okay =)
 

SgtWookie

Joined Jul 17, 2007
22,230
Do you have bypass caps across your PIC Vdd/GND terminals?
Is the ground connection between the ground side of D1, and the analog ground or ground of the PIC, a very good connection?

Do you have bypass capacitors from the +V and -V opamp supply to analog ground?

Do you have a 10nF capacitor from the PIC adc input to the analog ground or ground of the PIC to keep the voltage stable?

Do you put the PIC in sleep mode when starting the ADC sample?

Are you certain that you are reading the correct I/O pin with the ADC? Can you give the I/O pin a fixed voltage and read it?

Is your wiring long? Noise picked up on long wires will cause strange ADC readings.
 

Thread Starter

atakan1907

Joined Jan 23, 2011
9
Yes i put the pic in sleep mode at the start of the convestion.
No cap on analog input.
And its better to make a strong connection of diode and pic grounds.
Thank You ;)
 
Top