EmbeddedRelated.com
Forums

AD with 12F675 fluctuations

Started by d1camero April 8, 2004
I am trying to measure 10-15volts to 0.01 volt accuracy. I am
using the built-in 10bit ADC on the 12F675 with 1% tolerance
resistor voltage divider.

I find that the values fluctuate way more than expected, +/- 0.03
volts. The voltage is coming from a regulated power supply and I
have verified it with 2 DVMs, and it seems quite steady.

Here are some things I have tried:

1. changed power supplies - no difference

2. put up to a 1 second sleep after going into AD read mode - no
difference.

3. averaged 5, 10 and 50 samples - this has reduced the quantity of
fluctuations, but not the magnitude.

4. Tried a different development board - no change. 5. Changed the sample rate of the ADC to its max (250us) no change. Any comments or suggestions?

thanks
d1




There are some app notes for the 12F675 for doing higher accuracy A/D
conversions here:
http://www.microchip.com/download/lit/pline/picmicro/families/12f6xx/40040b.pdf
Perhaps they might give you some ideas...
- Don

d1camero wrote:

>I am trying to measure 10-15volts to 0.01 volt accuracy. I am
>using the built-in 10bit ADC on the 12F675 with 1% tolerance
>resistor voltage divider.
>
>I find that the values fluctuate way more than expected, +/- 0.03
>volts. The voltage is coming from a regulated power supply and I
>have verified it with 2 DVMs, and it seems quite steady.
>
>Here are some things I have tried:
>
>1. changed power supplies - no difference
>
>2. put up to a 1 second sleep after going into AD read mode - no
>difference.
>
>3. averaged 5, 10 and 50 samples - this has reduced the quantity of
>fluctuations, but not the magnitude.
>
>4. Tried a different development board - no change. >5. Changed the sample rate of the ADC to its max (250us) no change. >Any comments or suggestions?
>
>thanks
>d1 >to unsubscribe, go to http://www.yahoogroups.com and follow the instructions
>Yahoo! Groups Links >
>





Hello,

1k resistor and 0.01uF capacitor useally helps. Connect resistor to voltage
source and to A/D pin. Connect capacitor to A/D pin and to ground. That's
it. Make experiments with different values for both resistor and capacitor.
Make sure that total resistance of source and resistor don't exceed 10k (see
Data Sheet).

Regards,
Igor ----- Original Message -----
From: "d1camero" <>
To: <>
Sent: 09.04.2004. 3:46 AM
Subject: [piclist] AD with 12F675 fluctuations > I am trying to measure 10-15volts to 0.01 volt accuracy. I am
> using the built-in 10bit ADC on the 12F675 with 1% tolerance
> resistor voltage divider.
>
> I find that the values fluctuate way more than expected, +/- 0.03
> volts. The voltage is coming from a regulated power supply and I
> have verified it with 2 DVMs, and it seems quite steady.
>
> Here are some things I have tried:
>
> 1. changed power supplies - no difference
>
> 2. put up to a 1 second sleep after going into AD read mode - no
> difference.
>
> 3. averaged 5, 10 and 50 samples - this has reduced the quantity of
> fluctuations, but not the magnitude.
>
> 4. Tried a different development board - no change. > 5. Changed the sample rate of the ADC to its max (250us) no change. > Any comments or suggestions?
>
> thanks
> d1 > to unsubscribe, go to http://www.yahoogroups.com and follow the
instructions
> Yahoo! Groups Links



Hello,

...and another reply:

> I am trying to measure 10-15volts to 0.01 volt accuracy. I am
> using the built-in 10bit ADC on the 12F675 with 1% tolerance
> resistor voltage divider.

OK, so you have 15V maximum divided by 3 in order to have 0-5V range for AD,
right?

> I find that the values fluctuate way more than expected, +/- 0.03
> volts. The voltage is coming from a regulated power supply and I
> have verified it with 2 DVMs, and it seems quite steady.

OK, now lets do some math...

2^10 = 1024
5V / 1024 = 0.00488V

Now, we multiply that with 3 because of that divider:

0.00488V * 3 = 0.0146V

Now, we add AD error which is probably +/-1LSB and that gives us:

+/-0.0146V or approx. 0.03Vpp fluctuation

What it means is that fluctuation is quite normal... if I did this math
right :)

Regards,
Igor



This seems to be a common problem with PICs. I've seen it on the
12F675, 16F88, 16F877 (A and non-A), 16F819. I too have tried the
same things that d1camero tried, also to no avail.

I've had some success with taking care to isolate the analog section
from the rest of the system but the PICs pin outs makes that a bit
difficult. There is a Microchip app note on this topic. Also, some
sensors produce a lot of noise. I've run tests where I used the
center tap on a pot as the input to an ADC pin and it was quite
stable. Hook up a sensor and it got 3+ LSBs of noise.

I've started looking into conditioning as a way to improve the
noise. I got some noise reduction on a temperature sensor by using a
cap and a resistor (LM34, as described in the app note). However,
the Sharp GP2D12 is one noisy sensor and probably needs it own power.

The tips app note is kind of funny in that they seem to be saying
that to get higher accuracy, dont use the ADC. Uh, yeah, sure, why
did I buy that chip???

--- In , Don Hackler <donh@s...> wrote:
>
> There are some app notes for the 12F675 for doing higher accuracy
A/D
> conversions here:
>
http://www.microchip.com/download/lit/pline/picmicro/families/12f6xx/4
0040b.pdf
> Perhaps they might give you some ideas...
> - Don
>
> d1camero wrote:
>
> >I am trying to measure 10-15volts to 0.01 volt accuracy. I am
> >using the built-in 10bit ADC on the 12F675 with 1% tolerance
> >resistor voltage divider.
> >
> >I find that the values fluctuate way more than expected, +/- 0.03
> >volts. The voltage is coming from a regulated power supply and I
> >have verified it with 2 DVMs, and it seems quite steady.
> >
> >Here are some things I have tried:
> >
> >1. changed power supplies - no difference
> >
> >2. put up to a 1 second sleep after going into AD read mode - no
> >difference.
> >
> >3. averaged 5, 10 and 50 samples - this has reduced the quantity
of
> >fluctuations, but not the magnitude.
> >
> >4. Tried a different development board - no change.
> >
> >
> >5. Changed the sample rate of the ADC to its max (250us) no change.
> >
> >
> >Any comments or suggestions?
> >
> >thanks
> >d1
> >
> >
> >
> >
> >
> >to unsubscribe, go to http://www.yahoogroups.com and follow the
instructions
> >Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >





I have had really good luck with PIC A/Ds by:

Bypassing the PIC with 6 or 8 .1uF caps close to the chip on a 4-layer
board.
Connecting the reference GND directly to the PIC GND pins.
Using 2K in series and .1uF directly to GND at the input pin.
Making sure that the source impedance (feeding the 2K resistor) is not more
than 2K.
Waiting 100uSec before beginning conversion after any channel change.
Averaging at least 6 samples.

When doing the above, I have found that the jitter is generally less than
+/- 1 LSB.

Charles Linquist -----Original Message-----
From: Don Hackler [mailto:]
Sent: Thursday, April 08, 2004 11:46 PM
To:
Subject: Re: [piclist] AD with 12F675 fluctuations There are some app notes for the 12F675 for doing higher accuracy A/D
conversions here:
http://www.microchip.com/download/lit/pline/picmicro/families/12f6xx/40040b.
pdf
Perhaps they might give you some ideas...
- Don

d1camero wrote:

>I am trying to measure 10-15volts to 0.01 volt accuracy. I am using
>the built-in 10bit ADC on the 12F675 with 1% tolerance resistor voltage
>divider.
>
>I find that the values fluctuate way more than expected, +/- 0.03
>volts. The voltage is coming from a regulated power supply and I have
>verified it with 2 DVMs, and it seems quite steady.
>
>Here are some things I have tried:
>
>1. changed power supplies - no difference
>
>2. put up to a 1 second sleep after going into AD read mode - no
>difference.
>
>3. averaged 5, 10 and 50 samples - this has reduced the quantity of
>fluctuations, but not the magnitude.
>
>4. Tried a different development board - no change. >5. Changed the sample rate of the ADC to its max (250us) no change. >Any comments or suggestions?
>
>thanks
>d1 >to unsubscribe, go to http://www.yahoogroups.com and follow the
>instructions Yahoo! Groups Links >
>
to unsubscribe, go to http://www.yahoogroups.com and follow the instructions
Yahoo! Groups Links


