Kamstrup 402/403, mbus - what am I doing wrong?

Hello!

I am trying to read two heat meters using some sort of MBUS to UART module.
I actually made two modules - one using arduino uno, and another using wemos D1 mini. Both of them are working on the same principle - connect MBUS reader circuit to the microcontroller and then connect the controller to the emonPI via the onboard usb port.

When i open the serial monitor from Arduino IDE and send the command “r” to the board, i get a solid response, all the data from the Kamstrup.

when I connect the board to emonPI, the log from the emonhub says “no MBUS data to decode” or something like that. Also, no new input logs are present on the Inputs tab.

What am I doing wrong?

I uploaded the Mbus_reader.ino to the Uno board, and Mbus:reader_ESP.ino to the Wemos D1 mini (we are talking about two sepparate devices, both have good response in Serial Monitor, none uploads data to emonPI).

Baud rate on both devices is set to 2400, configuration of emonhub is also set to 2400. I tried changin addresses (my devices have addresses 29 and 70), nothing works. I also tried setting the address to 0, no succcess.

If needed, I can send some pictures of the devices and share some logs from Serial Monitor and emonhub.

Please help!

Hello @Benito a couple of pictures would help, the emonhub MBUS code reads directly from the MBUS to UART circuit and should not have an arduino or wemos as an intermediary… is that how you have it setup?

This is my setup (i made a little shield):

Basicly, i used the mbus reader circuit and connected the D4 and D5 to corresponding arduino pins.

I am getting a good response from serial monitor:
log_esp8266_kam402.txt (4.3 KB)

Also the log from the emonhub:
emonhub_log.txt (4.7 KB)

Obviousely I am doing something wrong.

Why can’t an arduino be used as a serial to uart converter?

If I understand this correctly, the main problem is in the arduino code - Mbus_Reader.ino is used only to verify that the mbus reader circuit is working correctly, NOT to interface with Emonhub?

If I use somethnig like this:

void setup()
{
pinMode(4,INPUT);
pinMode(5,OUTPUT)
}
void loop()
{

}

then the reader will work on Emonhub?

Nice! yes for emonhub you need to connect the mbus reader circuit directly to either the serial pins on the Pi or via a USB to UART connector. You dont need the arduino at all.

OK, thanks! Will try that.

If i connect the reader directly to Pi, do I have to make a voltage divider (5V/3,3V) to make it work or something like that? Also, what is the correct configuration for Emonhub interfacer in that case?

One more question, is it possible to read both heat meters (connecting both meters to single Mbus reader) to EmonPI?

I was thinking trying something like this for the Emonhub configuration:

[[MBUS]]
Type = EmonHubMBUSInterfacer
[[[init_settings]]]
device = /dev/ttyUSB0
baud = 2400
[[[runtimesettings]]]
pubchannels = ToEmonCMS,
address = 29
pages = 0
read_interval = 10
nodename = MBUS1

[[MBUS]]
Type = EmonHubMBUSInterfacer
[[[init_settings]]]
device = /dev/ttyUSB0
baud = 2400
[[[runtimesettings]]]
pubchannels = ToEmonCMS,
address = 70
pages = 0
read_interval = 10
nodename = MBUS2

Will this work?

Yes good point, I think you do, I have been connecting via a USB to UART programmer https://shop.openenergymonitor.com/programmer-usb-to-serial-uart/ so it handles that for you.

It looks like your interfacer configurations are correct but I doubt it will work with two as they will probably conflict or the second will not be able to open the port.

I think the interfacer itself would need more development to support multiple meters on one port.

You could connect two MBUS readers, one on ttyUSB0 and another on ttyUSB1 perhaps?

What if I change the read interval? If I set the read interval of the first heat meter to 10, and the second one to 9, in that case they will conflict every 10-th time and one of them will not be able to send data (if i set a longer read interval, that number could be even bigger, like 30-th read they conflict - I can live with that)?

I haven’t tried it yet, so cant tell for sure what will happen :slight_smile:

Ok, I will try it when I get a chance, when I do, I will report back if it works.

Thanks!
:smiley:

Hello!

Just to report back, the arduino USB to UART did not work for me. I did however found one CP2102 USB to UART converter like this one in my spare parts drawer so I will give that a try.
Is it enough just to connect the Rx/Tx from my arduino shield to the converter (and the 5V/GND from the converter to the shield) or do I need something else (resistors, capacitors, whatever)?

Hi,
I finally got the thing to work with 2 heat meters - i have 2 individual mbus circuits connected to USB0 and USB1 on the raspberry, reading data from Kamstrup 402 and 403.

However, I am having problems reading one of the heat meters - the value of energy is 0 on the Kamstrup 402. On the heat meter display, energy has some other value. Is there a problem with something in my configuration?

This is the log file from today: emonhub (3).txt (1.2 MB)