Test Instrumentation

Enter Your Electronics & Design Project for a chance to win a Grand Prize for Originality, a Tool Set, and a $100 Shopping Cart!

Back to The Project14 homepage

Project14 Home
Monthly Themes
Monthly Theme Poll


Blog posts:

"No lies" IR Thermometer - part I

"No lies" IR Thermometer - part II

This is part 3

"No lies" IR Thermometer - part IV


The firmware

Today, I would like to briefly describe the firmware of the IR thermometer.


A picture is sometimes worth a thousand words, so here is an attempt to create a state diagram:



The code start executing as soon as the power is applied, which is by default 2 AA alkaline batteries providing ca. 3 V. The following initialization in main function powers on the LCD, the IR sensor, initializes I2C bus and the LCD, reads ambient temperature and creates a bar graph effect for 800 ms. This part is supposed to delay 865 ms in total, because that is a time needed before the first and second reading the object temperature. This value is dependent on the time of the internal Infinite impulse response (IIR) and Finite impulse response (FIR) filter settings.


The following extract is taken from the application note for MLX90614 called Understanding MLX90614 on-chip digital signal filters. The document can be found on the web, but for some reason not on the Melexis website.


Anyway, the default sensor setting is the MAX FIR and IIR 50 %. I won’t pretend I understand these filters in detail. Important note is, that only the first valid measurement needs such settling time, the following measurements can be performed every 140 ms, according to the datasheet.


After the first and longest measurement comes a state in which both object and ambient temperature is simply measured and displayed and the program immediately goes into a 5 s sleep delay, which can be interrupted by two events. A) 5 seconds pass and the PSoC will go into stop mode. B) button was pressed and this redirects the program to the measuring and displaying state again, after which the 5 s delay comes again. Holding the button just cycles between S_MEASURE_DISPLAY and S_DELAY_BEFORE_STOP and allows continuous measurement.


Stop mode is a special low power mode, which can be interrupted only by a trigger on pin P0.7 (which is in Cypress kits connected to a button to try this exact feature). This interrupt simply causes a reset, but the reward should a power consumption of 20 nA.


I recommend seeing this video about PSoC power states: http://www.cypress.com/video-library/PSoC/psoc-creator-101-d-psoc-4200-low-power-modes/424891?tid=38141&sort_by=created


This source code is the first I wrote in more than one module. My idea was to do a bit of abstraction, so the code (which is only an easy C) can be ported to other MCUs with just rewriting a few hardware specific things (low power mode, GPIO control, I2C control).


As I wrote in my first blog post, there is one feature I haven’t found on the internet: dynamic CRC8 calculation needed for changing the MLX90614 emissivity coefficient. I wrote it with the help of TI's application note on how to calculate CRC8 in software. However, this feature was in this version of thermometer used only once to set emissivity to 0,98. I have more plans, so stay tuned



I saved all the design files to this shared Google Drive folder. IRthermometer v1.T3001 is a schematics and PCB file and the rest is a PSoC project directory.


Proof of work

Measuring a body temperature (forehead) of a baby



Measuring temperature of ice and hot water, comparision with another IR thermometer

The commercial thermometer clearly measures for a longer time and outputs only a maximum measured. However, the startup time and measurement speed is much slower.

SHT31 temperature / humidity sensor is present just for ambient temperature comparision.




Power consumption

I had to borrow a better meter to measure the power consumption. Please excuse the poor visibility of the thermometer in this video. It is caused by the internal resistance of the meter, the contrast ratio of the thermometer's LCD is set by a fixed resistor.

SHT31 temperature / humidity sensor is present just for ambient temperature comparision.