Kmeter Unit

Kmeter Unit 是一款带 I2C 通信接口的 K 型热电偶传感器。硬件采用 ESP32-C3 主控 + MAX31855KASA+T 14bit 热电偶数字转换芯片。该转换芯片支持测量范围为 -200°C 至 1350°C 的热电偶探头。

支持的产品:

Kmeter Unit

MicroPython 应用示例

import os, sys, io
import M5
from M5 import *
from hardware import *
from unit import KMeterUnit
import time


i2c0 = I2C(0, scl=Pin(1), sda=Pin(2), freq=100000)
kmeter_0 = KMeterUnit(i2c0, 0x66)
print(kmeter_0.get_firmware_version())
while True:
    print(kmeter_0.get_thermocouple_temperature(kmeter_0.CELSIUS))
    print(kmeter_0.get_internal_temperature(kmeter_0.CELSIUS))
    time.sleep_ms(250)

UiFlow2 应用示例:

example.png

cores3_kmeter_example.m5f2

class KmeterUnit

“”

class KmeterUnit(i2c, address)
参数:
  • i2c (object) – I2C 对象。

  • address (int) – 0x08 ~ 0x77。

UIFLOW2:

init.png

Methods

KmeterUnit.get_thermocouple_temperature(scale) float

获取 Kmeter Unit 中热电偶的温度。返回一个 float 值。

参数:

scale (bool) – 接受 KmeterUnit.CELSIUSKmeterUnit.FAHRENHEIT 的值。

UIFLOW2:

get_thermocouple_temperature.png

KmeterUnit.get_internal_temperature(scale) float

获取 Kmeter Unit 的内部温度。返回一个 float 值。

参数:

scale (bool) – 接受 KmeterUnit.CELSIUSKmeterUnit.FAHRENHEIT 的值。

UIFLOW2:

get_internal_temperature.png

KmeterUnit.get_sleep_time() int

获取以秒为单位的睡眠时间。返回一个 int 值。

  • 返回:int:0 ~ 65535。

UIFLOW2:

get_sleep_time.png

KmeterUnit.get_firmware_version() float

获取 Kmeter Unit 的固件版本。返回一个整数版本号。

  • 返回:float

UIFLOW2:

get_firmware_version.png

KmeterUnit.get_i2c_address() int

获取该设备的 i2c 地址,地址应在 0x08 到 0x77 之间。

  • 返回:int:0x08 ~ 0x77。

UIFLOW2:

get_i2c_address.png

KmeterUnit.set_sleep_time(sleep) None

设置睡眠时间,单位为秒。

参数:

sleep (int) – 0 ~ 65535

UIFLOW2:

set_sleep_time.png

KmeterUnit.set_wakeup_trigger(mode) str

设置唤醒触发模式为定时器或 I2C SCL 低电平。

参数:

mode (bool) – timer(True) 或 i2c scl 低电平 (False)

UIFLOW2:

set_wakeup_trigger.png

KmeterUnit.set_i2c_address(address) int

i2c 地址可由用户修改,且该地址应在 0x08 到 0x77 之间。

参数:

address (int) – 0x08 ~ 0x77

UIFLOW2:

set_i2c_address.png

Constants

KmeterUnit.CELSIUS: bool

摄氏温标。

KmeterUnit.FAHRENHEIT: bool

华氏温标。