Posted: May 25, 2020
It seems that thermometers are really hard to find these days, but I was able to find the the non-medical version of the MLX90614 IR thermometer. It reads the temperature digitally and transmits it over an SMBus (basically i2c). I decided to get it to make my own contactless thermometer.
The source code below assembles with naken_asm.
I'm guessing that most of contactless thermometers sold by stores like Amazon are probably using this exact chip or something similar. Pretty much all of the complexities of reading a temperature are done in a device like this so mostly all that's need to be done to manufacture a thermometer is building circuitry and software around it. These sensors are actually a bit hard to find right now too, they seem to be sold out everywhere. I preferred to have the medical version, but the only place I could find the sensor is SparkFun and this is all they had.
The first step to building this device is getting SMBus (i2c) working from the MSP430G2231 to the MLX90614. I was having a difficult time with hardware i2c so I just used some software version I wrote a while ago. Worked almost immediately. The temperature comes as a 16 bit number which needs to be multiplied by 0.02 and then have 273 (temperature in Kelvin) subtracted from it.
I was originally thinking of making this a talking thermometer, but having a dangling speaker and such seemed like a pain, so I hooked up this SparkFun 7-segment display. I originally put it on the same i2c bus as the MLX90614, but it was very glitchy. Instead I hooked up a single wire from the MSP430 to the RX pin and did a software UART. To calibrate the timing on the software UART I wrote a calibration routine using a 32.768kHz clock source.
The thermometer readings were pretty interesting. Pointing straight at the air, it seemed to get the air temperature in my room pretty accurately. Pointed at myself was much trickier. The temperature readings were dependant on the distance to my skin and angle. I wonder if this is due to having the non-medical version of the sensor? Or maybe the thermometers sold online take multiple readings and kind of guess the best one? The closest and most consistent readings I was able to get were the ones pointed inside my mouth.
Copyright 1997-2021 - Michael Kohn