#thermal #mlx #mlx90640 #melexis #melexis90640

rpmlx90640

High-level library for imaging using Raspberrypi I2C and the MLX90640 thermal sensor

1 unstable release

0.1.0 Dec 11, 2023

#679 in Embedded development

MIT/Apache

47KB
1K SLoC

rpmlx90640

High-level library for imaging using Raspberrypi I2C and the MLX90640 thermal sensors

Components

The module consists of two basic components, one for measuring a temperature-grid, and the other for coloring a provided temperature-grid.

Here, the main library rpmlx90640 represents the measuring part, while a submodule called "mlx_image" can be used for the coloring part.

Usage

Taking images

In order to simply take an image, use the take_image(color_type: &ColorTypes) function. It takes an enum, which specifies what coloring algorithm you whant. I recommend using HUE as the ColorType. That function will then return an array of color values wrapped inside a struct, following the pattern of [r0, g0, b0, r1, g1, b1, ...].

The temperature bounds for coloring are taken from the image; the coldest pixel will always be the "coldest" color, and the same with the hottest pixel.

Measuring temperatures

If you don't want to color the images and just access the raw temperature grid, use read_temperatures().

Calculating a gradient for display

A lot thermal imaging software display a gradient next to the image to display all possible colors. In order to do that easily, use get_scale(ColorTypes). Again, specify your preferred coloring algorithm, the function will give you an array of 256 colors going the from coldest to the hottest color possible.

Changing mlx refresh rate

The mlx90640 is also capable of changing the refresh rate. set_framerate(Framerates) will take an enum representing the desired framerate, and tell the mlx to use that framerate. If you want to know at what framerate the mlx is working right now, use read_framerate(). This is usefull if your application might have to restart and doesn't know the mlx's framerate anymore.

Dependencies

~380KB