Kmeter Unit

The Kmeter Unit is a K-type thermocouple sensor with I2C communication interface. The hardware adopts ESP32-C3 main control + MAX31855KASA+T 14bit thermocouple digital conversion chip. The conversion chip supports thermocouple probes with a measuring range of -200°C to 1350°C.

Supported Products:

Kmeter Unit

Micropython Example:

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:

example.png

cores3_kmeter_example.m5f2

class KmeterUnit

Constructors

class KmeterUnit(i2c, address)
Parameters:
  • i2c (object) – the I2C object.

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

UIFLOW2:

init.png

Methods

KmeterUnit.get_thermocouple_temperature(scale) float

Get the temperature of the thermocouple in the Kmeter Unit. Returns a float value.

Parameters:

scale (bool) – accepts values of KmeterUnit.CELSIUS or KmeterUnit.FAHRENHEIT.

UIFLOW2:

get_thermocouple_temperature.png

KmeterUnit.get_internal_temperature(scale) float

Get the internal temperature of the Kmeter Unit. Returns a float value.

Parameters:

scale (bool) – accepts values of KmeterUnit.CELSIUS or KmeterUnit.FAHRENHEIT.

UIFLOW2:

get_internal_temperature.png

KmeterUnit.get_sleep_time() int

Get the sleep time in seconds. Returns a int value.

  • Return: int: 0 ~ 65535.

UIFLOW2:

get_sleep_time.png

KmeterUnit.get_firmware_version() float

Get the firmware version of the Kmeter Unit. Returns an integer version number.

  • Return: float

UIFLOW2:

get_firmware_version.png

KmeterUnit.get_i2c_address() int

Get the i2c address of this device should be between 0x08 and 0x77.

  • Return: int: 0x08 ~ 0x77.

UIFLOW2:

get_i2c_address.png

KmeterUnit.set_sleep_time(sleep) None

Set the sleep time in seconds.

Parameters:

sleep (int) – 0 ~ 65535

UIFLOW2:

set_sleep_time.png

KmeterUnit.set_wakeup_trigger(mode) str

set wakeup trigger mode in timer or i2c scl low level.

Parameters:

mode (bool) – timer(True) or i2c scl low(False)

UIFLOW2:

set_wakeup_trigger.png

KmeterUnit.set_i2c_address(address) int

Set the i2c address can be changed by the user and this address should be between 0x08 and 0x77.

Parameters:

address (int) – 0x08 ~ 0x77

UIFLOW2:

set_i2c_address.png

Constants

KmeterUnit.CELSIUS: bool

Celsius scale.

KmeterUnit.FAHRENHEIT: bool

Fahrenheit scale.