Ok I have some good news for a change!
Tonight I set off to characterize my temp probe from my wireless grill thermometer mentioned above.
I made a few resistance measurements and compared to my type-K Simpson thermocouple:
18.3C - 215.5k (room temp)
-1.2C - 653k
0C - 625k (ice water)
1.1C - 596k
97.1C - 10.5k (boiling water)
Then I set off in Excel to solve the linear simultaneous equations… not too bad:

Some tests in excel with different resistances and rooms temps looked great! The equation and constants were as good as I’ve ever seen. Download the excel 2007 spreadsheet here.
Then I put your program into my
Core with a little tweaking for my constants. And I also used a 10k 5% pull up resistor which measured 9900 ohms.
I got all that running on the Core, but had some bad readings!
First of all, my readings were supposed to be 3930 and were coming in low at about 3600. This makes a BIG deal when dealing with a 3rd order equation. The readings were -62C and should have been about +20C.
So I went to the Arduino IDE and busted out the same code on the Arduino, with a tweak for the ADC resolution, and it was giving me the right readings, but the temps were even worse! -148C.
I knew I had two problems: 1) ADC readings on spark are known to be flaky, and 2) I know the equation is messing up in the code somehow.
After much screwing around, I broke out all of the equations and figured out how to print 10 decimal places, to check the math at various stages. Turns out… the R = Log(R); was the problem! Looking up the arduino math.h library, I saw that log(x) was actually the Natural Logarithm of x, and what I really wanted was log10(x) logarithm of x to base 10! You’ll see, if you look at thermistor equations on enough forums and wikipedia, you can tell that some use Ln® and some use Log®. Well typically Log® is base 10, but you’ll also know that whichever type of Log/Ln you used to SOLVE for your A,B,C constants, is the same Log/Ln you have to use to solve for your Temperature!
Once I made this change the Arduino was cranking out temps within 0-2C, good enough for a Meat Probe for sure!
Then I came back to the Spark Core
and knew what I had to do to fix my Logginess… and had a plan for the ADC issue as well. There are doubts about the validity of this fix, but I added a 0.1uF ceramic capacitor from the A3 input to the GND rail of my breadboard… which was connected over the top of the spark to the GND on the digital side. Despite how messed up that in itself is… IT WORKED!!! I was getting readings within 0-2C on the Spark Core as well!
I had some other issues with the Serial1 not sending me everything that I was trying to send, so I tried a bunch of different baud rates to no avail… what seemed to fix it was just adding a 1 second delay in four places after various bursts of calculations. It might have something to do with the floating point math… I’m not really sure but it’s late and I wanted to share this with you as soon as I could.
Here’s my Arduino Sketch:
#include <math.h>
void setup()
{
Serial.begin(115200);
}
void loop()
{
thermister_temp(analogRead(A3));
delay(1000);
}
void thermister_temp(int aval)
{
double R, T;
Serial.print("Analog Reading:");
Serial.println(aval);
R = (double)(1 / ((1023 / (double) aval) - 1)) * 9900.0;
Serial.print("Resistance:");
Serial.println(R,2);
R = (double)log10(R);
Serial.print("LOG10(R): ");
Serial.println(R,10);
T = (0.00000220911 * R * R * R);
Serial.print("(0.00000220911 * R * R * R): ");
Serial.println(T,10);
T = (0.000702421 * R);
Serial.print("(0.000702421 * R): ");
Serial.println(T,10);
T = ((((0.00000220911 * R * R) + 0.000702421) * R) + 0.0000199476);
Serial.print("((((-0.00000220911 * R * R) + 0.000702421) * R) + 0.0000199476): ");
Serial.println(T,10);
// Compute degrees K
T = 1 / ((((-0.00000220911 * R * R) + 0.000702421) * R) + 0.0000199476);
Serial.print("Temperature (K): ");
Serial.println(T);
Serial.print("Temperature (C): ");
Serial.println(T - 273.15);
Serial.print("Temperature (F): ");
Serial.println((((T - 273.15) * 9.0) / 5.0 + 32.0));
}
And here’s my Spark Core program:
#include <math.h>
void setup()
{
Serial.begin(115200);
}
void loop()
{
thermister_temp(analogRead(A3));
}
void thermister_temp(int aval)
{
double R, T;
Serial.print("Analog Reading:");
Serial.println(aval);
R = (double)(1 / ((4095 / (double) aval) - 1)) * 9900.0;
Serial.print("Resistance:");
Serial.println(R,2);
R = (double)log10(R);
Serial.print("LOG10(R): ");
Serial.println(R,10);
delay(1000);
T = (0.00000220911 * R * R * R);
Serial.print("(0.00000220911 * R * R * R): ");
Serial.println(T,10);
T = (0.000702421 * R);
Serial.print("(0.000702421 * R): ");
Serial.println(T,10);
delay(1000);
T = ((((0.00000220911 * R * R) + 0.000702421) * R) + 0.0000199476);
Serial.print("((((-0.00000220911 * R * R) + 0.000702421) * R) + 0.0000199476): ");
Serial.println(T,10);
// Compute degrees K
T = 1 / ((((-0.00000220911 * R * R) + 0.000702421) * R) + 0.0000199476);
delay(1000);
Serial.print("Temperature (K): ");
Serial.println(T);
Serial.print("Temperature (C): ");
Serial.println(T - 273.15);
Serial.print("Temperature (F): ");
Serial.println((((T - 273.15) * 9.0) / 5.0 + 32.0));
delay(1000);
}
@avidan Thanks for the push to work on this!!
I was following your progress and really wanted to try my hand at it… I hope these things help you get it solved!