M-Bus Data Source
The M-Bus (Meter-Bus) data source communicates with utility meters and sensors using the M-Bus protocol (EN 13757). M-Bus is a European standard for remote reading of gas, water, electricity, and heat meters, as well as environmental sensors. The protocol supports both wired (M-Bus serial) and wireless (Wireless M-Bus / wM-Bus) communication, enabling Mango to collect consumption data and measurements from a wide range of metering devices.
M-Bus is widely used in building automation, district heating systems, smart metering infrastructure, and energy management applications. The protocol is designed for battery-powered devices and low-bandwidth communication, making it well suited for long-term utility monitoring.
Overview
| Property | Value |
|---|---|
| Module | mangoAutomation-MBus |
| Protocol | M-Bus (EN 13757) |
| Direction | Polling |
| Typical Use | Utility meter reading (water, gas, heat, electricity) |
Prerequisites
- One or more M-Bus compatible meters or sensors connected via a serial M-Bus network or wireless M-Bus receiver.
- An M-Bus master (level converter) that interfaces between the M-Bus physical layer and a standard serial port (RS232 or USB-to-serial) on the Mango server. For wired M-Bus, this is typically a dedicated M-Bus to RS232 converter.
- Knowledge of the primary or secondary addresses of the meters on the bus.
- The M-Bus module installed in your Mango instance.
Configuration
Data Source Settings
| Setting | Description |
|---|---|
| Name | A descriptive name for the data source. |
| Update period | How frequently Mango polls the M-Bus devices for new readings. |
| Connection type | The physical connection method: Serial (wired M-Bus) or TCP/IP (for M-Bus gateways that provide network access to the bus). |
Serial Connection Settings
| Setting | Description |
|---|---|
| Serial port | The serial port connected to the M-Bus master (e.g., /dev/ttyUSB0 on Linux, COM3 on Windows). |
| Baud rate | Communication speed. Standard M-Bus baud rates are 300, 2400, and 9600. Most meters use 2400. |
TCP/IP Connection Settings
| Setting | Description |
|---|---|
| Host | The IP address or hostname of the M-Bus gateway. |
| Port | The TCP port number for the M-Bus gateway. |
Data Point Configuration
| Setting | Description |
|---|---|
| Address type | Whether to use the primary address (0-250) or secondary address (manufacturer-specific identifier) to communicate with the meter. |
| Primary address | (If using primary addressing) The bus address of the meter (0-250). |
| Secondary address | (If using secondary addressing) The full secondary address of the meter, which typically includes manufacturer ID, device ID, medium, and version. |
| Data record | The specific data record within the meter's response to read. M-Bus meters can report multiple values (e.g., current reading, historical readings, flow rate, temperature). |
| Data type | The Mango data type for this point (typically Numeric for meter readings). |
Discovering Meters
M-Bus supports device scanning to discover meters on the bus:
- Primary address scan: Iterates through addresses 0-250, sending initialization requests to each. Meters that respond are listed as available.
- Secondary address scan: Uses wildcard matching to discover meters by their secondary addresses. This is slower but works when primary addresses are unknown or not configured.
Scanning a large M-Bus network can take several minutes, especially when scanning secondary addresses. The bus must be idle during scanning -- no other data source should be polling while a scan is in progress.
Common Patterns
Utility Sub-Metering
Deploy M-Bus meters on individual utility feeds (gas, water, electricity, heat) within a building and use the M-Bus data source to collect consumption data. Create dashboards showing per-tenant or per-zone consumption for billing, cost allocation, and efficiency monitoring.
District Heating Monitoring
M-Bus is the standard protocol for heat meters in district heating systems. Configure the data source to read energy consumption (kWh or MWh), flow rate, supply temperature, and return temperature from heat meters at each building connection point.
Water Consumption Tracking
Water meters with M-Bus interfaces can report cumulative consumption, flow rates, and leak detection alerts. Poll these meters to track usage patterns, detect unusual consumption (potential leaks), and generate billing data.
Multi-Meter Buildings
In buildings with multiple M-Bus meters on a single bus, configure all meters under one data source. Use primary addressing for simple networks (up to 250 devices) or secondary addressing when meters need to be identified by their serial numbers.
Battery-Powered Meter Considerations
Many M-Bus meters are battery-powered and have a limited communication budget. Configure the Update period conservatively (e.g., once per hour or once per day) to preserve battery life. Frequent polling can significantly reduce battery lifespan.
Troubleshooting
No Response from Meter
- Verify the physical wiring between the M-Bus master (level converter) and the meter. M-Bus uses a two-wire bus with specific polarity requirements.
- Check the Baud rate matches the meter's configuration. Try 2400 if unsure -- it is the most common M-Bus baud rate.
- Ensure the correct Serial port is selected and that no other application is using it.
- For TCP/IP connections, verify the gateway is accessible and the port is correct.
Wrong or Missing Values
- Verify the correct Data record is selected for the data point. M-Bus meters often contain multiple data records (current reading, previous month, maximum flow, etc.).
- Check the meter's documentation for the meaning of each data record index.
- Some meters require an initialization sequence before they respond with data. The data source handles this automatically, but very old meters may have compatibility issues.
Bus Contention
- Only one M-Bus master should be active on the bus at a time. If another system is polling the same bus, communication errors will occur.
- If running multiple M-Bus data sources on different serial ports connected to the same physical bus, ensure they do not poll simultaneously.
Scan Does Not Find All Meters
- Wiring issues: Meters that are too far from the master or connected through damaged cable may not respond to scan requests.
- Address conflicts: Two meters with the same primary address will cause collisions. Use secondary addressing to resolve conflicts.
- Battery-depleted meters: Battery-powered meters that have exhausted their battery will not respond to bus communications.
- Baud rate mismatch: Not all meters on a bus may be configured for the same baud rate. Try scanning at different baud rates.
Related Pages
- Data Sources Overview — General data source and data point concepts
- Serial Data Source — General-purpose serial communication for M-Bus wired connections
- OneWire Data Source — Another bus-based protocol for reading utility meters and environmental sensors
- Modbus Data Source — Alternative industrial protocol for metering devices with Modbus support