Community
OpenEnergyMonitor

Community

MBUS Meter Reader, Sontex 531 Heat Meter

mbus
Tags: #<Tag:0x00007f16a6840760>

(Trystan Lea) #1

A quick note for those interested in heat metering and mbus, I’ve managed to read from the Sontex 531 Heat Meter via mbus using the heatpump monitor board.

Using the main heatpump monitor firmware: HeatpumpMonitor_AutoTemp, reading from the sontex 531 can be enabled by changing the default Kamstrup_402:

#define MBUS_ENABLE 1
#define KAMSTRUP_402 // KAMSTRUP_403 or SONTEX_531, 

to:

#define MBUS_ENABLE 1
#define SONTEX_531

Using mbus its possible to access a lot of useful data from the Sontex meter, page1 provides cumulative kWh heat output, page3 provides:

  • Flow temperature C
  • Return temperature C
  • Heat Output W
  • Flow rate m3/h

I’ve also put together a more generic MBUS Reader tool, that can be used to:

  • Change the meter address
  • Change the meter baud rate
  • Read the meter data, (including a partial decode of data types and positions in the reply)
  • Select the page of data to read (sontex 531 has several pages of data).
  • Send Normalise and Application Reset commands

This is also available in the HeatpumpMonitor repository here:
https://github.com/openenergymonitor/HeatpumpMonitor/tree/master/Firmware/Arduino/MBUS_Reader


(Trystan Lea) #2

A quick example of what the MBUS_Reader tool can do. After uploading to the Heatpump Monitor or Arduino with the MBUS reader circuit, the following options should be presented:

Arduino MBUS reader
- a: set mbus address to 100
- n: normalize
- r: request data
- c: application reset
- i: set id 1234
- b: set baudrate 4800
- p: select page eg: p1

Setting the MBUS meter address
In the Arduino Serial Monitor enter character ‘a’ and press enter. If the meter receives the command it will reply with an acknowledgement (ACK). The MBUS address to set is hard coded in the MBUS_Reader firmware.

Command sent: set address 100
ACK

Normalise
Enter character ‘n’ and press enter. If the meter receives the command it will reply with an acknowledgement (ACK).

Command sent: normalize
ACK

Set page
Some MBUS meters store multiple pages of results, to access pages other than 1 enter character ‘p’ with the page number immediately appended e.g: ‘p2’ and press enter. If the meter receives the command it will reply with an acknowledgement (ACK).

Command sent: page
Page: 3
ACK

Request data

To read a frame of data from the MBUS meter, enter character ‘n’ and press enter. This is what the reply looks like from the third page of the Sontex 531 Heat Meter:

Command sent: request data
0	104	68	START
1	119	77	LEN
2	119	77	LEN
3	104	68	START
4	8	8	C FIELD
5	100	64	ADDRESS
6	114	72	CI FIELD
7	1	1	ID
8	2	2	ID
9	3	3	ID
10	4	4	ID
11	238	EE	MID
12	77	4D	MID
13	14	E	Gen
14	4	4	Media
15	128	80	Access
16	0	0	Access
17	0	0	Signature
18	0	0	Signature
19	5	5	DIF 4
20	91	5B	VIF Flow Temp C
21	128	80	DATA
22	24	18	DATA
23	191	BF	DATA
24	65	41	DATA
25	5	5	DIF 4
26	95	5F	VIF Return Temp C
27	0	0	DATA
28	103	67	DATA
29	194	C2	DATA
30	65	41	DATA
31	5	5	DIF 4
32	62	3E	VIF Volume Flow m3/h
33	0	0	DATA
34	0	0	DATA
35	0	0	DATA
36	0	0	DATA
37	5	5	DIF 4
38	43	2B	VIF Power W
39	0	0	DATA
40	0	0	DATA
41	0	0	DATA
42	0	0	DATA
43	1	1	DIF 1
44	255	FF	VIF 
45	7	7	VIFE
46	1	1	DATA
47	5	5	DIF 4
48	150	96	VIF 
49	40	28	VIFE
50	153	99	DATA
51	147	93	DATA
52	133	85	DATA
53	56	38	DATA
54	5	5	DIF 4
55	255	FF	VIF 
56	1	1	VIFE
57	0	0	DATA
58	0	0	DATA
59	0	0	DATA
60	0	0	DATA
61	5	5	DIF 4
62	255	FF	VIF 
63	2	2	VIFE
64	0	0	DATA
65	0	0	DATA
66	0	0	DATA
67	0	0	DATA
68	1	1	DIF 1
69	255	FF	VIF 
70	4	4	VIFE
71	1	1	DATA
72	1	1	DIF 1
73	253	FD	VIF 
74	15	F	VIFE
75	42	2A	DATA
76	2	2	DIF 2
77	253	FD	VIF 
78	13	D	VIFE
79	41	29	DATA
80	0	0	DATA
81	3	3	DIF 3
82	34	22	VIF Power 100 J/h
83	72	48	DATA
84	15	F	DATA
85	0	0	DATA
86	1	1	DIF 1
87	112	70	VIF Duration seconds
88	3	3	DATA
89	130	82	DIF 2
90	137	89	DIFE
91	1	1	DIFE
92	253	FD	VIF 
93	37	25	VIFE
94	60	3C	DATA
95	0	0	DATA
96	130	82	DIF 2
97	130	82	DIFE
98	3	3	DIFE
99	253	FD	VIF 
100	38	26	VIFE
101	24	18	DATA
102	0	0	DATA
103	2	2	DIF 2
104	236	EC	VIF 
105	126	7E	VIFE
106	1	1	DATA
107	15	F	DATA
108	194	C2	DIF 2
109	132	84	DIFE
110	1	1	DIFE
111	236	EC	VIF 
112	126	7E	VIFE
113	1	1	DATA
114	7	7	DATA
115	130	82	DIF 2
116	133	85	DIFE
117	1	1	DIFE
118	236	EC	VIF 
119	126	7E	VIFE
120	1	1	DATA
121	1	1	DATA
122	31	1F	DIF 0
123	130	82	VIF CHECKSUM VALID
124	22	16	VIFEEND

Troubleshooting: If no acknowledgement is received make sure Arduino serial line ending is set to “Both NL & CR” and the serial monitor baudrate is set to 115200.

The reader currently implements a basic data packet decode. I’ve entered the vif codes for a small number of the potential variable types, see lines 201 to 215:

if (val==0x06) Serial.print("Energy kWh");
if (val==0x13) Serial.print("Volume 0.001m3");
if (val==0x14) Serial.print("Volume 0.01m3");

if (val==0x5b) Serial.print("Flow Temp C");
if (val==0x5f) Serial.print("Return Temp C");
if (val==0x3e) Serial.print("Volume Flow m3/h");
if (val==0x2b) Serial.print("Power W");
if (val==0x22) Serial.print("Power 100 J/h");
if (val==0x6D) Serial.print("TIME & DATE");

if (val==0x70) Serial.print("Duration seconds");
if (val==0x75) Serial.print("Duration minutes");
if (val==0x78) Serial.print("Fab No");
if (val==0x79) Serial.print("Enhanced");

If anyone finds the reader useful and would like to contribute further VIF details, I would welcome contributions.


(Dave) #3

@TrystanLea
Hi Trystan
I’m looking to install a heat meter and have found one on the following link on ebay, this auction includes the unit and two probes, is this everything that you need to measure the heat and transfer data into emoncms?

Regards
Dave


(Trystan Lea) #4

Looks alight, although you will also need the expensive bit which is the flow sensor e.g:

https://heatmeter.co.uk/thermal-energy-meters/sontex/superstatic-440/SS-440-1QP3.5?gclid=CjwKCAiAqIHTBRAVEiwA6TgJwyA7AhoYuX5NWfEcDYBZEKNe-8wZMhp-oHBDPmu4HdbtLQcYjzYJnhoCbL0QAvD_BwE


(Dave) #5

Thanks Trystan
Does the flow sensor just give a pulse every litre or is it more complicated than that?

Regards
Dave


(Bryan McLellan) #6

Thanks for all the work @TrystanLea.

For comparison, here’s some example data from my SpireMT 280T-S which appears to be a relative of the Shenitech STUF-280T. The company is U.S. based, although I doubt their manufacturing is. You can order online from their website. I did order a 280T and received the slightly different 280T-S but it’s working for me so it’s ok.

For anyone new digging in, the values returned for data are actually decimal and not hex and the data bytes are ordered right to left. For example, the data for Energy kWh in my data below is 0x19, 0x3, 0x0, 0x0, and the value on my display is 319 kWh.

Trystan’s manufacturer ID is 0xEE, 0x4D. If you reverse that to 0x4DEE, convert to decimal and get 19950, then run the algorithm from 6.3 of the specification, you get 83,79,78, converted to ASCII is SON for Sontex from the flag list.

