M-Bus Meter Reader, Sontex 531 Heat Meter

A quick note for those interested in heat metering and M-Bus, I’ve managed to read from the Sontex 531 Heat Meter via M-Bus 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 M-Bus 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 M-Bus 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

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

Arduino M-Bus 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 M-Bus 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 M-Bus 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 M-Bus 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.

@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?

http://www.ebay.co.uk/itm/Sontex-Supercal-531energy-Integrator-14-available/282751352631?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2060353.m1438.l2649

Regards
Dave

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

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

Regards
Dave

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.

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

@dave sorry, Im not entirely sure

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

@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 !

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

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

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

1 Like

Hello,

I now tried to read the Mbus from my KAMSTRUP MultiCal 302whit the Heatpump board.

After setting the baud rates to 2400 its working partly.

There are coming values but they are the wrong ones. For instance the KSheat stays on 0

I tried the Kamstrup 402 and 403 but they don’t fit.

Is the list from the MBUS reader help to get the wright figures?

The serial reader gives this; debug 1

mbus_request_data 0
OEM CT READ
OEM CT READ END
Msg:32,OEMct1:1017,OEMct2:1301,OEMct3:1298,OEMct1Wh:86,OEMct2Wh:111,OEMct3Wh:111,KSkWh:18230,KSflowT:526,KSreturnT:524,KSdeltaT:1025,KSheat:0,KSflowrate:16
mbus_request_data 0

Should there -with debug 1- not be more readings

Hello Frans

Its likely that the Kamstrup 302 has different register locations to the 402. You will likely need to ajust the code to access the readings that you want to access.

There is a tool called MBUS_Reader https://github.com/openenergymonitor/HeatpumpMonitor/tree/master/Firmware/Arduino/MBUS_Reader which is a more generic reader that helps to identify the register locations, could you try running that and posting the result here?

Once you know the register locations and types you can specify your own decoder in this section here: https://github.com/openenergymonitor/HeatpumpMonitor/blob/master/Firmware/Arduino/HeatpumpMonitor_AutoTemp_MultiPage/HeatpumpMonitor_AutoTemp_MultiPage.ino#L525

e.g for the Kamstrup 402, the flow temperature is 4 bytes starting at byte 45, multiplied by 0.01…

Hope that helps

Hello Trystan, thanks for your help.

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

Command sent: request data
0 104 68 START
1 199 C7 LEN
2 199 C7 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 45 2D MID
12 44 2C MID
13 48 30 Gen
14 4 4 Media
15 8 8 Access
16 0 0 Access
17 0 0 Signature
18 0 0 Signature
19 12 C DIF 4
20 120 78 VIF Fab No
21 54 36 DATA
22 71 47 DATA
23 121 79 DATA
24 103 67 DATA
25 4 4 DIF 4
26 5 5 VIF
27 75 4B DATA
28 128 80 DATA
29 0 0 DATA
30 0 0 DATA
31 4 4 DIF 4
32 133 85 VIF
33 255 FF VIFE
34 2 2 VIFE
35 91 5B DATA
36 18 12 DATA
37 0 0 DATA
38 0 0 DATA
39 4 4 DIF 4
40 255 FF VIF
41 7 7 VIFE
42 6 6 DATA
43 101 65 DATA
44 4 4 DATA
45 0 0 DATA
46 4 4 DIF 4
47 255 FF VIF
48 8 8 VIFE
49 172 AC DATA
50 5 5 DATA
51 4 4 DATA
52 0 0 DATA
53 4 4 DIF 4
54 19 13 VIF Volume Flow 0.001m3
55 20 14 DATA
56 179 B3 DATA
57 11 B DATA
58 0 0 DATA
59 4 4 DIF 4
60 34 22 VIF Power 100 J/h (averaged)
61 158 9E DATA
62 4 4 DATA
63 0 0 DATA
64 0 0 DATA
65 52 34 DIF 4
66 34 22 VIF Power 100 J/h (averaged)
67 241 F1 DATA
68 0 0 DATA
69 0 0 DATA
70 0 0 DATA
71 2 2 DIF 2
72 89 59 VIF Flow Temp 0.01C
73 156 9C DATA
74 16 10 DATA
75 2 2 DIF 2
76 93 5D VIF Return Temp 0.01C
77 234 EA DATA
78 14 E DATA
79 2 2 DIF 2
80 97 61 VIF
81 178 B2 DATA
82 1 1 DATA
83 4 4 DIF 4
84 45 2D VIF
85 215 D7 DATA
86 0 0 DATA
87 0 0 DATA
88 0 0 DATA
89 20 14 DIF 4
90 45 2D VIF
91 38 26 DATA
92 1 1 DATA
93 0 0 DATA
94 0 0 DATA
95 4 4 DIF 4
96 59 3B VIF Volume Flow mm3/h (averaged)
97 181 B5 DATA
98 16 10 DATA
99 0 0 DATA
100 0 0 DATA
101 20 14 DIF 4
102 59 3B VIF Volume Flow mm3/h (averaged)
103 201 C9 DATA
104 16 10 DATA
105 0 0 DATA
106 0 0 DATA
107 2 2 DIF 2
108 253 FD VIF
109 23 17 VIFE
110 0 0 DATA
111 0 0 DATA
112 4 4 DIF 4
113 109 6D VIF TIME & DATE
114 44 2C DATA
115 48 30 DATA
116 107 6B DATA
117 35 23 DATA
118 68 44 DIF 4
119 5 5 VIF
120 111 6F DATA
121 81 51 DATA
122 0 0 DATA
123 0 0 DATA
124 68 44 DIF 4
125 133 85 VIF
126 255 FF VIFE
127 2 2 VIFE
128 21 15 DATA
129 18 12 DATA
130 0 0 DATA
131 0 0 DATA
132 68 44 DIF 4
133 255 FF VIF
134 7 7 VIFE
135 253 FD DATA
136 241 F1 DATA
137 2 2 DATA
138 0 0 DATA
139 68 44 DIF 4
140 255 FF VIF
141 8 8 VIFE
142 7 7 DATA
143 187 BB DATA
144 2 2 DATA
145 0 0 DATA
146 68 44 DIF 4
147 19 13 VIF Volume Flow 0.001m3
148 74 4A DATA
149 228 E4 DATA
150 7 7 DATA
151 0 0 DATA
152 84 54 DIF 4
153 45 2D VIF
154 54 36 DATA
155 1 1 DATA
156 0 0 DATA
157 0 0 DATA
158 84 54 DIF 4
159 59 3B VIF Volume Flow mm3/h (averaged)
160 218 DA DATA
161 16 10 DATA
162 0 0 DATA
163 0 0 DATA
164 66 42 DIF 2
165 108 6C VIF
166 124 7C DATA
167 34 22 DATA
168 7 7 DIF 8
169 255 FF VIF
170 15 F VIFE
171 48 30 DATA
172 119 77 DATA
173 10 A DATA
174 4 4 DATA
175 0 0 DATA
176 0 0 DATA
177 0 0 DATA
178 0 0 DATA
179 4 4 DIF 4
180 255 FF VIF
181 17 11 VIFE
182 135 87 DATA
183 184 B8 DATA
184 0 0 DATA
185 0 0 DATA
186 4 4 DIF 4
187 255 FF VIF
188 18 12 VIFE
189 0 0 DATA
190 32 20 DATA
191 203 CB DATA
192 0 0 DATA
193 2 2 DIF 2
194 255 FF VIF
195 26 1A VIFE
196 1 1 DATA
197 24 18 DATA
198 2 2 DIF 2
199 253 FD VIF
200 14 E VIFE
201 1 1 DATA
202 8 8 DATA
203 142 8E DIF 6CHECKSUM VALID
204 22 16 DIFEEND

this is from the Arduino Mbus reader whit i load in the Heatpump board

i have this in a exel or tekst file but dont now how to upload this

To upload, click on reply if you’re replying to a post, then click on the image symbol and follow the directions in the box that pops up.

If you are not replying, i.e. starting a new thread, click on image and follow the directions…

HTH

Bill

MBUS reader met lopende WP.txt (3.4 KB)

Looks like you got it. thumbsup