Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 8 of 8

Thread: MLX90640 Thermal Camera and a Teensy 4.0

  1. #1

    MLX90640 Thermal Camera and a Teensy 4.0

    As you may recall. I built a thermal camera using and 8x8 sensor and a Teensy 3.2, and while my interpolate routing to scale the 8x8 up to 70 x 70 to smooth the display, 8x8 is, well eh.

    Melexis offers a 32 x 24 array and after 3 months of waiting due to back order, my unit finally arrived. I could not wait to connect it to my Teensy 4.0. I built a thermal camera using this MLX90640 camera and a Teensy 4.0, with the following capability

    1. 32x24 pixel array scaled up to 310 x 230 using linear interpolation (linear is good enough since the display is only 16-bit color)
    2. display on a 320 x 240 ILI9341 display
    3. added a gradient legend
    4. added a histogram to show quantities of temp ranges
    5. added a cute icon to activate a menu with slider controls and option buttons for setting display and operating parameters
    6. added a print screen function so you can save a snapshot of the display to an SD card (I'm able to get SD+Display+touch+pixel reading with a very specific 320x240 display)
    7. added an option to interpolate the results or show 32 x 24 with 10x10 square pixels
    8. touchscreen support
    9. ability to set max and min temperature

    Fun project but NOT possible without a Teensy.


    Source code in the videos link

    https://youtu.be/1EBoug27hrA


    Sample images (of course I had to use hand gestures for the Teensy model number)

    raw display where each pixel is scaled to a 10x10 rectangle
    Click image for larger version. 

Name:	10px.jpg 
Views:	16 
Size:	24.5 KB 
ID:	24306

    Interpolated image with gradient legend
    Click image for larger version. 

Name:	ThermalCamera.jpg 
Views:	15 
Size:	27.2 KB 
ID:	24307

    Interpolated image with histogram legend
    Click image for larger version. 

Name:	Hdcam001.png 
Views:	17 
Size:	31.4 KB 
ID:	24310

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    14,439
    Nice looking work!

  3. #3
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,261
    would it be easy to colour code histogram legend?

  4. #4
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,832
    that would be good to have when checking someone for fever at entrances and their temperatures are high

  5. #5
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    14,439
    Quote Originally Posted by WMXZ View Post
    would it be easy to colour code histogram legend?
    Should be some easy change to : UpdateHistogram() @ HD_ThermalCam_v1.0.ino#L694
    Code:
        Display.fillRect(293, 200 - (j * 3), Length, 2, ILI9341_BLACK);
        Display.fillRect(293 + Length, 200 - (j * 3), 24 - Length, 2, ILI9341_WHITE);
    Where ILI9341_BLACK is changed to proper temp color at that 'j' spot at temp drops from start

  6. #6
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    7,209
    Nice work Kris. I came across the video yesterday on Youtube and really looked good. Going to have to have to give it a try once done playing with MM. I actually picked up the one from Sparkfun, https://www.sparkfun.com/products/14844, before the global parts shortage so its already in my box of goodies

  7. #7
    yep, easy. I thought about doing this in v1.0, not sure why I didnt't

    Display.fillRect(293, 200 - (j * 3), Length, 2, GetColor( (MINTEMP + (inc * j)) ));
    // Display.fillRect(293, 200 - (j * 3), Length, 2, ILI9341_BLACK);
    Display.fillRect(293 + Length, 200 - (j * 3), 24 - Length, 2, ILI9341_WHITE);

    Click image for larger version. 

Name:	Hdcam004.png 
Views:	14 
Size:	18.9 KB 
ID:	24313

  8. #8
    Junior Member
    Join Date
    Sep 2019
    Posts
    11
    Looks good!

    I recommend to give bicubic interpolation a try (it is correctly coded in the driver for the Adafruit AMG8333 module). It is slow, but image appearance is vastly improved over bilinear interpolation.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •