Forums

Need some advice on RC characteristics of Slope ADC

Started by Myauk September 13, 2012
Hi All,

As I am working on Slope ADC configuration as described by AN863
(http://ww1.microchip.com/downloads/en/AppNotes/00863a.pdf)
Microchip application note AN929 http://ww1.microchip.com/downloads/en/AppNotes/00929a.pdf
, page 3 figure 5 shows Ramp Rate Method where by using a single
Capacitor and a known ref: resistor, the resistance of any unknown
resistor Rx can be measured. The method goes as follows:

1. Connect the supply voltage through the ref: resistor Rref and let
the capacitor chraged until it reaches threshold voltage Vth, the
charge time T1 is recorded.
2. Discharge the capacitor and then connect the supply voltage again
through unknown resistor Rx, and let the capacitor charged until it
reaches threshould voltage Vth, charge time T2 is then recorded.

And theoractically, Rx = (T2/T1) * Rref

I used C = 0.47 uF, Rref = 200 ohms, Vth = 2.02V, Vsupply = 3.08V (I
use PIC18F45k20 port RA1 and RA2 to supply voltage to RC ckt, and RA0
as the comparator input).

Results are not as expected.

When Rref = 200 ohms with C=0.47 uF , time T1 is measured to be 138 us
to reach 2.02V. Again, when Rx = 360,540 ohms, with the same capacitor
0.47uF, time T2 is measured to be 200,292 us. The time Ratios T2/T1
does not match the time ratio in this experiment.

I understand that the source characteristics of the I/O port in the
MCU affects the charge time behaviour but I am not sure how exactly it
relates and I do not know how to model the circuit so as for me to
calculate predictable results.

Any suggestions?

Regards
On Sep 13, 4:03=A0am, Myauk <aungkokot...@gmail.com> wrote:
> Hi All, > > As I am working on Slope ADC configuration as described by AN863 > (http://ww1.microchip.com/downloads/en/AppNotes/00863a.pdf) > Microchip application note AN929http://ww1.microchip.com/downloads/en/App=
Notes/00929a.pdf
> , page 3 figure 5 shows Ramp Rate Method where by using a single > Capacitor and a known ref: resistor, the resistance of any unknown > resistor Rx can be measured. The method goes as follows: > > 1. Connect the supply voltage through the ref: resistor Rref and let > the capacitor chraged until it reaches threshold voltage Vth, the > charge time T1 is recorded. > 2. Discharge the capacitor and then connect the supply voltage again > through unknown resistor Rx, and let the capacitor charged until it > reaches threshould voltage Vth, charge time T2 is then recorded. > > And theoractically, Rx =3D (T2/T1) * Rref > > I used C =3D 0.47 uF, Rref =3D 200 ohms, Vth =3D 2.02V, Vsupply =3D 3.08V=
(I
> use PIC18F45k20 port RA1 and RA2 to supply voltage to RC ckt, and RA0 > as the comparator input). > > Results are not as expected. > > When Rref =3D 200 ohms with C=3D0.47 uF , time T1 is measured to be 138 u=
s
> to reach 2.02V. Again, when Rx =3D 360,540 ohms, with the same capacitor > 0.47uF, time T2 is measured to be 200,292 us. The time Ratios T2/T1 > does not match the time ratio in this experiment. > > I understand that the source characteristics of the I/O port in the > MCU affects the charge time behaviour but I am not sure how exactly it > relates and I do not know how to model the circuit so as for me to > calculate predictable results. > > Any suggestions? > > Regards
What's the source impedance driving the RC? (most likely pretty low.. but.) What's the input impedance of the comparator input? George H.
> What's the source impedance driving the RC? =A0(most likely pretty low.. > but.) > What's the input impedance of the comparator input? > > George H.
Hi George, Thanks for your reply. May I know if there is any way to find out? The Microchip does not give me such details. Regards
On Thu, 13 Sep 2012 01:03:35 -0700, Myauk wrote:

> Hi All, > > As I am working on Slope ADC configuration as described by AN863 > (http://ww1.microchip.com/downloads/en/AppNotes/00863a.pdf) Microchip > application note AN929 > http://ww1.microchip.com/downloads/en/AppNotes/00929a.pdf , page 3 > figure 5 shows Ramp Rate Method where by using a single Capacitor and a > known ref: resistor, the resistance of any unknown resistor Rx can be > measured. The method goes as follows: > > 1. Connect the supply voltage through the ref: resistor Rref and let the > capacitor chraged until it reaches threshold voltage Vth, the charge > time T1 is recorded. > 2. Discharge the capacitor and then connect the supply voltage again > through unknown resistor Rx, and let the capacitor charged until it > reaches threshould voltage Vth, charge time T2 is then recorded. > > And theoractically, Rx = (T2/T1) * Rref > > I used C = 0.47 uF, Rref = 200 ohms, Vth = 2.02V, Vsupply = 3.08V (I use > PIC18F45k20 port RA1 and RA2 to supply voltage to RC ckt, and RA0 as the > comparator input). > > Results are not as expected. > > When Rref = 200 ohms with C=0.47 uF , time T1 is measured to be 138 us > to reach 2.02V. Again, when Rx = 360,540 ohms, with the same capacitor > 0.47uF, time T2 is measured to be 200,292 us. The time Ratios T2/T1 does > not match the time ratio in this experiment. > > I understand that the source characteristics of the I/O port in the MCU > affects the charge time behaviour but I am not sure how exactly it > relates and I do not know how to model the circuit so as for me to > calculate predictable results. > > Any suggestions? > > Regards
What are you using for a switch? Electronic switches have non-zero impedances, with some of the less expensive ones (like the CD4051-ish ones) being over 100 ohms. If you're using one that has a 50 ohm "on" resistance, then the math works out pretty well. It looks like you're using a PIC port to as the switch? Check the data sheet -- if they don't say what the effective resistance of the port is directly, you can approximate it by looking at their rated current and voltage drop for the pin as a current driver. PICs are pretty good about driving lots of current, but I still wouldn't be surprised at 50 ohms. What are you using for a capacitor? Electrolytic capacitors -- even tantalum caps -- leak, and act like resistors in parallel to the cap. Most capacitors have all sorts of second-order effects that make them act like they have less capacitance at high frequencies than at low, but I wouldn't expect _that_ much unless you maybe used the cheapest possible ceramic. OTOH, both of the effects that I mentioned would make the high resistance time longer, not shorter. If you're using a capacitor with a high ESR (electrolytic, again) or if you have some resistance in series with the cap after you tap off your comparator input, then the higher current from the 200 ohm resistor would raise the capacitor voltage, and make the comparator pop off quicker. Basically, you need to draw out your _actual_ circuit, then you need to add in all of the parasitic effects that you can think of, _with values_, and assess each one to see if you can figure out what is screwing you up. More empirically, you can substitute a number of different resistance standards for the 200 ohms, and plot a time vs. resistance chart, then see if anything jumps out at you. -- My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com
> What are you using for a switch? =A0Electronic switches have non-zero > impedances, with some of the less expensive ones (like the CD4051-ish > ones) being over 100 ohms. =A0If you're using one that has a 50 ohm "on" > resistance, then the math works out pretty well. > > It looks like you're using a PIC port to as the switch? =A0Check the data > sheet -- if they don't say what the effective resistance of the port is > directly, you can approximate it by looking at their rated current and > voltage drop for the pin as a current driver. =A0PICs are pretty good abo=
ut
> driving lots of current, but I still wouldn't be surprised at 50 ohms. > > What are you using for a capacitor? =A0Electrolytic capacitors -- even > tantalum caps -- leak, and act like resistors in parallel to the cap. > Most capacitors have all sorts of second-order effects that make them act > like they have less capacitance at high frequencies than at low, but I > wouldn't expect _that_ much unless you maybe used the cheapest possible > ceramic. =A0OTOH, both of the effects that I mentioned would make the hig=
h
> resistance time longer, not shorter. > > If you're using a capacitor with a high ESR (electrolytic, again) or if > you have some resistance in series with the cap after you tap off your > comparator input, then the higher current from the 200 ohm resistor would > raise the capacitor voltage, and make the comparator pop off quicker. > > Basically, you need to draw out your _actual_ circuit, then you need to > add in all of the parasitic effects that you can think of, _with values_, > and assess each one to see if you can figure out what is screwing you up. > > More empirically, you can substitute a number of different resistance > standards for the 200 ohms, and plot a time vs. resistance chart, then > see if anything jumps out at you. > > -- > My liberal friends think I'm a conservative kook. > My conservative friends think I'm a liberal kook. > Why am I not happy that they have found common ground? > > Tim Wescott, Communications, Control, Circuits & Softwarehttp://www.wesco=
ttdesign.com Hello Tim, Thanks for your kind reply. I have got a reply from the original author of the application notes. He said the microchip I/O ports have about 50-100 ohms of resistance. Additionally, they have a slew rate limit that prevents them from activating too fast. For the case of capacitor I am using NPO Capacitors http://sg.element14.com/jsp/search/productdetail.jsp?SKU=3D1679460. For Modelling such circuits, what are the critical parasitic parameters for my case? ESL? ESR? Just for clarification, they are the lumped parameters calculated by the supplier for modelling the capacitors, right? I mean once I use ESL or ESR I don't need to use parallel parasitic resistance and inductance parameters any more, I guess.. Regards Aung
On Thu, 13 Sep 2012 01:03:35 -0700 (PDT), Myauk
<aungkokothet@gmail.com> wrote:

>Hi All, > >As I am working on Slope ADC configuration as described by AN863 >(http://ww1.microchip.com/downloads/en/AppNotes/00863a.pdf) >Microchip application note AN929 http://ww1.microchip.com/downloads/en/AppNotes/00929a.pdf >, page 3 figure 5 shows Ramp Rate Method where by using a single >Capacitor and a known ref: resistor, the resistance of any unknown >resistor Rx can be measured. The method goes as follows: > >1. Connect the supply voltage through the ref: resistor Rref and let >the capacitor chraged until it reaches threshold voltage Vth, the >charge time T1 is recorded. >2. Discharge the capacitor and then connect the supply voltage again >through unknown resistor Rx, and let the capacitor charged until it >reaches threshould voltage Vth, charge time T2 is then recorded. > >And theoractically, Rx = (T2/T1) * Rref > >I used C = 0.47 uF, Rref = 200 ohms, Vth = 2.02V, Vsupply = 3.08V (I >use PIC18F45k20 port RA1 and RA2 to supply voltage to RC ckt, and RA0 >as the comparator input). > >Results are not as expected. > >When Rref = 200 ohms with C=0.47 uF , time T1 is measured to be 138 us >to reach 2.02V. Again, when Rx = 360,540 ohms, with the same capacitor >0.47uF, time T2 is measured to be 200,292 us. The time Ratios T2/T1 >does not match the time ratio in this experiment. > >I understand that the source characteristics of the I/O port in the >MCU affects the charge time behaviour but I am not sure how exactly it >relates and I do not know how to model the circuit so as for me to >calculate predictable results. > >Any suggestions? > >Regards
The uP ports will have some equivalent resistance to Vcc when they are pulling up your resistors. If you short the capacitor and turn on the pullups one at a time, you can measure the DC voltage at the pullup port and calculate the resistance. It won't be quite the same at different ports, and it won't stay linear/purely resistive at higher currents. 200 ohms is kind of low to measure accurately this way. Port equivalent resistance will start to matter. Does the uP have an ADC? -- John Larkin Highland Technology, Inc jlarkin at highlandtechnology dot com http://www.highlandtechnology.com Precision electronic instrumentation Picosecond-resolution Digital Delay and Pulse generators Custom laser drivers and controllers Photonics and fiberoptic TTL data links VME thermocouple, LVDT, synchro acquisition and simulation
On Thu, 13 Sep 2012 10:16:45 -0700, Myauk wrote:

>> What are you using for a switch? &nbsp;Electronic switches have non-zero >> impedances, with some of the less expensive ones (like the CD4051-ish >> ones) being over 100 ohms. &nbsp;If you're using one that has a 50 ohm "on" >> resistance, then the math works out pretty well. >> >> It looks like you're using a PIC port to as the switch? &nbsp;Check the data >> sheet -- if they don't say what the effective resistance of the port is >> directly, you can approximate it by looking at their rated current and >> voltage drop for the pin as a current driver. &nbsp;PICs are pretty good >> about driving lots of current, but I still wouldn't be surprised at 50 >> ohms. >> >> What are you using for a capacitor? &nbsp;Electrolytic capacitors -- even >> tantalum caps -- leak, and act like resistors in parallel to the cap. >> Most capacitors have all sorts of second-order effects that make them >> act like they have less capacitance at high frequencies than at low, >> but I wouldn't expect _that_ much unless you maybe used the cheapest >> possible ceramic. &nbsp;OTOH, both of the effects that I mentioned would >> make the high resistance time longer, not shorter. >> >> If you're using a capacitor with a high ESR (electrolytic, again) or if >> you have some resistance in series with the cap after you tap off your >> comparator input, then the higher current from the 200 ohm resistor >> would raise the capacitor voltage, and make the comparator pop off >> quicker. >> >> Basically, you need to draw out your _actual_ circuit, then you need to >> add in all of the parasitic effects that you can think of, _with >> values_, and assess each one to see if you can figure out what is >> screwing you up. >> >> More empirically, you can substitute a number of different resistance >> standards for the 200 ohms, and plot a time vs. resistance chart, then >> see if anything jumps out at you. >> >> -- >> My liberal friends think I'm a conservative kook. My conservative >> friends think I'm a liberal kook. Why am I not happy that they have >> found common ground? >> >> Tim Wescott, Communications, Control, Circuits & >> Softwarehttp://www.wescottdesign.com > > Hello Tim, > > Thanks for your kind reply. > > I have got a reply from the original author of the application notes. He > said the microchip I/O ports have about 50-100 ohms of resistance. > Additionally, they have a slew rate limit that prevents them from > activating too fast. > > For the case of capacitor I am using NPO Capacitors > http://sg.element14.com/jsp/search/productdetail.jsp?SKU=1679460. > > For Modelling such circuits, what are the critical parasitic parameters > for my case? ESL? ESR? Just for clarification, they are the lumped > parameters calculated by the supplier for modelling the capacitors, > right? I mean once I use ESL or ESR I don't need to use parallel > parasitic resistance and inductance parameters any more, I guess..
Even in a 2220 case, I'm mildly astonished at a 470nF C0G cap. Especially if you use the microprocessor ports for switching, I don't think you have to worry about the capacitor. (There's more measurement- oriented folks on the group who may wade in with more info, though). I would expect that you'd be able to maintain fairly good accuracy over a 10:1 or maybe even 100:1 range -- beyond that, it's probably possible but you'd need to do a ton of work. So I'd choose a resistor that sits at the arithmetic mean (or maybe geometric -- I'd have to do some math) of the expected resistance range you're trying to measure, and use that as a reference. If you have the room on the board, use some small switching FETS (or analog switches, or even bipolar transistors) to turn things on, actuated by the processor. You can find ones with on-resistances that are much, much less than 50 ohms. -- My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com
John Larkin <jlarkin@highlandtechnology.com> writes:

> On Thu, 13 Sep 2012 01:03:35 -0700 (PDT), Myauk > <aungkokothet@gmail.com> wrote: > >>Hi All, >> >>As I am working on Slope ADC configuration as described by AN863 >>(http://ww1.microchip.com/downloads/en/AppNotes/00863a.pdf) >>Microchip application note AN929 http://ww1.microchip.com/downloads/en/AppNotes/00929a.pdf >>, page 3 figure 5 shows Ramp Rate Method where by using a single >>Capacitor and a known ref: resistor, the resistance of any unknown >>resistor Rx can be measured. The method goes as follows: >> >>1. Connect the supply voltage through the ref: resistor Rref and let >>the capacitor chraged until it reaches threshold voltage Vth, the >>charge time T1 is recorded. >>2. Discharge the capacitor and then connect the supply voltage again >>through unknown resistor Rx, and let the capacitor charged until it >>reaches threshould voltage Vth, charge time T2 is then recorded. >> >>And theoractically, Rx = (T2/T1) * Rref >> >>I used C = 0.47 uF, Rref = 200 ohms, Vth = 2.02V, Vsupply = 3.08V (I >>use PIC18F45k20 port RA1 and RA2 to supply voltage to RC ckt, and RA0 >>as the comparator input). >> >>Results are not as expected. >> >>When Rref = 200 ohms with C=0.47 uF , time T1 is measured to be 138 us >>to reach 2.02V. Again, when Rx = 360,540 ohms, with the same capacitor >>0.47uF, time T2 is measured to be 200,292 us. The time Ratios T2/T1 >>does not match the time ratio in this experiment. >> >>I understand that the source characteristics of the I/O port in the >>MCU affects the charge time behaviour but I am not sure how exactly it >>relates and I do not know how to model the circuit so as for me to >>calculate predictable results. >> >>Any suggestions? >> >>Regards > > The uP ports will have some equivalent resistance to Vcc when they are > pulling up your resistors. If you short the capacitor and turn on the > pullups one at a time, you can measure the DC voltage at the pullup > port and calculate the resistance. > > It won't be quite the same at different ports, and it won't stay > linear/purely resistive at higher currents. > > 200 ohms is kind of low to measure accurately this way. Port > equivalent resistance will start to matter. > > Does the uP have an ADC?
He could buy one for the cost of that cap... -- John Devereux
On Thu, 13 Sep 2012 23:01:01 +0100, John Devereux
<john@devereux.me.uk> wrote:

>John Larkin <jlarkin@highlandtechnology.com> writes: > >> On Thu, 13 Sep 2012 01:03:35 -0700 (PDT), Myauk >> <aungkokothet@gmail.com> wrote: >> >>>Hi All, >>> >>>As I am working on Slope ADC configuration as described by AN863 >>>(http://ww1.microchip.com/downloads/en/AppNotes/00863a.pdf) >>>Microchip application note AN929 http://ww1.microchip.com/downloads/en/AppNotes/00929a.pdf >>>, page 3 figure 5 shows Ramp Rate Method where by using a single >>>Capacitor and a known ref: resistor, the resistance of any unknown >>>resistor Rx can be measured. The method goes as follows: >>> >>>1. Connect the supply voltage through the ref: resistor Rref and let >>>the capacitor chraged until it reaches threshold voltage Vth, the >>>charge time T1 is recorded. >>>2. Discharge the capacitor and then connect the supply voltage again >>>through unknown resistor Rx, and let the capacitor charged until it >>>reaches threshould voltage Vth, charge time T2 is then recorded. >>> >>>And theoractically, Rx = (T2/T1) * Rref >>> >>>I used C = 0.47 uF, Rref = 200 ohms, Vth = 2.02V, Vsupply = 3.08V (I >>>use PIC18F45k20 port RA1 and RA2 to supply voltage to RC ckt, and RA0 >>>as the comparator input). >>> >>>Results are not as expected. >>> >>>When Rref = 200 ohms with C=0.47 uF , time T1 is measured to be 138 us >>>to reach 2.02V. Again, when Rx = 360,540 ohms, with the same capacitor >>>0.47uF, time T2 is measured to be 200,292 us. The time Ratios T2/T1 >>>does not match the time ratio in this experiment. >>> >>>I understand that the source characteristics of the I/O port in the >>>MCU affects the charge time behaviour but I am not sure how exactly it >>>relates and I do not know how to model the circuit so as for me to >>>calculate predictable results. >>> >>>Any suggestions? >>> >>>Regards >> >> The uP ports will have some equivalent resistance to Vcc when they are >> pulling up your resistors. If you short the capacitor and turn on the >> pullups one at a time, you can measure the DC voltage at the pullup >> port and calculate the resistance. >> >> It won't be quite the same at different ports, and it won't stay >> linear/purely resistive at higher currents. >> >> 200 ohms is kind of low to measure accurately this way. Port >> equivalent resistance will start to matter. >> >> Does the uP have an ADC? > >He could buy one for the cost of that cap...
Oh, one should make sure to discharge that cap between measurements. 10 tau, maybe. -- John Larkin Highland Technology, Inc jlarkin at highlandtechnology dot com http://www.highlandtechnology.com Precision electronic instrumentation Picosecond-resolution Digital Delay and Pulse generators Custom laser drivers and controllers Photonics and fiberoptic TTL data links VME thermocouple, LVDT, synchro acquisition and simulation
On Thu, 13 Sep 2012 10:16:45 -0700 (PDT), Myauk
<aungkokothet@gmail.com> wrote:

>> What are you using for a switch? &#2013266080;Electronic switches have non-zero >> impedances, with some of the less expensive ones (like the CD4051-ish >> ones) being over 100 ohms. &#2013266080;If you're using one that has a 50 ohm "on" >> resistance, then the math works out pretty well. >> >> It looks like you're using a PIC port to as the switch? &#2013266080;Check the data >> sheet -- if they don't say what the effective resistance of the port is >> directly, you can approximate it by looking at their rated current and >> voltage drop for the pin as a current driver. &#2013266080;PICs are pretty good about >> driving lots of current, but I still wouldn't be surprised at 50 ohms. >> >> What are you using for a capacitor? &#2013266080;Electrolytic capacitors -- even >> tantalum caps -- leak, and act like resistors in parallel to the cap. >> Most capacitors have all sorts of second-order effects that make them act >> like they have less capacitance at high frequencies than at low, but I >> wouldn't expect _that_ much unless you maybe used the cheapest possible >> ceramic. &#2013266080;OTOH, both of the effects that I mentioned would make the high >> resistance time longer, not shorter. >> >> If you're using a capacitor with a high ESR (electrolytic, again) or if >> you have some resistance in series with the cap after you tap off your >> comparator input, then the higher current from the 200 ohm resistor would >> raise the capacitor voltage, and make the comparator pop off quicker. >> >> Basically, you need to draw out your _actual_ circuit, then you need to >> add in all of the parasitic effects that you can think of, _with values_, >> and assess each one to see if you can figure out what is screwing you up. >> >> More empirically, you can substitute a number of different resistance >> standards for the 200 ohms, and plot a time vs. resistance chart, then >> see if anything jumps out at you. >> >> -- >> My liberal friends think I'm a conservative kook. >> My conservative friends think I'm a liberal kook. >> Why am I not happy that they have found common ground? >> >> Tim Wescott, Communications, Control, Circuits & Softwarehttp://www.wescottdesign.com > >Hello Tim, > >Thanks for your kind reply. > >I have got a reply from the original author of the application notes. >He said the microchip I/O ports have about 50-100 ohms of resistance. >Additionally, they have a slew rate limit that prevents them from >activating too fast.
That 50-100 ohms is lethal, if you're trying to measure 200 ohms. Try to find a higher resistance sensor.
> >For the case of capacitor I am using NPO Capacitors >http://sg.element14.com/jsp/search/productdetail.jsp?SKU=1679460.
The cap doesn't have to be stable, since the math is ratiometric.
> >For Modelling such circuits, what are the critical parasitic >parameters for my case? ESL? ESR? Just for clarification, they are the >lumped parameters calculated by the supplier for modelling the >capacitors, right? I mean once I use ESL or ESR I don't need to use >parallel parasitic resistance and inductance parameters any more, I >guess..
ESL shouldn't matter at your speeds, and most film caps will have low ESR. But don't use a ceramic... they are nonlinear on voltage. Maybe you should use another method. Like an LM71 with a digital/SPI interface. -- John Larkin Highland Technology, Inc jlarkin at highlandtechnology dot com http://www.highlandtechnology.com Precision electronic instrumentation Picosecond-resolution Digital Delay and Pulse generators Custom laser drivers and controllers Photonics and fiberoptic TTL data links VME thermocouple, LVDT, synchro acquisition and simulation