Close Menu
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
Facebook X (Twitter) Instagram
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us
Facebook X (Twitter) Instagram Pinterest YouTube LinkedIn
How To Electronics
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
How To Electronics
Home » IR Thermometer with MLX90614 & Raspberry Pi Pico
Raspberry Pi Raspberry Pi Pico Projects

IR Thermometer with MLX90614 & Raspberry Pi Pico

Mamtaz AlamBy Mamtaz AlamUpdated:February 2, 20255 Mins Read
Share Facebook Twitter LinkedIn Telegram Reddit WhatsApp
IR Thermometer with MLX90614 & Raspberry Pi Pico
Share
Facebook Twitter LinkedIn Pinterest Email Reddit Telegram WhatsApp

Overview

In this project, you will learn how to make your own Infrared Thermometer using the MLX90614 Infrared Temperature Sensor & Raspberry Pi Pico using MicroPython Code. You can display the temperature reading on an SSD1306 0.96″ OLED Display. Earlier, we utilized temperature sensors like DS18B20, LM35, & MAX6675. However, these temperature sensors can only sense the temperature when heat is applied directly to their surface. But if you aim to measure the temperature of a very hot object such as a flame or hot iron, these sensors are not suitable.

The MLX90614 sensor employs contactless temperature sensing to gather temperature data without needing to physically touch the surface. For this project, we will connect the MLX90614 with the Raspberry Pi Pico and utilize MicroPython for programming. The OLED Display will show the value of ambient and object temperature.

We can use the MLX90614 to measure the temperature of hot objects such as machinery, flames, hot iron, and device CPUs. This sensor is also suitable for laboratory purposes; for instance, the MLX90614 can be used as an infrared thermometer for measuring body temperature. Earlier, during COVID-19, the demand for this sensor surged very high.


Bill of Materials

We need following components for making this IR Thermometer.

S.N.Components NameQuantityPurchase Links
1Raspberry Pi Pico1Amazon | AliExpress
2MLX90614 IR Temperature Sensor1Amazon | AliExpress
30.96" I2C OLED Display1Amazon | AliExpress
4Connecting Jumper Wires10Amazon | AliExpress
5Breadboard1Amazon | AliExpress




MLX90614 Contactless Infrared Temperature Sensor

MLX90614

The MLX90614 is an infrared thermometer for non-contact temperature measurements capable of measuring temperature between -70 to 380°C. The sensor uses IR sensitive thermopile detector chip and the signal conditioning ASIC integrated into a single chip. 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. Even though it works on SMBus protocol, but can be used with I2C pins.

MLX90614 Pinout Configuration

MLX90614 Pinout Configuration

The MLX90614 sensor has 4 pins. The working voltage of the sensor is 3.6V to 5V but the 3.3V version is also available. It has I2C Pins as SDA & SCL. The SDA is the Serial data pin & SCL is the Serial Clock pin used for I2C Communication.

Specifications

1. Operating Voltage: 3.6V to 5V
2. Supply Current: 1.5mA
3. Object Temperature Range: -70°C to 382°C
4. Ambient Temperature Range: -40°C to 125°C
5. Accuracy: 0.02°C
6. Field of View: 80°
7. Distance between object and sensor: approx. 2cm-5cm

Working Principle of MLX90614

As mentioned earlier, the MLX90614 sensor can measure the temperature of an object with any physical contact. This is often made possible with a law called Stefan-Boltzmann Law, which states that each one objects and living beings emit IR Energy and therefore the intensity of this emitted IR energy is going to be directly proportional to the temperature of that object or living being.

Therefore the MLX90614 sensor calculates the temperature of an object by measuring the quantity of IR energy emitted from it.


Applications of MLX90614

  1. High-precision non-contact temperature measurements
  2. Thermal Comfort sensor for Mobile Air Conditioning control system
  3. Temperature sensing element for residential, commercial & industrial building air
  4. Automotive blind angle detection
  5. Industrial temperature control of moving parts
  6. Healthcare
  7. Livestock monitoring
  8. Movement detection
  9. Thermal relay/alert
  10. Body temperature measurement

