MLX90640 IR Thermal Camera Working With Raspberry Pi 4

20K1632

Intro: MLX90640 IR Thermal Camera Working With Raspberry Pi 4

Want to detect something that can emit heat and figure out their temperatures? The MLX90640 IR thermal camera can display the relative temperature and shape of the objects as long as you put them in front of the IR thermal camera. IR thermal camera connects with Raspberry Pi 4 var I2C interface, after reading the data from the camera, raspberry pi 4 would process these data and convert them to numbers of pixels and finally displayed as a thermal image on the Raspberry Pi display.

STEP 1: Hardware

Here is the 40 pin schematic of the Raspberry Pi, you can easily find I2C interface SCL and SDA. The IR thermal camera has an I2C Grove interface, so a transform wire is needed from Grove to jump wire. At last, The IR thermal camera is correctly connected with the corresponding pins of the Raspberry Pi.

The next step is simple, a 5’’ Raspberry Pi display needs to be connected with Raspberry Pi 4 var mini HDMI wire. And Raspberry Pi 4 needs to be powered by a 5V/3A power adapter by the USB Type-C interface. Keyboard and mouse are optional depending on your requirements. From now on, an IR thermal camera project’s hardware has already been set up.

STEP 2: Software

The software contains two parts, one for data reading and the other for data processing. So here come two python codes to realize both of the functions. The detail operation steps are as follows.

Step1

Install grove.py by the commend

curl -sL <a href="https://github.com/Seeed-Studio/grove.py/raw/master/install.sh">  https://github.com/Seeed-Studio/grove.py/raw/mast...> | sudo bash -s -
Step2

Install the MLX90640 driver with the following commend.

pip3 install seeed-python-mlx90640

or (If you have the authority of your Raspberry Pi):

sudo pip3 install seeed-python-mlx90640

if you want to update the driver locally from PyPI. you can use:

pip3 install --upgrade seeed-python-mlx90640
Step3

Check if the i2c device works properly, 0x33 is the MLX90640 i2c address.

i2cdetect -y -r 1

If your Raspberry Pi connects well with MLX90640 IR thermal camera, you will get the result below.

0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- 33 -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --
Step4

Install the upper computer code from Github.

sudo git clone  https://github.com/gobuyun/seeed_ircamera.git
Step5

Operate the python file and you will get the thermal image.

Cd seeed_ircamera
Sudo python3 seeed_python_ircamera.py

STEP 3: Demo Result

19 Comments

I can't get this to work, as the shellscript fails on unmet dependencies, libpython3.5 and python3-mraa. This may be relying on an older libpython installation.
Hello,
I am connecting MLX90640 with a RPi 3b+ following your step 2-1: Install grove.py based on the command you wrote. However, it appeared "syntax error" in several attempts.
Could you please rewrite a correct command?

Thank you in advance for your help.
hello, i have a problem this error .(see the picture) Excuse me for my english ( i m french)
I might be wrong, but my modules shows me left und right side swapped. As i´m pretty new to this theme, i have no idea to invert. Is there a solution?
After running a couple of minutes I get the following error and can't run again till reboot, any idea what is wrong?

Error:Please check if the I2C device insert in I2C of Base Hat
QObject::~QObject: Timers cannot be stopped from another thread
Hi,
I am trying to implement the project and have got some issues.
In step 3, I did not get 33 in the line 30. And in step 5, I got this "Traceback (most recent call last):
File "seeed_python_ircamera.py", line 3, in <module>
import seeed_mlx90640
ModuleNotFoundError: No module named 'seeed_mlx90640'.
Any help please
Hi, please check your camera is connecting correctly with the I2C interface of the raspberry pi. This issue is probably caused by the connection.
Thank you a lot, it works finally.
How did you solve your error? I am getting the same one
Same i got the ModuleNotFoundError. Author please reply.
You have to run sudo if I am not wrong.
Thank you very much. I have solved the problem.
Is it possible to get a better picture from this camera, as well as update the refresh rate on the screen to be a bit quicker?
Hi Steven, using your coding and MLX90640 and with Raspberry PI 3b+, I have done a co-relation with the thermometer and there is a 2 degrees difference. Can kindly advice if I can compensate thru your coding for these 2 degree? For your information and kindest advice.
Hi Steven the spec sheet on the 90640 shows +- 2 deg. accuracy so that might be it. Would be great if can be rectified in software. I have not made this project yet so is it good and worth trying it?
Hi , I would like to know what is the maximum distance can the object or body be from the camera to detect temperature ?? Are there any other better spec thermal cameras available to use in place of 90640 with this project ?? Thank you great project