// define the analog input pins for the temperature sensors
const int tempSensor1Pin = A0;
const int tempSensor2Pin = A1;
const int tempSensor3Pin = A2;
const int tempSensor4Pin = A3;
const int tempSensor5Pin = A4;
const int tempSensor6Pin = A5;
const float BETA = 3950;
void setup() {
// initialize serial communication
Serial.begin(9600);
}
void loop() {
// read the temperature sensors
int temp1 = analogRead(tempSensor1Pin);
int temp2 = analogRead(tempSensor2Pin);
int temp3 = analogRead(tempSensor3Pin);
int temp4 = analogRead(tempSensor4Pin);
int temp5 = analogRead(tempSensor5Pin);
int temp6 = analogRead(tempSensor6Pin);
// convert the analog readings to temperature in degrees Celsius
float temp1C = 1 / (log(1 / (1023. / temp1 - 1)) / BETA + 1.0 / 298.15) - 273.15;
float temp2C = (temp2 * 5.0 / 1024.0 - 0.5) * 100.0;
float temp3C = (temp3 * 5.0 / 1024.0 - 0.5) * 100.0;
float temp4C = (temp4 * 5.0 / 1024.0 - 0.5) * 100.0;
float temp5C = (temp5 * 5.0 / 1024.0 - 0.5) * 100.0;
float temp6C = (temp6 * 5.0 / 1024.0 - 0.5) * 100.0;
// print the temperature readings to the serial monitor
Serial.print("Temperature 1: ");
Serial.print(temp1C);
Serial.print(" C, Temperature 2: ");
Serial.print(temp2C);
Serial.print(" C, Temperature 3: ");
Serial.print(temp3C);
Serial.print(" C, Temperature 4: ");
Serial.print(temp4C);
Serial.print(" C, Temperature 5: ");
Serial.print(temp5C);
Serial.print(" C, Temperature 6: ");
Serial.print(temp6C);
Serial.println(" C");
// delay for a short period of time before taking the next reading
delay(1000);
}