1

I'm currently in the middle of trying to decode the communication of an hydrometer. Thanks to a previous question made in this site I was able to find a PDF describing the communication of a different hydrometer from the same company. I suspect the type of communication is equal or similar for both products.

From what I understand I first need to define the response I want to have by sending a 10 bytes frame:

enter image description here

And then request a response with a 5 bytes frame:

enter image description here

By checking the appendix 1, I choose, for application reset byte, the value "0x00":

Application reset

But I don't know the meaning of the bytes:

  1. C-field
  2. Address
  3. Cl-field
  4. Checksum

Even without knowing the meaning of those fields, I tried defining and requesting a response, but I'm struggling to interpret the data, probably because I don't know the meaning of DIF and VIF columns:

enter image description here

Summing up, by any chance could I get an explanation of the fields:

  1. C-field
  2. Address
  3. CL-field
  4. checksum
  5. DIF
  6. VIF
2

A comment in your previous question pointed out that your hydrometer likely uses the M-Bus or Meter-Bus protocol, and your fields in question are all thoroughly explained in the documentation of said protocol (PDF)

The C-Field is the control field and defines what function is being performed (page 23 of the above PDF). It is an 8-bit value where the lowest 4 bits determine the type of transfer (e.g., long frame, data request, etc.) and the highest 4 bits serve as control flags for various operations.

The address determines which device you're talking to. The M-Bus protocol specifies a master/slave setup where one device can talk to many connected devices on the same local network. This is necessary because it's used in metering applications where a single controller might want to be able to query data from and send data to a large number of interconnected devices. In your case, the documentation uses an address of 0xFD or 253 which specifies that the address is handled on the network layer (which makes sense given you are communicating over Bluetooth).

The CI[sic] field is the "Control Information" field; it communicates which type of data is being transmitted (page 31 of the above PDF). The example you posted uses a CI of 0x50, which indicates an application reset. The following byte specifies the "type" of reset requested, with 0x00 representing a full application-layer reset. When reset, it appears that the device responds with its relevant parameters as specified in your posted image.

The checksum is used to verify the integrity of the transmitted or received data. These are fairly standard in serial communication protocols and generally straightforward to calculate. Calculating the M-Bus checksum requires adding up the raw values of the fields in the frame starting from the C-field and ending after the transmitted data (though this depends on the type and length of the frame, so for short frames, some fields may not be relevant). This calculation, as well as code to calculate it, are easily found with a cursory search.

DIF and VIF stand for Data Information Field and Value Information Field. The DIF tells you what type of data you got (so from the Diehl PDF you posted, 0xC corresponds to volume, 0xB to flow rate, etc.) The VIF gives units and multiplier so that you can tell what units the specific parameters are in (e.g., liters, m3, etc.)

I suggest that you take a look at that PDF, as it is very thorough in explaining the protocol and comes directly from the source of the protocol itself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.