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!
Hardware List
- 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
- 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)
- 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
1. Solder components as below:
2. Transform show pictures and 16*24 script in use to hexadecimal code with PCtoLCD2002 LCD impression taking software
3. Programing with uPyCraft MicroPython IDE and burn codes to FireBeetle ESP32.
Check after codes burnt.
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.
5. Use Cura (a 3D printing slice software) to make 3D printing files.
6. Print crusts with Overload Pro 3D printer.
7. Allocate components to inner part of printed crusts with hot melt and glue.
8. Temperature measurement
Measure temperature of mobile saddle:
Comments