Project 03 - strange temperatures

I'm on project 03, the Love Tester, and I'm pretty new to this.

I have it wired as in the book and the code running on it.

The temperature sensor gives very strange readings:

Sensor Value: 42, Volts: 0.21, degrees C: -29.49
Sensor Value: 67, Volts: 0.33, degrees C: -17.29
Sensor Value: 80, Volts: 0.39, degrees C: -10.94
Sensor Value: 76, Volts: 0.37, degrees C: -12.89
Sensor Value: 62, Volts: 0.30, degrees C: -19.73
Sensor Value: 43, Volts: 0.21, degrees C: -29.00
Sensor Value: 17, Volts: 0.08, degrees C: -41.70
Sensor Value: 0, Volts: 0.00, degrees C: -50.00
Sensor Value: 0, Volts: 0.00, degrees C: -50.00
Sensor Value: 0, Volts: 0.00, degrees C: -50.00
Sensor Value: 9, Volts: 0.04, degrees C: -45.61
Sensor Value: 31, Volts: 0.15, degrees C: -34.86
Sensor Value: 55, Volts: 0.27, degrees C: -23.14
Sensor Value: 77, Volts: 0.38, degrees C: -12.40
Sensor Value: 78, Volts: 0.38, degrees C: -11.91
Sensor Value: 71, Volts: 0.35, degrees C: -15.33
Sensor Value: 52, Volts: 0.25, degrees C: -24.61
Sensor Value: 31, Volts: 0.15, degrees C: -34.86
Sensor Value: 5, Volts: 0.02, degrees C: -47.56
Sensor Value: 0, Volts: 0.00, degrees C: -50.00
Sensor Value: 0, Volts: 0.00, degrees C: -50.00
Sensor Value: 0, Volts: 0.00, degrees C: -50.00

Every few loop executions it completes a cycle of between 0 and about 80. Interestingly, the length of each cycle changes depending on how quickly I run the loop. At 1000x a second (as in the book), it's about 15 loops. At 10x a second (as shown above) it is about 10 loops. At 1x a second, it's 5 loops.

The temperature sensor gets warm and at one point actually hurt a little bit to touch. That can't help the accuracy. I've tried three different sensor units (nothing actually says "TMP" as the book implies but there's only one strip of 5 things that look anything like the picture).

I've quadruple checked the wiring and tried it without the LEDs and without the serial connection code with no luck, although without the serial connection code reporting back I had only the untested LEDs as proof. Changing the analog in socket, in case A0 was faulty, didn't change anything.

I've done a bit more testing with a simpler circuit.

// Temperature test

const int sensorPin = A0;

void setup() {
    Serial.begin(9600);
}

void loop() {
    int sensorVal = analogRead(sensorPin);
    
    Serial.print("Sensor Value: ");
    Serial.println(sensorVal);
    
    delay(1);
}

High resolution image of the circuit

Sample output:

Sensor Value: 0
Sensor Value: 0
Sensor Value: 0
Sensor Value: 13
Sensor Value: 35
Sensor Value: 51
Sensor Value: 68
Sensor Value: 80
Sensor Value: 83
Sensor Value: 87
Sensor Value: 77
Sensor Value: 56
Sensor Value: 32
Sensor Value: 13
Sensor Value: 0
Sensor Value: 0
Sensor Value: 0
Sensor Value: 19
Sensor Value: 41
Sensor Value: 55
Sensor Value: 71
Sensor Value: 81
Sensor Value: 84
Sensor Value: 86
Sensor Value: 72
Sensor Value: 49
Sensor Value: 25
Sensor Value: 10
Sensor Value: 0
Sensor Value: 0
Sensor Value: 0
Sensor Value: 27
Sensor Value: 45
Sensor Value: 60
Sensor Value: 75
Sensor Value: 82
Sensor Value: 85
Sensor Value: 84
Sensor Value: 66
Sensor Value: 42
Sensor Value: 23
Sensor Value: 4
Sensor Value: 0
Sensor Value: 0
Sensor Value: 9
Sensor Value: 46
Sensor Value: 62
Sensor Value: 77
Sensor Value: 81
Sensor Value: 86
Sensor Value: 82
Sensor Value: 63
Sensor Value: 39
Sensor Value: 20
Sensor Value: 2
Sensor Value: 0
Sensor Value: 0
Sensor Value: 12
Sensor Value: 35
Sensor Value: 50
Sensor Value: 66
Sensor Value: 79
Sensor Value: 82
Sensor Value: 88
Sensor Value: 79
Sensor Value: 57
Sensor Value: 34
Sensor Value: 15
Sensor Value: 0
Sensor Value: 0
Sensor Value: 0
Sensor Value: 18
Sensor Value: 39
Sensor Value: 56

That's ... that's not the temperature sensor.

Putting the temperature sensor in the place when I want to sense the temperature works a great deal better. XD

I had the heating problem with the temperature sensor when I had the power polarity reversed.

Might be worth having a look at something like this if you continue to have problems - http://www.designspark.com/knowledge-item/arduino-starter-kit-video-3-love-o-meter

Good Luck

Well, now I know what happens when you hook up a transistor instead of a temp sensor... I was wondering what would happen.

It was hard to tell those parts apart. I had to use a helping hand magnifying glass to look at the writing on the parts.

Almost did the same thing. Had to look really closely at the TMP printed on the sensor. Almost need a magnifying glass to read it. Once I figured out which sensor it was it worked perfectly the first time. This is fun. :slight_smile: