tMTH-4 - Temperature and humidity meter with Modbus interface

tMTH-4 is a temperature and humidity measurement module with Modbus RTU interface. It features four independent I2C buses, dedicated for connecting AHT20/AM2301B temperature and humidity sensors, allowing for a total of 4 sensors.
Temperature and humidity data is made available via Modbus registers.

The tMTH-4 is primarily designed to function as an extension module for LK4 or LK3.5+ devices (also compatible with LK3.9), enabling scalable and distributed temperature and humidity monitoring.
A ready-to-use configuration file for these devices is available, allowing for quick and hassle-free integration.

Basic features

Technical specifications

Parameter Value
Power supply 5-12 V DC (connector)
5 V (USB)
Sensor support Up to 4 × AHT20/AM2301B sensors
Interfaces I2C: 4 buses via RJ12 connectors,
Modbus RTU (RS485),
Serial (over USB; 115200 baud)
Dimensions 74 × 40 × 30 mm (without DIN handle)
Weight 50 g

Default setup

Out of the box, the tMTH-4 is pre-configured with:

These defaults suit most standard installations. However, if you need to change the Modbus address see section below or if you need to change other settings, refer to the Advanced Configuration section.

Quick Modbus address configuration

If you need to change the Modbus address, you can do so using the built-in function button and the LED located on the PCB. The button is placed near the edge of the board opposite the side with the USB port and the Modbus and power supply connectors.

To read the current address:

  1. Click the button once.
  2. The LED will blink to indicate the address.
    (For example, 2 blinks = address 2.)

To set a new address:

  1. Press and hold the button.
  2. After 2 seconds, the LED will blink once.
  3. Continue holding — the LED will blink once per second up to 5 times.
  4. Release the button after the number of blinks that corresponds to your desired address.
    (For example, for address 3, release after the third blink.)

⚠️ If you hold the button for more than 7 seconds, the process is canceled and no changes are made.

For additional configuration options, see the Advanced Configuration section.

Integration with LK

The tMTH-4 integrates seamlessly with LK4 and LK3.5+ devices. It can be powered directly from the LK controller using its 5 V and GND outputs. Then, connect it—either alone or together with other Modbus devices—to the LK’s Modbus A+ and B− terminals to establish communication.

Once connected, configure a custom Modbus module on the LK using the ready-to-use configuration preset available in the Downloads section. You can easily modify this preset to read only the parameters you need, such as selected temperature and humidity sensors.

Firmware update

To update the firmware, the device must be placed into bootloader mode. In this mode, the device appears as a mass storage device named RPI-RP2 when connected to a PC. Simply copy the new firmware file to that storage. After the upload, the device will automatically restart and resume normal operation with the new firmware.

Enabling bootloader mode

You can enable bootloader mode in one of two ways:

Firmware files are available in the Downloads section.

Advanced configuration

To modify the settings, you will need to connect the tMTH-4 to a computer via USB. The device can be powered through USB, so no additional power connections are necessary.

Required software

To establish a connection with the board, you’ll need an application that can handle serial communication. Popular choices include:

Example Configuration Process

  1. List Available Ports
    Run pyserial-ports to list the available COM ports before connecting the device. The output might look like:

    COM1
    COM3
    COM15
    COM16
    COM17
  2. Connect the Device
    Plug in the tMTH-4 and run the command again. The new COM port (e.g., COM11) will represent the connected device.

  3. Connect to tMTH-4
    Use the following connection parameters:

    • Baud rate: 115200
    • Byte size: 8 bits
    • Parity: None
    • Stop bits: 1

    Example command:

    pyserial-miniterm COM11 115200
  4. Send Commands
    Once connected, you can issue commands to the device. Each command must be followed by the Enter key. A useful command is ? or help, which provides a list of all available commands (described below).

Command list

Command Description
address? | a? Get the Modbus address (Slave ID).
address=X | a=X Set the Modbus address. Parameters: X - address to set, number <1, 255>.
frequency? | f? Get the I2C bus frequency (for all interfaces), value in Hz.
frequency=X | f=X Set the I2C bus frequency in Hz. Parameters: X - frequency to set, number <10_000, 400_000>.
read_sensors | rs Read the sensors readings.
init_sensors | is Detect and initialize the sensors.
save_config | sc Save configuration to Flash memory. It should be called after changing the Modbus address.
read_registers | rr Read Modbus register values.
read_definitions | rd Read Modbus register definitions (name, address, type).
bootloader Reboot the device into bootloader mode to update the firmware. When connected to a computer, it will appear as a storage device named RPI-RP2, to which you should copy the firmware file with the extension uf2. Then the device will reboot into normal operation mode.
restart Restart the device.
verbose=X | v=X Turn on or off verbose mode, which displays more messages.
help | ? Display this help message with a list of available commands.

Common use cases

Some commands are useful only in specific situations.

Modbus addressing
When using multiple tMTH-4 devices on one Modbus bus or together with another device that has the same address, it is recommended to change the address using the command address=X so that each device has a unique one.

Detecting connected sensors
Sensors are detected and initialized when the device is started. To initialize sensors connected later, use the init_sensors command.

Saving changes
After changing settings using the commands address=X or frequency=X, you must use save_config to store the configuration in permanent memory. Otherwise, the changes will be lost after a power loss or device restart.

Modbus registers

Below is the list of Modbus registers available in the device.
The content corresponds to the output of the read_definitions command and includes register names, addresses, types, and divisors.

| Name                           | Addr | Type   | Func         | Divisor |
| ------------------------------ | ---- | ------ | ------------ | ------- |
| uptime                         | 3000 | uint32 | 0x04 (IREG)  |         |
| temperature1                   | 3002 | int32  | 0x04 (IREG)  |      10 |
| humidity1                      | 3004 | int32  | 0x04 (IREG)  |      10 |
| temperature2                   | 3006 | int32  | 0x04 (IREG)  |      10 |
| humidity2                      | 3008 | int32  | 0x04 (IREG)  |      10 |
| temperature3                   | 3010 | int32  | 0x04 (IREG)  |      10 |
| humidity3                      | 3012 | int32  | 0x04 (IREG)  |      10 |
| temperature4                   | 3014 | int32  | 0x04 (IREG)  |      10 |
| humidity4                      | 3016 | int32  | 0x04 (IREG)  |      10 |
| version_major                  | 3100 | uint16 | 0x04 (IREG)  |         |
| version_minor                  | 3101 | uint16 | 0x04 (IREG)  |         |
| version_patch                  | 3102 | uint16 | 0x04 (IREG)  |         |
| address                        | 4000 | uint16 | 0x03 (HREG)  |         |
| frequency                      | 4001 | uint32 | 0x03 (HREG)  |         |