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.

PIC analog input impedance question

Status
Not open for further replies.

Futterama

Member
Hello forum,

I'm using a PIC's analog input pin with the internal AD converter to measure the voltage from a voltage devider, as in the circuit diagram below.

Now, the PIC's datasheet says max 10K input impedance, but I'm not sure how to calculate this value.

The resistor devider supply can vary from 4V to 10V.

Thanks for any help.

Regards,
Futterama
 

Attachments

  • input.gif
    input.gif
    2 KB · Views: 1,560
The source impedance should be no more than 2.5K, your divider is considerably more than that!. This will restrict how fast you can switch between channels, and may have some bearing on accuracy.

If you can't use a lower value potential divider, you should consider an opamp buffer between the PIC and divider - check my analogue tutorial!.
 
Nigel Goodwin said:
The source impedance should be no more than 2.5K...
But why? The datasheet says 10K. Please explain :D

Nigel Goodwin said:
...your divider is considerably more than that!
Ok, then please tell me how much more, and include a calculation so I can calculate it myself :wink:

Nigel Goodwin said:
If you can't use a lower value potential divider...
Oh, but I can lower the resistor values, but not below 1K total because of the current consumed by the resistors then.

Nigel Goodwin said:
...check my analogue tutorial!
I'm sorry Nigel, I don't find any helpful tutorial on you site, it is a bit confusing finding anything in there :roll:

Regards,
Futterama
 
Futterama said:
Nigel Goodwin said:
The source impedance should be no more than 2.5K...
But why? The datasheet says 10K. Please explain :D

Sorry, I see the 12F675 states 10k, other PIC's are usually 2.5k, so the 12F675 is somewhat better.

Nigel Goodwin said:
...your divider is considerably more than that!
Ok, then please tell me how much more, and include a calculation so I can calculate it myself :wink:

Actually, when you sit down and work it out, it's slightly LESS than 10k, but it looks more at first glance.

You only need ohms law and parallel resistors to work it out - you need to work out what value resistor you would put in parallel with the bottom resistor to give half the voltage - the extra resistor equals the source impedance.

Nigel Goodwin said:
If you can't use a lower value potential divider...
Oh, but I can lower the resistor values, but not below 1K total because of the current consumed by the resistors then.

Having seen your other post, I don't see any problems with the existing values, there's no need for speed or accuracy.

Nigel Goodwin said:
...check my analogue tutorial!
I'm sorry Nigel, I don't find any helpful tutorial on you site, it is a bit confusing finding anything in there :roll:

The tutorial is at .
 
Futterama said:
Now, the PIC's datasheet says max 10K input impedance, but I'm not sure how to calculate this value.

You'd consider any low impedance DC voltage to be a ground, and then calculate the resistance to the measuring point. So 30k in parallel with 10k = 7.5k.
 
Nigel Goodwin said:
You only need ohms law and parallel resistors to work it out - you need to work out what value resistor you would put in parallel with the bottom resistor to give half the voltage - the extra resistor equals the source impedance.
Oznog said:
You'd consider any low impedance DC voltage to be a ground, and then calculate the resistance to the measuring point. So 30k in parallel with 10k = 7.5k.
Thanks, both methods works for me, but Oznogs is much easier to work with :wink:

Regards,
Futterama
 
Futterama said:
Nigel Goodwin said:
You only need ohms law and parallel resistors to work it out - you need to work out what value resistor you would put in parallel with the bottom resistor to give half the voltage - the extra resistor equals the source impedance.
Oznog said:
You'd consider any low impedance DC voltage to be a ground, and then calculate the resistance to the measuring point. So 30k in parallel with 10k = 7.5k.
Thanks, both methods works for me, but Oznogs is much easier to work with :wink:

But I don't think it gives an accurate value? - I couldn't be bothered working it out exactly, but it came out between 9K and 10K. Not that it matters much for this application!.
 
Nigel, that's odd, I used an Excel worksheet to do the calculation, and I also ended up with 7.5k with the method you mentioned.
 
Futterama said:
Nigel, that's odd, I used an Excel worksheet to do the calculation, and I also ended up with 7.5k with the method you mentioned.

Perhaps I messed up? - I'll try it again when I have time, I did it before with a calculator in one hand, a phone in the other, and a piece of paper on the bench :lol:
 
Simple experiment to show current flowing into input pin

Angry Nigel told me to get lost.

I used to be like Nigel. Then I learned electronics and programming.
 
Last edited:
I suggest you do a couple of things:

1) Read the dates on threads, this one is over SIX years old!!.

2) Read what the thread is about, your post doesn't have the slightest relation to the thread.

Not to mention the content of your post is completely wrong, and is an extremely complicated and inaccurate way to try and measure the input impedance of an input.
 
I know my thread is very old, but I have come across this voltage divider impedance issue again.

I understand how to calculate the impedance now but I have a question.

In my current project I use the PIC ADC to measure a voltage from a voltage divider. I don't need much accuracy or speed but I need low current consumption from the source to be measured. If I use 30k and 10k as in my first post, I get 7.5k impedance. According to the calculations I can achieve roughly the same impedance with 68k and 8.2k but with lower current consumption in the divider.

Using the higher value resistors, I know I get a more narrow voltage range to measure using the ADC but this is acceptable.

But can I just keep raising the upper resistor value and lower the botton resistor value to get the desired impedance? At some point, the current flowing through the resistor divider will approach the leakage current of the input pin, what happens then?
 
You need to read the section of the datasheet that covers the A2D converter. There is a set of equations that step you through determining the effect that source impedance has on the A2D process.

But basically, the source impedance affects two things. DC accuracy, and integration time. If your application can get away with less accuracy than the pic is capable of, then you can increase the source impedance. For instance, I often only use 8 of the 10 bits in my measurements. This means that, for DC accuracy, I can get away with a source impedance four times higher than what is needed for a 10 bit conversion. The integration time can also be shortened, but that equation is not a simple 1:4 so you need to run the numbers to see how far you can go before the errors get to large for your measurement needs.


Note: As discussed in the first few posts of this thread, not all PIC A2D converters are made equal, so you need to check the specifics of the part you are designing for.
 
The part in question is PIC10F222.

I know the stuff about the AD converter, it's the voltage divider that puzzles me.

My main question is this: Can I just keep raising the top resistor value and lower the bottom resistor value to get the desired impedance?
 
The part in question is PIC10F222.

I know the stuff about the AD converter, it's the voltage divider that puzzles me.

My main question is this: Can I just keep raising the top resistor value and lower the bottom resistor value to get the desired impedance?

No, because you're reducing resolution all the time - what voltage are you trying to measure?, and what voltage is the PIC supply?.

It's not so much 'impedance' that's the problem it's the time taken to charge/discharge the internal sample and hold capacitor - as long as you are only using a single analogue input, and don't need to take rapid readings, then you can use far higher value resistors than you might think.

I would suggest you experiment? - set up the PIC to display the voltage on the input, and then try different value resistors (keeping the ratio the same) and see how it affects the readings.
 
Hi Nigel,

PIC supply is 5V and voltage to measure is from a 3 cell LiPo battery, so the voltage is in the range 9-12.6V. The PIC just needs to know when the voltage is getting below 9.6V so the battery is not damaged by deep discharge.
 
Hi Nigel,

PIC supply is 5V and voltage to measure is from a 3 cell LiPo battery, so the voltage is in the range 9-12.6V. The PIC just needs to know when the voltage is getting below 9.6V so the battery is not damaged by deep discharge.

Like I said, try different values, and see what the results are - try 10K at the bottom and 22K at the top, and check what it displays - then try 1K and 2.2K, then 100K and 220K - you get the idea.

Assuming you're enabling the A2D each time you read it?, then wait a second or two before you take the reading, so as to ensure the capacitor has charged up fully.
 
I would use very large voltage divider resistors and put a capacitor after the voltage divider. 10pF sample capacitor charging from 100nF capacitor introduces a very small error. And the error is on the "pessimistic" side for low voltage monitor.. which is good. But anyway the error will (most likely) be less than 1bit.
 
Last edited:
  • Like
Reactions: 3v0
The PIC supply (the 5V) is not consumption sensitive, so I plan to leave the ADC enabled at all times. I just tried with 100k and 10k which should give 9k impedance and this worked fine and only consumes 115µA with a fully charged LiPo battery. The consumption of the voltage divider needs to be low because it is connected to the LiPo battery all the time unless I manually disconnect it's connector, and I'm pretty sure I forget to disconnect it some day so the battery will survive longer (keep it's charge) with a lower divider consumption.

I actually included a 100nF capacitor on the ADC input to eliminate noise so it's already there ;-)
 
I have always related impedance (matching) to the ability to deliver power. You are not delivering power. You are only concerned about information, which does not require power (ideally).
Experiment with larger resistors and you'll see that it does not make any difference.. if you are measuring battery voltage which is DC in practice.

I'm pretty sure that you do measure the performance of your system, don't you? Why else would you ask all these questions.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top