/**
Measurement of two temperatures with 2 NTCs and Arduino NanoCone
https://wokwi.com/projects/349683872869384787
Assumes two 10K@25℃ NTC thermistor with Beta = 3950K, connected in series with a 10K resistor.
The voltage dividers have the NTC between Analog Input of Arduino Nano and GND
Copyright (C) 2022, Luis Zorzano
*/
const float BETA = 3950; // should match the Beta Coefficient of the thermistor
void setup() {
Serial.begin(9600);
}
void loop() {
int N1 = analogRead(A1);
int N2 = analogRead(A2);
float V1 = N1/1024.0*5.0;
float V2 = N2/1024.0*5.0;
float R1 = 10000.0/(5.0/V1 - 1.0);
float R2 = 10000.0/(5.0/V2 - 1.0);
float t1 = 1/(1/298.15 + 1/BETA*log(R1/10000.0)) - 273.15;
float t2 = 1/(1/298.15 + 1/BETA*log(R2/10000.0)) - 273.15;
Serial.print("Temperature 1: ");
String S1 = "N1 = " + String(N1) + ", V1 = " + String(V1) + ", R1 = " + String(R1) + ", t1 = " + String(t1);
Serial.print(S1);
Serial.println(" ℃");
Serial.print("Temperature 2: ");
String S2 = "N2 = " + String(N2) + ", V2 = " + String(V2) + ", R2 = " + String(R2) + ", t2 = " + String(t2);
Serial.print(S2);
Serial.println(" ℃");
delay(1000);
}