Im trying to use my PT100 with an Arduino-based PLC from Industrial Shields, which is basically an Arduino Mega encased in a plastic container. Im using a 250Ω resistor, actually 237Ω resistor between Analog and Ground.
Here is my setup:
Here is my code:
int sensorValue = 0;
int temperature = 0;
int ReceivedByte = 0;
float f1 = 0;
float t1 = 0;
void setup() {
Serial.begin(9600);
Serial.println("hi...");
}
void loop() {
delay(1000);
sensorValue = analogRead(A2);
Serial.println(sensorValue);
temperature=map(sensorValue,639,719,0,110);
f1 = temperature; // Float conversion
Serial.print(f1);
Serial.print("\n");
}
These are my results for room temperature:
I got the values from an online pt100 table for resistance and tabulated them from 0-110C in 10 deg increments and for the corresponding resistance using:
nADC = 1023 * ( 237Ω/(237Ω+Rpt100))
Its not working because im getting values of ~300 for room temp which is well below this range, but since its not constrained (the map function). What should I do?
Thanks