Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Sampling Unsmoothed DC

Status
Not open for further replies.
You don't have to wait at all and there is no need for an opamp. What you are suggesting is just complete overkill.

Mike.


you should call microchip up and tell them to fix they dayda sheetz dood.

I suppose if they don't want an accurate measure then sure disregard the data sheet, while you're at it, don't worry about all those other pesky values, I'm sure its ok to put over 5.5volts into a pit CuzZ id dids it once time.
 
Keep in mind that the capacitor we are trying to charge is only 25pF. A 1uF external cap will charge it almost instantly and it's voltage will not be effected (that you can measure).

Mike.
Yes, a 1uF paralleled with a 25pF cap would only drop to 1/40000 of its voltage, which is much less than a code in the ADC (1/1024). However, the cap is also needed to smooth the AC, not just reduce filter output impedance to pulses. And, at that, the filter should have a 2.4Hz cutoff with a 1uF. Which sounds basically OK. The lowpass filter is a first-order type and the cutoff is very gradual. If the ripple was at 120Hz and the filter had a 60Hz cutoff, and the ripple was of high amplitude, that might not be enough. But the ripple amplitude is moderated by the battery to begin with, and 2.4Hz is far from 120Hz, so the ripple amplitude should be way below detectable levels with a 1uF cap and a 200K/100K resistor divider. The leakage current issue remains a factor.
 
Last edited:
I read all of your replies & gained lots of ideas.

What I learned was

Input impedance mean, impedance seen by anything connected to the input of a circuit or device.Its the effect of all the resistance, capacitance and inductance connected to the input inside the circuit or device.

But my circuit will provide unsmoothd DC & there is no any AC.So we have to concentrate only the resistors & ignore the capacitor.

In this case I see there is 66.7K impedance seen by the PIC input.I wonder how this capacitor makes the impedance below 10K ???
 
Suraj,

The capacitor acts as a reservoir to supply the current required to charge the sample and hold capacitor and so the input impedance is no longer a problem.

Mike.
 
Thanks Mike

By the way is it ok if I add 220K & 100K resisters with a 1uF.Because 200K is no longer available.
 
Yes you can but you need to adjust your calculations accordingly however, as I said earlier, I would use something like 100K and 47K and a low leakage capacitor. Even with these reduced values the drain on the battery is minuscule.

Mike.
 
But my circuit will provide unsmoothd DC & there is no any AC.So we have to concentrate only the resistors & ignore the capacitor.
No, because only the leakage on the pin is DC. When you engage the Sample period of the ADC, it connects an internal 25pF capacitor to the pin, thus drawing a current pulse and effectively puts the internal ADC cap in parallel with the filter's output cap. That's a short pulse of current needed, it's a type of AC.
 
To people all helped me in this thread please listen to me.

Until now I did AD measuring projects using temp sensors like LM35 & measured V/R & display the ADC levels on LEDs'.For that we never scared to impedance stories.

From this thread I really frustrated after hearing the word call impedance.Data sheet says you do anything but keep the ADC pin below 10K level.

What I know is if the voltage is larger than the PIC input voltage you need to use a voltage divider & scale between 0V-5V.

Earlier I thought I need to concentrate only bottom resistor & it should be below 10K.But after reading this entire thread I found there is something called Thévenins theorem.In that case you need to parallel the two resisters & calculate the total impedance.That means in any circuit that uses a voltage divider, to calculate the impedance you need to parallel the two resisters.After reading lots of articles on the web somehow I managed to calculate the total impedance.

Then after that we were adding a capacitor to the bottom resistor.Actually I don't know what are the side effects of using that capacitor.

After adding a capacitor
what is cut off frequency,time constant & how often do I have to sample,how much is the maximum cap you can put,to measure extremely smooth DC can I use the same filter etc... are my really problems for the time being.

I know its bothering but those questions are never ending stories to me.
 
