Electronic – arduino – How to read in M-bus metering data with an Arduino Uno

arduinoccommunication

I am trying to send data from a Kamstrup Multical 601 to an Arduino Uno using the M-bus protocol.

I am considering trying to use the libmbus c libraries to do this. However, I do not have a lot of experience in c programming so was wondering if:

  • you think this is a realistic/achievable approach?
  • anyone could suggest an alternative/easier approach?

The main chip on the Arduino Uno is the Atmel Atmega382P-PU.

After getting the data to the Arduino I aim to perform some calculations and send data to an LCD (this I think I can do).

Best Answer

You're going to have a lot of trouble converting that C library for use on the Arduino. As mentioned by Chris, it looks like it's for a bigger system like a PC, so you'll have to port it for use in an embedded system. It's feasible, but may be more work than you'd like.

I was able to find some application notes that use an MSP430 and a bus transceiver. In this way you can write to the M-Bus using UART, which TI has lots of code available for implementation. They even use an LCD for displaying read information. Putting your Arduino in place of the MSP430 should work in the same way, they both have UART which you can set to the appropriate baud rate. This will get you as far how to talk to your meter. Then all you really need to do is figure out what to say to your meter. This page has a nice diagram for the data layer of the M-Bus protocol,
frame descriptions for m-bus
Each of the rows represent a byte value you would write to your UART send register. As far as what your specific meter is expecting for each of these fields, that's going to take some digging. It looks like there may be some register information here. But that's all going to depend on what modules you have installed on your meter, which you didn't specify.