Skip to content

an Arduino M-Bus data link layer communication library

License

Notifications You must be signed in to change notification settings

Zeppelin500/MBusCom

Repository files navigation

MBusinoCom - an Arduino M-Bus data link layer communication library.

version license

Documentation

The MBusCom library enables Arduino devices to communicate with M-Bus Slaves thru a M-Bus Master (level converter) at the Data Link Layer

Tested at ESPs, Arduino Mega, MKR and Raspberry Pico but should work with all kind of µCs.

Together with the MBusinoLib, you can build a M-Bus Master for reading out M-Bus Slaves.

A working M-Bus --> MQTT gateway with this library MBusino

Credits

Thanks to HWHardsoft and TrystanLea for parts of the M-Bus communication: https://github.com/HWHardsoft/emonMbus and https://github.com/openenergymonitor/HeatpumpMonitor

API

Class: MBusCom

Include and instantiate the MBusCom class. The constructor takes the Serial Interface and UART Pins.

MBusCom(HardwareSerial *MbusSerial, uint8_t rxPin, uint8_t txPin);

or

MBusCom(Serial1 *MbusSerial);

begin

MBusCom.begin();

start the Serial communication

normalize

MBusCom.normalize(byte address);

set the bus back

set_address

MBusCom.set_address(byte oldaddress, byte newaddress);

change the M-Bus address of a slave. Use 254 as oldaddress to change a single slave with unknown address.

request_data

MBusCom.request_data(byte address)

Request RSP_UD telegrams. (Slave data records)

get_response

MBusCom.get_response(byte *pdata, unsigned char len_pdata);

Get the slave response from the rx buffer.

clearRXbuffer

MBusCom.clearRXbuffer();

Clears the rx buffer, if some junk received

References

License

The MBusCom library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The MBusCom library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with the MBusinoLib library. If not, see http://www.gnu.org/licenses/.

About

an Arduino M-Bus data link layer communication library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages