Ground source heat pump monitoring

Merry Christmas!

Having a bit of spare time this days I wanted to order a Heat pump monitor Mbus based Rasp Pi hat from Open energy shop for my Ground source open loop heat pump monitoring project.
I do have a MID approved heat meter installed some time ago but just realised it is not the MBUS protocol.

Instead there is a label rs485 Modbus on the 4 wires cable.
I also have a electric meter with the same Modbus protocol.
I have tried to get more info around here but I couldn’t find to much info on Modbus heatmeters.

My question,
Has someone successfully read this kind of heat meters?
Or, is there any Modbus interface that can be used on the Raspberry pi hat, so it can read the heatmeter and the electric meter the same way it reads data from MBUS hardware?

Thanks

Hello @luxprospector what is the model number of the heat meter that you have there?

emonhub has a modbus reader interfacer that should be flexible enough to read in the data: emonhub/EmonHubMinimalModbusInterfacer.py at master · openenergymonitor/emonhub · GitHub

You will need to specify or work out the relevant data registers to read from. Id be interested to hear how you get on.

Hi Tristan, my heat meter is a UF50 ultrasonic Heat Meter from Micronics UK.




I

Now I am reading with a Raspberry pi, flow and return temperatures and also control the heat pump with some relays on and off times .
I don’t have to much experience with electronic stuf or programming.
For this reason I was trying to buy a ready-made solution for my project. I have tried with a usb to rs485 adaptor to read some data but no success so far.
Could you explain what hardware and software would be needed?

Finally I made some progress reading the data from the heat meter to my windows pc with the usb modbus adapter,
!

The problem now is I don’t know how to make the changes in the Modbus interface in emonhub to be able to read the heat meter.
Is there any one that can guide me how can I achieve that ?
Thanks

No matter what I have tried still not able to connect the modbus meters I have to the raspi Emoncms.
I always get a not connected error.

Has anyone succeeded reading a modbus heat meter or different make of electric modbus meter (RI-D19-80-C. is the one I have)?

Hello @luxprospector

What have you tried so far for the modbus interfacer, the default for reading from an SDM120 electric meter is:

[[SDM120]]
    Type = EmonHubMinimalModbusInterfacer
    [[[init_settings]]]
        device = /dev/ttyUSB0
        baud = 2400
    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,
        read_interval = 10
        nodename = sdm120
        # prefix = sdm_
        registers = 0,6,12,18,30,70,72,74,76
        names = V,I,P,VA,PF,FR,EI,EE,RI
        precision = 2,3,1,1,3,3,3,3,3

It might be worth trying something like:

[[HeatMeter]]
    Type = EmonHubMinimalModbusInterfacer
    [[[init_settings]]]
        device = /dev/ttyUSB0
        baud = 2400
    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,
        read_interval = 10
        nodename = heatmeter
        registers = 0,1,2,3,4
        names = A,B,C,D
        precision = 1,1,1,1

That should go below the heading:

[interfacers]

in /etc/emonhub/emonhub.conf, which is also editable from within the local emoncms interface.

Hi Tristan,
Thank you for taking time to help!

I have tried already what you have suggested and also what you have sent in the last post .

After I modify the baud rate to 9600, I do get some response from the electric meter


It seems that is at least connected to the electric meter as some response commes back but search on the Google has not helped me to do much.

But from the Heat meter still no answer

Is there a way to modify the " parity= None " in the Heatmeter Interfacer , it seems the only way I could connect to it with the Modpoll software

The settings from Modpoll where I was able to collect some data from the HeatMeter was,
9600 baud
Parity None
Word length. 8
Stop bits. 1

Whereas on the Electric meter
9600 baud
Parity = odd
Word length 8
Stop bits. 1

Thanks in advance to anyone who may have an ideea how I can get further!

Hello @luxprospector the parity is set on this line https://github.com/openenergymonitor/emonhub/blob/master/src/interfacers/EmonHubMinimalModbusInterfacer.py#L63
you could try changing it to see if that makes any difference?

Thanks Tristan, I have tried to play with that code before but it is too much for me .
I did not managed to figure out how github works and what steps I needed to make in order to alter the code and use it.

I have instead some progress with the Heatmeter code

 [[HeatMeter]]
    Type = EmonHubMinimalModbusInterfacer
    [[[init_settings]]]
        device = /dev/ttyUSB0
        baud = 9600
    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,
        read_interval = 10
        nodename = heatmeter
        registers = 0,1,2,3,4
        names = A,B,C,D
        precision = 1,1,1,1

It connects to the electric KW meter but no matter what registers I ask to read it always comes with error 0

The checksum error disappeared from the log when I have connected the 120R resistor.

On windows laptop the Kw meter is read with no problem or errors.


