Go Down

Topic: [3/Love-o-meter] it seems TMP36 doesn't work (volts: 0.00 ; degrees: -50.00) (Read 38385 times) previous topic - next topic

hiduino



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.


Garmien




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)?

emmanuelle1670


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

Arucarn

Double check that you are using the correct componant. I made the mistake of using the wrong componant.

RocketMagnet

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.

bamboohydraulics


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);
}
   

Simo_xx

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.

missgreer

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.

gerardgerard

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.

wouterclaes

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...


niocnioc

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

Cyberdog

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 :)

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy