Project 3: Love-O-Meter Heating up

I tried making Project 3 from the Arduino starter kit projects book.
but when I uploaded the code and opened the serial monitor is said this: sensor value: 604, Volts: 2.95, degrees C: 244.92.

and when I looked at the arduino the plastic on the bread board was melting and the top of the TMP36 sensor was super hot.
the connections on the board are the exact same as in the book and I unplugged everything and replugged everything the right way (like it also was before), and it still got super hot.

My code looks also the same as in the book:

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

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600); // open a serial port
  
  for(int pinNumber = 2; pinNumber<5; pinNumber++){
    pinMode(pinNumber, OUTPUT);
    digitalWrite(pinNumber, LOW);
  }
}

void loop() {
  // put your main code here, to run repeatedly:
  int sensorVal = analogRead(sensorPin);
  Serial.print("sensor value: ");
  Serial.print(sensorVal);
  
  // convert the ADC reding to voltage
  float voltage = (sensorVal/1024.0) * 5.0;
  Serial.print(", Volts: ");
  Serial.print(voltage);
  
  Serial.print(", degrees C: ");
  // convert the voltage to temperature in 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(1);
}

so I really dont know what I did wrong here

Many components get very hot when powered with the wrong polarity. Most probably you killed the sensor already :frowning:

oke, the thing is tho that when i plug in the sensor it still heats up, so it still draws power. is this posible if the sensor is dead?

yes it is. It's also possible you still have it connected incorrectly. Please provide more information about that.

oke thanks for the help and guess I broke it.

Well you came here for advice... instead of just giving up, why not provide some information and get help?

Like, photos and/or diagrams of how you connected it...

yes, I didn't give up.
I pluged everything back out and in and now it is working😄.
I had plugged in the sensor the wrong way so power was connected to the wrong side and GND was connected to the wrong side. my fault🤦‍♂️
Its all fine now and thanks for telling me that I could have still connected it wrongly👍

it is not a sensor but simple transistor. you are scammed by seller.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.