Professional Documents
Culture Documents
int Thermistor2Pin = 1;
int Thermistor3Pin = 2;
int Thermistor4Pin = 3;
int Thermistor5Pin = 4;
int Thermistor6Pin = 5;
int Thermistor7Pin = 6;
int Thermistor8Pin = 7;
int Vo;
int t;
float TempsH[30] = {0};
float TempsC[30] = {0};
float DeltaTprom[30] = {0};
float deltaTprom = 0;
float R1 = 10000;
float logR2, R2, T, Tc1, Tc2, Tc3, Tc4, Tc5, Tc6, Tc7, Tc8, AvHot, AvCold, DeltaT,
StableConfirmTime, mStableH, mStableC;
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;
void setup() {
Serial.begin(9600);
t=0;
void loop() {
Vo = analogRead(Thermistor1Pin);
R2 = R1 * (1023.0 / (float)Vo - 1.0);
logR2 = log(R2);
T = (1.0 / (c1 + c2 * logR2 + c3 * logR2 * logR2 * logR2));
Tc1 = T - 273.15+1;
Vo = analogRead(Thermistor2Pin);
R2 = R1 * (1023.0 / (float)Vo - 1.0);
logR2 = log(R2);
T = (1.0 / (c1 + c2 * logR2 + c3 * logR2 * logR2 * logR2));
Tc2 = T - 273.15-0.5;
Vo = analogRead(Thermistor3Pin);
R2 = R1 * (1023.0 / (float)Vo - 1.0);
logR2 = log(R2);
T = (1.0 / (c1 + c2 * logR2 + c3 * logR2 * logR2 * logR2));
Tc3 = T - 273.15-0.5;
Vo = analogRead(Thermistor4Pin);
R2 = R1 * (1023.0 / (float)Vo - 1.0);
logR2 = log(R2);
T = (1.0 / (c1 + c2 * logR2 + c3 * logR2 * logR2 * logR2));
Tc4 = T - 273.15;
Vo = analogRead(Thermistor5Pin);
R2 = R1 * (1023.0 / (float)Vo - 1.0);
logR2 = log(R2);
T = (1.0 / (c1 + c2 * logR2 + c3 * logR2 * logR2 * logR2));
Tc5 = T - 273.15+1.5;
Vo = analogRead(Thermistor6Pin);
R2 = R1 * (1023.0 / (float)Vo - 1.0);
logR2 = log(R2);
T = (1.0 / (c1 + c2 * logR2 + c3 * logR2 * logR2 * logR2));
Tc6 = T - 273.15+3;
Vo = analogRead(Thermistor7Pin);
R2 = R1 * (1023.0 / (float)Vo - 1.0);
logR2 = log(R2);
T = (1.0 / (c1 + c2 * logR2 + c3 * logR2 * logR2 * logR2));
Tc7 = T - 273.15+6.5;
Vo = analogRead(Thermistor8Pin);
R2 = R1 * (1023.0 / (float)Vo - 1.0);
logR2 = log(R2);
T = (1.0 / (c1 + c2 * logR2 + c3 * logR2 * logR2 * logR2));
Tc8 = T - 273.15-0.5;
t=t+1;
Serial.print(" | 2: ");
Serial.print(Tc2);
Serial.print(" C");
Serial.print(" | 3: ");
Serial.print(Tc3);
Serial.print(" C");
Serial.print(" | 4: ");
Serial.print(Tc4);
Serial.print(" C");
Serial.print(" | 5: ");
Serial.print(Tc5);
Serial.print(" C");
Serial.print(" | 6: ");
Serial.print(Tc6);
Serial.print(" C");
Serial.print(" | 7: ");
Serial.print(Tc7);
Serial.print(" C");
Serial.print(" | 8: ");
Serial.print(Tc8);
Serial.println(" C");
AvHot = (Tc5+Tc6+Tc7+Tc8)/4;
AvCold = (Tc1+Tc2+Tc3+Tc4)/4;
DeltaT = AvHot-AvCold;
TempsH[0]=AvHot;
TempsC[0]=AvCold;
DeltaTprom[0]=DeltaT;
deltaTprom = deltaTprom/30;
if (t<30)
{
Serial.println("Tiempo de confirmación de estado estable no cumplido");
}
else
{
mStableH = (TempsH[0]-TempsH[29])/30;
Serial.print("Tasa de cambio lado caliente: ");
Serial.print(abs(mStableH), 4);
Serial.println(" °C/min");
mStableC = (TempsC[0]-TempsC[29])/30;
Serial.print("Tasa de cambio lado frio: ");
Serial.print(abs(mStableC), 4);
Serial.println(" °C/min");
/*
Serial.print("Valores TempsC: ");
Serial.print(TempsC[0]);
Serial.print(" ; ");
Serial.print(TempsC[1]);
Serial.print(" ; ");
Serial.print(TempsC[2]);
Serial.print(" ; ");
Serial.print(TempsC[3]);
Serial.print(" ; ");
Serial.print(TempsC[4]);
Serial.print(" ; ");
Serial.print(TempsC[5]);
Serial.print(" ; ");
Serial.print(TempsC[24]);
Serial.print(" ; ");
Serial.print(TempsC[25]);
Serial.print(" ; ");
Serial.print(TempsC[26]);
Serial.print(" ; ");
Serial.print(TempsC[27]);
Serial.print(" ; ");
Serial.print(TempsC[28]);
Serial.print(" ; ");
Serial.println(TempsC[29]);
*/
Serial.print('\n');
Serial.print('\n');
delay(2000);