Last edited:
Thanks to all. I have gathered a lot from these posts. It is so resourceful to me. I request my senior and expert friends to kindly explain the leakage current and its effect on ADC.

swapan
 
Thanks to all. I have gathered a lot from these posts. It is so resourceful to me. I request my senior and expert friends to kindly explain the leakage current and its effect on ADC.

swapan

Thanks swapan it is a problem for me also.I'm also wondering where the hell comes this leakage current?What leakage?

I didn't ask because they will get too much to answer from the questions we asks.
 
Last edited:
Normally, you need to keep the input resistance below 10k if you want to keep the acquisition time low (this is the time required for the internal cap to charge). However, if your resistance is higher than 10k you can still use the ADC but you must allow more time for the internal capacitor to charge. It is shown in the data sheet how to calculate the required acquisition time. On a modern pic the internal cap is 10pF and so for an input resistance of 50k the acquisition time is,

10*10^-12*(1*10^3+7*10^3+50*10^3)*ln(1/2048) = 4.4uS (from 16F886 data sheet)

So, after selecting the channel and turning on the ADC you must wait 4.4uS before starting the ADC. With 10k input impedance this is around 1.5uS.

However, if you leave the channel selected and the ADC on then the internal cap will track the voltage and won't require a charging time.

Another way to achieve the same result is by adding an external cap that will track the voltage and that can rapidly charge the internal cap when the ADC is turned on. This only works with voltages that are changing slowly as in this case.

The leakage current is a different matter. This is the current that leaks to ground through the ADC pin and for a 16F886 it is up to ±500nA. This current will flow through the resistive divider and with a 50k input impedance could result in a reading that is 25mV out.

And therein end ADC101.

HTH.

Mike.
 
So many thanks Mr. Pommie. I have got a clear conception on leakage current so far as ADC is concerned. Thanks again.

swapan
 
The leakage is in the PIC pin.
Note that it's+/-500nA, so it could be 500nA from the pin to gnd- which lowers the pin voltage, or 500nA from the pin to Vdd- which raises the pin voltage.

Other than the 500nA limit, it doesn't give any description of that error. Now with a 50K impedance, that could be a 25mV error. Yes. But say it's +25mV at 0v. That's a code of about 5 from the ADC when it should be zero. However, it'll have to decrease as the pin voltage approaches Vdd, because it can't physically be an error of +25mV at Vdd=5v. Leakage doesn't generate more voltage than at the rail. Exactly how much leakage happens at what voltage is unspecified... there may be 0 leakage at 2.56v on the pin and +240nA at 0v and -230nA at 5v- so at some voltages it pulls it up and some it pulls it down.

It will vary from part to part, and will vary with temp. It's unspecified, thus there are no guarantees except: 1) it can't pull the analog pin voltage outside Vdd/Vss, and 2) won't be "noise" which changes significantly from reading to reading. Only slowly, with temp or age.
 
