Hi all! I´m trying to read data from a Smartec SMT-160-30-50 with the code is shown in:
http://playground.arduino.cc/Code/SMT16030
but my Arduino Uno only read values such as 144,60 (in theory they are ºC, if they were Farenheit my room would be burning too
).
I´ve tried another code from the topic Temperature Sensor:
http://forum.arduino.cc/index.php?topic=41846.0
and in this case I only receive 0.
I´ve search in the Web and I haven´t found anything else interesting or different.
I´ve tried to read the sensor with pulseIn(my_pin, HIGH) function and I also get a 0.
Is there anything I am doing wrong? The connections are very simple (according to the playground tutorial). Is any timeout needed?(I´ve tried several values but nothing change).
Thanks in advance.
try this modified version that uses more samples in the same time
unsigned long now;
unsigned long lastOutput;
unsigned long sampleCount;
unsigned long highCount;
int sensorPin = 2;
void setup()
{
Serial.begin(9600);
Serial.println("Start SMT16030");
pinMode(sensorPin, INPUT);
digitalWrite(sensorPin, LOW);
sampleCount = 0;
highCount = 0;
lastOutput = 0;
}
void loop()
{
now = millis();
if (now - lastOutput > 500)
{
float temperature = ((1.0 * highCount)/sampleCount) - 0.32)/0.0047;
Serial.print(highCount);
Serial.print(" / ");
Serial.print(sampleSize);
Serial.print(" temp: ");
Serial.println(temperature);
lastOutput = now;
sampleSize = 0;
highCount = 0;
sampleCount = 0;
}
sampleCount++;
if (digitalRead(sensorPin)) highCount++;
}
lachini:
you can use this library :
https://github.com/HosseinLachini/SMT160
Over four years late to the party...