// Thermistor pins
const int thermistorPins[] = {0,1,2,3,4,5,13,9,10,11};
// Constants for the thermistors
const float thermistorNominal = 10000; // Resistance at nominal temperature (in Ohms)
const float temperatureNominal = 25; // Nominal temperature (in degrees Celsius)
const float BCoefficient = 3950; // Beta coefficient of the thermistor
const float seriesResistor = 10000; // Value of the series resistor (in Ohms)
void setup() {
Serial.begin(9600); // Initialize serial communication
}
void loop() {
// Read the temperature from each thermistor
for (int i = 0; i < 10; i++) {
int reading = analogRead(thermistorPins[i]);
float resistance = seriesResistor / (1023.0 / reading - 1.0);
float steinhart;
steinhart = resistance / thermistorNominal;
steinhart = log(steinhart);
steinhart /= BCoefficient;
steinhart += 1.0 / (temperatureNominal + 273.15);
steinhart = 1.0 / steinhart;
steinhart -= 273.15;
// Print the temperature for each thermistor
Serial.print("Thermistor ");
Serial.print(i + 1);
Serial.print(": ");
Serial.print(steinhart);
Serial.println(" °C");
}
delay(1000); // Wait for a second
}
Loading
ssd1306
ssd1306