aberon
Posts: 29
Joined: Fri Jan 17, 2014 2:15 pm

Calculate R to determine temp

Tue Jan 21, 2014 3:36 pm

I have posted a few questions here so far to help me out...but have not accomplished my goal of getting an actual temperature that makes sense (so far my house is at -373F).


How do you calculate R?

I have a 10k resistor on the breadboard. I am using an MCP3008 to get the analog reading. My readings of room temp are coming in between 61 and 65.

I convert that to volts by doing: (analog_value * 3.3) / 1024.0

Then I come to the R part of the formula and completely get lost......so, any help would be most welcome.

Respectfully
CR

User avatar
FLYFISH TECHNOLOGIES
Posts: 1750
Joined: Thu Oct 03, 2013 7:48 am
Location: Ljubljana, Slovenia
Contact: Website

Re: Calculate R to determine temp

Tue Jan 21, 2014 4:08 pm

Hi,
aberon wrote:How do you calculate R?
What R are you talking about ?


Best wishes, Ivan Zilic.
Running out of GPIO pins and/or need to read analog values?
Solution: http://www.flyfish-tech.com/FF32

aberon
Posts: 29
Joined: Fri Jan 17, 2014 2:15 pm

Re: Calculate R to determine temp

Tue Jan 21, 2014 4:14 pm

The resistance....used in the Steinhart-Hart formula

I know that a, b and c are = 2.4723753e-4, 2.3402251e-4, and 1.3879768e-7 for

TempKelvin = 1.0 / ((a * R * R +b) * R + c)

note, I am also aware that I will need to math.log(R) above before sticking R into that formula.

User avatar
chrisryall
Posts: 155
Joined: Wed Nov 27, 2013 11:45 am
Location: Wirral UK
Contact: Website

Re: Calculate R to determine temp

Tue Jan 21, 2014 4:26 pm

Might sound boring, but if you don't have liquid gasses to hand you'll need to calibrate using more mundane things - classically melting ice and boiling water

If R0 is ice resistance
R100 is steam resistance

Temp in centigrade for RX

= (RX - R0) x (100 - 0) / (R100 - R0)

Same but fiddlier in Fahrenheit (does anyone still use it?) or if you calibrate to a good thermometer. There is a an assumption of linearity which is probably true in this range, probably not at liquid helium levels!

.. could you be really wacky and calibrate on the 2.73K cosmic background on your TV screen :evil:

aberon
Posts: 29
Joined: Fri Jan 17, 2014 2:15 pm

Re: Calculate R to determine temp

Tue Jan 21, 2014 4:40 pm

I don't mean to be clueless....but I am with this.

are you saying that I need to stick the thermometer in ice water and read the analog results from the pi to get the ice resistance? If so, do I convert to volts.

The best way to help me with this is to pretend I know nothing, and need a little hand-holding. For example...stick thermometer in ice and read X, then do Y, then beg someone for help again....hehe.

Thanks again,
CR

Ravenous
Posts: 1956
Joined: Fri Feb 24, 2012 1:01 pm
Location: UK

Re: Calculate R to determine temp

Tue Jan 21, 2014 4:45 pm

I'm really not convinced we're wiring this thing up correctly, also I'm very suspicious of plugging in an equation with assumed values of a, b, c and expecting it to work - do we really trust whoever gave you those values?

Have you tried measuring the resistance of the probe, using just an ordinary DC multimeter with nothing else connected?

Also, I'm not clear but I gather this thing has only two connections, and it is wired to a simple "mono" headphone-style plug with a screen/earth contact and a single tip contact?

Also, are you sure a 10K resistor is the right thing to use - are you sure there isn't any self-heating going on anywhere and a bigger resistor is preferred for this probe?

Without anything else connected, I think you need the following: a resistor conneted to +5V or +3.3V (doubt if it matters much); other end of the resistor connected to the "tip" contact; the "earth" contact wired to 0V. nothing else connected anywhere. With this connection, I would expect a voltage to be readable with a multimeter at the "tip" contact, somewhere nicely between 0 and +V, which might vary very very slightly with temperature.

Chris's comments about calibrating it, maybe with a linear fit instead of the Steinway-Sausage thing :D , is a good idea too, to get some rough readings. Theoretical equations are good in theory...

aberon
Posts: 29
Joined: Fri Jan 17, 2014 2:15 pm

Re: Calculate R to determine temp

Tue Jan 21, 2014 5:08 pm

I am confident about the 3 numbers, but not 100% certain. I researched the probe online, with the manufacturer and with another firm who uses these specific probes in a similar solution.

I do not have a multimeter, but am guessing that I will be headed to RadioShack or Lowe's to get one. Therefore I have not done that.

Again, pretty sure the 10k resistor is correct, based on my research into the probe as well. The probe is a Maverick E-72 and E-73. I also have a T732, but could not get specific numbers on that probe online or from the manufacturer. If you are asking, I am assuming you have a concern....what is that concern?

As for connections...I have 2 connections (the third is not needed because the probe only has 2 wires. My connections are as follows. Ground from probe -> MCP3008 channel 1 -> 10 resistor .....to ground on breadboard; power to 3.3v to power/red on probe.

This has been driving me crazy for a week now with way to many hours in it to count. I know there is a learning curve for me, as I am just a programmer and not an electrical engineer....but I thought I could figure it out.

Ravenous....I would be more than willing to do a facetime/skype thing and show you everything I got....if you are up for it, PM me.

Ravenous
Posts: 1956
Joined: Fri Feb 24, 2012 1:01 pm
Location: UK

Re: Calculate R to determine temp

Tue Jan 21, 2014 5:49 pm

I'm afraid I don't know anything about using these probes, I was just interested to hear what the problem was, but here's the only circuit I found - arduino based but all similar stuff I think:
http://hruska.us/tempmon/

I think from your description you do have it wired correctly, but you might want to check (yet) again. Oh, the reason I mentioned the 10K resistor is that too low a value will increase the current and might cause odd self-heating effects, but it would probably need a very low value to cause real problems.

A cheap multimeter (with a resistance/ohms reading for completeness) really is a handy thing to have I promise!

aberon
Posts: 29
Joined: Fri Jan 17, 2014 2:15 pm

Re: Calculate R to determine temp

Tue Jan 21, 2014 5:59 pm

hooked up a multimeter....not sure if I did it right, but got the following:

.53 in a glass of ice water
.18 under a lighter

aberon
Posts: 29
Joined: Fri Jan 17, 2014 2:15 pm

Re: Calculate R to determine temp

Tue Jan 21, 2014 6:12 pm

also....i put in a 22k resistor (red, red, black, gold), and tried 5V instead of 3.3 -> following the example you sent.

I get 0 for the returned value from the MCP3008....

danjperron
Posts: 3511
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Calculate R to determine temp

Tue Jan 21, 2014 6:30 pm

Strange if I use the Steinhart-Hart equation from wikipedia , I got 31 celsius.

3.3V * 61 / 1024 = 0.1966V
then the current is 19.7 micro ampere.
and the thermistor will be R=(3.3V - 0.1966V) / 19.7e-6A= 157869 ohm

temp = A + B * ln(R) + C * ln(R)* ln(R) * ln(R) = 304.3 Kelvin

Dont' forget that you will have some current leakage to the a/d converter

Daniel

User avatar
rpdom
Posts: 17409
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Calculate R to determine temp

Tue Jan 21, 2014 6:45 pm

aberon wrote:also....i put in a 22k resistor (red, red, black, gold), and tried 5V instead of 3.3 -> following the example you sent.

I get 0 for the returned value from the MCP3008....
Red, red, black, gold is 22 Ohm, not 22000 Ohm. (red=2, red=2, black=0, gold=divide by 10).

What you need there is Red, red, black, red (red=2, red=2, black=0, red=multiply by 100)

aberon
Posts: 29
Joined: Fri Jan 17, 2014 2:15 pm

Re: Calculate R to determine temp

Tue Jan 21, 2014 6:49 pm

so, multiple mistakes killing a newbie. But, that is why I put the detail in the posts. When I am working with my seven year old on his math homework, I tell him...you are not smarter than math...do all the steps. So, here, I am thinking I am not smarter than pi, so show all my stuff....thus me posting the colors of the resistor. Thanks for the clear-up on the 22K issue....off to radio shack to get the right ones.

Daniel...thanks for putting the whole formula in, so I can see it working from start to finish. I am ok with leakage, just not temps that tell me it is the apocalypse....but still....I keep my house at 66F, not 86, so a 20 degree leakage seems off a bit


Gotta go pick up my kids, I will be back at this using the new information after I get them home and post back here what I find.

User avatar
rpdom
Posts: 17409
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Calculate R to determine temp

Tue Jan 21, 2014 7:23 pm

It is good that you put all the detail in your posts.

Very often people do not post enough detail which makes it hard to find out what is wrong. This is not always their fault, they just do not know what detail to post. More is always better. :)

anita2r
Posts: 226
Joined: Sun Dec 23, 2012 6:55 pm
Location: Ottawa, Canada

Re: Calculate R to determine temp

Tue Jan 21, 2014 8:08 pm

chrisryall wrote:
Same but fiddlier in Fahrenheit (does anyone still use it?)
Only the whole of the USA !

... and pipe sizes are still in inches
... and you buy lumber (aka wood) by the foot
... and nails are still sized in old pence - e.g. 6d nails
(from Wikipedia -
In the United States, the length of a nail is designated by its penny size, ...
Penny sizes originally referred to the price for a hundred nails in England in the 15th century)

Regards

anita2R
More useless information available for a small consideration :D

danjperron
Posts: 3511
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Calculate R to determine temp

Tue Jan 21, 2014 8:53 pm

red red black gold is 22 ohm but the gold means 5% tolerance.

for 22k you need

red red orange (gold or silver) in four bands resistor or
red red black red ( brown , red , gold or silver) 5 bands

the last color is always the tolerance.

Daniel

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: Calculate R to determine temp

Tue Jan 21, 2014 8:57 pm

Or if you want to be doubly sure - http://www.electronics2000.co.uk/calc/r ... ulator.php

Richard S.

danjperron
Posts: 3511
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Calculate R to determine temp

Tue Jan 21, 2014 9:34 pm

Just wonder if you put 5v instead if 3.3 V at the probe. because you would be right in the range. 67 Fahrenheit. The calculated resistance value would have been 244k ohm .

aberon
Posts: 29
Joined: Fri Jan 17, 2014 2:15 pm

Re: Calculate R to determine temp

Tue Jan 21, 2014 9:51 pm

So, radio shack was out of the 22's (not rims for a car), but the other one has them...so I will go tomorrow.

They did have 10 Ohm, and when I tried that one, I did not get anything back from the MCP3008.

Would having the wrong resistor in there cause the temp to read off by 20 degrees?

Just wanted to get this in here, since I said I would post when I got back from getting kids....I will post tomorrow after getting the other resistors.

aberon
Posts: 29
Joined: Fri Jan 17, 2014 2:15 pm

Re: Calculate R to determine temp

Tue Jan 21, 2014 10:04 pm

Danjperron,

I have the probe attached to the 3.3v side of the cobbler.

But...when I do the calculation that you refer to, I am not getting the same numbers.

5.0V * 61 / 1024 = .3125

R = (5.0 - 0.3125) / 31.25e-6 = 150000


Did I do that wrong???

danjperron
Posts: 3511
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Calculate R to determine temp

Tue Jan 21, 2014 11:03 pm

I assumed that the A/D converter is on the 3.3V. Just the 5V at the probe change.

Daniel

danjperron
Posts: 3511
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Calculate R to determine temp

Tue Jan 21, 2014 11:51 pm

This is my spreadsheet from google drive

https://docs.google.com/spreadsheet/ccc ... sp=sharing

The second sheet display a table of temperature versus calculated Thermistor resistance using the reverse function.


I hope that you have a google account.

Daniel

danjperron
Posts: 3511
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Calculate R to determine temp

Wed Jan 22, 2014 12:34 am

Question of range.

It is always better to figure out the best range. Better signal versus noise.

If this for inside a house, I think that we could use the absolute 50C (122F) to be the maximum.

At 50C the thermistor resistance is around 82K ohm. If we have 5V on the thermistor the best R1 value should gives an A/D value to 3.3V. R1 should be 160K ohm.

With the 160K resistor, one A/D value will be around 0.1C. If you kept the 10K resistor, one A/D value is ~1C.

Just play with the worksheet and you will see.

Daniel
Last edited by danjperron on Wed Jan 22, 2014 3:17 am, edited 1 time in total.

danjperron
Posts: 3511
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Calculate R to determine temp

Wed Jan 22, 2014 3:00 am

B.T.W.

if you check this website. https://community.spark.io/t/thermistor ... re/1276/24

you will see that you invert the coefficient A & C. So my formula is correct. and at 73 fahrenheit, I got 216K ohm.(sheet 2)

Daniel

aberon
Posts: 29
Joined: Fri Jan 17, 2014 2:15 pm

Re: Calculate R to determine temp

Wed Jan 22, 2014 12:20 pm

Dan....I have a google account and downloaded the spreadsheet...thanks

I am taking kids to school, then back at this....post something shortly after I return. Just wanted to get a note in here to say thanks for all your help.

CR

Return to “Automation, sensing and robotics”