Logic Machine Forum
M-bus problem - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10)
+--- Thread: M-bus problem (/showthread.php?tid=4772)



M-bus problem - Andrea Becagli - 17.05.2023

Hi, 
I am having problems reading data from m-bus meter. I have Caleffi Conteca Easy with M-Bus (750705) a Techbase M-Bus to rs485 Converter (MBus10) and a LM, i am trying with this script:
Code:
require('mbus')

mbus.init('/dev/ttyUSB0', 9600 ,"half")


res, err = mbus.scan(1 , 10, 1)
log(res)
log(err)
log(mbus.getdata(7))
 to scan for the Caleffi meter (address:7) and to read some data from it. As a result i get this:
Code:
m-bus 17.05.2023 12:07:52
* table:
[1]
  * bool: false
[2]
  * bool: false
[3]
  * bool: false
[4]
  * bool: false
[5]
  * bool: false
[6]
  * bool: false
[7]
  * bool: false
[8]
  * bool: false
[9]
  * bool: false
[10]
  * bool: false
m-bus 17.05.2023 12:07:52
* nil
m-bus 17.05.2023 12:07:54
* arg: 1
  * nil
* arg: 2
  * string: failed to send/receive frame
I have tried changing polarity of the m-bus and of the rs485 connection with no result though. Could you help me? Huh


RE: M-bus problem - Daniel - 17.05.2023

To which LM port is it connected? Are you sure it is RS485 not RS232? Your port is clearly wrong as it points to USB


RE: M-bus problem - Andrea Becagli - 17.05.2023

Sorry, right now i am using a rs485 to usb converter but i am having the same problem.  
See the attachment for the techbase converter.   [attachment=3221]


RE: M-bus problem - admin - 17.05.2023

The meter documentation says "M-Bus protocol on BUS RS-485". This means that you can connect the meter directly to LM RS-485 port without any additional converters.


RE: M-bus problem - Andrea Becagli - 17.05.2023

I tried connecting the caleffi meter to the /dev/RS485-2 port as a result i don't get the scan table and still no data

Code:
require('mbus')

mbus.init('/dev/RS485-2', 9600 ,"half")


res, err = mbus.scan(1 , 10, 1)
log(res)
log(err)
log(mbus.getdata(7))

log:
Code:
m-bus 17.05.2023 12:38:53
* table:
m-bus 17.05.2023 12:38:53
* nil
m-bus 17.05.2023 12:38:55
* arg: 1
  * nil
* arg: 2
  * string: failed to send/receive frame



RE: M-bus problem - Daniel - 17.05.2023

Did you try swapping A/B?


RE: M-bus problem - admin - 17.05.2023

Try setting a lower baudrate (2400) on both LM and the meter. It's possible that RS485 is damaged on the meter if you've connected M-Bus there - not all RS485 ports are protected against 24V DC connection. There's also a similar meter model with Modbus instead of M-Bus.