KrisKasprzak
Well-known member
I have a leak in my A/C duct system and to help isolate the problem, I built a thermal imaging camera. It’s based on an AMG8833 sensor that has an 8x8 sensor grid. The unit was packaged in a breakout board from Adafruit, who also published a library for fast startup use. Connection is via I2C, and the examples made getting the unit working a snap.
Out of the box the results were not very good, namely because of a small 8x8 sensor and the few colors that were assigned to for each pixel to represent temperature. The library is just to get started, so no complaints—I’ll have to thank any library writer for doing the heavy lifting. My code improves the results by taking advantage of all colors on my 2.8” TFT screen (65K), and turned up the resolution to 70x70 with some basic interpolation.
My algorithm for color assignment based on temperature is linear (namely due to the need to keep code running as fast as possible), and 65K colors will not be perfectly smooth anyway. I found a neat website that had RGB color definition per temp, so i just had to plot the RGB values and develop some equations, using y=mx + b.
To generate data at the interior points I had to interpolate each row, expanding 8 points to 70 for each row, and when complete I ran interpolation against each of the 70 columns. My interpolation routine to generate 10 points between each measured point is also linear. Again, in an attempt to display sensor readings at the maximum of 10 fps (as governed by the sensor), I wanted to keep the math as fast as possible. Also the 65K color limit prevents the need for supper accurate log-based color interpolation.
I also added some touch screen capability so the user can set the max/min temperature for converting the temp to color before drawing the results to the screen, and a grid that uses an interesting concept to avoid flickering due to repeatedly drawing grid lines.
I’m using a Teensy 3.2 running at 120 mhz and the screen refreshes around 3 fps—good enough for an $80 project. I still can't find my leak though...
To help others get started, I created a YouTube video of this project and have a link to the source code. Have a look.
https://www.youtube.com/watch?v=A9F1ezGgaC4
Happy measuring
Kris
Out of the box the results were not very good, namely because of a small 8x8 sensor and the few colors that were assigned to for each pixel to represent temperature. The library is just to get started, so no complaints—I’ll have to thank any library writer for doing the heavy lifting. My code improves the results by taking advantage of all colors on my 2.8” TFT screen (65K), and turned up the resolution to 70x70 with some basic interpolation.
My algorithm for color assignment based on temperature is linear (namely due to the need to keep code running as fast as possible), and 65K colors will not be perfectly smooth anyway. I found a neat website that had RGB color definition per temp, so i just had to plot the RGB values and develop some equations, using y=mx + b.
To generate data at the interior points I had to interpolate each row, expanding 8 points to 70 for each row, and when complete I ran interpolation against each of the 70 columns. My interpolation routine to generate 10 points between each measured point is also linear. Again, in an attempt to display sensor readings at the maximum of 10 fps (as governed by the sensor), I wanted to keep the math as fast as possible. Also the 65K color limit prevents the need for supper accurate log-based color interpolation.
I also added some touch screen capability so the user can set the max/min temperature for converting the temp to color before drawing the results to the screen, and a grid that uses an interesting concept to avoid flickering due to repeatedly drawing grid lines.
I’m using a Teensy 3.2 running at 120 mhz and the screen refreshes around 3 fps—good enough for an $80 project. I still can't find my leak though...
To help others get started, I created a YouTube video of this project and have a link to the source code. Have a look.
https://www.youtube.com/watch?v=A9F1ezGgaC4
Happy measuring
Kris
Last edited: