Capteur de température : sonde PT100 : 100 ohm à 0°
La resistance mesurée entre A et B correspond à RPt100 + Rf1 + Rf2 Sonde Pt100 à 20° avec 3 m de cable : s = 0,25mm2
Valeur ohmique : 107,79+(2*0,233)=112,45 ohms : 21,2°
/* A finir avec le tableau de correspondance de la PT100
diviseur de tension
GND - R2 Var (sonde) — R1 Fixe — 5V
| A0
*/
int analogPin = 0; int analogPin2 = 2;
int raw = 100; int raw2; float Vin = 4.98; variable to store the input voltage float Vout = 0; variable to store the output voltage float R1 = 119.1; variable to store the R1 value float R2 = 0; variable to store the R2 value float T = 0; buffer variable for calculation void setup() { Serial.begin(9600); Setup serial digitalWrite(13, HIGH); Indicates that the program has intialized }
void loop() {
raw = analogRead(analogPin); // Reads the Input PIN raw2 = analogRead(analogPin); Vout = (Vin / 1023.0) * raw; // Calculates the Voltage on th Input PIN R2 = (Vout / Vin)*R1/(1 - Vout/Vin);
T = 20 * R2 / 110; lineaire pour 110 ohms à 20° … if (R2 < 119.01);{ if 1);{ T = 10;} else { if 2);{ T = 11;}
else{ T=12; } }
else {
// T="error";}
raw2 = analogRead(analogPin2); Serial.print(“TEMP: ”);
Serial.println(raw2); // Outputs the information Serial.print("R2: "); Serial.print("Voltage: "); // Serial.println(Vout); // Outputs the information Serial.print("R2: "); // Serial.println(R2); // Serial.print("T: "); // Serial.println(T); //
delay(1000);
}