I'm finishing up my rainy day project that I started earlier MLX90640 Thermal Camera on Wio Terminal .
I 3D printed a cover for the camera module and cut a small proto PCB to mount a short dual row header to allow me to plug the module into the RPi connector on the rear of the Wio Terminal battery pack. I thought about using that header to eliminate the external wiring, but I like the flexibility to move the camera to a different position relative to the display. Of course, moving the camera to the opposite side meant I had to mirror the display and change some of the offsets. I would have preferred to mount the camera more in the vertical center as it would have been easier to align the object being measured. I decided to use the camera module with the 55 degree FOV as it seems more useful when looking at smaller objects like components on a PCB.
I added the battery pack to make the camera portable. The addition of the battery pack makes the assembly bulkier, but it actually has a better "hand feel".
Since the Wio Terminal has an SD card interface, I thought it would be a nice feature to be able to save thermal images for documentation purposes. Unfortunately, this took me down a rat hole. My idea was to capture the pixel data from the TFT controller and convert it to an image file to write to the SD card. Seemed like it would be straightforward with the TFT_eSPI library that I was using, but I had not considered the amount of memory that would be required to process that data and I ended up with memory overruns. I'm sure someone has figured this out, probably use smaller buffers and convert and write the data in small chunks. I looked around and found a screen capture example from Bodmer who created the TFT_eSPI library - https://github.com/Bodmer/TFT_eSPI/tree/master/examples/Generic/TFT_Screen_Capture . This example does not write the image to the SD card, but instead sends a serial stream to a host PC and runs a Processing script to render and save the image. I appropriated the screenSaver function and the processing_sketch to use with my program. I had some problems with the processing sketch because the latest version changed the data type boolean to bool to fix a deprecation issue and that does not run with the version of Processing (3.5.4) that I am using. I reverted the data type to boolean and that runs.
A short demo of the screen capture. The image viewer in the background shows the rendering of the captured image on the PC. I use the "B" button (top middle) to trigger the screen capture.
And the captured image in .png format.
Of course, that means that I've lost my portability since I need to be tethered to the PC to do screen captures. As an alternative, I can save the data from the thermal sensor to the SD card. That array is only 32x24 and takes less than 5 KB if I save it as a .csv file. I implemented a "save Snapshot" mode to do that which is triggered by the "A" button (top right). The image below is rendered as a .png using a Python script.
I found the temperature difference between the two images interesting. The top image was taken after I had just come inside after digging holes for my wife who had purchased some native plants for the yard. The second image was taken a few hours later after doing computer work. My wife thinks that means I should do more yard work to improve my circulation .
So, where to go from here? I could do more post-processing in Python to get the raw thermal data to match the format of the TFT display image. I'd like to add some GUI functionality for file viewing and naming. But those are projects for another set of rainy days...
Top Comments