Arduino Forum

Products => The Arduino Starter Kit and Basic Kit => Topic started by: kukulo on Jan 23, 2013, 01:51 pm

Title: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: kukulo on Jan 23, 2013, 01:51 pm
I'm a beginner and I'm trying to train myself following step-by-step "Arduino Project Book" teachings.

I implemented project 03 (love-o-meter) but the value measured by the sensor varies between 144 and 146, that means 0 volts and a temperature of -50.00 degrees.
I tried to "heat" the sensor for some minutes with my fingers (preheated) without any results.

The circuit is (or seems to be) the one explained on the book, and the same is for the code.

Is it possible there is some problem with the sensor?

Thanks.
Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: robtillaart on Jan 23, 2013, 07:59 pm
best to check all connections, and if you connected the sensor not "in reverse"
Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: feiticeir0 on Jan 23, 2013, 11:40 pm
Hi !

Like Kukulo, i had the same problem. When doing that project, i didn't get any output in the serial monitor nor getting the sensor the report anything.. I've checked and re-checked the connections... nothing...

Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: ovolollo95 on Jan 25, 2013, 10:13 pm
Hi to everyone,
i had a this problem too: i received an output on serial but the degrees was always negative (i tested it in a room, about 19/20°C) so i tried to check the code and the wiring and it was all right. So i used a multimeter to calculate the central pin output (black wire on GND red in central pin) and i had  0.0 V in output. Au contraire with the red wire on the positive pin of the sensor and the black on central I saw 4,36 V.
So i thought that the project is probably wrong in facts if you put a very "big" resistance (800 Kohms) between the positive pin and the central one it does work.
Maybe i'm wrong but try to fix this in your future starter kit version.
Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: hiduino on Jan 26, 2013, 10:38 am

I implemented project 03 (love-o-meter) but the value measured by the sensor varies between 144 and 146, that means 0 volts and a temperature of -50.00 degrees.


The formula for the voltage should be;

Voltage = (sensor / 1024) X 5.0

So if you had a sensor value of 145 then it should be (145/1024) X 5 = 0.71 volts, not 0 volts.

Temperature = (voltage - 0.5) X 100

So if you had a sensor value of 145 and 0.71 volts, then temperature will calculate to (0.71 - 0.5) X 100 = 21 degrees C.

Looks like your TMP 36 is working correctly.

Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: hiduino on Jan 26, 2013, 10:56 am

So i used a multimeter to calculate the central pin output (black wire on GND red in central pin) and i had  0.0 V in output. Au contraire with the red wire on the positive pin of the sensor and the black on central I saw 4,36 V.


If you had 4.36V between the left pin and center pin then that means you should have read 0.64V (assuming you are using 5V power) between the center pin and GND.  It looks like you didn't make a good connection with your meter if you read 0V.  Using the formulas the temperature is (0.64 - 0.5) X 100 = 14 degrees C.  This is colder than you said but that depends on how accurate your voltage readings were.  It looks like your TMP 36 is working also.

Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: Garmien on Jan 29, 2013, 07:46 pm
I have a problem with the sensor values jumping from 0 to ~85 every approximately 1 sec

The board is set up exactly as the book describes, left pin to 5V, mid pin to A0, right pin to GND.

example print:

Sensor Value: 0, Volts: 0.00, Degrees: 20.00
Sensor Value: 0, Volts: 0.00, Degrees: 20.00
Sensor Value: 0, Volts: 0.00, Degrees: 20.00
Sensor Value: 6, Volts: 0.03, Degrees: 17.07
Sensor Value: 36, Volts: 0.18, Degrees: 2.42
Sensor Value: 65, Volts: 0.32, Degrees: -11.74
Sensor Value: 79, Volts: 0.39, Degrees: -18.57
Sensor Value: 78, Volts: 0.38, Degrees: -18.09
Sensor Value: 59, Volts: 0.29, Degrees: -8.81
Sensor Value: 28, Volts: 0.14, Degrees: 6.33
Sensor Value: 4, Volts: 0.02, Degrees: 18.05
Sensor Value: 0, Volts: 0.00, Degrees: 20.00
Sensor Value: 0, Volts: 0.00, Degrees: 20.00
Sensor Value: 0, Volts: 0.00, Degrees: 20.00


Any idea what i'm doing wrong?
Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: hiduino on Jan 29, 2013, 07:58 pm

Any idea what i'm doing wrong?


Please post your code.
Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: Garmien on Jan 30, 2013, 10:02 am


Any idea what i'm doing wrong?


Please post your code.


Should be the same as in the manual.

Code: [Select]
const int sensorPin = A0;
const float baselineTemp = 20.0;

void setup(){
 Serial.begin(9600);
 for(int pinNumber = 2; pinNumber < 5; pinNumber++){
   pinMode(pinNumber, OUTPUT);
   digitalWrite(pinNumber, LOW);
 }
}


void loop(){
 int sensorVal = analogRead(sensorPin);
 Serial.print("Sensor Value: ");
 Serial.print(sensorVal);
 float voltage = (sensorVal/1024.0)*5.0;
 Serial.print(", Volts: ");
 Serial.print(voltage);
 Serial.print(", Degrees: ");
 float temperature = (voltage - .5)*100;
 Serial.println(temperature);
 
 if(temperature < baselineTemp){
   digitalWrite(2, LOW);
   digitalWrite(3, LOW);
   digitalWrite(4, LOW);
 }
 else if(temperature >= baselineTemp+2 && temperature < baselineTemp+4){
   digitalWrite(2, HIGH);
   digitalWrite(3, LOW);
   digitalWrite(4, LOW);
 }
 else if(temperature >= baselineTemp+4 && temperature < baselineTemp+6){
   digitalWrite(2, HIGH);
   digitalWrite(3, HIGH);
   digitalWrite(4, LOW);
 }
 else if(temperature >= baselineTemp +6){
   digitalWrite(2, HIGH);
   digitalWrite(3, HIGH);
   digitalWrite(4, HIGH);
 }
 delay(100);
}
Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: kukulo on Jan 30, 2013, 11:55 am


I implemented project 03 (love-o-meter) but the value measured by the sensor varies between 144 and 146, that means 0 volts and a temperature of -50.00 degrees.


The formula for the voltage should be;

Voltage = (sensor / 1024) X 5.0

So if you had a sensor value of 145 then it should be (145/1024) X 5 = 0.71 volts, not 0 volts.



Thank you, hiduino!
Do you know what? I calculated Voltage by multiplying to 0.5 instead of 5.0   :smiley-red:
Adjusting the multiplication factor, it works fine.

Just a short note: if I write "Voltage = (sensor /1024) * 5.0", Voltage is calculated as 0.00; instead, if I write "Voltage = (sensor /1024.0) * 5.0", the result is correct (not zero).
Do I need to write any number using at least a decimal place after point?
But this is not really a problem for me: probably, a better knowledge of this specific coding language could help me in avoiding this kind of mistakes.
Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: robtillaart on Jan 30, 2013, 08:34 pm
There are rules how the compiler handles math operators. If both are int the result will be int. That is why sensor/1024 = 0; and sensor/1024.0 = >0;

Furthermore from performance point of view it is always faster to multiply than to divide e.g.

x/10.0 is slower than x * 0.1;


Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: Garmien on Jan 30, 2013, 09:19 pm



Any idea what i'm doing wrong?


Please post your code.


Should be the same as in the manual.

Code: [Select]
const int sensorPin = A0;
const float baselineTemp = 20.0;

void setup(){
 Serial.begin(9600);
 for(int pinNumber = 2; pinNumber < 5; pinNumber++){
   pinMode(pinNumber, OUTPUT);
   digitalWrite(pinNumber, LOW);
 }
}


void loop(){
 int sensorVal = analogRead(sensorPin);
 Serial.print("Sensor Value: ");
 Serial.print(sensorVal);
 float voltage = (sensorVal/1024.0)*5.0;
 Serial.print(", Volts: ");
 Serial.print(voltage);
 Serial.print(", Degrees: ");
 float temperature = (voltage - .5)*100;
 Serial.println(temperature);
 
 if(temperature < baselineTemp){
   digitalWrite(2, LOW);
   digitalWrite(3, LOW);
   digitalWrite(4, LOW);
 }
 else if(temperature >= baselineTemp+2 && temperature < baselineTemp+4){
   digitalWrite(2, HIGH);
   digitalWrite(3, LOW);
   digitalWrite(4, LOW);
 }
 else if(temperature >= baselineTemp+4 && temperature < baselineTemp+6){
   digitalWrite(2, HIGH);
   digitalWrite(3, HIGH);
   digitalWrite(4, LOW);
 }
 else if(temperature >= baselineTemp +6){
   digitalWrite(2, HIGH);
   digitalWrite(3, HIGH);
   digitalWrite(4, HIGH);
 }
 delay(100);
}



I just realised i had made some changes, so the numbers are different (but still not correct). This is the true outprint example with the above code:

Sensor Value: 52, Volts: 0.25, Degrees: -24.61
Sensor Value: 53, Volts: 0.26, Degrees: -24.12
Sensor Value: 56, Volts: 0.27, Degrees: -22.66
Sensor Value: 61, Volts: 0.30, Degrees: -20.21
Sensor Value: 69, Volts: 0.34, Degrees: -16.31
Sensor Value: 74, Volts: 0.36, Degrees: -13.87
Sensor Value: 75, Volts: 0.37, Degrees: -13.38
Sensor Value: 73, Volts: 0.36, Degrees: -14.36
Sensor Value: 68, Volts: 0.33, Degrees: -16.80
Sensor Value: 58, Volts: 0.28, Degrees: -21.68
Sensor Value: 56, Volts: 0.27, Degrees: -22.66
Sensor Value: 53, Volts: 0.26, Degrees: -24.12
Sensor Value: 52, Volts: 0.25, Degrees: -24.61
Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: hiduino on Jan 30, 2013, 10:17 pm


I just realised i had made some changes, so the numbers are different (but still not correct). This is the true outprint example with the above code:

Sensor Value: 52, Volts: 0.25, Degrees: -24.61
Sensor Value: 53, Volts: 0.26, Degrees: -24.12
Sensor Value: 56, Volts: 0.27, Degrees: -22.66
Sensor Value: 61, Volts: 0.30, Degrees: -20.21
Sensor Value: 69, Volts: 0.34, Degrees: -16.31
Sensor Value: 74, Volts: 0.36, Degrees: -13.87
Sensor Value: 75, Volts: 0.37, Degrees: -13.38
Sensor Value: 73, Volts: 0.36, Degrees: -14.36
Sensor Value: 68, Volts: 0.33, Degrees: -16.80
Sensor Value: 58, Volts: 0.28, Degrees: -21.68
Sensor Value: 56, Volts: 0.27, Degrees: -22.66
Sensor Value: 53, Volts: 0.26, Degrees: -24.12
Sensor Value: 52, Volts: 0.25, Degrees: -24.61



Looks like your sensor acts more like a TMP 35 range.  If you remove the - .5 from the formula (temperature = voltage * 100) do the readings make sense?
Are the sensor values changing that fast?  It could be bad connections causing sporadic readings.  Otherwise I guess it could be just a bad sensor.

Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: lotdrops on Jan 31, 2013, 06:00 pm
My sensor doesn't seem to work either. I get these values:
Sensor value: 26, Volts: 0.13, degrees C: -37.30
Sensor value: 25, Volts: 0.12, degrees C: -37.79
I have the same code as in the manual, and connected everything like the manual too.
If i use 3.3V instead of 5V i get:
Sensor value: 34, Volts: 0.17, degrees C: -33.40
Sensor value: 34, Volts: 0.17, degrees C: -33.40
Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: Garmien on Jan 31, 2013, 06:07 pm



I just realised i had made some changes, so the numbers are different (but still not correct). This is the true outprint example with the above code:

Sensor Value: 52, Volts: 0.25, Degrees: -24.61
Sensor Value: 53, Volts: 0.26, Degrees: -24.12
Sensor Value: 56, Volts: 0.27, Degrees: -22.66
Sensor Value: 61, Volts: 0.30, Degrees: -20.21
Sensor Value: 69, Volts: 0.34, Degrees: -16.31
Sensor Value: 74, Volts: 0.36, Degrees: -13.87
Sensor Value: 75, Volts: 0.37, Degrees: -13.38
Sensor Value: 73, Volts: 0.36, Degrees: -14.36
Sensor Value: 68, Volts: 0.33, Degrees: -16.80
Sensor Value: 58, Volts: 0.28, Degrees: -21.68
Sensor Value: 56, Volts: 0.27, Degrees: -22.66
Sensor Value: 53, Volts: 0.26, Degrees: -24.12
Sensor Value: 52, Volts: 0.25, Degrees: -24.61



