Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

ESP32-Based Infrared Thermometer with I2C LCD Display

View and Edit Project In Cirkit DesignerImage of ESP32-Based Infrared Thermometer with I2C LCD Display

Circuit Documentation

Summary

The circuit in question is designed to measure and display temperature readings using an infrared temperature sensor and an I2C LCD screen. The core of the circuit is an ESP32 microcontroller, which interfaces with an MLX90614 infrared temperature sensor and a 16x2 I2C LCD screen to display ambient and object temperatures. The circuit is powered by a 18650 Li-Ion battery, which is charged through a TP4056 charging module connected to a USB plug. The ESP32 also manages the I2C communication between the sensor and the LCD.

Component List

ESP32 (30 pin)

MLX90614

18650 Li-Ion Battery

I2C LCD 16x2 Screen

TP4056

USB Plug

Wiring Details

ESP32 (30 pin)

MLX90614

18650 Li-Ion Battery

I2C LCD 16x2 Screen

TP4056

USB Plug

Documented Code

Code for ESP32 (30 pin)

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Adafruit_MLX90614.h>

// Create an instance of the LCD and MLX90614
LiquidCrystal_I2C lcd(0x27, 16, 2);  // Change 0x27 to your LCD's I2C address if necessary
Adafruit_MLX90614 mlx = Adafruit_MLX90614();

void setup() {
  // Initialize I2C
  Wire.begin();
  
  // Initialize the LCD
  lcd.begin();
  lcd.backlight(); // Turn on the backlight
  
  // Initialize the MLX90614
  if (!mlx.begin()) {
    lcd.print("MLX90614 Error");
    while (1); // Stop the program if the sensor is not found
  }
  
  // Welcome message
  lcd.setCursor(0, 0);
  lcd.print("Infrared Temp");
}

void loop() {
  // Read temperatures
  float ambientTemp = mlx.readAmbientTempC();  // Get ambient temperature in Celsius
  float objectTemp = mlx.readObjectTempC();    // Get object temperature in Celsius
  
  // Display on LCD
  lcd.setCursor(0, 1);  // Move cursor to the second line
  lcd.print("Amb: ");
  lcd.print(ambientTemp);
  lcd.print((char)223); // Degree symbol
  lcd.print("C Obj: ");
  lcd.print(objectTemp);
  lcd.print((char)223); // Degree symbol
  lcd.print("C");
  
  // Wait for a bit before the next reading
  delay(1000); // 1-second delay
}

This code is responsible for initializing the I2C communication, setting up the LCD and MLX90614 sensor, and continuously reading and displaying the temperature data on the LCD. The ambient and object temperatures are displayed with a 1-second delay between updates.