post

Mathematica catches the heat

I recently purchased the AMG8833 thermal camera breakout from Adafruit.  It’s an 8×8 pixel array of sensors that can be used to incorporate thermal vision into a project.  I’m interested in monitoring a thermoelectric cooler.  Adafruit provides a number of examples on how to interface the breakout with a Raspberry Pi or display connected to an Arduino.  I wanted to try a different interface and see if I could control it with Mathematica.  It took me longer to write this post than it did to write the software.

Temperature of 30×30 mm2 Peltier cooling device being measured with an AMG8833.

Read on if you’re interested in learning more

The build

Here’s what I’ve used to piece together this project:

  • Mathematica, V11.3 running on Windows
  • Arduino IDE
  • Arduino
  • AMG8833 (thermal breakout)
  • 5 V thermoelectric cooler (from Adafruit)

To power the TEC, I found a 5V 1A charger that has a USB connector on it.  I then took an old USB cable that my cat chewed and spliced the end to reveal the power lines.  I also hacked together a support with some scraps of wood, a sheet of aluminum for a heat sink, and an old computer fan that is powered with a 9 V battery.  The thermal camera breakout was connected using the Adafruit tutorial (including installing the appropriate libraries).  The firmware on the Arduino is essentially two pieces of example code (pixels_test from the AMG88xx library and Serialevent from the stock examples) spliced together.  The code has been posted to my github page.

The Arduino and thermal sensor are upside down and positioned above the thermoelectric cooler.

Operation

The Arduino spits out a string of pixel temperatures whenever it receives a newline character via the Serial interface.  Once Mathematica has opened the device, it writes a newline character and then reads the serial buffer after giving the sensor a chance to collect data (the sensor is rated at 10 hz).  This string needs to be processed a bit to turn in to data usable by Mathematica, but I’ve done all of that in a Package (also available on the github page).  As this is a proof of concept design at the moment, there’s little documentation.  That will change depending on whether or not I pursue this project.

Since there are only 64 pixels in the array, it’s pretty easy to collect, process and visualize the data.  I drop down to a refresh rate of 5 Hz and can store temperatures with reasonable temporal resolution.   The animated gif earlier in this post was obtained by collecting data for about 40 seconds while the TEC was plugged in for 15 seconds and thereafter unplugged.  The data were then visualized using the ListPlot3D function in Mathematica to emphasize the cooling effect.  With this setup, I can get the TEC to about 15 degrees C, which is 3-4 degrees cooler than when I did not have the fan and aluminum mount.  As noted in the header image, there are other ways to visualize the data, like a ListDensityPlot.  Additionally, since the data is converted into a matrix of temperatures, it is easy to calculate average temperatures or look at the variation (standard deviation) of the sensors with time in order to assess the quality of the data being collected.  All of these visualizations were acquired with interpolated data (order 2); however, it’s possible to show the data without interpolation when it is being used for less artistic pursuits.  I’ve got some ideas for what those pursuits are, but it’s a beautiful afternoon and I must go enjoy it.

 

2 thoughts on “Mathematica catches the heat

  1. Hey! Thanks a lot for this great post! I am also eager to try out your project, since I am new to using Mathematica, please tell me where I must run the tc.wl code on git hub after installing Mathematica. I tried to paste the code after creating a new package in the App but I seem to be getting no response. Thanks a ton for your time and efforts!

    • `tc.wl` just creates a set of functions but does not “do” anything. If you are very new to Mathematica, I encourage you to check out the tutorials on the Wolfram website since there’s a bit of a learning curve. Once the `tc.wl` package is loaded, using `OpenInterface[]` should produce an output.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.