Searching \ for '[PIC]: [EE]: NTC sampling via R/C-network and jitt' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: '[EE]: NTC sampling via R/C-network and jitt'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: [EE]: NTC sampling via R/C-network and jitt'
2003\02\18@194404 by Kyrre Aalerud

flavicon
face
I'm using a R/C-network to read the resistance of some thermistors with a
PIC16F627.
I'm currently using a 10uF cap and a 10k(@25c) thermistor and have a 24 bit
counter-loop taking 10us pr loop.  I was under the impression that as long
as I discharged the cap really good before recharge, I should get fairly
equal consequtive readings.  It turns out I get a 13 bit jitter!
This jitter only translates to about 0.03c but still...

The transformation to temperature from time-reading is done in the computer,
instead of the PIC.  This allows for the use of floatingpoint math and
exp/log functions.  I use the correct curve for the NTC resistors  and have
noticed av very close match to "real-world".  Doing a comparison between two
analog thermometers and two of my sensors in a glass of water revealed no
observable deviations across 60 to 13c!  I calibrated the sensor-loop once
at 22c as it was room-temp. (As read of the analog thermometers.)

I'm using the internal 4 MHz oscillator of the 16F627.  Can this be the
source of the jitter, or is it parhaps that I run the circuit from the DTR
and RTS signals fo the serial-port.
I am running the power through diodes and a resistor, but a capacitor may
not be a bad idea?

All ideas welcome.  Except adding a ADC, I'm trying to keep this simple and
cheap!

   KreAture

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\18@205915 by hard Prosser

flavicon
face
I'm sorry - bu t I don't fully understand what you are doing.
My best interpretation is that you are using a PIC pin to charge a
capacitor via a NTC resistor and timing the point at which a different pin
changes state to derive a value for the resistance - and then the
temperature. The whole lot being powered from a PC's RS232 port via a
resistor/diode network of some sort.

If this is the case, then a 10uF cap seems excessive making the time
constant involved something like 100mS.
If you are using a 10uF cap then it seems likly it is an electrolytic. Not
a good choice for this as amoungst other effects (such as wide tolerances,
temperature effects, aging & leakage) , they can regain a small amount of
charge after a "full" discharge - I forget the correct term for the effect
but polyprop. caps are a lot more satisfactory - but you'll be stuck with
lower capacitance.

If you are powering the whole shebang from a serial port - or if you're
not, a filter cap on the power suppply would be mandetory.

Hope this helps - I may have misinterpreted the problem but it may help
anyway.

Richard P






                   Kyrre Aalerud
                   <kreature@C2I.        To:     spam_OUTPICLISTTakeThisOuTspamMITVMA.MIT.EDU
                   NET>                  cc:
                   Sent by: pic          Subject:     [PIC]: [EE]: NTC sampling via R/C-network and jitter...
                   microcontrolle
                   r discussion
                   list
                   <PICLIST@MITVM
                   A.MIT.EDU>


                   19/02/03 13:50
                   Please respond
                   to pic
                   microcontrolle
                   r discussion
                   list






I'm using a R/C-network to read the resistance of some thermistors with a
PIC16F627.
I'm currently using a 10uF cap and a 10k(@25c) thermistor and have a 24 bit
counter-loop taking 10us pr loop.  I was under the impression that as long
as I discharged the cap really good before recharge, I should get fairly
equal consequtive readings.  It turns out I get a 13 bit jitter!
This jitter only translates to about 0.03c but still...

The transformation to temperature from time-reading is done in the
computer,
instead of the PIC.  This allows for the use of floatingpoint math and
exp/log functions.  I use the correct curve for the NTC resistors  and have
noticed av very close match to "real-world".  Doing a comparison between
two
analog thermometers and two of my sensors in a glass of water revealed no
observable deviations across 60 to 13c!  I calibrated the sensor-loop once
at 22c as it was room-temp. (As read of the analog thermometers.)

I'm using the internal 4 MHz oscillator of the 16F627.  Can this be the
source of the jitter, or is it parhaps that I run the circuit from the DTR
and RTS signals fo the serial-port.
I am running the power through diodes and a resistor, but a capacitor may
not be a bad idea?

All ideas welcome.  Except adding a ADC, I'm trying to keep this simple and
cheap!

   KreAture

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\18@222003 by Kyrre Aalerud

