Using an Arduino IR camera to plot a heatmap

10 views (last 30 days)
Armaan Dhalla
Armaan Dhalla on 22 Nov 2019
Answered: Kaashyap Pappu on 26 Nov 2019
I have an arduino code that takes values from an IR camera a couple of times a second and converts it into a matrix with temperature values.
[ 22.2 22.2 22.1 22.0 21.2 21.0
22.2 22.0 21.9 21.8 21.9 21.8
22.1 22.1 21.9 21.8 21.9 21.8
22.0 22.1 21.8 21.7 21.8 21.8
22.0 22.2 21.9 21.8 21.9 21.8 ]
I need to take these values, either while its connected to the arduino(or after the arduino saves the stuff above as a .txt or .csv file, whichever is easier), and plot those values on a colormap, which shows a color dependent on the value, to show the temperature like taking a picture with an infrared camera would.
I have tried looking at how to make colormaps, connecting an arduino device to matlab, and other stuff but still cant figure anything out. Any help would be appreciated!

Answers (1)

Kaashyap Pappu
Kaashyap Pappu on 26 Nov 2019
There are multiple ways to do this. If you are saving data in a text file and then want to load it into MATLAB, you can use fscanf to load the matrix, into MATLAB workspace, into a variable.
Alternatively, you can download the MATLAB Support Package for Arduino Hardware and follow the steps here to set up serial reception of data from Arduino Hardware. Note that addition configuration may be required on the board to facilitate serial communication between the Arduino board and MATLAB.
Finally, use the colormap function on the image to get the desired output. If the matrix does not have RGB values, you may have to use imagesc to get the image plot.
Hope this helps!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!