Igor,

Thanks for the quick feedback. I calculate the error:

The AD converter is measuring 0-5 volts, hence no division or
multiplication by 3 for the AD part.

1 LSB bit fluctuation is simply then:

5v / 1024 = 0.0048v

So I expect to see some fluctuation, but not as much as I have been
measuring. I will try the other suggestions and repot back.

thanks everyone.

Don
--- In , "Igor Janjatovic" <kodrat@p...>
wrote:
> Hello,
>
> ...and another reply:
>
> > I am trying to measure 10-15volts to 0.01 volt accuracy. I am
> > using the built-in 10bit ADC on the 12F675 with 1% tolerance
> > resistor voltage divider.
>
> OK, so you have 15V maximum divided by 3 in order to have 0-5V
range for AD,
> right?
>
> > I find that the values fluctuate way more than expected, +/- 0.03
> > volts. The voltage is coming from a regulated power supply and I
> > have verified it with 2 DVMs, and it seems quite steady.
>
> OK, now lets do some math...
>
> 2^10 = 1024
> 5V / 1024 = 0.00488V
>
> Now, we multiply that with 3 because of that divider:
>
> 0.00488V * 3 = 0.0146V
>
> Now, we add AD error which is probably +/-1LSB and that gives us:
>
> +/-0.0146V or approx. 0.03Vpp fluctuation
>
> What it means is that fluctuation is quite normal... if I did this
math
> right :)
>
> Regards,
> Igor





--- In , "d1camero" <a8723@c...> wrote:
> The AD converter is measuring 0-5 volts, hence no division or
> multiplication by 3 for the AD part.

But you said you were measuring 10-15V. How are you getting this down
to the 0-5V range for measurement?

Is your PIC properly decoupled? (That is do you have a .1uf cap as
close to Vss as possible?)

You said you were sleeping for 1 second after starting the conversion.
Why not just turn the interrupt on for A/D and go to sleep? (It will
wake up when the A/D is done that way.) If you are doing this in a
high level language are you sure that when you say to sleep for a
second that it's not just doing a 1 second timing loop? (I always
done everything in asm so I don't know anything about HL languages on
the PIC -- this is just a stab in the dark.) To truely sleep for 1
second you would need to set a timer so it would expire in 1 second
and it would need to be the only interrupt source -- that's why I
think it's reasonable that the HL language is simply doing a timing loop.

It sounds like you are only using one A/D channel so you would have no
need to change channels but if you are changing channels are you
waiting the necessary aqcuisition time (Taqc as described in the
datasheet) prior to starting the conversion?

--Scott


Thanks for all the input. I have tried your suggestions (averaging,
capacitors, sleeping) without any appeciable change in fluctuation.

BUT, when I removed the resistor divider network, and simply used
the 12F675 to measure 0-5volts, the ADC works great, with an
acceptable 1 bit fluctuation.

So my question has changed: How can I accurately measure 10-15volts
with the 675. Obviously a 1% resistor divider network introduces
too much noise. Other ideas?

thanks
d1




You don't mention what values of 1% resistors you use. It is important that
the parallel combination (thevenin equivalent) of these two resistors is
less
than 10K. Actually I prefer to keep it below 4K.

Charles Linquist ----- Original Message -----
From: "d1camero" <>
To: <>
Sent: Friday, April 09, 2004 11:44 AM
Subject: [piclist] Measure 10-15 volts ***accurately*** (was Re: AD with
12F675 fluctuations) > Thanks for all the input. I have tried your suggestions (averaging,
> capacitors, sleeping) without any appeciable change in fluctuation.
>
> BUT, when I removed the resistor divider network, and simply used
> the 12F675 to measure 0-5volts, the ADC works great, with an
> acceptable 1 bit fluctuation.
>
> So my question has changed: How can I accurately measure 10-15volts
> with the 675. Obviously a 1% resistor divider network introduces
> too much noise. Other ideas?
>
> thanks
> d1 >
>
> to unsubscribe, go to http://www.yahoogroups.com and follow the
instructions
> Yahoo! Groups Links