Interfacing MLX90614 with Raspberry Pi Pico

Let us interface MLX90614 Infrared Temperature Sensor with Raspberry Pi Pico. The connection is very simple as MLX90614 works on I2C communication protocol.

MLX90614 Raspberry Pi Pico Connection

Connect the I2C Pins of MLX90614 to Raspberry Pi Pico. Here we are connecting the SDA & SCL pin of MLX90614 to GP0 (Pin 1) & GP1 (Pin 2) of Pi Pico respectively. Provide the 3.3V & GND to the power pin of MLX90614.

MLX90614 Pi Pico Breadboard Connection

You can use a breadboard for assembly and jumper wire for connection.



MicroPython Code for MLX90614 with Raspberry Pi Pico

Here is the MicroPython Code for reading the temperature reading from MLX90614 using the Raspberry Pi Pico.

The code continuously reads and displays the ambient and object temperatures using the MLX90614 infrared temperature sensor connected to a Raspberry Pi Pico via I2C. It initializes the I2C bus, reads temperatures from the sensor’s registers and converts these readings from Kelvin to Celsius. Finally it prints the results to the console in a loop until the script is manually stopped by the user.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from machine import SoftI2C, Pin
import time
 
# MLX90614 I2C address
MLX90614_I2C_ADDR = 0x5A
 
# Register addresses for temperatures
MLX90614_TA = 0x06  # Ambient temperature register
MLX90614_TOBJ1 = 0x07  # Object temperature register
 
# Initialize I2C on the specified SDA and SCL pins
i2c = SoftI2C(sda=Pin(0), scl=Pin(1), freq=100000)
 
def read_temp(register):
    """
    Reads temperature from a specified register of the MLX90614.
    
    Args:
        register: The register address from which to read the temperature.
    
    Returns:
        The temperature in Celsius.
    """
    # Read data from the sensor's register
    data = i2c.readfrom_mem(MLX90614_I2C_ADDR, register, 3)
    # Combine the bytes and convert to temperature in Celsius
    temp = (data[1] << 8) | data[0]
    temp = (temp * 0.02) - 273.15  # Convert from Kelvin to Celsius
    return temp
 
try:
    print("* MLX90614 Temperature Readings *")
 
    while True:
        # Read sensor values for object and ambient temperatures
        object_temp = read_temp(MLX90614_TOBJ1)
        ambient_temp = read_temp(MLX90614_TA)
 
        # Print the temperature readings with the degree symbol
        print("Object Temperature: {:>5.2f}°C".format(object_temp))
        print("Ambient Temperature: {:>5.2f}°C".format(ambient_temp))
        print("-" * 30)  # Print a separator line for clarity
 
        # Wait for a second before the next reading
        time.sleep(1)
 
except KeyboardInterrupt:
    # Gracefully handle script termination by the user
    print('\nScript stopped by user')
 
finally:
    # Any cleanup can be done here
    print('Goodbye!')

Copy the above code and paste it on the Thonny IDE. Save the file with any name such as main.py. Then run the code.

The console will display the value of ambient as well as object temperature. You may place your hand or any hot object in front of MLX90614, you will observe immediate change in temperature reading.


Displaying Temperature Reading on OLED Display

Let us add an extra OLED Display to the above circuit, so that we can display the temperature readings on OLED Screen.

MLX90614 with Raspberry Pi Pico & OLED Display

The OLED Display we are using here is SSD1306 I2C OLED Display Module. Here we are not using the same I2C pins as we assigned for MLX90614. Rather we are using different I2C pin to connect OLED Display with Raspberry Pi Pico. Connect the SCL Pin of OLED to GP19 and SDA Pin to GP18 of Raspberry Pi Pico.

MLX90614 with OLED

You can insert the OLED Display on breadboard and use jumper wires to establish connection with Raspberry Pi Pico.




MicroPython Code for Displaying Temperature Reading on OLED

Let us write a MicroPython Code to read the temperature value from MLX90614 connected to Raspberry Pi Pico and display the readings on OLED Display.

