Close
0%
0%

Raspberry Pi Thermal Imaging

This project shows how to use the MLX90620 or MLX90621 16x4 Thermopile Array from the Raspberry Pi

Similar projects worth following
This project shows how to use the MLX90621 16x4 IR sensor array from the Raspberry Pi to add basic thermal imaging to your pi for under $100. It is a part of my ongoing project to build a general purpose electromagnetic scanner (prototype picture on left).

This Project is provided under the MIT license, enjoy ;-)

The MLX90620 and MLX 90621 are 16x4 remote temperature sensors. Both operate via I2C. The MLX sensors are very affordable and work well. The only drawback is that the sensors are designed for 'production line' so their 16x4 aspect ratio is not ideal. You can see in the picture of the thermo-data overlaying the camera image that we get a 'strip' of temperature data that runs either horizontally or vertically across the middle of the image depending on orientation.

Aside from this one drawback, they are pretty awesome little sensors. They will work from 3.3V but prefer a bit lower voltage. So it's prudent to connect a small rectifier diode in series with th positive power (a 1n4001 works nicely.) Other than that, wiring is the same as any I2C device-

MLX Raspberry Pi

  • Vcc -> Pin 1 (via 1n4001 diode to drop voltage)
  • SCL -> Pin 3
  • SDA -> Pin 5
  • Gnd -> Pin 9

You'll also need to make sure that i2c is enabled for your Raspberry Pi. (A pretty good guide on that is here- http://www.raspberrypi-spy.co.uk/2014/11/enabling-the-i2c-interface-on-the-raspberry-pi/)

Finally you'll need to enable the pi camera if you wish to run the 'mlxview' example that's included with the mlx90621 user space driver.

Once the device is physically installed and i2c is enabled verify that the SOC can see it by opening a terminal and running-

for Raspi - 'sudo i2cdetect -y 0'

for Raspi 2 - 'sudo i2cdetect -y 1'

(If that command is not found do 'sudo apt-get install i2c-tools'.)

Once you execute that command you'll see a grid of dashes with numbers where any i2c device is detected. The MLX has 2 i2c devices which collectively bind 9 i2c addresses - 50, 51, 52, 53, 54, 55, 56, 57 and 60

Addresses 50-57 and 60 below are the MLX90621. The other addresses are other i2c peripherals...

Once you can see the MLX90621 with 'i2cdetect' you can download and install the mlxd code from github.

To run the driver/daemon do- 'sudo mlxd &', if succesfull the thermopile data will now be available at - /var/run/mlx90620.sock

The mlxview.py application is an example app that grabs the thermopile data and attempts to superimpose it over the feed from the raspicam. It has a few python prerequisites. So if you want to run it first do -

'sudo apt-get install python-numpy python-scipy python-skimage'

(There may be other prerequisites I'm unaware of because I already had them installed. But those are the big ones...)

Here's a short video of the mlxview.py demo in action-



  • 1 × MLX90621 thermopile array
  • 1 × Raspberry Pi 2
  • 1 × Raspicam (and ribbon cable)
  • 1 × LCD display (HDMI or PiTFT)

View project log

Enjoy this project?

Share

Discussions

Liathano wrote 07/21/2015 at 07:09 point

Hi,

really good description.
but I have a problem. If I say "run in terminal" the terminal is open for 1 sec and then is closing. so I can't measure anything (but need it for my studies..) and don't have a mlx90620.sock

What can be the reason? any tips?

thanks

  Are you sure? yes | no

Liathano wrote 07/21/2015 at 07:35 point

the 2nd problem is, that when I write 'sudo i2cdetect -y 1'

it shows nothing for the mlx90621, but every line shows a number if i try the mlx90614 .... 
hope you can help me, I really need it.

  Are you sure? yes | no

Bob Hannent wrote 09/27/2016 at 13:01 point

open a terminal window using xterm or some other option in your OS?

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates