Home Circuitpython Adafruit Feather M0 and MLX90614 infrared thermometer circuitpython example

Adafruit Feather M0 and MLX90614 infrared thermometer circuitpython example

by shedboy71

In this example we connect a MLX90614 infrared thermometer to an Adafruit Feather M0 running Circuitpython

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
Adafruit Feather M0 Express Adafruit (PID 3403) Feather M0 Express – Designed for CircuitPython – ATSAMD21 Cortex M0
MLX90614 MLX90614 non-contact Infrared Temperature Sensor
Connecting cables Free shipping Dupont line 120pcs 20cm male to male + male to female and female to female jumper wire

 

Schematic/Connection

feather and MLX90614 layout

feather and MLX90614 layout

Code Example

I used Mu for development

The following is based on a library , I copied the MLX90614 library to the lib folder on my Feather M0 Express – https://circuitpython.org/libraries

import board
import busio as io
import adafruit_mlx90614
import time
 
# the mlx90614 must be run at 100k [normal speed]
# i2c default mode is is 400k [full speed]
# the mlx90614 will not appear at the default 400k speed
i2c = io.I2C(board.SCL, board.SDA, frequency=100000)
mlx = adafruit_mlx90614.MLX90614(i2c)
 
while True:
   # temperature results in celsius
   print("Ambient Temperature: ", mlx.ambient_temperature)
   print("Object Temperature: ", mlx.object_temperature)
   time.sleep(1.0)

Output

Here is what I saw in Mu REPL window

Ambient Temperature: 21.41
Object Temperature: 19.23
Ambient Temperature: 21.37
Object Temperature: 19.17
Ambient Temperature: 21.37
Object Temperature: 19.13
Ambient Temperature: 21.35
Object Temperature: 19.17

Links

https://www.melexis.com/en/product/mlx90614/digital-plug-play-infrared-thermometer-to-can#

 

You may also like

Leave a Comment