does anyone own this temperature sensor?

Hi,

does anyone own this sensor and got it to work properly?

http://www.ebay.de/itm/261026313725?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649

I would love to get some hints on how to do it.

Looks like you get the output of a voltage divider. You'll need to calibrate it to determine temperature. Without any specifications for the thermistor you might have to determine the specifications by experiment.

The trim pot sets a trigger level. The analog comparator gives a binary output depending on the temperature being above or below the setpoint.

thx for the answer,

by staring long enough at the circuit i figured out how it all works.
i altered the example for thermistors so that it calculates right with this unusual order of elements VCC-RESI-Thermi-GND instead of VCC-Thermi-RESI-GND.

But still im getting false readings. I just hoped someone has figured out which ntc it is /datasheet or some way that i would not have to calibrate.
I calibrated it for one value, around 37°C with a fever thermometer, but for all other temperatures i have no fitting/exact sensor/thermometer to calibrate with

i thought it would be like a usual 10K ntc with that res beeing 10K but 40°C for around 20°C roomtemp is a bit off the charts

or do i have maybe a mistake in the code?

#include <math.h>

#define ThermistorPIN 0                 // Analog Pin 0

float vcc = 5;                       // only used for display purposes, if used
                                        // set to the measured Vcc.
float pad = 10000;                       // balance/pad resistor value, set this to
                                        // the measured resistance of your pad resistor
float thermr = 10000;                   // thermistor nominal resistance

float Thermistor(int RawADC) {
  long Resistance;  
  float Temp;  // Dual-Purpose variable to save space.

  Resistance=((pad * RawADC)/(1024 - RawADC)); //((1024 * pad / RawADC) - pad); 
  Temp = log(Resistance); // Saving the Log(resistance) so not to calculate  it 4 times later
  Temp = 1 / (0.001129148 + (0.000234125 * Temp) + (0.0000000876741 * Temp * Temp * Temp));
  Temp = Temp - 273.15;  // Convert Kelvin to Celsius                      
 
  return Temp;                                      // Return the Temperature
}
void setup() {
  Serial.begin(115200);
}
void loop() {
  float temp;
  temp=Thermistor(analogRead(ThermistorPIN));       // read ADC and  convert it to Celsius
  Serial.print("Celsius: "); 
  Serial.print(temp,1);                             // display Celsius

  Serial.println("");                                   
  delay(5000);                                      
}
  Temp = 1 / (0.001129148 + (0.000234125 * Temp) + (0.0000000876741 * Temp * Temp * Temp));

Those magical constants depend on the Beta value of the thermistor. That's something you can calculate if you have more than one data point.

http://www.daycounter.com/Calculators/Steinhart-Hart-Thermistor-Calculator.phtml

I don't have this one, but you can easily get 3 data points.

1st you have your fever thermometer. These are usually quite good, because it's important to know if somebody might die (or not) of a fever smiley-eek:

2nd get some ice and cold water. The triple point of water is 0 deg C (it's the point at which all three states of water exist, not the freezing point of water). So if ice and water (and the water vapor you can't see) exist at low altitude, after some time to allow equilibrium , you have 0 deg C. Could check wikipedia for effect of altitude etc.

I'm sure you know that water boils around 100 deg C. There is your 3rd data point.

OK there will be some error - you may not be at STP and the water may not be pure.

Hope it helps. That's how I check mine anyway, assuming the response is linear (ish) over the range.

The other factor I found was the supply voltage to the temperature sensor device. So you can get different scaling factors at different voltages eg 3.3 vs 5v. But you can check that using the constants above.

Sensors can be sensitive to RF interference. I was using one of mine near my computer and it's WiFi router = lots of noise. Ok, I switched off the router, shortened the cables and wrapped the sensor cable in aluminum foil = much less noise.

Cheers

P Andersons site has a table and the math to accurately "Linreaize" a thermistor... however I don't see a way to apply that to your board because as it states in the first reply "The device contains a thermistor and a pot for calibration of a "Comparator". The corrections would have to be applied to the output state to determine the output validity. The device is a simple temperature controller and IMO must be calibrated against an external accurate thermometer. It is really a temperature controller and not a sensor in the manner of digital (DS18B20) or a linear (LM34/5/6, AD592) type of sensor. IMO

Doc

Hm i do not understand,

its a simple thermistor voltage divider circuit. With AnalogOutput on one pin.
The other pin is a digital output, the switching point of that output can be set with that pot.

I only care about the AO.

So in my opionion that first part is like a sensor, but on the other hand im not very experienced :wink:

i also found some good pdf on how to calculate all those values, but thanks anyway.

Somehow i imagined it would be easier: buying tempmodule for 3€, plug and play and fun :wink:

Ah i think i figured it all out :wink:

Due to the strange order of Thermi and the Resistor i dont get the full voltage span from 0-5V but 0-2,5V to measure with ADC, considering that i get finally plausible results, with around <1°C difference from room temp and around 2°C from 36°C

:slight_smile:

oh noes, its not working :frowning:

with that steinhart calibrating it even gets worse.

If i post all my calculations and what i altered in the example for thermistors and how i calibrated, would someone look at it and tell me what i might have done wrong?

first thing id like confirmed is this:

To do anything with the thermistor i need to find out which resistance it currently has so that i can calculate temperature with it, true?

The Thermistor and Resistor r in unusal order:
Vcc->Res--->Therm->GND
|
V
ADC

Res = R1; Therm = R2; Vcc=U; ADC= U2

equotation for Voltage divider is:
U2= (U*R2)/(R1+R2)

so to get to R2 i need to transform this:
R2= (-U2*R1)/(U2-U)

correctly done?

Because ADC has its steps i have to transform U=Voltage to ADC, using 5 Volts
U2=(ADC*(5/1023)
and U=5V=1023

right?

Then it looks like this with R1 beeing 10000 Ohms:

long Resistance;
float Temp;
float Thermistor(int RawADC) {

Resistance=( (-1 * RawADC*5/1023)10000)/((RawADC5/1023)-5);

is what i did right?

lax123:
Somehow i imagined it would be easier: buying tempmodule for 3€, plug and play and fun :wink:

I recommend the Dallas Semiconductor DS18b20. For about $2 you get a calibrated temperature sensor that connects to any data pin and can share that data pin with a nearly unlimited number of other sensors.

thx for the hint, but actually id love to get it to work, this way i guess i will learn much more from my mistakes, i got my ardu 2 days ago so there is plenty to learn.

omg this is driving me crazy, it worked but wrong, then i formated my code so for better posting here and now its not working anymore i get always fixed Resistance 2500 Value but RawADC is changing all the time

float Temp;
long Resistance;
float Thermistor(int RawADC) {
Resistance=((-1RawADC5/102310000)/(RawADC5/1023-5));

What kind of noob mistake did i do that i get for that formula always Resistance= 2500 no matter how RawADC changes

Try putting an L suffix on the constants in your formula - you may be getting integer overflow effects.

Thank you, but that didnt help :frowning:
i post the complete code, i bet its some really stupid newbie mistake

#include <math.h>
#define ThermistorPIN 0               

float Thermistor(int RawADC) {
  long Resistance;  
  float Temp;  

 Resistance=((-1L*RawADC*5L/1023L*10000L)/(RawADC*5L/1023L-5L));

  Temp = log(Resistance); 
  Temp = 1 / (0.001129148 + (0.000234125 * Temp) + (0.0000000876741 * Temp * Temp * Temp));
  Temp = Temp - 273.15;  
 
  Serial.print(", Resistance: "); 
  Serial.print(Resistance);
  Serial.print("  ");
  Serial.print(RawADC);
  return Temp;                                     
}

void setup() {
  Serial.begin(115200);
}

void loop() {
  float temp;
  temp=Thermistor(analogRead(ThermistorPIN));       
  Serial.print("  Celsius: "); 
  Serial.print(temp,1); 
  Serial.println("");                                   
  delay(500);                                   
}

can someone see why i always get the value 2500 for Resistance, though RawADC is changing all the time depending on temperature?

And is it right to use 1023? I d think 0-1023= 1024 values, but i see a lot of expamples using 1024 instead

It doesn't give 2500 for all values, but it does give it for a range of them because you're doing integer division. Change Resistance to be a float and change the constants to have a .0 suffix instead of the L.

Sometimes when I get stuck in a calculation like that, I use a pencil a piece of paper and a calculator and work it out on paper. when you can 'see' the calculation and the intermediate results it can point out non obvious mistakes in the calculation (s) (works for me)

Doc

thx both of you.

changing to float didnt do anything, already tried that.

How do i do that with .0? just add .0 instead of L?

Well about the paper, i did all the formula transformation and math on paper, my problem is the coding part since im new to this but not to math :wink:

cool thx, with .0 its working :smiley:

could u tell me why? that datatype stuff is kinda confusion, or maybe a good link where it all gets explained?

but anyway thx so much

Arduino is C so you can use this. It's old (1988) but I find it useful being new to C programming.

Also you can download it free as PDF.

http://net.pku.edu.cn/~course/cs101/2008/resource/The_C_Programming_Language.pdf

cheers