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/

The wM-Bus or Wireless Meter Bus is a European standard (EN 13757-4) that defines communication between usability meters and data loggers, hubs or intelligent meter gates. Based on the M-Bus wireless bus, a new advanced measurement infrastructure (AMI) was developed to meet the needs of media meters across Europe. Several years have passed since M-Bus and sub-GHz wireless connections were introduced, but they are still evolving in response to changing environments and taking advantage of technological advances, including the emergence of the Internet of Things.

2.4 GHz band vs unlicensed bands

Wireless communication over long distances is a requirement for intelligent network devices. These frequencies are unlicensed and provide better radio wave propagation than 2.4 GHz. In Europe, the most common frequencies are 868 MHz, 434 MHz and 169 MHz. These unlicensed bands can be used to reach difficult areas, such as underground meters or the location of buildings with many walls and obstructions. In addition, utilities have lower solution costs when operating in the unlicensed band.

COVID-19 and wireless technologies

The use of wireless technologies during COVID-19 pandemic hazards is often a necessity, to prevent the virus from spreading. One of obvious choices for Internet of Things and home monitoring is Wireless M-Bus implementation.MODUINO series expansion options now include TECHBASE’s high-performance Wireless M-Bus module.

For low power applications using either the specifically allocated 169 MHz metering band or the 868 MHz ISM band, the module can be configured as an embedded micro system or simple data modem. For Industrial IoT applications, the device can be configured for interoperability in a WMBus network.

In terms of covered area and power consumption, the RF implementation ensures best-in-class performance. On the 169 MHz band, the output power can be increased up to +30 dBm (+27 dBm on the optimized version for maximum power efficiency) and up to +15 dBm on the 868 MHz band. The extremely reduced power consumption gives access to long lasting battery life requirements (up to 2 μA in sleep mode for wireless M-Bus modules with an RTC clock running).

It is possible to make Moduino devices equipped with a WMBus stack that Embit developed specifically for the ESP32 platform, allowing them to be integrated in any desired system, without effort, and simplifying interactions in WMBus networks.

The creators of the Pi-oT module returned to Kickstarter and launched a new module based on ESP32. Thanks to this, users familiar with Arduino programming or preferring lighter architecture can enjoy all the advantages of the IoT module for enterprises.

Pi-oT ESP module key features and specification:

  • Board – ESP32-DevKitC-D32 based on ESP32-WROOM-D32 module with ESP32 dual-core processor, 32Mbit SPI flash
  • Relays – 4x Panasonic SPDT relays controlled via GPIO pins
  • Screws terminals for
    • Relay outputs
    • 6x analog inputs configurable as GPIO if needed
    • 2x analog outputs configurable as GPIO if needed
    • 2x GPIO
    • 5V input, 3.3V, and GND
  • Power Supply – 5V input via terminal or Micro USB port?; 5V circuitry protection
  • Dimensions – DIN rail enclosure

Source: https://www.cnx-software.com/2020/05/04/pi-ot-esp-module-leverages-esp32-screw-terminals-iot-automation/

The ESP Module is a microcontroller based IoT Module which offers the same great features as our Pi-oT Module, but based off on an ESP32 platform. The ESP Module is powered by an ESP32 DEVKITC-32D microcontroller which is included in each reward.

Source: https://www.kickstarter.com/projects/pi-ot/esp-module

Additionally 10 GPIO pins are routed to the housing terminals to utilize the power of ESP32 in a wide range of applications. The flexibility of the ESP32s system allows easy configuration of 6 of these pins as analogue inputs and 2 as analogue outputs.

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

Amazon‚s website has introduced a Software Audio Front End (AFE) Development Kit section that lists software algorithms that optimize sound detection in noisy environments. The latest addition is the Amazon Alexa recently certified Espressif audio front end or ESP AFE algorithm for shorts.

The Espressif AFE algorithm was certified by Amazon after achieving excellent performance in long-range Alexa testing. In most cases, in low signal-to-noise scenarios, the wakeup rate reaches 100% and the speech recognition rate exceeds 90%.

Amazon-Qualified “Software Audio Front-End” Solution

Low resource consumption

Espressif’s AFE algorithms are optimized, as they take advantage of Espressif’s AI accelerator that is available in the ESP32-S3 SoC. Espressif’s AFE algorithms consume just 12-20% of CPU and around 460 KB of memory, including 220 KB of internal memory and 240 KB of external memory. This provides sufficient headroom for customer applications on the ESP32-S3 SoC.

Espressif’s AFE algorithms offer an easy and intuitive API for customer applications, so that their performance can change as dynamically as it is required. The distance between the two microphones can be between 20-80 mm, which allows considerable flexibility for the hardware design of developers’ end-products.

Source: https://www.espressif.com/en/solutions/audio-solutions/esp-afe

Industrial use of ESP32-based solutions

One of industrial IoT devices, supporting Espressif’s ESP32 technology is 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

Microsoft announced Windows 11 with new system requirements, including hardware with a TPM 2.0 chip. Altho not all computers, laptops, and tablets come with Trusted Platform Module (TPM), which can be a problem, especially if you need version 2.0.

According to a tweet from Shen Ye, Senior Director, Global Head of HTC Hardware Products, the price of TPM 2.0 has quadrupled, so while Windows 11 isn’t officially available yet, Microsoft has it legitimate, and the name is security.

Securing devices with Infineon industrial grade TPM

Infineon Technologies AG has unveiled a new security chip that defines the first TPM (Trusted Platform Module), designed specifically for industrial applications such as industrial computers, servers, industrial controllers and edge gates. The module protects confidential data in connected devices and reduces the risk of leakage of this information due to attacks, e.g. hackers.

The OPTIGA TPM SLM 9670 module protects the integrity of industrial systems and the identity of users using them. The system controls access to sensitive data at key locations in industrial environments, such as an automated factory. It also protects the cloud interface if the network uses one. The security system fully meets the TPM 2.0 standard developed by the Trusted Computing Group and is certified by an independent test laboratory in accordance with the criteria contained in this standard. The new module is meticulously controlled and certified by Infineon. Thanks to its use, it is possible to shorten the time of designing and introducing the device to the market, thanks to the ready security solution in the system.

The TPM system has a lifetime declared as 20 years. It allows programmers to perform firmware updates, which in turn enables them to meet the long-term security requirements in rapidly changing industrial environments. In this way, it can also reduce maintenance costs of industrial equipment thanks to secured remote software updates. The TPM chip will be available in serial production in the second half of 2019.

TPM 2.0 Key Features

  • Random Number Generator (RNG) according to NIST SP800-90A
  • TPM FW update functionality installed
  • 6962 Bytes of free NV memory
  • Full personalization with Endorsement Key (EK) and EK certificate
  • Up to 3 keys in the volatile memory
  • Up to 7 keys in the NV memory
  • Up to 8 NV counters
  • Support of various cryptographic algorithms:
    • RSA-1024 and RSA-2048
    • SHA-1 and SHA-256
    • ECC NIST P256
    • ECC BN256

Security chip implementation in Industrial IoT devices

With knowledge of latest Industrial IoT security measures, the choice of proper end-point conroller or gateway is much easier than you think. Some manufacturers can implement TPM 2.0 security chip in production process, to allow users to generate certification keys after purchase, maximizing security of their installations. TECHBASE offers wide range of solutions, optionally aided with TPM system.

For example, ESP-32 based solution, Moduino X series and eModGATE series products offer the support for such security measures. Read more in Industrial IoT Ecosystem brochure, to understand the importance of reliable and secure hardware for Industrial IoT.

Toit was founded in 2018 by a team of developers who built V8 for Chrome on Google in order to build a generic firmware for IoT devices that will replace the traditional development process. They offer a completely new feature set and a new Python-like programming language developed specifically for IoT. Toit is a high-level object-oriented language with a simple, easy-to-use Python-like syntax that is 20 times faster than MicroPython.

Key Features for Toit IoT Platform:

  • Light and efficient multitasking capabilities on an MCU, enabling complex IoT solutions to work on battery-powered devices.
  • A new high-level object-oriented programming language.
  • A publicly available gRPC API to have full control over your devices.
  • An MQTT-like PubSub API for communicating with other devices over the cloud.
  • Cellular connectivity with NB-IoT / CAT M-1 and out-of-the-box Wi-Fi support
    CLI and SDK support on Windows, macOS, and Linux.
  • VS Code extension for seamless integration with their platform, allowing for faster development.
  • No subscription or provisioning fees

Source: https://www.cnx-software.com/2021/08/06/iot-development-platform-comparision-toit-balena-particle-microsoft-azure-iot/

A look into the features of Toit programming language

