same problem here: Formula in datasheet doesn't work. Suggested code here gives strange values as well. Is there a schematics available for this module? And what is the trimmer good for? And what about the digital pin? No description in the datasheet.
I'm currently testing this sensor and wondering about it's 2 LEDs: L1 seems to be power on/off, but what does L2 mean? It's switching from off to on/dimmed to on in some situations. Thanks in advance Guys
This might work:
#define SERIESRESISTOR 40000
#define NOMINAL_RESISTANCE 10000
#define NOMINAL_TEMPERATURE 25
#define BCOEFFICIENT 3950
float ADCvalue;
float Resistance;
ADCvalue = analogRead(sensorPin);
//convert value to resistance
Resistance = (1023 / ADCvalue) - 1;
Resistance = SERIESRESISTOR / Resistance;
float steinhart;
steinhart = Resistance / NOMINAL_RESISTANCE; // (R/Ro)
steinhart = log(steinhart); // ln(R/Ro)
steinhart += 1.0 / (NOMINAL_TEMPERATURE + 273.15); // + (1/To)
steinhart = 1.0 / steinhart; // Invert
steinhart -= 273.15; // convert to C
temperature = steinhart;
1
2
4\n
5
6
7
This might work: #define SERIESRESISTOR 40000 #define NOMINAL_RESISTANCE 10000 #define NOMINAL_TEMPERATURE 25 #define BCOEFFICIENT 3950 float ADCvalue; float Resistance; ADCvalue = analogRead(sensorPin); //convert value to resistance Resistance = (1023 / ADCvalue) - 1; Resistance = SERIESRESISTOR / Resistance; float steinhart; steinhart = Resistance / NOMINAL_RESISTANCE; // (R/Ro) steinhart = log(steinhart); // ln(R/Ro) steinhart /= BCOEFFICIENT; // 1/B * ln(R/Ro) steinhart += 1.0 / (NOMINAL_TEMPERATURE + 273.15); // + (1/To) steinhart = 1.0 / steinhart; // Invert steinhart -= 273.15; // convert to C temperature = steinhart;
I have tested the Sensor with exactly the code above. But to me it seems that the Thermistor is not a NTC. When i heat it up, the temperature goes down. So can anyone help me to get this sensor running? Thank's