【一、准备材料】FireBeetle ESP32主板——1只MLX90614非接触式红外测温传感器——1只Gravity IIC OLED-2864 显示屏——1只3.7V 400mAh锂电池——1只6mm直径红光激光发射器——1只C&K滑动开关——1只3D打印外壳上盖和下盖——1套【二、制作步骤】▼1.如上图所示焊接好各个部件▼2.使用PCtoLCD2002液晶取模软件将需要用到的图片和16X24字体转换为16进制代码,按照上图模式来进行设置和取模▼3.使用uPyCraft MicroPython IDE 进行编程,烧写代码到FireBeetleESP32主板上,并测试程序是否可以工作代码如下:import MLX90614from machine import Pin,I2Cimport timeimport ssd1306from 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 7264def DisplayPicture(x,y,picture):for line in range(0,64):for bytes in range(0,9):for bits in range(0,8):if picture[9line+bytes]&0x80>>bits:lcd.pixel(x+bytes8+bits,y+line,1)else:lcd.pixel(x+bytes8+bits,y+line,0)return#Display a character 1624def DisplayCharacter16X24(x,y,character):for line in range(0,24):for bytes in range(0,2):for bits in range(0,8):if character[line2+bytes]&0x80>>bits:lcd.pixel(x+bytes8+bits,y+line,1)else:lcd.pixel(x+bytes8+bits,y+line,0)return#---------------------run here------------------------------------#display logoDisplayPicture(28,0,picture)lcd.show()time.sleep(1)lcd.fill(0)#display O:123.4C#A:123.4CDisplayCharacter16X24(0,0,charArray[10]) #ODisplayCharacter16X24(161,0,charArray[12]) #:DisplayCharacter16X24(167,0,charArray[13]) #CDisplayCharacter16X24(0,24,charArray[11]) #ADisplayCharacter16X24(161,24,charArray[12]) #:DisplayCharacter16X24(167,24,charArray[13]) #Clcd.show()while True:time.sleep(0.2)Object = ir.getObjCelsius() # CAmbient = ir.getEnvCelsius() # C#Object = ir.getObjFahrenheit() # F#Ambient = ir.getEnvFahrenheit() # F#print("Object %s C"% Object)#print("Ambient %s C"% Ambient)#print()ObjectInt = int(Object10)AmbientInt = int(Ambient10)if ObjectInt < 0:ObjectInt = abs(ObjectInt)DisplayCharacter16X24(162,0,charArray[15])# -temp1 = (ObjectInt%1000)//100if(temp1 == 0):DisplayCharacter16X24(163,0,charArray[16]) # spaceelse:DisplayCharacter16X24(163,0,charArray[temp1])DisplayCharacter16X24(164,0,charArray[(ObjectInt%100)//10])DisplayCharacter16X24(165,0,charArray[14]) # .DisplayCharacter16X24(166,0,charArray[ObjectInt%10])else:temp1 = ObjectInt//1000temp2 = (ObjectInt%1000)//100if temp1 == 0:DisplayCharacter16X24(162,0,charArray[16]) # spaceelse:DisplayCharacter16X24(162,0,charArray[temp1])if temp1 == 0 and temp2 == 0:DisplayCharacter16X24(163,0,charArray[16]) # spaceelse:DisplayCharacter16X24(163,0,charArray[temp2])DisplayCharacter16X24(164,0,charArray[(ObjectInt%100)//10])DisplayCharacter16X24(165,0,charArray[14]) # .DisplayCharacter16X24(166,0,charArray[ObjectInt%10])if AmbientInt < 0:ObjectInt = abs(AmbientInt)DisplayCharacter16X24(162,24,charArray[15])# -temp1 = (AmbientInt%1000)//100if temp1 == 0:DisplayCharacter16X24(163,24,charArray[16]) # spaceelse:DisplayCharacter16X24(163,24,charArray[temp1])DisplayCharacter16X24(164,24,charArray[(AmbientInt%100)//10])DisplayCharacter16X24(165,24,charArray[14]) #.DisplayCharacter16X24(166,24,charArray[AmbientInt%10])else:temp1 = AmbientInt//1000temp2 = (AmbientInt%1000)//100if temp1 == 0:DisplayCharacter16X24(162,24,charArray[16]) # spaceelse:DisplayCharacter16X24(162,24,charArray[temp1])if temp1 == 0 and temp2 == 0:DisplayCharacter16X24(163,24,charArray[16]) # spaceelse:DisplayCharacter16X24(163,24,charArray[temp2])DisplayCharacter16X24(164,24,charArray[(AmbientInt%100)//10])DisplayCharacter16X24(165,24,charArray[14]) # .DisplayCharacter16X24(166,24,charArray[AmbientInt%10])lcd.show()▼4.根据部件尺寸设计外壳▼5.使用使用价值6999元的Overlord 3D打印机把测温枪的外壳打印出来▼6.使用热熔胶和胶水将部件安装到打印的外壳内大功告成
可以去人多的场合嘚瑟了
(图片来源网络,侵删)
0 评论