Mine is 0xB4, 0x4D, so 0x4DB4 or 19892 decimal. The algorithm returns 83,77,84, which in ASCII is SMT. The flag list has “Smarteh d.o.o.” for SMT, but I suspect SpireMT didn’t bother to apply for an ID and just put in SMT.

Similarly the ID fields are 0x00, 0x30, 0x17, 0x70, but if you reverse that and treat it as decimal rather than converting you get 70173000, which is the serial number of my meter.

Byte # Value Hex Value* Description
0 104 68 START
1 51 33 LEN
2 51 33 LEN
3 104 68 START
4 8 8 C FIELD
5 1 1 ADDRESS
6 114 72 CI FIELD
7 0 0 ID
8 48 30 ID
9 23 17 ID
10 112 70 ID
11 180 B4 MID
12 77 4D MID
13 164 A4 Gen
14 12 C Media
15 0 0 Access
16 0 0 Access
17 0 0 Signature
18 0 0 Signature
19 9 9 DIF 1
20 116 74 VIF Duration seconds (actual)
21 8 8 DATA
22 9 9 DIF 1
23 112 70 VIF Duration seconds (averaged)
24 8 8 DATA
25 12 C DIF 4
26 6 6 VIF Energy kWh
27 25 19 DATA
28 3 3 DATA
29 0 0 DATA
30 0 0 DATA
31 12 C DIF 4
32 20 14 VIF Volume Flow 0.01m3
33 101 65 DATA
34 112 70 DATA
35 0 0 DATA
36 0 0 DATA
37 11 B DIF 3
38 44 2C VIF Power kW (averaged)
39 0 0 DATA
40 0 0 DATA
41 0 0 DATA
42 11 B DIF 3
43 59 3B VIF Volume Flow mm3/h (averaged)
44 0 0 DATA
45 0 0 DATA
46 0 0 DATA
47 10 A DIF 2
48 89 59 VIF Flow Temp 0.01C
49 147 93 DATA
50 36 24 DATA
51 10 A DIF 2
52 93 5D VIF Return Temp 0.01C
53 49 31 DATA
54 38 26 DATA
55 97 61 DIF 1CHECKSUM VALID
56 22 16 VIF END

I submitted a PR for the additional VIFs that I decoded.


(Trystan Lea) #7

Thanks for the pull request with additional VIF codes Bryan, great to see this applied to further meters.


(Trystan Lea) #8

@dave sorry, Im not entirely sure


(Bryan McLellan) #9

Here’s my firmware and documentation for a M-Bus master with an RFM69 to upload to an emonPi/emonBase.


(Opennrj) #10

@TrystanLea

Hello,

Thanks for this post !
I am a Sontex 624 user and I was wondering if you think that the heat pump monitor board would also work for my 624.

By the way, can we pull values from all 4 counters I have ?

Thank you !


(Evan) #11

Hi Trystan,
I am having problems getting the heatpumpmonitor to talk to Kamstrup 403 meters - used successfully in the past with the Kamstrup 402.

I have used your MBUS reader tool to try to narrow down the cause, and interestingly it seems to work fine (on the same hardware), following the instructions above I can read a page of data and so on.

However the heatpumpmonitor code doesn’t get any response from the meter (checked with a scope) - there is nothing received during the scan function.

Any ideas what could cause this, or how to debug the scan function? (I’m not completely sure how it works).

As before I am wanting to use 3 meters eventually.

Thanks
Evan


(Trystan Lea) #12

Hello @Et0

Could it be a different in baud rate?

customSerial->begin(4800, CSERIAL_8E1);

https://github.com/openenergymonitor/HeatpumpMonitor/blob/master/Firmware/Arduino/HeatpumpMonitor_AutoTemp/HeatpumpMonitor_AutoTemp.ino#L213

vs

customSerial->begin(2400, CSERIAL_8E1);

https://github.com/openenergymonitor/HeatpumpMonitor/blob/master/Firmware/Arduino/MBUS_Reader/MBUS_Reader.ino#L50


(Evan) #13

Same issue at 2400.
I ended up replacing all of the mbus code in my sketch (which was version 2) with the code from your MBUS Reader. That fixed it. The difference seems to be that the new mbus_scan() function uses mbus_normalize with an address, rather than mbus_send_ping.

I am using that old version because I need RFM transmission, which I think has gone from the current version.

Cheers
Evan