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?
