Re: [piclist] Re: PIC A/D and Voltage Divider


Mar 18, 2011

 


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

#11533 Mar 18, 2011

This group has been way too quite for too long. I thought I'd liven things up a bit by asking a question. I would like to use the on chip A/D converter in a Pic 16F887 and I have some Microchip MCP1541 4.096 voltage reference devices. I need to be able to measure voltages up to around 18 volts. If I use a voltage divider that divides the input voltage by 5, I could measure up to 20.46 volts. So far so good. Now there are a lot of combinations of resistors that could be used to divide by 5. This project will be battery powered so I want to keep the current through the resistors to a minimum to extend battery life. But if I use too high of resistance, the impedance of the A/D converter will affect the accuracy of the readings. Is there a formula to use when calculating resistance values? I am trying to avoid using an Op Amp as a buffer.



Thanks in Advance



Max



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

#11534 Mar 19, 2011

Hi Max,

The potential divider chain will not load the battery it will load the voltage being measure. (Unless it is the devices battery voltage being measured.) Section 9.3 of the data sheet explains the things that need to be considered when using the ADC. It does suggest that the source resistance should not be above 10 K ohms. This would mean that the highest value resistors that you could use would be 12.5 K and 50 K The source resistance also depends on how fast you need to take samples.

Les.

--- In piclist@yahoogroups.com, "Max" kg4pid@...> wrote:

>

> This group has been way too quite for too long. I thought I'd liven things up a bit by asking a question. I would like to use the on chip A/D converter in a Pic 16F887 and I have some Microchip MCP1541 4.096 voltage reference devices. I need to be able to measure voltages up to around 18 volts. If I use a voltage divider that divides the input voltage by 5, I could measure up to 20.46 volts. So far so good. Now there are a lot of combinations of resistors that could be used to divide by 5. This project will be battery powered so I want to keep the current through the resistors to a minimum to extend battery life. But if I use too high of resistance, the impedance of the A/D converter will affect the accuracy of the readings. Is there a formula to use when calculating resistance values? I am trying to avoid using an Op Amp as a buffer.

>

> Thanks in Advance

>

> Max

>



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

#11535 Mar 19, 2011

Firstly because of the way the preferred values work its impossibleto get a ratio 4:1 as needed to get an analogue divide by 5. So there is 1Kbut only 3.9 or 4.1.  Secondly , when I saw this I thought the data sheet would say whatthe resistance or impedance of the the input were but I can't find it anywhere.All it says is that the the impedance of the voltage should be less than 10Kwhich seems very low,   I havea PIC based Ham Radio test tool that measures battery voltage and that uses16k/3.9k as the dividers to give a divide ratio of 5.1 , but that's >10k

 So asyou can see its a complete mess...... Youmight want to consider 2k and 10K which gives a divide by 6., or  even16K and 2x2k in series to give divide by 5.  DaveG4UGM  

-----Original Message-----From: piclist@yahoogroups.com[mailto:piclist@yahoogroups.com] On Behalf Of MaxSent: 19March 2011 05:49To: piclist@yahoogroups.comSubject:[piclist] PIC A/D and Voltage Divider

 This group has been way too quite for too long. I thought I'd liven thingsup a bit by asking a question. I would like to use the on chip A/D converterin a Pic 16F887 and I have some Microchip MCP1541 4.096 voltage referencedevices. I need to be able to measure voltages up to around 18 volts. If I usea voltage divider that divides the input voltage by 5, I could measure up to20.46 volts. So far so good. Now there are a lot of combinations of resistorsthat could be used to divide by 5. This project will be battery powered so Iwant to keep the current through the resistors to a minimum to extend batterylife. But if I use too high of resistance, the impedance of the A/D converterwill affect the accuracy of the readings. Is there a formula to use whencalculating resistance values? I am trying to avoid using an Op Amp as abuffer.

Thanks in Advance

Max



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

#11536 Mar 19, 2011

On 19/03/2011 12:07, Dave wrote: >

>

> Firstly because of the way the preferred values work its impossible to

> get a ratio 4:1 as needed to get an analogue divide by 5. So there is 1K

> but only 3.9 or 4.1.

> Secondly , when I saw this I thought the data sheet would say what the

> resistance or impedance of the the input were but I can't find it

> anywhere. All it says is that the the impedance of the voltage should be

> less than 10K which seems very low,

> I have a PIC based Ham Radio test tool that measures battery voltage and

> that uses 16k/3.9k as the dividers to give a divide ratio of 5.1 , but

> that's >10k

> So as you can see its a complete mess......

> You might want to consider 2k and 10K which gives a divide by 6., or

> even 16K and 2x2k in series to give divide by 5.



Impedance must be below 10k for proper operation of the ADC.



Leon

--

Leon Heller

G1HSM



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

#11537 Mar 19, 2011

Firstly because of the way the preferred values work its impossible to

> get a ratio 4:1 as needed to get an analogue divide by 5. So there is

> 1K but only 3.9 or 4.1.



You can get a lot of values these days.. Check out Mouser or DigiKey

or any other full line distributor (I happen to be in the US).

> Secondly , when I saw this I thought the data sheet would say what the

> resistance or impedance of the the input were but I can't find it

> anywhere. All it says is that the the impedance of the voltage should

> be less than 10K which seems very low,



As Les inferred, if you can leave the sample and hold open for more

you might be able to read a higher impedance source.

> I have a PIC based Ham Radio test tool that measures battery voltage

> and that uses 16k/3.9k as the dividers to give a divide ratio of 5.1 ,

> but that's >10k



Not actually.. Again, Les has it right here.. You need two resistors of

value Rx and 4Rx to make a 5:1 voltage divider.. The source impedance

seen by the ADC will be their Thevenin equivalent or (4 * Rx^2)/5Rx or

0.8Rx which wants to be = 10K... Ergo Rx must be = 12.5K and 4Rx

is 50K.



(16K * 4K)/(20K) ~= 3.2K so you're well below the constraint.



Max, I recently designed a sophisticated battery charger/monitor/UPS

using a PIC24H family part and need a high impedance source for

measuring battery voltage.. Along with Les' suggestion on considering

a longer sample and hold period to charge the PIC16F877's internal

sample capacitor, you could put a 0.1uF cap on the input.. This cap

would charge to the sample voltage and then at sample time would

provide extra current to charge the PIC's internal sample cap.



Some of this stuff may be discussed in a Microchip document called

something like "Midrange CPU Family Family Reference".. It's always

seems to take me a couple of tries to find it at Microchip's website but

it probably has the background info on the A/D section.



Coop, AA1WW



> -----Original Message-----

> From: piclist@yahoogroups.com [mailto:piclist@yahoogroups.com] On

> Behalf Of Max

> Sent: 19 March 2011 05:49

> To: piclist@yahoogroups.com

> Subject: [piclist] PIC A/D and Voltage Divider

>

>

>

> This group has been way too quite for too long. I thought I'd liven

> things up a bit by asking a question. I would like to use the on chip

> A/D converter in a Pic 16F887 and I have some Microchip MCP1541 4.096

> voltage reference devices. I need to be able to measure voltages up to

> around 18 volts. If I use a voltage divider that divides the input

> voltage by 5, I could measure up to 20.46 volts. So far so good. Now

> there are a lot of combinations of resistors that could be used to

> divide by 5. This project will be battery powered so I want to keep the

> current through the resistors to a minimum to extend battery life. But

> if I use too high of resistance, the impedance of the A/D converter

> will affect the accuracy of the readings. Is there a formula to use

> when calculating resistance values? I am trying to avoid using an Op

> Amp as a buffer.

>

> Thanks in Advance

>

> Max







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

#11538 Mar 19, 2011

 

-----Original Message-----From: piclist@yahoogroups.com[mailto:piclist@yahoogroups.com] On Behalf Of JeffCooperSent: 19 March 2011 14:15To:piclist@yahoogroups.comSubject: RE: [piclist] PIC A/D and VoltageDivider

 > Firstly because of the way the preferred values work itsimpossible to> get a ratio 4:1 as needed to get an analogue divide by5. So there is> 1K but only 3.9 or 4.1.

You can get a lot ofvalues these days.  Check out Mouser or DigiKey or any other fullline distributor (I happen to be in the US). 

I am in the UK.but onchecking on Radio Spares I can get a wide range of values in surface mount,although some are 80p each in packs of 10 so thats about  $1 each. I hadn'trealized that was possible as I normally only use wiredcomponents..

> Secondly , when I saw this I thought the data sheet would say whatthe> resistance or impedance of the the input were but I can't findit> anywhere. All it says is that the the impedance of the voltageshould> be less than 10K which seems very low,

As Les inferred,if you can leave the sample and hold open for more you might be able toread a higher impedance source. 

Ok I had forgotten it had a cap andused sample and hold, so that makes sensenow... > I have a PIC based HamRadio test tool that measures battery voltage> and that uses 16k/3.9kas the dividers to give a divide ratio of 5.1 ,> but that's>10k

Not actually.  Again, Les has it right here.  Youneed two resistors ofvalue Rx and 4Rx to make a 5:1 voltage divider. The source impedance seen by the ADC will be their Thevenin equivalent or(4 * Rx^2)/5Rx or0.8Rx which wants to be = 10K.   Ergo Rxmust be = 12.5K and 4Rxis 50K.

(16K * 4K)/(20K) ~= 3.2K soyou're well below the constraint.  

 OK I follow that, after a little googlingan re-reading.. Max, I recently designed asophisticated battery charger/monitor/UPS using a PIC24H family part andneed a high impedance source formeasuring battery voltage.  Alongwith Les' suggestion on consideringa longer sample and hold period tocharge the PIC16F877's internal sample capacitor, you could put a 0.1uFcap on the input.  This cap would charge to the sample voltage andthen at sample time would provide extra current to charge the PIC'sinternal sample cap.

Some of this stuff may be discussed in a Microchipdocument called something like "Midrange CPU Family FamilyReference".  It's always seems to take me a couple of tries to findit at Microchip's website but it probably has the background info on theA/D section. 

I think I have that on the mainPC....  Coop, AA1WW 

Thanks, very usefulDave > -----OriginalMessage-----> From: piclist@yahoogroups.com [mailto:piclist@yahoogroups.com]On> Behalf Of Max> Sent: 19 March 2011 05:49> To: piclist@yahoogroups.com>Subject: [piclist] PIC A/D and Voltage Divider>>>>This group has been way too quite for too long. I thought I'd liven>things up a bit by asking a question. I would like to use the on chip>A/D converter in a Pic 16F887 and I have some Microchip MCP1541 4.096>voltage reference devices. I need to be able to measure voltages up to>around 18 volts. If I use a voltage divider that divides the input>voltage by 5, I could measure up to 20.46 volts. So far so good. Now>there are a lot of combinations of resistors that could be used to>divide by 5. This project will be battery powered so I want to keepthe> current through the resistors to a minimum to extend battery life.But> if I use too high of resistance, the impedance of the A/Dconverter> will affect the accuracy of the readings. Is there a formulato use> when calculating resistance values? I am trying to avoid usingan Op> Amp as a buffer.>> Thanks inAdvance>> Max



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

#11539 Mar 19, 2011

Thanks for all of the replys. Now to check the suppliers and see what values they have that will work.



Max

--- In piclist@yahoogroups.com, "Max" kg4pid@...> wrote:

>

> This group has been way too quite for too long. I thought I'd liven things up a bit by asking a question. I would like to use the on chip A/D converter in a Pic 16F887 and I have some Microchip MCP1541 4.096 voltage reference devices. I need to be able to measure voltages up to around 18 volts. If I use a voltage divider that divides the input voltage by 5, I could measure up to 20.46 volts. So far so good. Now there are a lot of combinations of resistors that could be used to divide by 5. This project will be battery powered so I want to keep the current through the resistors to a minimum to extend battery life. But if I use too high of resistance, the impedance of the A/D converter will affect the accuracy of the readings. Is there a formula to use when calculating resistance values? I am trying to avoid using an Op Amp as a buffer.

>

> Thanks in Advance

>

> Max

>



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

#11540 Mar 19, 2011

I am in the UK.but on checking on Radio Spares I can get a wide range

> of values in surface mount, although some are 80p each in packs of 10

> so thats about $1 each. I hadn't realized that was possible as I

> normally only use wired components..



I've found a surprising range of values at the distributors I mentioned

(Mouser and DigiKey).. You might check out Maplin, Farnell, and the like..

