{"id":791,"date":"2023-02-01T12:31:04","date_gmt":"2023-02-01T11:31:04","guid":{"rendered":"https:\/\/blog.techbase.eu\/en\/?p=791"},"modified":"2023-02-01T12:31:04","modified_gmt":"2023-02-01T11:31:04","slug":"connect-your-m-bus-installations-with-moduino-esp32","status":"publish","type":"post","link":"https:\/\/blog.techbase.eu\/en\/connect-your-m-bus-installations-with-moduino-esp32\/","title":{"rendered":"Connect your M-Bus installations with Moduino ESP32"},"content":{"rendered":"\n<p>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 <strong><a href=\"https:\/\/iot-industrial-devices.com\/meter-monitoring-during-pandemic-wireless-m-bus\/\">M-Bus (Meter-Bus) <\/a><\/strong>protocol. This protocol is used for communication between energy meters, heat cost allocators and other devices in the energy management and building automation systems.<\/p>\n\n\n\n<p>In this article, we will discuss how to use <strong><a href=\"https:\/\/iot-industrial-devices.com\/moduino-x-with-esp32-wrover-b-now-available-for-purchase-2\/\">Moduino ESP32<\/a><\/strong> with the M-Bus protocol using RS-232 communication.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Requirements<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Moduino ESP32<\/li>\n\n\n\n<li>M-Bus devices (e.g energy meters)<\/li>\n\n\n\n<li>RS-232 to RS-232 cable<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Hardware Connections<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Connect the Moduino ESP32 to the M-Bus device using an M-Bus cable.<\/li>\n\n\n\n<li>Connect the Moduino ESP32 to a computer using an RS-232 to RS-232 cable.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Software Setup<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Download and install the Arduino IDE from the official website.<\/li>\n\n\n\n<li>Open the Arduino IDE and go to File -&gt; Preferences.<\/li>\n\n\n\n<li>In the Additional Board Manager URLs field, add the following URL: <a href=\"https:\/\/dl.espressif.com\/dl\/package_esp32_index.json\">https:\/\/dl.espressif.com\/dl\/package_esp32_index.json<\/a><\/li>\n\n\n\n<li>Go to Tools -&gt; Board: -&gt; Board Manager and search for &#8220;esp32&#8221;.<\/li>\n\n\n\n<li>Install the &#8220;ESP32 by Espressif Systems&#8221;.<\/li>\n\n\n\n<li>Go to Tools -&gt; Board and select &#8220;ESP32 Dev Module&#8221;.<\/li>\n\n\n\n<li>Go to Sketch -&gt; Include Library -&gt; Manage Libraries.<\/li>\n\n\n\n<li>Search for &#8220;MBus library&#8221; and install it.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Code<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Create a new sketch in the Arduino IDE.<\/li>\n\n\n\n<li>Include the M-Bus library by adding the following line at the top of the sketch:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\">cCopy code<code>#include &lt;MBus.h&gt;\n<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\" start=\"3\">\n<li>Define the M-Bus object and the serial port for communication:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\">scssCopy code<code>MBus mbus;\nHardwareSerial mbusSerial(2);\n<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\" start=\"4\">\n<li>In the setup() function, initialize the serial port for communication and start the M-Bus:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\">scssCopy code<code>void setup() {\n  mbusSerial.begin(2400, SERIAL_8N1, 16, 17);\n  mbus.begin(mbusSerial);\n}\n<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\" start=\"5\">\n<li>In the loop() function, read the M-Bus data and print it to the serial monitor:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\">scssCopy code<code>void loop() {\n  if (mbus.available()) {\n    MBusDataFrame data = mbus.read();\n    Serial.println(data.toString());\n  }\n}\n<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\" start=\"6\">\n<li>Upload the code to the Moduino ESP32 using the Upload button in the Arduino IDE.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion <\/h2>\n\n\n\n<p>With the above steps, you have successfully set up <strong><a href=\"https:\/\/iiot-shop.com\/product\/moduino\/\">Moduino ESP32<\/a><\/strong> 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.<\/p>\n\n\n\n<p>Order <strong>Moduino X <\/strong>now: <a href=\"https:\/\/iiot-shop.com\/product\/moduino\/\"><strong>https:\/\/iiot-shop.com\/product\/moduino\/<\/strong><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.techbase.eu\/en\/connect-your-m-bus-installations-with-moduino-esp32\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Connect your M-Bus installations with Moduino ESP32&#8221;<\/span><\/a><\/p>\n","protected":false},"author":4,"featured_media":792,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[168],"tags":[170,354,172,326,212,355,138,169],"class_list":["post-791","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-moduino","tag-arduino","tag-arduino-ide","tag-esp32","tag-esp32-module","tag-esp32-wrover-b","tag-espressif-systems","tag-m-bus","tag-moduino"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Connect your M-Bus installations with Moduino ESP32 - TECHBASE Group - Industrial Raspberry Pi &amp; ESP32 devices<\/title>\n<meta name=\"description\" content=\"Moduino ESP32 is a compact, powerful and versatile IoT device that can be used for various M-Bus automation and control applications.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.techbase.eu\/en\/connect-your-m-bus-installations-with-moduino-esp32\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Connect your M-Bus installations with Moduino ESP32 - TECHBASE Group - Industrial Raspberry Pi &amp; ESP32 devices\" \/>\n<meta property=\"og:description\" content=\"Moduino ESP32 is a compact, powerful and versatile IoT device that can be used for various M-Bus automation and control applications.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.techbase.eu\/en\/connect-your-m-bus-installations-with-moduino-esp32\/\" \/>\n<meta property=\"og:site_name\" content=\"TECHBASE Group - Industrial Raspberry Pi &amp; ESP32 devices\" \/>\n<meta property=\"article:published_time\" content=\"2023-02-01T11:31:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/blog.techbase.eu\/en\/wp-content\/uploads\/2023\/02\/mx7.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"900\" \/>\n\t<meta property=\"og:image:height\" content=\"900\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"techbase\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"techbase\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blog.techbase.eu\/en\/connect-your-m-bus-installations-with-moduino-esp32\/\",\"url\":\"https:\/\/blog.techbase.eu\/en\/connect-your-m-bus-installations-with-moduino-esp32\/\",\"name\":\"Connect your M-Bus installations with Moduino ESP32 - TECHBASE Group - Industrial Raspberry Pi &amp; ESP32 devices\",\"isPartOf\":{\"@id\":\"https:\/\/blog.techbase.eu\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/blog.techbase.eu\/en\/connect-your-m-bus-installations-with-moduino-esp32\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/blog.techbase.eu\/en\/connect-your-m-bus-installations-with-moduino-esp32\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/blog.techbase.eu\/en\/wp-content\/uploads\/2023\/02\/mx7.jpg\",\"datePublished\":\"2023-02-01T11:31:04+00:00\",\"dateModified\":\"2023-02-01T11:31:04+00:00\",\"author\":{\"@id\":\"https:\/\/blog.techbase.eu\/en\/#\/schema\/person\/e2f9571d6746e802bfb3632109805359\"},\"description\":\"Moduino ESP32 is a compact, powerful and versatile IoT device that can be used for various M-Bus automation and control applications.\",\"breadcrumb\":{\"@id\":\"https:\/\/blog.techbase.eu\/en\/connect-your-m-bus-installations-with-moduino-esp32\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blog.techbase.eu\/en\/connect-your-m-bus-installations-with-moduino-esp32\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/blog.techbase.eu\/en\/connect-your-m-bus-installations-with-moduino-esp32\/#primaryimage\",\"url\":\"https:\/\/blog.techbase.eu\/en\/wp-content\/uploads\/2023\/02\/mx7.jpg\",\"contentUrl\":\"https:\/\/blog.techbase.eu\/en\/wp-content\/uploads\/2023\/02\/mx7.jpg\",\"width\":900,\"height\":900},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/blog.techbase.eu\/en\/connect-your-m-bus-installations-with-moduino-esp32\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/blog.techbase.eu\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Connect your M-Bus installations with Moduino ESP32\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/blog.techbase.eu\/en\/#website\",\"url\":\"https:\/\/blog.techbase.eu\/en\/\",\"name\":\"TECHBASE Group - Industrial Raspberry Pi &amp; ESP32 devices\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/blog.techbase.eu\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/blog.techbase.eu\/en\/#\/schema\/person\/e2f9571d6746e802bfb3632109805359\",\"name\":\"techbase\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/blog.techbase.eu\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/5bb9f6b44e733ba32ba6cbe2c144554b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/5bb9f6b44e733ba32ba6cbe2c144554b?s=96&d=mm&r=g\",\"caption\":\"techbase\"},\"url\":\"https:\/\/blog.techbase.eu\/en\/author\/techbase\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Connect your M-Bus installations with Moduino ESP32 - TECHBASE Group - Industrial Raspberry Pi &amp; ESP32 devices","description":"Moduino ESP32 is a compact, powerful and versatile IoT device that can be used for various M-Bus automation and control applications.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.techbase.eu\/en\/connect-your-m-bus-installations-with-moduino-esp32\/","og_locale":"en_GB","og_type":"article","og_title":"Connect your M-Bus installations with Moduino ESP32 - TECHBASE Group - Industrial Raspberry Pi &amp; ESP32 devices","og_description":"Moduino ESP32 is a compact, powerful and versatile IoT device that can be used for various M-Bus automation and control applications.","og_url":"https:\/\/blog.techbase.eu\/en\/connect-your-m-bus-installations-with-moduino-esp32\/","og_site_name":"TECHBASE Group - Industrial Raspberry Pi &amp; ESP32 devices","article_published_time":"2023-02-01T11:31:04+00:00","og_image":[{"width":900,"height":900,"url":"https:\/\/blog.techbase.eu\/en\/wp-content\/uploads\/2023\/02\/mx7.jpg","type":"image\/jpeg"}],"author":"techbase","twitter_misc":{"Written by":"techbase","Estimated reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/blog.techbase.eu\/en\/connect-your-m-bus-installations-with-moduino-esp32\/","url":"https:\/\/blog.techbase.eu\/en\/connect-your-m-bus-installations-with-moduino-esp32\/","name":"Connect your M-Bus installations with Moduino ESP32 - TECHBASE Group - Industrial Raspberry Pi &amp; ESP32 devices","isPartOf":{"@id":"https:\/\/blog.techbase.eu\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blog.techbase.eu\/en\/connect-your-m-bus-installations-with-moduino-esp32\/#primaryimage"},"image":{"@id":"https:\/\/blog.techbase.eu\/en\/connect-your-m-bus-installations-with-moduino-esp32\/#primaryimage"},"thumbnailUrl":"https:\/\/blog.techbase.eu\/en\/wp-content\/uploads\/2023\/02\/mx7.jpg","datePublished":"2023-02-01T11:31:04+00:00","dateModified":"2023-02-01T11:31:04+00:00","author":{"@id":"https:\/\/blog.techbase.eu\/en\/#\/schema\/person\/e2f9571d6746e802bfb3632109805359"},"description":"Moduino ESP32 is a compact, powerful and versatile IoT device that can be used for various M-Bus automation and control applications.","breadcrumb":{"@id":"https:\/\/blog.techbase.eu\/en\/connect-your-m-bus-installations-with-moduino-esp32\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.techbase.eu\/en\/connect-your-m-bus-installations-with-moduino-esp32\/"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/blog.techbase.eu\/en\/connect-your-m-bus-installations-with-moduino-esp32\/#primaryimage","url":"https:\/\/blog.techbase.eu\/en\/wp-content\/uploads\/2023\/02\/mx7.jpg","contentUrl":"https:\/\/blog.techbase.eu\/en\/wp-content\/uploads\/2023\/02\/mx7.jpg","width":900,"height":900},{"@type":"BreadcrumbList","@id":"https:\/\/blog.techbase.eu\/en\/connect-your-m-bus-installations-with-moduino-esp32\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blog.techbase.eu\/en\/"},{"@type":"ListItem","position":2,"name":"Connect your M-Bus installations with Moduino ESP32"}]},{"@type":"WebSite","@id":"https:\/\/blog.techbase.eu\/en\/#website","url":"https:\/\/blog.techbase.eu\/en\/","name":"TECHBASE Group - Industrial Raspberry Pi &amp; ESP32 devices","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.techbase.eu\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/blog.techbase.eu\/en\/#\/schema\/person\/e2f9571d6746e802bfb3632109805359","name":"techbase","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/blog.techbase.eu\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/5bb9f6b44e733ba32ba6cbe2c144554b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5bb9f6b44e733ba32ba6cbe2c144554b?s=96&d=mm&r=g","caption":"techbase"},"url":"https:\/\/blog.techbase.eu\/en\/author\/techbase\/"}]}},"_links":{"self":[{"href":"https:\/\/blog.techbase.eu\/en\/wp-json\/wp\/v2\/posts\/791","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.techbase.eu\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.techbase.eu\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.techbase.eu\/en\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.techbase.eu\/en\/wp-json\/wp\/v2\/comments?post=791"}],"version-history":[{"count":1,"href":"https:\/\/blog.techbase.eu\/en\/wp-json\/wp\/v2\/posts\/791\/revisions"}],"predecessor-version":[{"id":793,"href":"https:\/\/blog.techbase.eu\/en\/wp-json\/wp\/v2\/posts\/791\/revisions\/793"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.techbase.eu\/en\/wp-json\/wp\/v2\/media\/792"}],"wp:attachment":[{"href":"https:\/\/blog.techbase.eu\/en\/wp-json\/wp\/v2\/media?parent=791"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.techbase.eu\/en\/wp-json\/wp\/v2\/categories?post=791"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.techbase.eu\/en\/wp-json\/wp\/v2\/tags?post=791"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}