Lesson 38: Using an MLX90614 Infrared Temperature Sensor with Arduino

Lesson 38: Using an MLX90614 Infrared Temperature Sensor with Arduino

This project demonstrates how to use the MLX90614 infrared temperature sensor with an Arduino. This sensor allows you to measure temperature without contact, making it suitable for various applications. The provided code simplifies the process of reading temperatures in Celsius, Fahrenheit, and Kelvin, and offers flexible functions for incorporating the sensor into your projects.

Possible applications and project ideas using this sensor include:

  • Contactless temperature measurement for people or objects.
  • Monitoring temperature in sensitive environments.
  • Building a thermal imaging camera (with additional hardware).
  • Creating a temperature-controlled fan or other appliance.
  • Detecting the presence of people or animals based on heat signatures.

Hardware/Components

  • Arduino Uno (or compatible board)
  • MLX90614 Infrared Temperature Sensor
  • Jumper wires
  • USB cable

Wiring Guide

The MLX90614 sensor communicates with the Arduino using the I2C protocol. (in video at 07:00)

%%WIRING%%

Code Explanation

The provided Arduino code utilizes the Adafruit MLX90614 library. (in video at 08:04) This library simplifies interaction with the sensor. The code includes two key functions, printTemp() and getTemp(), designed for easy temperature retrieval and display.

Key configurable elements within the code:


char *typeName[]={"Object","Ambient"};

This array defines the labels used when printing temperatures. You can customize these labels as needed.


void printTemp(char type)

This function prints the temperature reading to the Serial Monitor. The type parameter specifies the temperature unit and source (object or ambient). The following characters are used for different readings: (in video at 10:28)

  • 'C': Object temperature in Celsius
  • 'D': Ambient temperature in Celsius
  • 'F': Object temperature in Fahrenheit
  • 'G': Ambient temperature in Fahrenheit
  • 'K': Object temperature in Kelvin
  • 'L': Ambient temperature in Kelvin


float getTemp(char type)

This function returns the temperature value as a float. It uses the same type characters as printTemp(). This function is useful for using the temperature readings in calculations or displaying them on other devices. (in video at 11:36)

Example usage of the getTemp() function:


if( getTemp('C')>40)
{
  //do something here, e.g., activate a fan
}

Live Project/Demonstration

The video demonstrates the project using an Arduino Uno and an MLX90614 sensor. (in video at 14:06) The demonstration shows the effect of distance on readings and how to take measurements from various objects, including a heater. (in video at 18:08)

Chapters

  • [00:00] Introduction and Project Overview
  • [00:46] Hardware Overview
  • [06:53] Wiring Instructions
  • [08:04] Code Explanation
  • [14:06] Project Demonstration
509-Lesson 38: Using the MLX90614 Infrared Temperature Sensor with an Arduino
اللغة: C++
تم النسخ!

الموارد والمراجع

ملفات📁

لا توجد ملفات متاحة.