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
- Raspberry Pi 4 Computer Model B 4GB
- Grove - Thermal Imaging Camera / IR Array MLX90640 55 degree
- 5 inch 800x480 Capacitive TouchScreen
- Grove - 4 pin Female Jumper to Grove 4 pin Conversion Cable (5 PCs per PAck)
- Raspberry Pi 4 Official micro HDMI to Standard HDMI Male Cable - 1m White
- Wall Adapter Power Supply - 5VDC 3A Type-C
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