tMEM - Energy monitor with Modbus interface

tMEM is a single-phase, bidirectional energy monitor with Modbus RTU interface.

Connecting this device to the LK4 provides a modern solution for remote electricity monitoring and setting events to optimize energy consumption in commercial, industrial, and residential buildings. Thanks to bidirectional measurement, the meter is also compatible with photovoltaic installations.

The device is sold with a 100A/50mA CT (current transformer) with which it is calibrated to work.

Basic features

Technical specifications

Parameter Value
Power supply 5 - 12 V DC (connector)
5 V (USB)
Rated AC input voltage 230 V
AC current measurement range 0 - 100 A
Power measurement deadband 3 - 4 W
Interfaces Modbus RTU (RS485),
Serial (over USB; 115200 baud)
Dimensions 74 × 40 × 25 mm (without DIN handle)
Weight 49 g

tMEM is an energy monitor designed for measurement and automation applications in electrical installations. The device does not have MIB certification, which is required for energy meters intended for billing purposes. Therefore, it cannot be used for billing purposes.

Default setup

Out of the box, the tMEM 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 tMEM 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 voltage, current, power or energy values.

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 tMEM 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 tMEM and run the command again. The new COM port (e.g., COM11) will represent the connected device.

  3. Connect to tMEM
    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>.
ratio_X? Get conversion ratio for sensor. Parameters: X - string ‘Voltage’, ‘Current’ or ‘Power’.
ratio_X=Y Set conversion ratio for sensor. Parameters: X - string ‘Voltage’, ‘Current’ or ‘Power’, Y - float.
read_sensor Read the sensors readings.
reset_energy Reset energy status.
set_energy=X,Y Set energy status. Parameters: X - value of positive energy (float), Y - value of reverse energy (float).
save_config | sc Save configuration to Flash memory. It should be called after changing the Modbus address and conversion ratios.
read_registers | rr Read Modbus register values.
read_definitions | rd Read Modbus register definitions (name, address, type).
auto_save? | as? Get the value of the auto-save function. This is the interval in seconds at which the counters are saved.
auto_save=X | as=X Set the value of the auto-save function. Parameters: X - value in seconds, number <0, 65_535>, for 0 the function is disabled.
read_status | rs Read the saved status.
write_status | ws Write the status to Flash memory.
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 tMEM 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.

Automatic saving If it is necessary to preserve the energy status in case of a power failure, the command auto_save=X should be used. This causes the energy status to be periodically saved to permanent memory.
Be mindful of flash memory wear, as it has a limited number of write cycles (rated for about 100k). Therefore, when using this feature, the interval should be chosen as a reasonable compromise. For example, the default value of 600 seconds should allow for about 2 years of operation. The devices use a wear-leveling file system, which significantly increases the expected number of writes (our test device has already performed over 440k writes without errors).

Resetting and setting energy status
Useful when replacing the energy monitor or changing the installation location. For example set_energy=123.123,0.345 will set positive energy status to 123.123 kWh and reverse energy to 0.345 kWh.

Saving changes
After changing settings using the commands address=X, ratio_X=Y, auto_save=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)  |         |
| Voltage                        | 3002 | int32  | 0x04 (IREG)  |      10 |
| Current                        | 3004 | int32  | 0x04 (IREG)  |    1000 |
| Power                          | 3006 | int32  | 0x04 (IREG)  |      10 |
| Frequency                      | 3008 | int32  | 0x04 (IREG)  |    1000 |
| PositiveEnergy                 | 3010 | int32  | 0x04 (IREG)  |    1000 |
| ReverseEnergy                  | 3012 | int32  | 0x04 (IREG)  |    1000 |
| V_RMS                          | 3014 | int32  | 0x04 (IREG)  |       1 |
| I_RMS                          | 3016 | int32  | 0x04 (IREG)  |       1 |
| I_FAST_RMS                     | 3018 | int32  | 0x04 (IREG)  |       1 |
| WATT                           | 3020 | int32  | 0x04 (IREG)  |       1 |
| CF_CNT                         | 3022 | int32  | 0x04 (IREG)  |       1 |
| FREQ                           | 3024 | int32  | 0x04 (IREG)  |       1 |
| version_major                  | 3100 | uint16 | 0x04 (IREG)  |         |
| version_minor                  | 3101 | uint16 | 0x04 (IREG)  |         |
| version_patch                  | 3102 | uint16 | 0x04 (IREG)  |         |
| address                        | 4000 | uint16 | 0x03 (HREG)  |         |
| auto_save                      | 4006 | uint16 | 0x03 (HREG)  |         |