PDA

View Full Version : Adc giving widely flactuating values



tamersoss
- 16th December 2006, 14:02
Hi freinds ...
Here is a code i made to measure temperature using a thermocouple and a two stage opamp amplifier ... Using my avo the amplifier gives 0.03 V at 0.c to 3.13 V at 300 0.c , I uses a pic16f877a , the problem is that i get on my pc a great fluctuation of values which is about 40 increments ... I don't know the impedance of my analog circuit ... How can i measure it ? Please tell me if the settings has something wrong ... Can you explain the effect of adjusting sampling time ? ... Many thanks for caring ... Bye

DEFINE OSC 20
trisa=255
DEFINE ADC_BITS 10
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 100
temp var word

adcon1=%10000000
loop :
adcin 0,temp 'measure temperature
serout portB.7,4,["C",temp.byte0,temp.BYTE1] 'send result to PC
pause 20
goto loop

mister_e
- 16th December 2006, 14:05
Could you post your schematic here?

tamersoss
- 16th December 2006, 14:16
see the .doc file

mister_e
- 16th December 2006, 14:22
In theory, the impedance of your circuit is the impedance of your LM324 output. Few tenth of ohm from what i remind. So it shouldn't be the problem.

What happen if you place a 0.1uF between pin 3 of your LM324 and GND?

Can you monitor the LM324 output with a scope and post a screen-shot of it here?

tamersoss
- 16th December 2006, 14:32
It didn't help ... The flactuation is the same ... I only want tell you that i made a mdification on the schematic which is that i replced the 70 k by a 100 k resistor

sougata
- 16th December 2006, 16:00
Hi,

If you are using your VDD as Vref for the ADC then it is important that your power supply is clean and steady. Because that effects your overall conversion accuracy. General remedies are decoupling caps on the VDD-VSS pins of your PIC and a stable source.

As steve mentioned there could be noise from the op-amps output too. So decouplers for them as well.

skimask
- 16th December 2006, 19:35
It didn't help ... The flactuation is the same ... I only want tell you that i made a mdification on the schematic which is that i replced the 70 k by a 100 k resistor


Have you tried using a bit of software averaging? Read the input a bunch of times, sum the total of the reads, divide by the number of reads, use that number. I know it's not a perfect solution, but it's always worked for me (read that as I'm compensating for bad circuit design :) )
JDG

tamersoss
- 16th December 2006, 20:25
I tried using averaging software but still the results are unsatisfactory ... However , i want to know the reason why my avo reads the amplified signal accurately while the adc gives a great flactuation ... Can any body tell me about sampling time ?

sayzer
- 16th December 2006, 21:44
Some people may not agree on this but,

Have a cap on ADC pin.

Try from 10uF to 220uF. (Cap+ to ADC pin, Cap- to GND.)

and, change Pause 20 to Pause 500.


Please do not forget to post your results here.


----------------------

mister_e
- 17th December 2006, 08:59
thermocouple are sometimes tricky to read. I would suggest you to read Microchip AN684 and AN844 appnotes. You should find some interesting information. Also the following should be familiar...
http://www.delabs-circuits.com/cirdir/theory/tutors/doc00024.html

If it was me, i would use a dedicated Thermocouple A/D convertor instead... but it's me..

If you don't have any scope to see what's happen on the supply line and on the LM324 pin... it's like fishing in the dark...