flavicon
face
You understood 100%.

I am doing this with 10 pinns, giving 10 different sensors and using two
pinns for the control.  1 pin for discharge through a 300 Ohm resistor and
one pin directly connected to capacitor for sensing.

As I've said, i got remarkably good results, but I think I can do better...
I think I'll try a smaller cap as you suggest.  I can then also shrink the
number of bits from 24 to 16.  This will give me 20% more cycles pr second
as I reduce the loop from 10us to 8us.
I've simply been stupid not to include a filter cap at the power-rails.  I
do have a zener making sure I don't get over-voltage.  (5.1v)

   KreAture


{Original Message removed}

2003\02\19@003127 by Ray Gallant

flavicon
face
----- Original Message -----
From: "Kyrre Aalerud" <.....kreatureKILLspamspam@spam@C2I.NET>
To: <PICLISTspamKILLspamMITVMA.MIT.EDU>
Sent: Tuesday, February 18, 2003 11:26 PM
Subject: Re: [PIC]: [EE]: NTC sampling via R/C-network and jitter...


> You understood 100%.
>
> I am doing this with 10 pinns, giving 10 different sensors and using two
> pinns for the control.  1 pin for discharge through a 300 Ohm resistor and
> one pin directly connected to capacitor for sensing.
>
> As I've said, i got remarkably good results, but I think I can do
better...
> I think I'll try a smaller cap as you suggest.  I can then also shrink the
> number of bits from 24 to 16.  This will give me 20% more cycles pr second
> as I reduce the loop from 10us to 8us.
> I've simply been stupid not to include a filter cap at the power-rails.  I
> do have a zener making sure I don't get over-voltage.  (5.1v)

Zener can potentially be a noisy device.

{Quote hidden}

pin
> > changes state to derive a value for the resistance - and then the
> > temperature. The whole lot being powered from a PC's RS232 port via a
> > resistor/diode network of some sort.
> >
> > If this is the case, then a 10uF cap seems excessive making the time
> > constant involved something like 100mS.
> > If you are using a 10uF cap then it seems likly it is an electrolytic.
Not
> > a good choice for this as amoungst other effects (such as wide
tolerances,
> > temperature effects, aging & leakage) , they can regain a small amount
of
> > charge after a "full" discharge - I forget the correct term for the
effect
> > but polyprop. caps are a lot more satisfactory - but you'll be stuck
with
{Quote hidden}

long
{Quote hidden}

no
> > observable deviations across 60 to 13c!  I calibrated the sensor-loop
once
> > at 22c as it was room-temp. (As read of the analog thermometers.)
> >
> > I'm using the internal 4 MHz oscillator of the 16F627.  Can this be the
> > source of the jitter, or is it parhaps that I run the circuit from the
DTR
> > and RTS signals fo the serial-port.
> > I am running the power through diodes and a resistor, but a capacitor
may
> > not be a bad idea?
> >
> > All ideas welcome.  Except adding a ADC, I'm trying to keep this simple
> and
> > cheap!
> >
> >     KreAture

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email @spam@listservKILLspamspammitvma.mit.edu with SET PICList DIGEST in the body

2003\02\19@034523 by hael Rigby-Jones

picon face
{Quote hidden}

Are you using the built in comparator to measure the charge time, and do you
use the inbuilt voltage reference on the other comparator input?  This is
essential to get a repeatable measurement, the standard ports switching
threshold changes with supply voltage.  A well regulated noise free supply
is essential, the PIC's output pins will change voltage with the supply and
if your reference voltage is fixed this could give you quite large
variations.

Is your counter loop totaly isochronous?  If you need more resolution
consider Scott Dattalo's ultra-cunning counter that gives 3 cycle
resolution.  I've used this with good results in almost exactly the same
application as you.  I don't have web access at the moment, but AFAIR it's
not on his web page, you may have to search the archives for it.

As Richard has said, an electroylitic is a bad idea in any precision circuit
such as yours.

Regards

Mike

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spamBeGonelistservspamBeGonespammitvma.mit.edu with SET PICList DIGEST in the body

2003\02\19@042517 by Alan B. Pearce

