Thermistor showing -273°C

Hey guys,

I'm absolutely new in Arduino, and I'm trying to hook up an MF52D Thermistor with an LCD Display, but the display keeps showing -273°C.
The analog input reads 1023, and I assume this means there is infinite resistance in my circuit. I tried measuring resistances of all the cables and the thermistor itself, and everything looks fine.
Here is the code:

#include <LiquidCrystal.h>

// Pin, an dem der Thermistor angeschlossen ist
#define PINOTERMISTOR A0
// Nenntemperaturwert für den Thermistor
#define TERMISTORNOMINAL 10000
// Nenntemperatur auf dem Datenblatt
#define TEMPERATURENOMINAL 25
// Anzahl der Proben
#define NUMAMOSTRAS 5
// Beta-Wert für unseren Thermistor
#define BCOEFFICIENT 3977
// Wert des Serienwiderstandes
#define SERIESRESISTOR 10000


int tempPin = 0;
//                BS  E  D4 D5  D6 D7
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

int amostra[NUMAMOSTRAS];
int i;

void setup() {
Serial.begin(9600);
lcd.begin(16, 2);
analogReference(EXTERNAL);
}

void loop(void) {
float media;

for (i=0; i< NUMAMOSTRAS; i++) {
amostra[i] = analogRead(PINOTERMISTOR);
Serial.println(amostra[i]);
delay(10);
}

media = 0;
for (i=0; i< NUMAMOSTRAS; i++) {
media += amostra[i];
}
media /= NUMAMOSTRAS;
// Umwandlung des thermischen Spannungswertes in Widerstand
media = 1023 / media - 1;
media = SERIESRESISTOR / media;

//Berechnen Sie die Temperatur mit der Beta-Faktor-Gleichung weiteres zur Gleichung bei google
float temperatura;
temperatura = media / TERMISTORNOMINAL;     // (R/Ro)
temperatura = log(temperatura); // ln(R/Ro)
temperatura /= BCOEFFICIENT;                   // 1/B * ln(R/Ro)
temperatura += 1.0 / (TEMPERATURENOMINAL + 273.15); // + (1/To)
temperatura = 1.0 / temperatura;                 // Invertiert den Wert
temperatura -= 273.15;                         // Umwandeln nach Celsius

//Serial.print("The sensor temperature is: ");
//Serial.print(temperatura);
//Serial.println(" *C");


lcd.setCursor(0, 0);
  lcd.print("Temp         C  ");
 
  lcd.setCursor(6, 0);
  // Anzeige Temperatur in C
  lcd.print(temperatura);
  
  
delay(1000);
}

HERE is a photo of the circuit (I switched the + and - lanes). I also have attached a diagram of the circuit. The Arduino I use is the Uno R3.
Another question: Why is the voltage between my breadboard lanes above 7V, when Arduino can only provide 5V?

analogReference(EXTERNAL);

Why this code when you don't have an external reference voltage?

That was the mistake, I removed it and now it works. I don't know why it is there, the whole code was from a tutorial. Thanks anyway!

DQQpy:
That was the mistake, I removed it and now it works. I don't know why it is there, the whole code was from a tutorial. Thanks anyway!

Probably the tutorial explained why it was there, or how it should be used (otherwise bad tutorial...)

It didn't, it belongs to a cheap starter kit that only shows how to get things running (Elegoo Starter Kit)

Hey Guys,

New user here with a question that I didn't find a real good place for:

I am using a high frequency (1Khz) input and want to save the numbers and then go back and operate on them, i.e. find the high and the low, etc. I want to look at 5 seconds worth of data at a time, so about 5,000 numbers, but I could gather fewer if required. The numbers can be can be 3 digit int so it's not the amount I'm concerned with but how I can store them and then recall them to see what they are. Any ideas from you experienced guys? Thank you.

hr2guy:
New user here with a question that I didn't find a real good place for

Opening a new thread for your question is better than hyjacking two other threads.

Why do you want to store 5000 A/D values if you just want the highest and the lowest value.
High/low extremes can be stored in two variables 'on the fly', and displayed/wiped every 5 seconds.
Leo..

OK, I'll look for an appropriate thread.

hr2guy:
OK, I'll look for an appropriate thread.

No, you create a new one.
Leo..