They may have minimum order requirements but at least it gives you an

idea.. Also, never underestimate eBay.

> Thanks, very useful

> Dave



Best Wishes,

Coop, AA1WW



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

#11541 Mar 19, 2011

Check out Rapid, they are likely to be cheaper on the components.



0805 1% 46p/100



www.rapidonline.com



Colin



:: I am in the UK.but on

:: checking on Radio Spares I can get a wide range of values in

:: surface mount,

:: although some are 80p each in packs of 10 so thats about $1 each.

:: I hadn't

:: realized that was possible as I normally only use wired

:: components..

--

cdb, colin@... on 20/03/2011



Web presence: www.btech-online.co.uk



Hosted by: www.justhost.com.au







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

#11542 Mar 19, 2011

Mouserand DigiKey are expensive on shipping for small quantities, as are Farnell.Last time I checked Maplin only had E24 (I use them often). RapidElectronics may be better, but I haven't checked. I drive past RSManchester most days and if I call and collect there are no deliverycharges, and I can get most things the day after I order.... Dave  

-----Original Message-----From: piclist@yahoogroups.com[mailto:piclist@yahoogroups.com] On Behalf Of JeffCooperSent: 19 March 2011 19:28To:piclist@yahoogroups.comSubject: RE: [piclist] PIC A/D and VoltageDivider

 > I am in the UK.but on checking on Radio Spares I can get a widerange> of values in surface mount, although some are 80p each in packsof 10> so thats about $1 each. I hadn't realized that was possible asI> normally only use wired components..

I've found a surprisingrange of values at the distributors I mentioned (Mouser andDigiKey).  You might check out Maplin, Farnell, and the like. 

They may have minimum order requirements but at least it gives you an

idea.  Also, never underestimate eBay.

> Thanks, veryuseful> Dave

Best Wishes,Coop, AA1WW



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

#11557 Apr 24, 2011

Or you could use higher value resistors with a very low power voltage follower, but that could be expensive if you need accuracy or speed, and could end up using more power in the end.  If you can live with lower speed or lower accuracy the 10k limit can be raised.  There should be a formula for sample time versus input resistance.

My software has no bugs, only undocumented features.

--- On Sat, 3/19/11, Les g8fub@...> wrote:

From: Les g8fub@...>Subject: [piclist] Re: PIC A/D and Voltage DividerTo: piclist@yahoogroups.comDate: Saturday, March 19, 2011, 4:09 AM

 



Hi Max,

The potential divider chain will not load the battery it will load the voltage being measure. (Unless it is the devices battery voltage being measured.) Section 9.3 of the data sheet explains the things that need to be considered when using the ADC. It does suggest that the source resistance should not be above 10 K ohms. This would mean that the highest value resistors that you could use would be 12.5 K and 50 K The source resistance also depends on how fast you need to take samples.

Les.



--- In piclist@yahoogroups.com, "Max" kg4pid@...> wrote:

>

> This group has been way too quite for too long. I thought I'd liven things up a bit by asking a question. I would like to use the on chip A/D converter in a Pic 16F887 and I have some Microchip MCP1541 4.096 voltage reference devices. I need to be able to measure voltages up to around 18 volts. If I use a voltage divider that divides the input voltage by 5, I could measure up to 20.46 volts. So far so good. Now there are a lot of combinations of resistors that could be used to divide by 5. This project will be battery powered so I want to keep the current through the resistors to a minimum to extend battery life. But if I use too high of resistance, the impedance of the A/D converter will affect the accuracy of the readings. Is there a formula to use when calculating resistance values? I am trying to avoid using an Op Amp as a buffer.

>

> Thanks in Advance

>

> Max

>



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

#11558 Apr 24, 2011

You should be able to use a fairly large, low-leakage capacitor on the

input of the A/D. This will, of course, limit how fast you can see

changes in the input voltage, but if you are simply measuring DC, then

that shouldn't be a problem. The capacitor will charge to the divided

voltage, and provide current while the A/D is sampling. Accuracy and

low power at the same time.

The cap will also filter out any noise that is induced into the

high-impedance voltage divider.



Charles Linquist.


S
e
n
i
o
r
T
u
b
e
.
o
r
g