MLX90640 IR Thermal Camera Working With Raspberry Pi 4

Introduction: 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.

Supplies

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

Be the First to Share

    Recommendations

    • Soup & Stew Speed Challenge

      Soup & Stew Speed Challenge
    • Fashion Challenge

      Fashion Challenge
    • Metal Contest

      Metal Contest

    14 Comments

    0
    aldude_jon
    aldude_jon

    8 months ago

    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

    0
    chocolaska.2905
    chocolaska.2905

    9 months ago on Step 2

    hello, i have a problem this error .(see the picture) Excuse me for my english ( i m french)

    image0 (1).jpg
    0
    ah224jr
    ah224jr

    1 year ago on Step 2

    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

    0
    Steven XU
    Steven XU

    Reply 1 year ago

    Hi, please check your camera is connecting correctly with the I2C interface of the raspberry pi. This issue is probably caused by the connection.

    0
    ah224jr
    ah224jr

    Reply 1 year ago

    Thank you a lot, it works finally.

    0
    elesey.r
    elesey.r

    Reply 1 year ago

    How did you solve your error? I am getting the same one

    0
    ChristopherN72
    ChristopherN72

    Reply 1 year ago

    Same i got the ModuleNotFoundError. Author please reply.

    0
    robhard
    robhard

    Reply 1 year ago

    You have to run sudo if I am not wrong.

    0
    fajriantynurul99
    fajriantynurul99

    Reply 1 year ago

    Make sure you have install the module

    0
    ah224jr
    ah224jr

    Reply 1 year ago

    Thank you very much. I have solved the problem.

    0
    R-A
    R-A

    1 year ago

    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?

    0
    robhard
    robhard

    Question 1 year ago on Step 2

    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.

    0
    firdoshdiakus26
    firdoshdiakus26

    Answer 1 year ago

    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?

    0
    firdoshdiakus26
    firdoshdiakus26

    1 year ago

    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