I am making a triple Arduino nano code in which I used Thermistor .h library but it doesn't read the data from sensors the answer is (-273 C) it should not be this. (sensor 1 =-273 C, sensor 2
Also I had used many codes on calculations they worked but there are many loses in them example ( sensor 1 = 36.78 C, sensor 2 = 36.90 C and sensor 3 = 57 C)
#include "NTC_Thermistor.h" // Adjust this if your library has a different name
// Define the thermistors using the NTC_Thermistor class
NTC_Thermistor thermistors[] = {
NTC_Thermistor(A0, 10000, 25.0, 3950, 10000),
NTC_Thermistor(A2, 10000, 25.0, 3950, 10000),
NTC_Thermistor(A5, 10000, 25.0, 3950, 10000)
};
// Number of thermistors
const int numThermistors = sizeof(thermistors) / sizeof(NTC_Thermistor);
void setup(void) {
Serial.begin(9600);
analogReference(EXTERNAL); // Remember to hook up AREF to 3v3
delay(1000); // Delay for stability
}
void loop(void) {
for (int i = 0; i < numThermistors; i++) {
float temp = thermistors[i].readCelsius(); // Using readCelsius method to get temperature in Celsius
Serial.print("Sensor");
Serial.print(i + 1);
Serial.print(": ");
if (temp != -273) {
Serial.print(temp, 1);
Serial.print(" C");
} else {
Serial.print("Error reading sensor");
}
if (i < numThermistors - 1) {
Serial.print(", ");
}
}
Serial.println();
delay(1000);
}
I would start by using a simple sketch that only reads the analogue voltage of A0, A2 and A5 and sends that data to the serial monitor. Do you get values that vary depending on the temperature?
Still same error even I connect wires according to circuit diagram and remove analog terms
#include "NTC_Thermistor.h" // Adjust this if your library has a different name
// Define the thermistors using the NTC_Thermistor class
NTC_Thermistor thermistors[] = {
NTC_Thermistor(0, 10000, 25.0, 3950, 10000),
NTC_Thermistor(2, 10000, 25.0, 3950, 10000),
NTC_Thermistor(5, 10000, 25.0, 3950, 10000)
};
// Number of thermistors
const int numThermistors = sizeof(thermistors) / sizeof(NTC_Thermistor);
void setup(void) {
Serial.begin(9600);
analogReference(EXTERNAL); // Remember to hook up AREF to 3v3
delay(1000); // Delay for stability
}
void loop(void) {
for (int i = 0; i < numThermistors; i++) {
double celsius = thermistors[i].readCelsius();
// Using readCelsius method to get temperature in Celsius
Serial.print("Sensor ");
Serial.print(i + 1);
Serial.print(": ");
if (celsius != -273) {
Serial.print(celsius , 1);
Serial.print(" C");
} else {
Serial.print("Error reading sensor");
}
if (i < numThermistors - 1) {
Serial.print(", ");
}
}
Serial.println();
delay(1000);
}