Thermal Imaging

From Open Source Controls Wiki
Jump to navigation Jump to search

Add thermal imaging to a project for under £100.

24 x 32 pixel resolution.

MLX90640-D55-Thermal-Camera-details-5.jpg

The image below is a hand.

The initial deployment of this camera will be to monitor the hydro-electric turbine on the Morden Hall field trial.


Thermal2.png

Links

Installation

sudo apt-get update
sudo apt-get install libi2c-dev
cd ~
git clone https://github.com/pimoroni/mlx90640-library.git
cd mlx90640-library
make clean
make I2C_MODE=LINUX
make examples/test
sudo examples/test (CTRL+C to stop test)
make examples/rawrgb

Node-RED

Thermal3.png

[{"id":"d74fbbb92887d522","type":"tab","label":"Flow 3","disabled":false,"info":"","env":[]},{"id":"61664d917559a982","type":"inject","z":"d74fbbb92887d522","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":280,"wires":[["37a0646d73ccea39"]]},{"id":"37a0646d73ccea39","type":"exec","z":"d74fbbb92887d522","command":" sudo /home/pi/mlx90640-library/examples/rawrgb","addpay":"","append":"","useSpawn":"true","timer":"","winHide":false,"oldrc":false,"name":"","x":490,"y":280,"wires":[["27990d10a35332bd","383d8165ed79a858"],[],[]]},{"id":"27990d10a35332bd","type":"debug","z":"d74fbbb92887d522","name":"debug 12","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":840,"y":280,"wires":[]},{"id":"30224b5ab3d2f704","type":"ui_heat_map","z":"d74fbbb92887d522","group":"a1ac88f20d07cec2","order":0,"width":"12","height":"16","name":"","rows":"32","columns":"24","minMax":true,"minimumValue":0,"maximumValue":"100","backgroundType":"color","backgroundColor":"#ffffff","image":"never","radius":"45","opacity":"0.6","blur":"0.8","showValues":false,"gridType":"none","valuesDecimals":0,"showLegend":false,"legendType":"none","legendDecimals":0,"legendCount":2,"x":900,"y":480,"wires":[[]]},{"id":"a0cbad37a2519760","type":"debug","z":"d74fbbb92887d522","name":"debug 15","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":980,"y":360,"wires":[]},{"id":"383d8165ed79a858","type":"function","z":"d74fbbb92887d522","name":"function 3","func":"var buff = msg.payload;\n\nvar oot = [];\nvar cnt = 0;\n\nfor (let rown = 0; rown < 24; rown++) {\n    for (let coln = 0; coln < 32; coln++) {\n\n        var i = ((23-rown) * 32) + coln;\n        //var hexToDecimal = hex => parseInt(hex, 16);\n\n        var cv = (255 * 255 * msg.payload[3 * i]) + (255 * msg.payload[(3 * i) + 1]) + (1 * msg.payload[(3 * i) + 2])\n        \n        cv = parseInt(cv / 165813.75);\n        // oot.push(255 * 255 * msg.payload);\n        // oot.push(255 * msg.payload[i+1]);\n        // oot.push(msg.payload[i+2]);\n        oot.push(cv);\n\n    }\n}\n   \n\nmsg.payload = oot;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":800,"y":360,"wires":[["a0cbad37a2519760","30224b5ab3d2f704"]]},{"id":"a1ac88f20d07cec2","type":"ui_group","name":"Default","tab":"3e483ad9b8798814","order":1,"disp":false,"width":"12","collapse":false,"className":""},{"id":"3e483ad9b8798814","type":"ui_tab","name":"Heatmap","icon":"dashboard","disabled":false,"hidden":false}]