Hi all. I made a precision bridge and instrumentation amplifier to read an RTD that's embedded in a product being tested. The full temperature range output available corresponds to 20-137C.
I predicted about 3 degrees nonlinearity (confirmed in calibration) and decided just to do a linear map like this:
temp = map (analogRead(tempPin), 0, 1023, 20, 137);
I've changed my mind and would like to account for the parabolic response of my circuit. I've thought of a couple of ways:
1: Make my temp variable a float and just calculate the temp directly from a curve fit between response temp and the analog input value (0-1023)
2: Break my temperature range into roughly linear segments and do an integer map depending on which range of the analog input it falls in.
- Keep my temp variable an int but bias my map to reduce the mid range error (would result in about a 1 degree error) like this:
temp = map (analogRead(tempPin), 0, 1023, 18, 135);
Is there a more elegant way to do what I want?
Thanks for any suggestions.
EDIT: a 1 degree C error is acceptable