For this code we require the SSD1306 OLED Driver. Therefore first copy the ssd1306.py to the Raspberry Pi Pico from following tutorial: OLED Display Pi Pico Guide.

The following code reads ambient and object temperatures using the MLX90614 infrared temperature sensor connected to a microcontroller via I2C, and displays these temperatures on an SSD1306 OLED display. It initializes two separate I2C buses for the sensor and the OLED display, respectively, continuously updates the display with the current temperature readings, and also prints these readings to the console.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
from machine import Pin, SoftI2C, I2C
import time
from ssd1306 import SSD1306_I2C
 
# MLX90614 I2C address and register addresses
MLX90614_I2C_ADDR = 0x5A
MLX90614_TA = 0x06  # Ambient temperature register
MLX90614_TOBJ1 = 0x07  # Object temperature register
 
# Initialize I2C for MLX90614 sensor
i2c_sensor = SoftI2C(sda=Pin(0), scl=Pin(1), freq=100000)
 
# OLED Display Setup
WIDTH, HEIGHT = 128, 64
i2c_display = I2C(1, scl=Pin(19), sda=Pin(18), freq=200000)
oled = SSD1306_I2C(WIDTH, HEIGHT, i2c_display)
 
def read_temp(register):
    data = i2c_sensor.readfrom_mem(MLX90614_I2C_ADDR, register, 3)
    temp = (data[1] << 8) | data[0]
    temp = (temp * 0.02) - 273.15  # Convert from Kelvin to Celsius
    return temp
 