Unlike other programming languages used for embedded systems, Toit is a language that was developed solely for IoT. So, it is a dedicated language for IoT that allows for better power management which is important for battery-based systems. Toit features an automatic memory management system which helps to avoid crashes. The new language also comes with a garbage collector, aiding the memory management system. Features like these are not available in traditional programming languages and might be a challenge implementing those using languages like C.

“With Toit, we wanted to create a high-level language that would avoid the limitations of the existing languages used in IoT development. On top of this, the Toit language had to be intuitive to learn and safe to use.” says the Toit team. The syntax of Toit is modern, simple and quite similar to Python. So, a Python developer can easily learn this new language within a few hours and deploy their first application within 15 minutes. Toit is an indentation based language just like Python and has no braces or semicolons. The files are saved with ‘.toit’ extensions and have a VS code language extension for a richer developing experience. So once you start developing with the Toit platform, there’s no coming back.

Source: https://opencloudware.com/toit-platform-redefines-the-way-we-implement-iot-applications/

Industrial use of ESP32-based solutions

One of industrial IoT devices, supporting Espressif’s ESP32 technology is 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

The M5Stack Core2 is an ESP32 IoT development kit with a 2-inch touchscreen, motion sensor, microphone and battery. The hardware is chosen by Amazon Web Services, with a few little things like adding secure components and the yellow colour that creates „AWS IoT EduKit” hardware and software solutions designed to“learn how to build IoT applications using AWS services through a prescriptive learning program”.

M5Stack Core2 for AWS IoT EduKit specifications:

  • SoC – Espressif ESP32-D0WDQ6-V3 dual-core Xtensa LX6 processor clocked at up to 240MHz with 520KB SRAM, Wi-Fi, and dual-mode Bluetooth connectivity
  • External Memory – 8MB PSRAM
  • Storage – 16MB flash storage, MicroSD card slot up to 16GB
  • Display – 2-inch IPS LCD screen with 320×240 resolution (ILI9342C driver), and touchscreen support (via FT6336U controller)
  • Audio – Built-in 1W speaker, SPM1423 PDM microphone, I2S codec, and power amplifier
  • Antenna – 2.4GHz 3D antenna
  • USB – 1x USB Type-C port for power and programming via CP2104 chip
  • Sensors – 6-axis IMU (MPU6886)
  • Expansion – 1x Grove connector with I2C, GPIO and UART, M-Bus socket
  • Security – ATECC608A Trust&GO secure element
  • Misc – Power LED, power button, reset button, 3x touch buttons, vibration motor, RTC, 10x RGB LEDs
  • Power Supply
    • Input Voltage – 5V @ 500mA
    • AXP192 PMU
    • SY7088 DC-DC Boost
    • 500 mAh/3.7V Lithium Battery
  • Dimensions – 54 x 54 x 24 mm (Plastic case)
  • Weight – 101 grams
  • Temperature Range – 0°C to 40°C

Source: https://www.cnx-software.com/2020/12/29/aws-iot-edukit-leverages-m5stack-core2-esp32-hardware/

A look into the features of Toit programming language

Unlike other programming languages used for embedded systems, Toit is a language that was developed solely for IoT. So, it is a dedicated language for IoT that allows for better power management which is important for battery-based systems. Toit features an automatic memory management system which helps to avoid crashes. The new language also comes with a garbage collector, aiding the memory management system. Features like these are not available in traditional programming languages and might be a challenge implementing those using languages like C.

“With Toit, we wanted to create a high-level language that would avoid the limitations of the existing languages used in IoT development. On top of this, the Toit language had to be intuitive to learn and safe to use.” says the Toit team. The syntax of Toit is modern, simple and quite similar to Python. So, a Python developer can easily learn this new language within a few hours and deploy their first application within 15 minutes. Toit is an indentation based language just like Python and has no braces or semicolons. The files are saved with ‘.toit’ extensions and have a VS code language extension for a richer developing experience. So once you start developing with the Toit platform, there’s no coming back.

Source: https://opencloudware.com/toit-platform-redefines-the-way-we-implement-iot-applications/

Industrial use of ESP32-based solutions

One of industrial IoT devices, supporting Espressif’s ESP32 technology is 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

The creators of the Pi-oT module returned to Kickstarter and launched a new module based on ESP32. Thanks to this, users familiar with Arduino programming or preferring lighter architecture can enjoy all the advantages of the IoT module for enterprises.

