Hi all I'm a newby to the forum and have only been playing arduino for a few months.
I have a circuit with a simple pt100 temperature sensor in it. It is simply a sensor that changes resistance with temperature.
I have the sensor set up with in a potential divider with a fixed known resistance (560ohms) and the ref voltage goes off to the A/D input.
In my code I first find the voltage at the reference point, then convert that by a mthematical equation into a resistance for the pt100, then convert that number into a temperature.
The code looks like this:
float temperature1 = (temp_sensor_state * (5.0 / 1023.0)) ; // Convert the 10bit analog reading into a voltage value
Serial.print(temperature1); Serial.println("temperature 1");
float pt100resistance = 560 * (1 / ((5 / temperature1) - 1)) ; // calculate the resistance of the pt100 for the ref voltage
Serial.print(pt100resistance); Serial.println("pt100 resistance");
float temperature2 = ((pt100resistance / 100) - 1) / (3.92 * (1 / 1000)); // figure out the resultant temperature
Serial.print(temperature2); Serial.println("temperature 2");
The problem I am having is that when it comes to the line 'float temperature2 = etc.....' no number is returned to the serial monitor for temperature 2. All it then shows is 'inftemperature2'
If the ref voltage is 0.8volts, this should make the pt100 resistance be about 110ohms and thus temperature2 should return a number of around 20, which would be 20degrees centigrade, but the serial number just shows 'inftemperature2'
I'm not sure what i've done wrong, or am i asking to much of the micro with the multiple uses of 'float'
Any help would be much appreciated