Thermal Imaging
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
Equipment
Devices used:
- IR Grid Click
mikromedia Plus for STM32mikromedia Plus for STM32 Shield- mikroProg for STM32
- Li-Polymer Battery 3.7 V 2000 mAh
- USB cable
Camera Setup
- Connect a battery to
mikromedia Plus.
- Connect
mikromedia Plus Shield tomikromedia Plus.
- Connect IR Grid Click to mikroBUS1 on Shield
Figure 4
- Connect mikroProg to mikroMedia Plus. Be careful! That can be done in two ways, but orientation should be as shown in Figure 5.
Figure 5
- Connect mikroProg to the computer via USB
Figure 6
Image Processing
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.
Figure 7
Here is a fragment of code that does that, just to get the idea:
float tmp1;
float tmp2;
float tmp3;
float tmp4;
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.
Figure 8
Set to 1:
The original matrix is modified by adding virtual pixels at all vertices where pixels are in contact. New dimensions are 30x6.
Figure 9
Set to 2:
Figure 10
Colors can be changed by editing color_scale.c
Drawbacks
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.
Summary
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.