#12018
An Application Tutorial of FireBeetle ESP32
Make an Temperature Measurement Gun
with Noncontact IR Temperature Sensor MLX90614


What a hot day it is! Too hot to drive and ride and I am thinking of making a temperature measurement sensor. With FireBeetle ESP32 produced by DFRobot and MLX90614 (a noncontact IR temperature sensor) on hand, let’s do it!
Image
Image

Make an Infrared Thermometer Gun using FireBeetle EPS32-YouTube

Hardware &software in need
FireBeetle ESP32, the new master board produced by DFRobot, smaller than traditional Arduino Uno, with build-in power port and charging circuit, it is ideally suitable for making low-power-consumption devices.
MLX90614, compared to traditional LM35, DS18B20 temperature sensors, it is a noncontact IR temperature sensor uses infrared radiation to measure the temperature and does not require direct touch. With IIC interface, it is very convenient to contact to master board.
Gravity IIC OLED-2864 display, a very beautiful self-luminous display module with a blue background. The display bezel is constructed form aluminum alloy that protects the screen from scratches and damage.
uPyCraft MicroPython IDE, programing with python and decreases development difficulty.
Image
Hardware in need

Hardware List
FireBeetle ESP32 IOT Microcontroller (Supports Wi-Fi & Bluetooth) ×1
Gravity: Non-contact IR Temperature Sensor for Arduino ×1
Gravity I2C OLED-2864 Display ×1
3.7V 400mAh Lithium battery ×1
Red laser transmitter (diameter: 6mm) ×1
C&K slide switch ×1
3D printing crust set (2 parts) ×1

Tools
Thermo-control Anti-Static Soldering Station AT936b
Overlord Pro 3D printer
401 glue
Hot melt gun

Software list
MLX90614.py (library file of MLX90614 noncontact IR temperature sensor)
SSD1306.py (library file of Gravity IIC OLED-2864 display)
piclib.py (library file of show pictures and 16*24 script used in the project)
InfraRedThermometer.py (source files of project codes)
uPyCraft MicroPython IDE
PCtoLCD2002 LCD impression taking software
3D printing slice software: Cura
3D printing file: 3D print - left part.stl (available for direct printing of Overload Pro 3D printer)
3D printing file: 3D print - right part.stl

Operating process
1. Solder components as below:
Image
Connection diagram

2. Transform show pictures and 16*24 script in use to hexadecimal code with PCtoLCD2002 LCD impression taking software
Image

Image
Setting and take impression as below:

3. Programing with uPyCraft MicroPython IDE and burn codes to FireBeetle ESP32.
Image
Check after codes burnt.
Code: Select all
import MLX90614
from machine import Pin,I2C
import time
import ssd1306
from piclib import *
# This code will show you how to make a Infra Red Thermometer using the MLX90614 sensor.
 
 
i2c = I2C(scl=Pin(22), sda=Pin(21), freq=100000)
ir=MLX90614.MLX90614(i2c)
lcd=ssd1306.SSD1306_I2C(128,64,i2c)
 
#Display a picture 72*64 
def DisplayPicture(x,y,picture):
  for line in range(0,64):
    for bytes in range(0,9):
      for bits in range(0,8):
        if picture[9*line+bytes]&0x80>>bits:
          lcd.pixel(x+bytes*8+bits,y+line,1)
        else:
          lcd.pixel(x+bytes*8+bits,y+line,0)
  return
 
#Display a character 16*24 
def DisplayCharacter16X24(x,y,character):
  for line in range(0,24):
    for bytes in range(0,2):
      for bits in range(0,8):
        if character[line*2+bytes]&0x80>>bits:
          lcd.pixel(x+bytes*8+bits,y+line,1)
        else:
          lcd.pixel(x+bytes*8+bits,y+line,0)
  return
 
#---------------------run here------------------------------------  
#display logo
DisplayPicture(28,0,picture) 
lcd.show()
time.sleep(1)
lcd.fill(0)
 
#display O:123.4C
#        A:123.4C 
DisplayCharacter16X24(0,0,charArray[10]) #O
DisplayCharacter16X24(16*1,0,charArray[12]) #:
DisplayCharacter16X24(16*7,0,charArray[13]) #C
 