def center_text(text, line, font_width=8):
    # Calculate starting x position based on text length
    x = max(0, (WIDTH - len(text) * font_width) // 2)
    oled.text(text, x, line)
 
try:
    print("* MLX90614 Temperature Readings *")
 
    while True:
        object_temp = read_temp(MLX90614_TOBJ1)
        ambient_temp = read_temp(MLX90614_TA)
        
        # Clear the display before adding new text
        oled.fill(0)
        
        # Display temperatures
        obj_temp_str = "{:.2f}C".format(object_temp)
        amb_temp_str = "{:.2f}C".format(ambient_temp)
        
        center_text("Object Temp:", 10)
        center_text(obj_temp_str, 20)  # Adjust line spacing as needed
        center_text("Ambient Temp:", 40)
        center_text(amb_temp_str, 50)
        
        # Update the display with new content
        oled.show()
        
        # Print the readings to the console as well
        print("Object Temperature: {:>5.2f}°C".format(object_temp))
        print("Ambient Temperature: {:>5.2f}°C".format(ambient_temp))
        
        time.sleep(1)
 
except KeyboardInterrupt:
    print('\nScript stopped by user')
 
finally:
    print('Goodbye!')


After running the code, the OLED will display the value of ambient temperature and object temperature both on OLED Screen.

To observe the change in the temperature reading introduce any hot/cold object or your hand in front of MLX90614.

You will see the rise in temperature reading displayed on OLED Screen. Thus, this is how we can use MLX90614 Infrared temperature sensor with Raspberry Pi Pico to read temperature without any physical contact.

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Reddit Telegram WhatsApp
Previous ArticleGas Leak Detection & Alarm using 555 Timer IC
Next Article Interfacing LM35 Temperature Sensor with ESP32 Web Server

Related Posts

ADXL375 Accelerometer with Raspberry Pi Pico & MicroPython

ADXL375 Accelerometer with Raspberry Pi Pico & MicroPython

Updated:July 24, 2025
Interface BMI160 with Raspberry Pi Pico & MicroPython

Interface BMI160 with Raspberry Pi Pico & MicroPython

Updated:February 2, 20253K
Shift Register 74HC595 with Raspberry Pi Pico & MicroPython

Shift Register 74HC595 with Raspberry Pi Pico & MicroPython

Updated:February 2, 202513K
Interfacing XBee Module with Raspberry Pi Pico & MicroPython

Interfacing XBee Module with Raspberry Pi Pico & MicroPython

Updated:February 2, 20253K
Modbus RTU with Raspberry Pi Pico & Micropython

Modbus RTU with Raspberry Pi Pico & MicroPython

Updated:February 2, 20258K
Fever Detector with MLX90640 & OpenCV Raspberry Pi

Thermal Fever Detector with MLX90640 & OpenCV Raspberry Pi

Updated:February 2, 20256K
Add A Comment

CommentsCancel reply

Latest Posts
ESP32 Fingerprint Attendance System with Live Web Dashboard

ESP32 Fingerprint Attendance System with Live Web Dashboard

June 21, 2026
IoT Based PM & Air Quality Monitoring System using ESP32

IoT Based PM & Air Quality Monitoring System using ESP32

June 14, 2026
DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

May 10, 2026
IoT Activity Tracker with ESP32 & Accelerometer Gyroscope

IoT Activity Tracker with ESP32 & Accelerometer/Gyroscope

May 2, 2026
A Guide to Sourcing Obsolete ICs for Vintage Projects

Beyond AliExpress: A Guide to Sourcing Obsolete ICs for Vintage Projects

April 21, 2026

ESP32 IoT Vehicle Motion Analyzer with MPU6050 & LIS3MDL

April 27, 2026
Building a Smart Sensor Node with a BLE Microcontroller

Building a Smart Sensor Node with a BLE Microcontroller

February 26, 2026
High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

April 27, 2026
Top Posts & Pages
  • 12V DC to 220V AC Inverter Circuit & PCB
    12V DC to 220V AC Inverter Circuit & PCB
  • ESP32 Fingerprint Attendance System with Live Web Dashboard
    ESP32 Fingerprint Attendance System with Live Web Dashboard
  • Buck Converter: Basics, Working, Design & Application
    Buck Converter: Basics, Working, Design & Application
  • ESP32 CAN Bus Tutorial | Interfacing MCP2515 CAN Module with ESP32
    ESP32 CAN Bus Tutorial | Interfacing MCP2515 CAN Module with ESP32
  • IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
    IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
  • LD2410 Sensor with ESP32 - Human Presence Detection
    LD2410 Sensor with ESP32 - Human Presence Detection
  • Full Wave Rectifier Basics, Circuit, Working & Applications
    Full Wave Rectifier Basics, Circuit, Working & Applications
  • How to use INA219 DC Current Sensor Module with Arduino
    How to use INA219 DC Current Sensor Module with Arduino
Categories
  • Arduino Projects (197)
  • Articles (60)
    • Learn Electronics (19)
    • Product Review (15)
    • Tech Articles (28)
  • Electronics Circuits (46)
    • 555 Timer Projects (21)
    • Op-Amp Circuits (7)
    • Power Electronics (13)
  • IoT Projects (205)
    • ESP32 MicroPython (7)
    • ESP32 Projects (82)
    • ESP32-CAM Projects (15)
    • ESP8266 Projects (76)
    • LoRa/LoRaWAN Projects (22)
  • Microcontrollers (38)
    • AMB82-Mini IoT AI Camera (4)
    • BLE Projects (18)
    • STM32 Projects (19)
  • Raspberry Pi (93)
    • Raspberry Pi Pico Projects (57)
    • Raspberry Pi Pico W Projects (12)
    • Raspberry Pi Projects (24)
Follow Us
  • Facebook
  • Twitter
  • Pinterest
  • Instagram
  • YouTube
About Us

“‘How to Electronics’ is a vibrant community for electronics enthusiasts and professionals. We deliver latest insights in areas such as Embedded Systems, Power Electronics, AI, IoT, and Robotics. Our goal is to stimulate innovation and provide practical solutions for students, organizations, and industries. Join us to transform learning into a joyful journey of discovery and innovation.

Copyright © How To Electronics. All rights reserved.
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us

Type above and press Enter to search. Press Esc to cancel.

Ad Blocker Enabled!
Ad Blocker Enabled!
Looks like you're using an ad blocker. Please allow ads on our site. We rely on advertising to help fund our site.