Wpisy

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/

Mannie Peterson (aka FellFromTree) developed an embedded operating system called HeliOS, which is specifically designed for 8-bit and 32-bit Arduino boards and is easy to use with the Arduino IDE. HeliOS is said to only have 21 function calls and implements collaboration, event driven multitasking, task notification / messaging, timers, and memory management.

How does HeliOS work?

HeliOS was written with hobbyists, enthusiasts and researchers in mind who want more functionality than what existing task schedulers offer yet want to avoid the size and complexity of an RTOS. HeliOS has only 21 function calls and implements a wide variety of functionality including cooperative multitasking (run-time balanced), event driven multitasking, task notification/messaging, timers and managed memory. Not only is HeliOS easy to use, it is conveniently available through the Arduino IDE Library Manager or from GitHub as a ZIP file and has out-of-the-box support for Arduino AVR, SAM, SAMD and ESP8266. Either way, HeliOS is compliant with Arduino’s 1.5 (rev 2.2) Library Manager Specifications so getting started is a snap!

Source: https://create.arduino.cc/projecthub/FellFromTree/helios-embedded-operating-system-e311bf

Industrial use of LoRa & ESP32-based solutions

One of industrial IoT devices, supporting LoRa wireless technology is ESP32 based eModGATE from TECHBASE. Economical, ESP32-based solution can serve as an end-point in any installation or works well as a gateway, gathering data from scattered sensor mesh across the installation. For more information and also Raspberry Pi based solutions check Industrial IoT Shop with all the configuration options for eModGATE.

eModGATE with ESP32