face picon face
>I'm currently using a 10uF cap and a 10k(@25c) thermistor
>and have a 24 bit counter-loop taking 10us pr loop.  I was
>under the impression that as long as I discharged the cap
>really good before recharge, I should get fairly equal
>consequtive readings.  It turns out I get a 13 bit jitter!
>This jitter only translates to about 0.03c but still...

Temperature to 24 bits ???? Not surprised you see 13 bit jitter.

With regard to how you are trying to measure the thermistor resistance, I
would have said the capacitor value is too large, and also if you are
holding the capacitor in a discharged state by shunting it with a transistor
on an output port, then you will have some self-heating effects in the
thermistor. These will certainly show if you are really trying to measure to
24 bits.

The other factor you will get is air currents around the thermistor will
certainly be making the temperature wander by a reasonable number of bits, I
would have thought that +/-0.1C would easily occur between adjacent readings
from this alone. I am surprised that what you see is better than this, and
do wonder about your calculation.

Another factor that will get you is variation in the input port threshold. I
do not know how much this will vary with temperature, but again this will be
a source of bit jitter.

Have you considered how much leakage current of the capacitor will affect
your readings? If using a tantalum then this may not be a problem, but any
sort of aluminium electrolytic will have some leakage current that will
affect the charging curve.

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email TakeThisOuTlistservEraseMEspamspam_OUTmitvma.mit.edu with SET PICList DIGEST in the body

2003\02\19@084305 by Olin Lathrop

face picon face
> I'm using a R/C-network to read the resistance of some thermistors with
a
> PIC16F627.
> I'm currently using a 10uF cap and a 10k(@25c) thermistor and have a 24
bit
> counter-loop taking 10us pr loop.  I was under the impression that as
long
> as I discharged the cap really good before recharge, I should get fairly
> equal consequtive readings.  It turns out I get a 13 bit jitter!
> This jitter only translates to about 0.03c but still...

How many good bits are left?  It sounds like your system is very accurate
if you can measure 0.03C.  In other words, what's your signal to noise
ratio?  It sounds like is actually surprisingly high, in which case there
is no problem.  There are many potential sources of noise, so some noise
shouldn't be a surprise nor considered a problem.  It all depends on what
signal to noise ratio you need and what you were expecting.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservspamTakeThisOuTmitvma.mit.edu with SET PICList DIGEST in the body

2003\02\19@115414 by llile

flavicon
face
If I were trying to get accurate measurements in such a system, I would :

1. Stay away from internal oscillators, go with an accurate crystal

2. Measure the thermistor with a median routine that reads a number of
times over at least two AC cycles, to get rid of the most obvious source
of noise,
3. Stay away from electrolytic caps, as they are not very accurate  Use a
precision film cap with good temperature stability

4.  Use a 5 volt linear regulator on the power line

5. shield my thermistor cables and ground the shield at my PCB ground
plane, ONly at one end

Having said this, I would also stay away from the old reliable r/c network
method of measuring resistance.  I think this is great for a really cheap
implementation, but if you want accuracy you should consider A/D with
prefiltering via and op-amp.

Now, have I made your project complicated enough?  ;-)



-- Lawrence Lile


--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservEraseMEspam.....mitvma.mit.edu with SET PICList DIGEST in the body

2003\02\25@062253 by Kyrre Aalerud

flavicon
face
----- Original Message -----
From: "Alan B. Pearce" <EraseMEA.B.PearcespamRL.AC.UK>
To: <RemoveMEPICLISTEraseMEspamEraseMEMITVMA.MIT.EDU>
Sent: Wednesday, February 19, 2003 10:25 AM
Subject: Re: [PIC]: [EE]: NTC sampling via R/C-network and jitter...
> >I'm currently using a 10uF cap and a 10k(@25c) thermistor
> >and have a 24 bit counter-loop taking 10us pr loop.  I was
> >under the impression that as long as I discharged the cap
> >really good before recharge, I should get fairly equal
> >consequtive readings.  It turns out I get a 13 bit jitter!
> >This jitter only translates to about 0.03c but still...
> Temperature to 24 bits ???? Not surprised you see 13 bit jitter.
> With regard to how you are trying to measure the thermistor resistance, I
> would have said the capacitor value is too large, and also if you are
> holding the capacitor in a discharged state by shunting it with a
transistor
> on an output port, then you will have some self-heating effects in the
> thermistor. These will certainly show if you are really trying to measure
to
> 24 bits.

I don't have the input to the resistor high while shunting to avoid this
issue.
This is how i do it, psaudocode/asm:
test:
 assume outputs are all tristated (inputs)
 set shunt to output and make sure it's low. (leave low for 250 ms.)
 tristate shunt pin
 set pin for sensor to output and make sure it's high
loop:
 incf    cntr0
 skpnz
 incf    cntr1
 btfss    PORTx, <pin>
 goto    loop
 tristate sensor pin
 return

> The other factor you will get is air currents around the thermistor will
> certainly be making the temperature wander by a reasonable number of bits,
I
> would have thought that +/-0.1C would easily occur between adjacent
readings
> from this alone. I am surprised that what you see is better than this, and
> do wonder about your calculation.

The first step is scaling input to match supposed resistance by calculating
the expected resistance at the calibration-point given by user.  To do this
I use the formulae "R = Rt0 * exp(B* (1/T -1/T0))".  Then I use the formulae
"T = 1/((log(R) - log(Rt0))/B + (1/T0))"  given by the producer of the
sensors to get temp from reading.
They claim this to be the best match if possible.  If not, one can use the
formulae with a/b/c parameters and try to approximate.

> Another factor that will get you is variation in the input port threshold.
I
> do not know how much this will vary with temperature, but again this will
be
> a source of bit jitter.

Hmm, yes.  I suppose I could simply round off the numbers to avoid this...

> Have you considered how much leakage current of the capacitor will affect
> your readings? If using a tantalum then this may not be a problem, but any
> sort of aluminium electrolytic will have some leakage current that will
> affect the charging curve.

Hmm, I'll switch to a tantalum.  I've found I can do with a much smaller cap
anyway, and the 16 bit accuracy didn't change results.

   KreAture

--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestspam_OUTspamKILLspammitvma.mit.edu>

2003\02\25@063113 by Kyrre Aalerud

flavicon
face
----- Original Message -----
From: <RemoveMEllileTakeThisOuTspamspamSALTONUSA.COM>
To: <EraseMEPICLISTspamspamspamBeGoneMITVMA.MIT.EDU>
Sent: Wednesday, February 19, 2003 5:52 PM
Subject: Re: [PIC]: [EE]: NTC sampling via R/C-network and jitter...
{Quote hidden}

Yes.  But, this is a ultra-cheap solution so I don't think I'll go for more
accuracy.  It actually seems good enough now, when changing caps.  I've had
it running for 5 days now just to see.  Here's some readings taken about 1
sec apart:

20.377140
20.402543
20.343324
20.341635
20.341635
20.296086

(All values in degrees celcius.)
I think the cap did the trick :-)

   KreAture

--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestKILLspamspammitvma.mit.edu>

2003\02\26@095449 by hael Rigby-Jones

picon face
> -----Original Message-----
> From: Kyrre Aalerud [SMTP:kreatureSTOPspamspamspam_OUTC2I.NET]
> Sent: Tuesday, February 25, 2003 11:32 AM
> To:   spamBeGonePICLISTSTOPspamspamEraseMEMITVMA.MIT.EDU
> Subject:      Re: [PIC]: [EE]: NTC sampling via R/C-network and jitter...
>
> Hmm, I'll switch to a tantalum.  I've found I can do with a much smaller
> cap
> anyway, and the 16 bit accuracy didn't change results.
>
>
Don't use a tantalum, they have a very poor temperature coefficient, nearly
as bad as an electrolytic (around 5% change for 50 degreeC change)  For
critical applications you can buy caps with almost zero tempco, but a
polystyrene cap (and some ceramic caps) should give good performance at as
reasonable price.  Check the datasheets before using!

Mike


=======================================================================
This e-mail is intended for the person it is addressed to only. The
information contained in it may be confidential and/or protected by
law. If you are not the intended recipient of this message, you must
not make any use of this information, or copy or show it to any
person. Please contact us immediately to tell us that you have
received this e-mail, and return the original to us. Any use,
forwarding, printing or copying of this message is strictly prohibited.
No part of this message can be considered a request for goods or
services.
=======================================================================
Any questions about Bookham's E-Mail service should be directed to KILLspampostmasterspamBeGonespambookham.com.

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads

More... (looser matching)
- Last day of these posts
- In 2003 , 2004 only
- Today
- New search...