DisplayCharacter16X24(0,24,charArray[11]) #A
DisplayCharacter16X24(16*1,24,charArray[12]) #:
DisplayCharacter16X24(16*7,24,charArray[13]) #C
lcd.show()
 
 
while True:
  time.sleep(0.2)
  Object = ir.getObjCelsius() #  *C
  Ambient = ir.getEnvCelsius() # *C
  #Object = ir.getObjFahrenheit() # *F
  #Ambient = ir.getEnvFahrenheit() # *F
  #print("Object  %s *C"% Object)
  #print("Ambient %s *C"% Ambient)
  #print()
  ObjectInt = int(Object*10)
  AmbientInt = int(Ambient*10)
  if ObjectInt < 0:
    ObjectInt = abs(ObjectInt)
    DisplayCharacter16X24(16*2,0,charArray[15])# -
    temp1 = (ObjectInt%1000)//100
    if(temp1 == 0):
      DisplayCharacter16X24(16*3,0,charArray[16]) # space
    else:
      DisplayCharacter16X24(16*3,0,charArray[temp1])
    DisplayCharacter16X24(16*4,0,charArray[(ObjectInt%100)//10])
    DisplayCharacter16X24(16*5,0,charArray[14]) # .
    DisplayCharacter16X24(16*6,0,charArray[ObjectInt%10]) 
    
  else:
    temp1 = ObjectInt//1000
    temp2 = (ObjectInt%1000)//100
    if temp1 == 0:
      DisplayCharacter16X24(16*2,0,charArray[16]) # space
    else:
      DisplayCharacter16X24(16*2,0,charArray[temp1])
    if temp1 == 0 and temp2 == 0:
      DisplayCharacter16X24(16*3,0,charArray[16]) # space
    else:
      DisplayCharacter16X24(16*3,0,charArray[temp2])
    DisplayCharacter16X24(16*4,0,charArray[(ObjectInt%100)//10])
    DisplayCharacter16X24(16*5,0,charArray[14]) # .
    DisplayCharacter16X24(16*6,0,charArray[ObjectInt%10]) 
  
  if AmbientInt < 0:
    ObjectInt = abs(AmbientInt)
    DisplayCharacter16X24(16*2,24,charArray[15])# -
    temp1 = (AmbientInt%1000)//100
    if temp1 == 0:
      DisplayCharacter16X24(16*3,24,charArray[16]) # space
    else:
      DisplayCharacter16X24(16*3,24,charArray[temp1])
    DisplayCharacter16X24(16*4,24,charArray[(AmbientInt%100)//10])
    DisplayCharacter16X24(16*5,24,charArray[14]) # .
    DisplayCharacter16X24(16*6,24,charArray[AmbientInt%10]) 
    
  else:
    temp1 = AmbientInt//1000
    temp2 = (AmbientInt%1000)//100
    if temp1 == 0:
      DisplayCharacter16X24(16*2,24,charArray[16]) # space
    else:
      DisplayCharacter16X24(16*2,24,charArray[temp1])
    if temp1 == 0 and temp2 == 0:
      DisplayCharacter16X24(16*3,24,charArray[16]) # space
    else:
      DisplayCharacter16X24(16*3,24,charArray[temp2])
    DisplayCharacter16X24(16*4,24,charArray[(AmbientInt%100)//10])
    DisplayCharacter16X24(16*5,24,charArray[14]) # .
    DisplayCharacter16X24(16*6,24,charArray[AmbientInt%10])  
  lcd.show()
4. Designing crusts according to dimension of components.
Image

Image
5. Use Cura (a 3D printing slice software) to make 3D printing files.
Image

6. Print crusts with Overload Pro 3D printer.
Image

Image
7. Allocate components to inner part of printed crusts with hot melt and glue.
Image

Image
8. Temperature measurement
Image
Measure temperature of palm

Image
Measure temperature of mobike saddle
Image
Measure temperature of freezer

Related documents
MLX90614.py (library file of MLX90614 noncontact IR temperature sensor)
SSD1306.py (library file of Gravity IIC OLED-2864 display)
piclib.py (library file of show pictures and 16*24 script used in the project)
InfraRedThermometer.py (source files of project codes)
uPyCraft MicroPython IDE (download link)
PCtoLCD2002 LCD impression taking software
3D printing slice software: Cura
3D printing file: 3D print - left part.stl (available for direct printing of Overload Pro 3D printer)
3D printing file: 3D print - right part.stl

Now, we have accomplished the procedure of practical noncontact temperature measurement gun. You can modify this program according to effective demands. For example, you can upload results to Internet of Things or cellphones with Wi-Fi and BLE Bluetooth in FireBeetle ESP32. I am always cannot recollect whether I have turned off gas cooker when I got out, so a noncontact temperature measurement gun that can upload data to IoT or phone is very helps me a lot.
Attachments
(4.46 MiB) Downloaded 257 times
#29402
Related documents
MLX90614.py (library file of MLX90614 noncontact IR temperature sensor)
SSD1306.py (library file of Gravity IIC OLED-2864 display)
piclib.py (library file of show pictures and 16*24 script used in the project)
InfraRedThermometer.py (source files of project codes)
uPyCraft MicroPython IDE (download link: https://essaytyper.pro)
PCtoLCD2002 LCD impression taking software
3D printing slice software: Cura
3D printing file: 3D print - left part.stl (available for direct printing of Overload Pro 3D printer)
3D printing file: 3D print - right part.stl

Now, we have accomplished the procedure of practical noncontact temperature measurement gun. You can modify this program according to effective demands.
Thanks! I try to upload results to Internet of Things with Wi-Fi as soon as possible. Now phone is even more helpful.