Pi-oT ESP module key features and specification:

  • Board – ESP32-DevKitC-D32 based on ESP32-WROOM-D32 module with ESP32 dual-core processor, 32Mbit SPI flash
  • Relays – 4x Panasonic SPDT relays controlled via GPIO pins
  • Screws terminals for
    • Relay outputs
    • 6x analog inputs configurable as GPIO if needed
    • 2x analog outputs configurable as GPIO if needed
    • 2x GPIO
    • 5V input, 3.3V, and GND
  • Power Supply – 5V input via terminal or Micro USB port?; 5V circuitry protection
  • Dimensions – DIN rail enclosure

Source: https://www.cnx-software.com/2020/05/04/pi-ot-esp-module-leverages-esp32-screw-terminals-iot-automation/

The ESP Module is a microcontroller based IoT Module which offers the same great features as our Pi-oT Module, but based off on an ESP32 platform. The ESP Module is powered by an ESP32 DEVKITC-32D microcontroller which is included in each reward.

Source: https://www.kickstarter.com/projects/pi-ot/esp-module

Additionally 10 GPIO pins are routed to the housing terminals to utilize the power of ESP32 in a wide range of applications. The flexibility of the ESP32s system allows easy configuration of 6 of these pins as analogue inputs and 2 as analogue outputs.

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

The wM-Bus or Wireless Meter Bus is a European standard (EN 13757-4) that defines communication between usability meters and data loggers, hubs or intelligent meter gates. Based on the M-Bus wireless bus, a new advanced measurement infrastructure (AMI) was developed to meet the needs of media meters across Europe. Several years have passed since M-Bus and sub-GHz wireless connections were introduced, but they are still evolving in response to changing environments and taking advantage of technological advances, including the emergence of the Internet of Things.

2.4 GHz band vs unlicensed bands

Wireless communication over long distances is a requirement for intelligent network devices. These frequencies are unlicensed and provide better radio wave propagation than 2.4 GHz. In Europe, the most common frequencies are 868 MHz, 434 MHz and 169 MHz. These unlicensed bands can be used to reach difficult areas, such as underground meters or the location of buildings with many walls and obstructions. In addition, utilities have lower solution costs when operating in the unlicensed band.

COVID-19 and wireless technologies

The use of wireless technologies during COVID-19 pandemic hazards is often a necessity, to prevent the virus from spreading. One of obvious choices for Internet of Things and home monitoring is Wireless M-Bus implementation.MODUINO series expansion options now include TECHBASE’s high-performance Wireless M-Bus module.

For low power applications using either the specifically allocated 169 MHz metering band or the 868 MHz ISM band, the module can be configured as an embedded micro system or simple data modem. For Industrial IoT applications, the device can be configured for interoperability in a WMBus network.

In terms of covered area and power consumption, the RF implementation ensures best-in-class performance. On the 169 MHz band, the output power can be increased up to +30 dBm (+27 dBm on the optimized version for maximum power efficiency) and up to +15 dBm on the 868 MHz band. The extremely reduced power consumption gives access to long lasting battery life requirements (up to 2 μA in sleep mode for wireless M-Bus modules with an RTC clock running).

It is possible to make Moduino devices equipped with a WMBus stack that Embit developed specifically for the ESP32 platform, allowing them to be integrated in any desired system, without effort, and simplifying interactions in WMBus networks.

Amazon‚s website has introduced a Software Audio Front End (AFE) Development Kit section that lists software algorithms that optimize sound detection in noisy environments. The latest addition is the Amazon Alexa recently certified Espressif audio front end or ESP AFE algorithm for shorts.

The Espressif AFE algorithm was certified by Amazon after achieving excellent performance in long-range Alexa testing. In most cases, in low signal-to-noise scenarios, the wakeup rate reaches 100% and the speech recognition rate exceeds 90%.

Amazon-Qualified “Software Audio Front-End” Solution

Low resource consumption

Espressif’s AFE algorithms are optimized, as they take advantage of Espressif’s AI accelerator that is available in the ESP32-S3 SoC. Espressif’s AFE algorithms consume just 12-20% of CPU and around 460 KB of memory, including 220 KB of internal memory and 240 KB of external memory. This provides sufficient headroom for customer applications on the ESP32-S3 SoC.

Espressif’s AFE algorithms offer an easy and intuitive API for customer applications, so that their performance can change as dynamically as it is required. The distance between the two microphones can be between 20-80 mm, which allows considerable flexibility for the hardware design of developers’ end-products.

Source: https://www.espressif.com/en/solutions/audio-solutions/esp-afe

Industrial use of ESP32-based solutions

One of industrial IoT devices, supporting Espressif’s ESP32 technology is 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