Looks like your sensor acts more like a TMP 35 range.  If you remove the - .5 from the formula (temperature = voltage * 100) do the readings make sense?
Are the sensor values changing that fast?  It could be bad connections causing sporadic readings.  Otherwise I guess it could be just a bad sensor.




Above print is with 100ms delay. Also, the sensor does not react on temperature changes at all. I've tried with different sensors of the same type, the result is the same (print below is without the -.5):

Sensor Value: 55, Volts: 0.27, Degrees: 26.86
Sensor Value: 55, Volts: 0.27, Degrees: 26.86
Sensor Value: 56, Volts: 0.27, Degrees: 27.34
Sensor Value: 57, Volts: 0.28, Degrees: 27.83
Sensor Value: 60, Volts: 0.29, Degrees: 29.30
Sensor Value: 67, Volts: 0.33, Degrees: 32.71
Sensor Value: 72, Volts: 0.35, Degrees: 35.16
Sensor Value: 75, Volts: 0.37, Degrees: 36.62
Sensor Value: 75, Volts: 0.37, Degrees: 36.62
Sensor Value: 70, Volts: 0.34, Degrees: 34.18
Sensor Value: 64, Volts: 0.31, Degrees: 31.25
Sensor Value: 59, Volts: 0.29, Degrees: 28.81
Sensor Value: 57, Volts: 0.28, Degrees: 27.83
Sensor Value: 56, Volts: 0.27, Degrees: 27.34
Sensor Value: 55, Volts: 0.27, Degrees: 26.86
Sensor Value: 55, Volts: 0.27, Degrees: 26.86


EDIT: Something is very wrong, if i change the sensors position on the breadboard i get different values..
Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: hiduino on Jan 31, 2013, 09:01 pm


EDIT: Something is very wrong, if i change the sensors position on the breadboard i get different values..



It might be that the Arduino input port is bad?  Can you try changing to another analog input port? (make sure you update your code to match)  Also some times if the wire leads are too long they can affect the sensor measurements.

Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: Garmien on Feb 01, 2013, 07:09 pm



EDIT: Something is very wrong, if i change the sensors position on the breadboard i get different values..



It might be that the Arduino input port is bad?  Can you try changing to another analog input port? (make sure you update your code to match)  Also some times if the wire leads are too long they can affect the sensor measurements.




I tried some of the other projects before going back to this, now i get these numbers(again with 100ms delay):

Sensor Value: 0, Volts: 0.00, Degrees: -50.00
Sensor Value: 0, Volts: 0.00, Degrees: -50.00
Sensor Value: 0, Volts: 0.00, Degrees: -50.00
Sensor Value: 0, Volts: 0.00, Degrees: -50.00
Sensor Value: 0, Volts: 0.00, Degrees: -50.00
Sensor Value: 35, Volts: 0.17, Degrees: -32.91
Sensor Value: 92, Volts: 0.45, Degrees: -5.08
Sensor Value: 96, Volts: 0.47, Degrees: -3.13
Sensor Value: 97, Volts: 0.47, Degrees: -2.64
Sensor Value: 89, Volts: 0.43, Degrees: -6.54
Sensor Value: 74, Volts: 0.36, Degrees: -13.87
Sensor Value: 0, Volts: 0.00, Degrees: -50.00
Sensor Value: 0, Volts: 0.00, Degrees: -50.00
Sensor Value: 0, Volts: 0.00, Degrees: -50.00
Sensor Value: 0, Volts: 0.00, Degrees: -50.00
Sensor Value: 0, Volts: 0.00, Degrees: -50.00


with this code:

Code: [Select]

const int sensorPin = A0;
const float baselineTemp = 20.0;

void setup(){
  Serial.begin(9600);
  for(int pinNumber = 2; pinNumber < 5; pinNumber++){
    pinMode(pinNumber, OUTPUT);
    digitalWrite(pinNumber, LOW);
  }
}