I assume the converter works well because of this .
Any hints what else I can try?
Thanks

[Formatted for presentation. Moderator - RW]

I think this interfacer is being worked on at the moment. See Reading from a SDM120 meter using EmonHub - #153 by TrystanLea

Hello @luxprospector

You shouldn’t need to interact with github at all, are you able to access the code directly on the RaspberryPi?

The location of the code is /opt/openenergymonitor/emonhub/src/interfacers/EmonHubMinimalModbusInterfacer.py

Thanks for your help Tristan!
Unfortunately a few sentences in your message takes me a couple of weeks of learning how to use that information.
In the last week I have managed to alter the code in the as per your guidance and as a result my modbus heat meter is showing some data ( still not able to have useful data).

I have succeeded to find the manual about the modbus protocol it uses.
Heat meter Modbus communication protocol - Micronics.pdf (749.9 KB)

It seems that I need to read float values from the "Holding registers ,function code 3 "whereas the on the SDM 120 your code read the “Input registers, function code 4” .
So I altered the code Minimal modbus , to read the function code 3 and this is the result !




No matter what precision numbers I use the rezult is always zero, if the field is blank then some values appear in the log but never on the input page .

If any suggestions please leave them here

Thanks,
Lucian

Hi again !
Winter is here again and the ground source heat pump must be on once again , the issue is that this year is going to be much more expensive to run.
I have had no succes with the Modbus heat meters that my installation had .

So I purchased a new Mbus Heat pump monitor RaspberryPi Hat so I can monitor my hot water tank temperature also , along with Mbus Kamstrup 403 heat meter and a Modbus SDM120 electric meter.
This time everything comes along quite well except the Mbus Interfacer for the Kamstrup 403.
I have used some examples found here witch seems to get most of the data I need except the Total heat kwh .
Could maybe someone that uses this meter share the Interfacer that needs to be used with
Mbus Kamstrup 403 heat meter

Hello @luxprospector the kamstrup should output everything on a single page/request. An interfacer like this should be fine (with the correct mbus address specified):

[[MBUS]]
    Type = EmonHubMBUSInterfacer
    [[[init_settings]]]
        device = /dev/ttyAMA0
        baud = 2400
    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,
        read_interval = 10
        validate_checksum = False
        nodename = MBUS
        [[[[meters]]]]
            [[[[[kamstrup]]]]]
                address = 1
                type = standard

What does the result look like in the emonhub.log? You can see the result a bit clearer on the command line e.g (or alternatively you can see it in the user interface.

tail -f /var/log/emonhub/emonhub.log

Hello TrystanLea, and Thaks for your input.
That interfacer worked straight away. after changing the Mbus address and outputs a lot of data ,including the needed ones

However I seem to have a bit of issue now with the 4 temperature sensors updating far more than usual 10 seconds,sometimes more than 30 seconds, a screenshot from the emonhub log view

2022-10-15 16:33:54,380 DEBUG MQTT Publishing: emonhub/rx/MBUS/values 187,1027,866,27.54,0,0,7458,1,16.92,15.09,1.83,0,4400,0,0.749,0,718156064,0,0,0,0,0,0,0,0,8641,6657,72297977,2000101,11851201,0
2022-10-15 16:33:55,079 WARNING DS18B20 Exception caught in DS18B20 thread. Traceback (most recent call last):
File “/opt/openenergymonitor/emonhub/src/emonhub_interfacer.py”, line 31, in wrapper
return func(*args)
File “/opt/openenergymonitor/emonhub/src/emonhub_interfacer.py”, line 98, in run
rxc = self.read()
File “/opt/openenergymonitor/emonhub/src/interfacers/EmonHubDS18B20Interfacer.py”, line 109, in read
value = self.ds.tempC(sensor)
File “/opt/openenergymonitor/emonhub/src/interfacers/EmonHubDS18B20Interfacer.py”, line 42, in tempC
while lines[0].strip()[-3:] != ‘YES’:
IndexError: list index out of range

2022-10-15 16:33:56,103 WARNING MainThread DS18B20 thread is dead.
2022-10-15 16:33:56,166 WARNING MainThread Attempting to restart thread DS18B20 (thread has been restarted 412 times…)
2022-10-15 16:33:56,222 INFO MainThread Creating EmonHubDS18B20Interfacer ‘DS18B20’
2022-10-15 16:33:57,357 INFO MainThread Setting DS18B20 read_interval: 10
2022-10-15 16:33:57,406 INFO MainThread Setting DS18B20 nodename: sensors
2022-10-15 16:33:57,479 INFO MainThread Setting DS18B20 ids:
2022-10-15 16:33:57,529 INFO MainThread Setting DS18B20 names:
2022-10-15 16:33:57,533 DEBUG MainThread Setting DS18B20 pubchannels: [‘ToEmonCMS’]
2022-10-15 16:33:57,634 INFO MainThread Setting SDM120 read_interval: 10
2022-10-15 16:33:57,650 INFO MainThread Setting SDM120 meters sdm120 address 1
2022-10-15 16:33:57,685 INFO MainThread Setting SDM120 meters sdm120 registers [0, 12, 18, 30, 70, 72, 74, 76]

Hello @luxprospector

I’ve made a minor modification to the DS18B20 interfacer to check for the length of the lines list to try and avoid the error you’re getting. If you can pull in the latest master branch to test that would be great.

Perhaps one of the sensors is playing up? might be worth checking the connections or even restarting the pi as I think the sensor may be listed but may not be returning correct information… I havent delved into this in depth yet so making a quick guess

That’s the error I’m getting always,

2022-12-01 12:51:23,702 WARNING MainThread DS18B20 thread is dead.
2022-12-01 12:51:23,732 WARNING MainThread Attempting to restart thread DS18B20 (thread has been restarted 1777 times…)
2022-12-01 12:51:31,412 WARNING DS18B20 Exception caught in DS18B20 thread. Traceback (most recent call last):
File “/opt/openenergymonitor/emonhub/src/emonhub_interfacer.py”, line 31, in wrapper
return func(*args)
File “/opt/openenergymonitor/emonhub/src/emonhub_interfacer.py”, line 103, in run
rxc = self.read()
File “/opt/openenergymonitor/emonhub/src/interfacers/EmonHubDS18B20Interfacer.py”, line 110, in read
value = self.ds.tempC(sensor)
File “/opt/openenergymonitor/emonhub/src/interfacers/EmonHubDS18B20Interfacer.py”, line 42, in tempC
if len(lines[0]):
IndexError: list index out of range

2022-12-01 12:51:31,574 WARNING MainThread DS18B20 thread is dead.
2022-12-01 12:51:31,577 WARNING MainThread Attempting to restart thread DS18B20 (thread has been restarted 1778 times…)
2022-12-01 12:51:54,664 WARNING DS18B20 Exception caught in DS18B20 thread. Traceback (most recent call last):
File “/opt/openenergymonitor/emonhub/src/emonhub_interfacer.py”, line 31, in wrapper
return func(*args)
File “/opt/openenergymonitor/emonhub/src/emonhub_interfacer.py”, line 103, in run
rxc = self.read()
File “/opt/openenergymonitor/emonhub/src/interfacers/EmonHubDS18B20Interfacer.py”, line 110, in read
value = self.ds.tempC(sensor)
File “/opt/openenergymonitor/emonhub/src/interfacers/EmonHubDS18B20Interfacer.py”, line 42, in tempC
if len(lines[0]):
IndexError: list index out of range

2022-12-01 12:51:54,827 WARNING MainThread DS18B20 thread is dead.
2022-12-01 12:51:54,841 WARNING MainThread Attempting to restart thread DS18B20 (thread has been restarted 1779 times…)
2022-12-01 12:52:31,333 WARNING DS18B20 Exception caught in DS18B20 thread. Traceback (most recent call last):
File “/opt/openenergymonitor/emonhub/src/emonhub_interfacer.py”, line 31, in wrapper
return func(*args)
File “/opt/openenergymonitor/emonhub/src/emonhub_interfacer.py”, line 103, in run
rxc = self.read()
File “/opt/openenergymonitor/emonhub/src/interfacers/EmonHubDS18B20Interfacer.py”, line 110, in read
value = self.ds.tempC(sensor)
File “/opt/openenergymonitor/emonhub/src/interfacers/EmonHubDS18B20Interfacer.py”, line 42, in tempC
if len(lines[0]):
IndexError: list index out of range

2022-12-01 12:52:31,364 WARNING MainThread DS18B20 thread is dead.
2022-12-01 12:52:31,383 WARNING MainThread Attempting to restart thread DS18B20 (thread has been restarted 1780 times…)

Hi Tristan , I have tested the later master branch, but no improvement.
Also have tested with only 2 sensor witch have worked perfectly fine before the M BUS adaptor board was installed. Tried a different power supply,3Amp one , and still no difference
The bad thing is that it also affects the M BUS readings and also MODBUS . I have a lot of missing data on the Heat meter and Electric meter , and so no accurate cop would be calculated
Please help

Hello @luxprospector

I have made a minor modification to the ds18b20 emonhub interfacer to try and catch the error that you are seeing above.
Are you ok try the following by command line?

cd /opt/openenergymonitor/emonhub
git fetch origin
git checkout ds18b20_error_check
sudo service emonhub restart