There's a thermocouple placed between the inner two heaters that I want to use to protect the heaters and galden from too high temperatures. While getting good temperature readings from thermocouples involves a bit of math, detecting certain thresholds is easy because that certain temperature is equivalent to a fixed voltage difference at the hot junction. This is offset by the cold junction, but the cold junction can be linearized around about 30 °C. Thus, detecting the overtemperature threshold is simple enough to do it in the microcontroller. The Teensy LC could probably do all the calculations to convert from ADC reading to temperatures, but I took that load over to the GUI side.
So what I want to detect is
The threshold thermocouple voltage can be read from the NIST ITS-90 Thermocouple Database. For 255 °C, type T, it is
Another value (I use 245 °C, 11.735 mV) can be used to add hysteresis to the algorithm. The equivalent ADC reading for the MCP3428 (16-bit differential ADC, 2.048 V reference, gain 8) is
which is 1574 for 255 °C and 1502 for 245 °C.
As already noted, this is offset by the cold junction, whose temperature is measured with a DS1621 thermometer IC, which outputs 256 LSBs/°C. This needs to be converted into equivalent thermocouple ADC readings in order to make the comparison in the first equation, so let's do that now using the aforementioned 30 °C linearization (DS1621 LSBs -> Temperature -> thermocouple voltage -> ADC LSBs).
For the linearization around 30°C we get (again from the thermocouple database)
so the equivalent thermocouple ADC reading is
This calculation can easily be done with some simple fixed point trickery, avoiding floating point conversions. The linearization could be a bit better but I really don't care about 0.2 K when I just want to switch the heaters off at somewhere around 250 °C.