1
\$\begingroup\$

I'm trying to get a readable value from a thermistor. Right now it's printing 223.25 as my celsius value in my room. I know this is wrong. I'm using the thermistor model which is located HERE. The specific part number of my thermistor is called PANE102350 which you'll need when you look at the datasheet. It doesn't give very much information. I'm also trying to find the A, B and C coefficients but cannot find them on that datasheet. I believe my issue is with my code as my circuit is fairly simple. My code and circuit is shown below.

My Circuit

Code

Thermistor

I have made the following changes to my code as Spehro Pefhany has indicated. I put in new values for A,B and C. I changed the Voltage equation as another person indicated. However now I'm getting a reading of 70 for celsius. Still doesn't seem right for room temperature. Here is another picture of the newly edited code. My circuit has stayed the same. I also did a Serial.print(adc_raw) and got a value of 108. I did a Serial.print(kelvin) also and got the value 344. I'm not for sure if these values are wrong but i'm assuming the kelvin one is because the celsius reading of 70 is wrong.

New Image

\$\endgroup\$
5
  • 2
    \$\begingroup\$ The schematic does not show a connection to the nose, as depicted in the photo. :) \$\endgroup\$
    – JYelton
    Commented Mar 24, 2014 at 20:50
  • \$\begingroup\$ wasn't for sure what the symbol for that was. \$\endgroup\$
    – Shane Yost
    Commented Mar 24, 2014 at 21:00
  • \$\begingroup\$ 1st: Check the analog reading by just evaluating a known voltage divider. 2nd: Throw a test-ADC value at your calculation routine and check the result. \$\endgroup\$
    – Rev
    Commented Mar 24, 2014 at 21:03
  • \$\begingroup\$ Your assignment for V is wrong. V = (V_IN * adc_raw)/1024, assuming V_IN is the reference for a 10-bit ADC. \$\endgroup\$ Commented Mar 24, 2014 at 21:08
  • \$\begingroup\$ I would expect analogRead() to return an int, not a double (but maybe the compiler does the appropriate conversion). In any case, I'd put the analog reading in the correct type variable, and print that value along with your converted value, to ensure that you are getting reasonable data from the ADC. I'd also print V and R_th to see that you're getting reasonable results at each step of the calculation. \$\endgroup\$ Commented Mar 24, 2014 at 23:17

1 Answer 1

2
\$\begingroup\$

Looks like there's some simple issue with the code.

enter image description here

To assist with getting the Steinhart-Hart equation parameters right, you can refer to the part specifications.

enter image description here

That refers to the "M" curve.

From the website, we get:

enter image description here

Which gives you the resistance values for various temperatures (multiply by 1000 for the values of your part in ohms).

Then, you can calculate the Steinhart-Hart parameters directly (from the Wikipedia page)

enter image description here

Or you can try this online calculator (I have not verified it is accurate)

enter image description here

In either case, optimize the thermistor linearization by picking three temperatures well spaced apart covering your range of interest.

\$\endgroup\$
7
  • \$\begingroup\$ I have changed the following line of code you indicated to the following....double V = (Vin*adc_raw)/1024;.....I inserted the new coefficient as they were different as you indicated. I also reset the arduino uno board by pressing the reset button and also unplugged the programming cable also. However now when i run the program i'm getting the value 71.2 as the celsius reading over and over again. \$\endgroup\$
    – Shane Yost
    Commented Mar 24, 2014 at 22:03
  • \$\begingroup\$ I have done some troubleshooting and pasted the results in my original post above with the newly edited code. Trying to double check the equations but can't seem to fix this. \$\endgroup\$
    – Shane Yost
    Commented Mar 24, 2014 at 22:12
  • \$\begingroup\$ i'm not understanding how to use the table you pasted in and how that relates to multiplying by 1000 ohms. i can't seem to replicate the results. \$\endgroup\$
    – Shane Yost
    Commented Mar 24, 2014 at 22:22
  • \$\begingroup\$ Okay, as others have said, first you should verify you're reading the voltage correctly. Double check that the resistance reading looks about right. The table column M, multiplied by 1000 is the resistance at various temperatures. At 25°C it is 1000. At 0°C it is 2809 ohms, at 50°C it is 412 ohms. If you want to cover the range 0-50C you could use those three values to determine the coefficients. Clear? \$\endgroup\$ Commented Mar 24, 2014 at 22:30
  • \$\begingroup\$ P.S. I did not calculate the coefficients for you- those ones are the default values for a common type of 10K thermistor. You'll need to stick the value you want to use into the calculator or the equations to get appropriate values for your thermistor and your range. \$\endgroup\$ Commented Mar 24, 2014 at 22:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.