Skip to content

Micropython implementation of the Meter-Bus (M-Bus EN13757-3) protocol.

License

Notifications You must be signed in to change notification settings

HWHardsoft/micropyMeterBus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Meter-Bus for MicroPython

MicroPython implementation of the Meter-Bus (M-Bus EN13757-3) protocol.

about M-BUS

Due to rising prices for oil, gas and heat as well as climate change, it is becoming more and more important to monitor energy consumption in order to keep an eye on energy costs, but also to be able to check the effectiveness of savings. Many meters for oil and gas, but also for water, are equipped with a special 2 wire bus system, the M-BUS or meter bus, for monitoring consumption values.

Hardware

I've tested this code with our Arduino MKR M-BUS shield and the Arduino Portenta H7 (via OpenMV IDE) and the Raspberry Pico (via Thonny IDE).

My image)

External libraries

MicroPython will not support the decimal function of standard Python. To solve this problem the library micropython-decimal-number is required.

Examples

Please enable/ disable the lines for UART configuration in the examples for your board first!

mbus-serial-scan.py

This program will scan the M-Bus for devices via the primary (logical) address. Currently it is limited to address 6 as maximum, but you can change the value MAX_PRIMARY_SLAVES in defines.py for upto 250 primary addresses.

mbus-serial-scan-secondary.py

This program will scan the M-Bus for devices via the secondary address.

mbus-serial-request-data.py

Will request the data from a slave device via primary address first and secondary address. The data is returned in JSON format.

Credits

Based on the pyMeterBus project by Mikael Ganehag Brorsson

https://github.com/ganehag/pyMeterBus