In this article we connect a MLX90614 infrared thermometer to a Raspberry Pi Pico running Circuitpython
Sensor Information
First lets look at some information about the sensor from the manufacturer
The MLX90614 is an infrared thermometer for non-contact temperature measurements. Both the IR sensitive thermopile detector chip and the signal conditioning ASIC are integrated in the same TO-39 can. Integrated into the MLX90614 are a low noise amplifier, 17-bit ADC and powerful DSP unit thus achieving high accuracy and resolution of the thermometer.
The thermometer comes factory calibrated with a digital SMBus output giving full access to the measured temperature in the complete temperature range(s) with a resolution of 0.02°C.
The user can configure the digital output to be pulse width modulation (PWM). As a standard, the 10-bit PWM is configured to continuously transmit the measured temperature in range of -20 to 120°C, with an output resolution of 0.14°C.
Features and benefits
Factory calibrated in wide temperature range: -40 to 125°C for sensor temperature and -70 to 380°C for object temperature
High accuracy of 0.5°C over wide temperature range (0..+50 C for both Ta and To)
Medical accuracy of 0.1°C in a limited temperature range available on request
Measurement resolution of 0.02°C
Single and dual zone versions
SMBus compatible digital interface for fast temperature readings and building sensor networks
Customizable PWM output for continuous reading
Available in 3V and 5V versions
Power saving mode
This is the sensor I bought
Parts Required
Name | Link |
Pico | Raspberry Pi Pico Development Board |
MLX90614 | MLX90614 Contactless Temperature Sensor Module |
Connecting cables | Aliexpress product link |
Schematic/Connection
I used a MLX90614 sensor
Black for GND
Red for V+
Blue for SDA
Yellow for SCL
So color coded for ease of use, this layout shows a connection to the module
Code Example
I used Thonny for development
The following is based on a library , I copied the adafruit_mlx90614.mpy library for this device to the lib folder on my Feather M0 Express – https://circuitpython.org/libraries
This is the basic example which comes with the library
[codesyntax lang=”python”]
import time import board import adafruit_mlx90614 import busio # Create sensor object, communicating over the board's default I2C bus i2c = busio.I2C(scl=board.GP1, sda=board.GP0) # uses board.SCL and board.SDA # Initialize the sensor. mlx = adafruit_mlx90614.MLX90614(i2c , 0x5A) while True: # temperature results in celsius print("Ambient Temp: ", mlx.ambient_temperature) print("Object Temp: ", mlx.object_temperature) time.sleep(1.0)
[/codesyntax]
Output
Here is what I saw in Thonny REPL window
Ambient Temp: 19.53
Object Temp: 21.5699
Ambient Temp: 19.49
Object Temp: 21.55
Ambient Temp: 19.51
Object Temp: 22.0699
Ambient Temp: 19.49
Object Temp: 21.55
Links
https://www.melexis.com/en/product/mlx90614/digital-plug-play-infrared-thermometer-to-can#