void loop(){
  int sensorVal = analogRead(sensorPin);
  Serial.print("Sensor Value: ");
  Serial.print(sensorVal);
  float voltage = (sensorVal/1024.0)*5.0;
  Serial.print(", Volts: ");
  Serial.print(voltage);
  Serial.print(", Degrees: ");
  float temperature = (voltage - .5)*100;
  Serial.println(temperature);
 
  if(temperature < baselineTemp){
    digitalWrite(2, LOW);
    digitalWrite(3, LOW);
    digitalWrite(4, LOW);
  }
  else if(temperature >= baselineTemp+2 && temperature < baselineTemp+4){
    digitalWrite(2, HIGH);
    digitalWrite(3, LOW);
    digitalWrite(4, LOW);
  }
  else if(temperature >= baselineTemp+4 && temperature < baselineTemp+6){
    digitalWrite(2, HIGH);
    digitalWrite(3, HIGH);
    digitalWrite(4, LOW);
  }
  else if(temperature >= baselineTemp +6){
    digitalWrite(2, HIGH);
    digitalWrite(3, HIGH);
    digitalWrite(4, HIGH);
  }
  delay(100);
}


I've noticed the numbers are the same whether i have the + connected or not, so i guess there's something wrong with the power? Or the sensor(s)?
Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: emmanuelle1670 on Feb 25, 2013, 07:23 am

hello
I tested the tmp36 and I think I will not use again! the tmp36 is too sensitive to electrostatic waves. the only way I managed it by adding a 0.1 uf ceramic capacitor for the values ??are more stable on the breadboard. but when you make a perforated plate or you use more than one tmp36 or otherwise in a surrounding with lots of electrostatic waves (film studio, or near a motor). this is not the same games. the first tmp36 influences the values ??of the other and so on. Environmental electrostatic waves distort the sensor values

The slightest change of voltage (power outage, run down, connection error etc.). Sensor burns. must be experienced in electronics, it's really not recommended to beginners! it should be noted that on this forum there are requests for help almost every 2 days for tmp36. must deduce something. I finally used a thermistor (variable resistor heat) and everything is settled.

emmanuelle
Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: Arucarn on Sep 20, 2014, 10:40 pm
Double check that you are using the correct componant. I made the mistake of using the wrong componant.
Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: RocketMagnet on Oct 04, 2014, 02:50 pm
Yes the Transistor looks similar to the Temperature Sensor. They have the same black body with 3 legs
though the Transistor outer legs are bent whereas the Temp Sensor I have the legs are all straight.

Anyway I tried a transistor in the circuit and got varying negative readings like those in this thread.

So ensure it's really the Temperature Sensor and not one of the Transistors.
In my official kit I got 1X Temp Sensor and 5X Transistors which were taped to a card.
Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: bamboohydraulics on May 03, 2015, 11:35 pm

for project love-o-meter This is my code, its from the book, and when I compile it works without errors, when I connected Arduino to it, only the LED that was connected to
pin 3 came on, nothing else happened, nothing on the serial monitor, what am I doing wrong

const int sensorPin = A0;
const float baselineTemp = 20.0;
void setup(){
  Serial.begin(9600);
  for(int pinNumber=2; pinNumber<5; pinNumber++){
    pinMode(pinNumber,OUTPUT);
    digitalWrite(pinNumber, LOW);
  }
}
void loop (){
  int sensorVal=analogRead(sensorPin);
  Serial.print("Sensor Value: ");
  Serial.print(sensorVal);
  float voltage=(sensorVal/1024.0)* 5.0;
  Serial.print(",Volts:");
  Serial.print(voltage);
  Serial.print(",degrees C:");
  float temperature=(voltage-.5)*100;
  Serial.println(temperature);
  if(temperature<baselineTemp){
    digitalWrite(2,LOW);
    digitalWrite(3,LOW);
    digitalWrite(4,LOW);
  }else if(temperature >=baselineTemp+2 &&
  temperature< baselineTemp+4){
    digitalWrite(2,HIGH);
    digitalWrite(3,LOW);
    digitalWrite(4,LOW);
  }else if(temperature >=baselineTemp+4 &&
  temperature < baselineTemp+6){
    digitalWrite(2, HIGH);
    digitalWrite(3, HIGH);
    digitalWrite(4, LOW);
  }else if(temperature >= baselineTemp+6){
    digitalWrite(2, HIGH);
    digitalWrite(3, HIGH);
    digitalWrite(4, HIGH);
  }
  delay(1);
}
   
Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: Simo_xx on May 12, 2015, 11:56 pm
As @arucarn posted, make sure you are using the correct component. The TMP36 temperature sensor looks almost identical to the BC 547B transistor.

If you have the Arduino starter kit then you will most likely have 5 transistors but only 1 temperature sensor.

The temperature sensor has entirely straight legs where as the transistor has straight legs that pinch in at the top.
Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: missgreer on Jul 14, 2015, 06:12 am
I don't know if this will help anyone but just in case...
I was having similar problems to those listed above with negative reads on my sensor. I checked and double checked the circuit and the code. I was about to give up when I realized it was way hotter in this room than my defined baseline temp, and hotter my max baseline temp +. I changed my baseline to match the actual temp in the room (almost 80 degrees) and it worked.
Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: gerardgerard on Jul 29, 2015, 11:22 pm
I have the same problem. Wired correctly, using the code from the site. Normal reading are in the -40s or -50s.

I bought a couple more temperature sensors from the site so I'll try them when I get them.
Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: wouterclaes on Nov 06, 2015, 11:13 pm
I was having the same problem with the negative numbers.
Turned out I just took the wrong part from the starter kit. Make sure you have the temperature sensor...

Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: niocnioc on Dec 26, 2015, 04:32 pm
Hi there

I've played with this sample and the tmp36 sensor. No problem so far , it was quite straightforward.

Only concern is that sensor output is not really stable, i get this serial output:
sensor Value: 146, Volts: 0.71, degrees C: 21.29
sensor Value: 144, Volts: 0.70, degrees C: 20.31
sensor Value: 145, Volts: 0.71, degrees C: 20.80
sensor Value: 144, Volts: 0.70, degrees C: 20.31
sensor Value: 144, Volts: 0.70, degrees C: 20.31
sensor Value: 147, Volts: 0.72, degrees C: 21.78
sensor Value: 144, Volts: 0.70, degrees C: 20.31
sensor Value: 146, Volts: 0.71, degrees C: 21.29
sensor Value: 144, Volts: 0.70, degrees C: 20.31

So my questions are:
- is it normal, and is it the correct behaviour of this sensor?
- if I want to improve the accuracy, should i change the sensor, the wiring, or focus on the software, with maybe a moving mean?

I've already faced this kind of analogic issue, with a capacitive sensor, and i used a moving mean. It was not really suitable for my purpose because it was for an input device, so adding latency with the computation of the mean was not good.

I'm interested in any suggestion, and quite a newb in electronics.
Thanks for reading

Nico
Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: Cyberdog on Jul 14, 2016, 10:23 pm
The problem with the negative value will be solved with the answer of Simo_xx: Just use the temperature sensor and not one of the 5 transistors! VERY USEFUL. Thanks Simo_xx. Problem solved :)
Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: Ladyp on Aug 04, 2016, 06:56 pm
Hi everyone,

I ran into a problem where my code has uploaded and everything seems to be connected but instead of lighting up after i touch the sensor. Once i plug in the power source all the LEDs are  already lit.

I am not sure what happened here
Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: hyperthalamus on Nov 18, 2016, 04:29 pm
Small chance this will help someone, in my case it was a goof in the code, mis-wrapped my parens:

wrote:
float temperature = (voltage - .5 * 100);

instead of:
float temperature = (voltage - .5) * 100;

Just one of those moments (thus a reminder), so make sure you spend some time on the obvious sources of problems if you hit this, particularly if you are seeing a lot of the ~-49C readings.
Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: JohannesW on Feb 08, 2018, 12:17 pm
I have had the same problem...

I used the line
float voltage = sensorVal/1024)*5;

However, the correct calculation is
float voltage = sensorVal/1024.0)*5;

I hope this helps some of you!

Johannes
Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: mech_1794 on Apr 01, 2018, 05:22 pm
Hello,

i have a problem with the temperature sensor aswell. In my case it seems to work properly when it starts but as soon as touch it, the temperature jumps to unrealsitic values.

Here is an example:

Sensor Value: 146, Volts: 0.71, degrees C: 21.29
Sensor Value: 147, Volts: 0.72, degrees C: 21.78
Sensor Value: 147, Volts: 0.72, degrees C: 21.78
Sensor Value: 147, Volts: 0.72, degrees C: 21.78
Sensor Value: 147, Volts: 0.72, degrees C: 21.78
Sensor Value: 146, Volts: 0.71, degrees C: 21.29
Sensor Value: 148, Volts: 0.72, degrees C: 22.27
Sensor Value: 157, Volts: 0.77, degrees C: 26.66
Sensor Value: 182, Volts: 0.89, degrees C: 38.87
Sensor Value: 228, Volts: 1.11, degrees C: 61.33
Sensor Value: 228, Volts: 1.11, degrees C: 61.33
Sensor Value: 229, Volts: 1.12, degrees C: 61.82
Sensor Value: 228, Volts: 1.11, degrees C: 61.33
Sensor Value: 228, Volts: 1.11, degrees C: 61.33
Sensor Value: 228, Volts: 1.11, degrees C: 61.33
Sensor Value: 228, Volts: 1.11, degrees C: 61.33
Sensor Value: 229, Volts: 1.12, degrees C: 61.82
Sensor Value: 230, Volts: 1.12, degrees C: 62.30
Sensor Value: 229, Volts: 1.12, degrees C: 61.82
Sensor Value: 229, Volts: 1.12, degrees C: 61.82



Is the sensor defect? I checked the wires and changed the analog pins but nothing helped. I am wondering what is going wrong since everthing looks fine until i try to measure some changes in temperature. The code is correct because the sensor values fits to the other data, but its value itself behaves unrealistic...


Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: deterr on May 10, 2018, 03:16 pm
Hi,

I have the exact same thing. When you start all is normal, but as soon as you touch the sensor it goes up to the unrealistic high values and won't come down again. When you unplug the Arduino and plug it in again, the sensor returns the correct value again and it all starts over again..

Sensor value: 147, Volts: 0.72, Degrees C: 21.78
Sensor value: 146, Volts: 0.71, Degrees C: 21.29
Sensor value: 147, Volts: 0.72, Degrees C: 21.78
Sensor value: 147, Volts: 0.72, Degrees C: 21.78
Sensor value: 147, Volts: 0.72, Degrees C: 21.78
Sensor value: 146, Volts: 0.71, Degrees C: 21.29
Sensor value: 146, Volts: 0.71, Degrees C: 21.29
Sensor value: 146, Volts: 0.71, Degrees C: 21.29
Sensor value: 146, Volts: 0.71, Degrees C: 21.29
Sensor value: 146, Volts: 0.71, Degrees C: 21.29
Sensor value: 146, Volts: 0.71, Degrees C: 21.29
Sensor value: 149, Volts: 0.73, Degrees C: 22.75
Sensor value: 172, Volts: 0.84, Degrees C: 33.98
Sensor value: 208, Volts: 1.02, Degrees C: 51.56
Sensor value: 208, Volts: 1.02, Degrees C: 51.56
Sensor value: 201, Volts: 0.98, Degrees C: 48.14
Sensor value: 201, Volts: 0.98, Degrees C: 48.14
Sensor value: 201, Volts: 0.98, Degrees C: 48.14
Sensor value: 200, Volts: 0.98, Degrees C: 47.66
Sensor value: 201, Volts: 0.98, Degrees C: 48.14
Sensor value: 200, Volts: 0.98, Degrees C: 47.66
Sensor value: 200, Volts: 0.98, Degrees C: 47.66
Sensor value: 200, Volts: 0.98, Degrees C: 47.66
Sensor value: 199, Volts: 0.97, Degrees C: 47.17
Sensor value: 200, Volts: 0.98, Degrees C: 47.66
Sensor value: 200, Volts: 0.98, Degrees C: 47.66
Sensor value: 200, Volts: 0.98, Degrees C: 47.66
Sensor value: 199, Volts: 0.97, Degrees C: 47.17
Sensor value: 199, Volts: 0.97, Degrees C: 47.17
Sensor value: 198, Volts: 0.97, Degrees C: 46.68
Sensor value: 198, Volts: 0.97, Degrees C: 46.68
Sensor value: 199, Volts: 0.97, Degrees C: 47.17
Sensor value: 199, Volts: 0.97, Degrees C: 47.17
Sensor value: 199, Volts: 0.97, Degrees C: 47.17
Sensor value: 199, Volts: 0.97, Degrees C: 47.17

Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: CzarCW on May 18, 2018, 10:19 am
I've had the same problem as mech_1794 and deterr. If I set my baselineTemp to something much higher, say 70 C, then the temperature sensor works fine (5-10 degree increases in temperature in the monitor when I touch the sensor, and then back down when I remove my hand) but none of the LEDs get activated.

Alternatively, if I set the system to run and touch the TMP36 so that it spikes up and registers temperatures around 70 C, and THEN pull out the LEDs one by one, I see the temperature sensor drop back down 10-20 degrees at a time until it's back in the normal range.

Could there by an ungrounded signal or something causing some interference? Would another resistor connected somehow to the temperature sensor pull down any stray voltage?
Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: CzarCW on May 18, 2018, 10:50 am
I switched the spot where by ground wire was connected (along the same ground rail on the breadboard), and it seems to have fixed the problem.
Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: beerfologist on Aug 13, 2018, 10:30 pm
I switched the spot where by ground wire was connected (along the same ground rail on the breadboard), and it seems to have fixed the problem.
I had the same instability problem, and my 5V wire was connected side-by-side with my ground wire on the breadboard (both at the first pin on top, but on different vertical rails, of course).

Following your advice, I moved the GND connection further down (to the second pin from the top) and the problem is now gone, though for the life of me I cannot figure out how or why.

Thanks!
Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: KaptenJansson on Oct 13, 2018, 10:41 pm
I had the same issue, it was due to the fact as someone stated, I used BC547 transistor (5 pack in the starter kit) rather than the TMP36 sensor (single similar looking but with 3 straight legs).
Title: Re: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00)
Post by: cookumsUNO on Nov 16, 2018, 03:44 am
I've had the same problem as mech_1794 and deterr. If I set my baselineTemp to something much higher, say 70 C, then the temperature sensor works fine (5-10 degree increases in temperature in the monitor when I touch the sensor, and then back down when I remove my hand) but none of the LEDs get activated.

Alternatively, if I set the system to run and touch the TMP36 so that it spikes up and registers temperatures around 70 C, and THEN pull out the LEDs one by one, I see the temperature sensor drop back down 10-20 degrees at a time until it's back in the normal range.

Could there by an ungrounded signal or something causing some interference? Would another resistor connected somehow to the temperature sensor pull down any stray voltage?
I troubleshooted this down to the LEDs just as you did but instead of pulling them out I ended up toggling the light on then off so that it didn't affect the sensor. There's probably a better way to write this but here's a piece of my code that worked for me:

Code: [Select]
if(temperature < baselineTemp){
  digitalWrite(2,LOW);
  digitalWrite(3,LOW);
  digitalWrite(4,LOW);
}else if(temperature >= baselineTemp + 2.0 && temperature < baselineTemp + 4.0){
  digitalWrite(2,HIGH);
  digitalWrite(3,LOW);
  digitalWrite(4,LOW);
  //have to turn LED back off not to affect temp sensor
  delay(250);
  digitalWrite(2,LOW);
}else if(temperature >= baselineTemp + 4.0 && temperature < baselineTemp + 6.0){
  digitalWrite(2,HIGH);
  digitalWrite(3,HIGH);
  digitalWrite(4,LOW);
  delay(250);
  //have to turn LEDs back off not to affect temp sensor
  digitalWrite(2,LOW);
  digitalWrite(3,LOW);
}else if(temperature >= baselineTemp + 6.0){
  digitalWrite(2,HIGH);
  digitalWrite(3,HIGH);
  digitalWrite(4,HIGH);
  //have to turn LEDs back off not to affect temp sensor
  delay(250);
  digitalWrite(2,LOW);
  digitalWrite(3,LOW);
  digitalWrite(4,LOW);
}