As a practical matter, whatever the leakage is today, it is not likely to change much tomorrow, provided the temperature is only varies from say 20degC to 30degC. That way, whatever it is, it will cause just a more-or-less constant offset relative to the output of the voltage divider. Since the resistors are matched to less than 1% (now even worse since the OP is electing to go with 5% or 10% Carbons, instead of the 1% Metal Film resistors I told him to use, then why quibble about the last few LSB reading changes.

The final point is that the leakage spec slowly effects the reading a little bit. The capacitor takes care of holding the voltage constant during the time the AD is reading the pin. Those are two different considerations....
 
Keep in mind that the capacitor we are trying to charge is only 25pF. A 1uF external cap will charge it almost instantly and it's voltage will not be effected (that you can measure).

Mike.

Mr Al, you just repeated the misconception AGAIN without answering any of the points that Pommie and I posted in response to Oznog's post. If the source impedance is 10KΩ or less, then the external source tied the AD input pin is low enough to prevent the capacitive coupling backwards from internal switches from perturbing the voltage at the input pin. This is a dynamic process (AC) which happens only during the conversion sequence.

The external shunt capacitor will present a source impedance much less than 10KΩ and will hold the voltage constant during the conversion. Think about how much current it would take to "move" the capacitor voltage.
This is independent and separate from the DC leakage spec, which slightly changes the DC level at the input pin.

Hello there again Mike and Mike (chuckle),

The dynamic coupling during the sample period is a different issue than the
leakage current issue. The leakage current is associated with the pin
itself, not with the ADC internal circuit. The leakage current is forever
present, from the time the device is powered up to the time it is powered
down, and can vary (usually) plus or minus 1 microamp.

What this means is that we have a total circuit that consists of two
resistors and a smoothing capacitor, where the top resistor is fed from
the source to be measured, and the center tap (the capacitor) is fed
from a DC current source that can slowly vary from -1ua to +1ua. Our job
is to make sure that this variance in current does not affect the AD input
by more than plus or minus one half bit. To reach this goal, the external
DC resistance MUST be less than some value which with a supply
voltage of 5v works out to be 2441 ohms, which is usually taken to be
2500 ohms. Thus, the external source DC resistance must work out to
2500 ohms to reach this goal.
Since the current variation is spec'd over the full temperature range, it
is sometimes assumed that the device will only be operated over a fraction
of that range so many people use 10k as the target resistance goal, but
we have to keep in mind this can still end up giving us an error of around
2 bits if the temperature varies enough or some other phenomenon causes
a change in that current.

Dont get me wrong though, i have used 25k and gotten away with it in
applications that were both calibrated on site and also did not vary in
ambient temperature by more than about 10 degrees C. It's good to
know how this works though.

I thought this was a well known concept among people who regularly
use PIC chips, or did i misunderstand your intent Mike1 or Mike2 ?

Also Mike1 or Mike2, what were your offset measurements for your applications
and what were your target temperature ranges in the past?
 
Last edited:
Normally, you need to keep the input resistance below 10k if you want to keep the acquisition time low (this is the time required for the internal cap to charge). However, if your resistance is higher than 10k you can still use the ADC but you must allow more time for the internal capacitor to charge. It is shown in the data sheet how to calculate the required acquisition time. On a modern pic the internal cap is 10pF and so for an input resistance of 50k the acquisition time is,

10*10^-12*(1*10^3+7*10^3+50*10^3)*ln(1/2048) = 4.4uS (from 16F886 data sheet)

So, after selecting the channel and turning on the ADC you must wait 4.4uS before starting the ADC. With 10k input impedance this is around 1.5uS.

However, if you leave the channel selected and the ADC on then the internal cap will track the voltage and won't require a charging time.

Another way to achieve the same result is by adding an external cap that will track the voltage and that can rapidly charge the internal cap when the ADC is turned on. This only works with voltages that are changing slowly as in this case.

The leakage current is a different matter. This is the current that leaks to ground through the ADC pin and for a 16F886 it is up to ±500nA. This current will flow through the resistive divider and with a 50k input impedance could result in a reading that is 25mV out.

And therein end ADC101.

HTH.

Mike.

Excellent Mike totally I understood.That is very easy to understood.I solved many of my doubts.

Thanks again
 
However, if you leave the channel selected and the ADC on then the internal cap will track the voltage and won't require a charging time.
Now correct me if I'm wrong, but isn't the internal sampling capacitor voltage "unknown" after an ADC conversion?

If so, then even if the channel has not been changed and the ADC has not been turned off nor the port reassigned to Digital IO, the cap will still require a acquisition charging interval immediately following a conversion, for back-to-back conversions. There is rarely a good reason for back-to-back conversions on the same channel though, it doesn't reject much noise and can really eat into the available processing cycles.
 
Yes, it will require time to track the voltage after a conversion. However, after an ADC conversion is the only time the capacitor voltage is known as you have just measured it.:D

Mike.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top