This RUST project can read and write a SDM72 energy meter from the command line.
The following hardware is required for this project:
- One or more SDM72 energy meter.
- One USB-RS485 converter.
- maximum 100 Ampere
- Two wire types: 3 phase with 4 wire or 1 phase with 2 wire
- RS485 Modbus RTU output
- Pulse Output
- Bi-directional measurement (import & export)
- Install Rust e.g. using these instructions.
- Ensure that you have a C compiler and linker.
- Clone
git clone https://github.com/acpiccolo/SDM72-Powermeter.git
- Run
cargo install --path .
to install the binary. Alternatively, check out the repository and runcargo build --release
. This will compile the binary totarget/release/sdm72
.
To see all available commands:
sdm72 --help
For RTU Modbus connected sdm72 energy meter:
sdm72 rtu --address 1 --baudrate 9600 read-all
For TCP Modbus connected sdm72 energy meter:
sdm72 tcp 192.168.0.222:502 read-all
You can even use this tool as a daemon for a MQTT broker, the connection is configured via the mqtt_config.yml
file:
sdm72 rtu --address 1 --baudrate 9600 daemon mqtt
Feature | Purpose | Default |
---|---|---|
tokio-rtu-sync |
Enable the implementation for the tokio modbus synchronous RTU client | ✅ |
tokio-rtu |
Enable the implementation for the tokio modbus asynchronous RTU client | ✅ |
tokio-tcp-sync |
Enable the implementation for the tokio modbus synchronous TCP client | - |
tokio-tcp |
Enable the implementation for the tokio modbus asynchronous TCP client | - |
bin-dependencies |
Enable all features required by the binary | ✅ |
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.