Connect your M-Bus installations with Moduino ESP32

Moduino ESP32 is a compact, powerful and versatile IoT device that can be used for various industrial automation and control applications. One of the communication protocols it supports is the M-Bus (Meter-Bus) protocol. This protocol is used for communication between energy meters, heat cost allocators and other devices in the energy management and building automation systems.

In this article, we will discuss how to use Moduino ESP32 with the M-Bus protocol using RS-232 communication.

Requirements

  • Moduino ESP32
  • M-Bus devices (e.g energy meters)
  • RS-232 to RS-232 cable

Hardware Connections

  1. Connect the Moduino ESP32 to the M-Bus device using an M-Bus cable.
  2. Connect the Moduino ESP32 to a computer using an RS-232 to RS-232 cable.

Software Setup

  1. Download and install the Arduino IDE from the official website.
  2. Open the Arduino IDE and go to File -> Preferences.
  3. In the Additional Board Manager URLs field, add the following URL: https://dl.espressif.com/dl/package_esp32_index.json
  4. Go to Tools -> Board: -> Board Manager and search for “esp32”.
  5. Install the “ESP32 by Espressif Systems”.
  6. Go to Tools -> Board and select “ESP32 Dev Module”.
  7. Go to Sketch -> Include Library -> Manage Libraries.
  8. Search for “MBus library” and install it.

Code

  1. Create a new sketch in the Arduino IDE.
  2. Include the M-Bus library by adding the following line at the top of the sketch:
cCopy code#include <MBus.h>
  1. Define the M-Bus object and the serial port for communication:
scssCopy codeMBus mbus;
HardwareSerial mbusSerial(2);
  1. In the setup() function, initialize the serial port for communication and start the M-Bus:
scssCopy codevoid setup() {
  mbusSerial.begin(2400, SERIAL_8N1, 16, 17);
  mbus.begin(mbusSerial);
}
  1. In the loop() function, read the M-Bus data and print it to the serial monitor:
scssCopy codevoid loop() {
  if (mbus.available()) {
    MBusDataFrame data = mbus.read();
    Serial.println(data.toString());
  }
}
  1. Upload the code to the Moduino ESP32 using the Upload button in the Arduino IDE.

Conclusion

With the above steps, you have successfully set up Moduino ESP32 with the M-Bus protocol using RS-232 communication. This will allow you to communicate with M-Bus devices and receive data from them, which can be further processed for industrial automation and control applications.

Order Moduino X now: https://iiot-shop.com/product/moduino/

ModBerry 500-CM4 with ESP32 and Arduino for ultimate power management

Sleep functionality for ModBerry 500 CM4 devices

TECHBASE company designed an extended version of Raspberry Pi Compute Module 4 based devices, ModBerry 500-CM4-PM series for better power management in changing conditions of industrial applications. With the use of GPIO the module can manage boot, sleep mode or safe shutdown of the device in terms of unexpected drop in the power network with help of built-in ESP32 module and Arduino environment.

In the last few years developers marketed a wide range of ARM-based development boards, lacking in enhanced power management, especially sleep and wake up modes, commonly used in PC-grade computing. These boards are not adjusted for battery power supply, so it’s natural that sleep/wake functions should be implemented. In connection with the development of solutions based on Linux-SBC, key factor is adding sleep modes to any remote installation

ESP32 based addon module for Raspberry Pi

With built-in algorithms and the possibility to program on your own, the TECHBASE’s sleep/wake addon module can wake the device using a scheduler/timer. The module itself is based on ESP32-WROVER, used in the Moduino X series. ESP32 as a lightweight and low-powered solution is a perfect aid system for Raspberry Pi. Another option is wake on external triggers, e.g. change of input state, etc. All the options for sleep, shutdown and wake can be configured for various scenarios to ensure constant operation of devices, safety of data and continuity of work in case of power failure in any installation.

Sleep mode with additional power backup

Additional power management option for ModBerry devices is sleep functionality enhanced with SuperCap UPS energy backup device. This solution allows programming scenarios including the execution of chosen actions, in order to save data, send a notification and restart/shutdown the controller after completion.

Advanced power management solution

Most advanced configuration includes use of ESP32 module, known from the successful, lightweight Moduino X series, for extra logic for wake up / sleep scripts. This addon will allow the RaspberryPi-based ModBerry device to be woken up by the internal ESP32 controller

Moduino-ModBerry symbiosis allows a wide range of wake-up/sleep schedule customization, in order to perform best and save energy according to power supply state. Arduino and MicroPython environments provide libraries to control different scenarios of data and power management.

ModBerry 500-CM4-PM availability

The preliminary ModBerry 500-CM4-PM devices are available on request and delivery time will be specified by the Sales Dept. depending on the size of the project. Contact via email or Live Chat here: https://iiot-shop.com/