February 14, 2021
I asked for a thermal camera sensor for my birthday so I could analyze electronic circuit hot-spots and also check my house for leaks.
After getting this Thermal Camera I decided to build a case and write firmware to control it.
- MLX90640 Thermal Camera board
- Teensy microcontroller
- Custom made circuit board
- MCUfriend LCD display
- 3D printed case
- Soldering iron
- Arduino IDE
- 3D Printer
After getting the thermal camera the first step was to read the documentation on the sensor and see how other people had used it. I found helpful information at these sites:
In this step I prototyped the camera on a breadboard to see how it worked and to also provide a base for developing the firmware.
Note: The sensor is not shown in the photo - it is soldered into the final version of the camera.
I started on an Arduino and using one of the firmware programs from online I was able to demonstrate the sensor by sending ASCII characters back to my PC, with different characters representing different temperatures. But, to utilize the full potential of the sensor something more powerful, and with more memory, than an Arduino was needed. The Teensy was recommended and I bought a Teensy 4.1 to use. A Teensy 4.0 would have been plenty, but in case I wanted to use it for something else later I got the 4.1 because of the extra pinouts it has.
Using the Teensy and an MCUfriend 320x240 pixel LCD display I was able to generate a full color display that clearly showed the different temperatures.
For this step I made a circuit board to mate all the electronic parts together. I was pretty sure the wires on the proto board would never stay in place if I tried to use the camera in prototype form!
Once I had the custom board I was able to solder the entire circuit into a single assembly. The thermal camera sensor is mounted on the back of the board, with the Teensy on the front of the board underneath the LCD. A knob on the left side rotates to highlight menu options and clicking the knob selects a menu item.
Fourth Step Continued
This photo shows the assembly from the other side.
The next step was to build a case to hold everything together and to make it easier to handle the camera. I printed the case in two parts - a main body that houses everything and a cover plate that goes over the top.
Put it all together in the case and turn it on! The photo shows the menu that appears after the preliminary splash screen and technical details. Clicking the button on the first menu item begins the thermal scan and display process.
You'll notice the cable coming out the side of the camera. It is a standard USB cable that connects to the battery pack underneath the camera. I decided to use an external USB power brick rather than put batteries inside the camera. This avoids needing to build a charging circuit into the camera and also eliminates the possibility of leaving batteries in the camera to go dead and rot. I can't say how many flashlights I've wrecked by leaving batteries in them too long! The external battery pack fits in a pocket, and alternatively, the camera could be plugged into any USB power socket.
Use it! Here's a demonstration showing it recognizing the temperature difference of my hand against a wooden door. You may notice the image is mirrored. That's because I had the LCD oriented the other way when I was looking at it during prototyping. This is easy to fix in firmware. That leads to:
- Flip the image in firmware
- Interpolate the temperatures for a smoother image. Right now every temperature valued is expanded to fill a 10 pixel by 10 pixel area on the screen
- Check for those leaks in my house - once the snow melts enough I can get near the foundation!