IR Grid click is a powerful thermal imaging sensor which gathers numerical values of the temperature in its surroundings (where it is aimed at) in the form of a 16x4 matrix. That raw data can be used for calculations depending on the need, but making those results visual is much more useful.
A simple thermal imaging camera can be put together if the sensor is accompanied by a display, in this case,
Figure 1: Cup of hot water
- IR Grid Click
mikromediaPlus for STM32 mikromediaPlus for STM32 Shield
- mikroProg for STM32
- Li-Polymer Battery 3.7 V 2000 mAh
- USB cable
- Connect a battery to
mikromediaPlus Shield to mikromediaPlus .
- Connect IR Grid Click to mikroBUS1 on Shield
- Connect mikroProg to mikroMedia Plus. Be careful! That can be done in two ways, but orientation should be as shown in Figure 5.
- Connect mikroProg to the computer via USB
Resolution of the original image is low, and our first aim is to increase it. That can be done by adding virtual pixels – pixels whose value is the mean of their neighborhood pixels, as shown in figure 7.
Here is a fragment of code that does that, just to get the idea:
tmp1 = GET_PIX_NOR((cc / 2), (rc / 2));
tmp2 = GET_PIX_NOR((cc / 2) + 1, (rc / 2));
tmp3 = GET_PIX_NOR((cc / 2), (rc / 2) + 1);
tmp4 = GET_PIX_NOR((cc / 2) + 1, (rc / 2) + 1);
tmp1 = (tmp1 + tmp2 + tmp3 + tmp4) / 4;
SET_PIX_VIR_1(tmp1, cc, rc);
Entire code can be found on Libstock.
Dimensions of the image generated from raw data are 16x4 pixels, which is inconvenient for most displays because of the width-to-height ratio of 4, which results in a very wide image. The aim is to process the original image in order to change its dimensions - which is already a consequence of adding virtual pixels.
By setting the value of frame_type we get different images:
Set to 0:
The original 16x4 matrix is displayed.
Set to 1:
The original matrix is modified by adding virtual pixels at all vertices where pixels are in contact. New dimensions are 30x6.
Set to 2:
Colors can be changed by editing color_scale.c
The more pixels we add, the clearer the image; but more pixels mean drawing more squares on the screen, which means more time spent. Hence the lower speed of the camera and the lower number of frames per second.
You can make your own simple thermal imaging camera by following this tutorial.
This project is very expandable – many kinds of image processing techniques can be implemented in order to modify the raw data matrix.
Code for the entire project can be found on
*Interview with the author of this text (Katarina Cimesa) can be found here.