element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino Projects
  • Products
  • Arduino
  • Arduino Projects
  • More
  • Cancel
Arduino Projects
Blog Create own MBUS meters with Feather boards
  • Blog
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino Projects to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: hwhardsoft
  • Date Created: 27 Oct 2023 2:37 PM Date Created
  • Views 1689 views
  • Likes 6 likes
  • Comments 0 comments
Related
Recommended

Create own MBUS meters with Feather boards

hwhardsoft
hwhardsoft
27 Oct 2023
Feather based M-BUS meter

The M-BUS or "meter bus" field bus is the widely used standard for recording consumption values. M-BUS systems always consist of an M-BUS master, which collects the data from the connected consumption meters, which contain a corresponding slave interface.

Since the data transmission works physically different in both directions, different interfaces are needed for the master and the slaves. In this example I want to show how to create a simple M-BUS slave with the help of our M-BUS slave FeatherWings and a Feather microcontroller board. This can be useful if you want to provide your own measured values to an existing M-BUS master.

{gallery}My Gallery Title

REPLACE THIS TEXT WITH YOUR IMAGE

IMAGE TITLE: THEN IMAGE DESCRIPTION

REPLACE THIS TEXT WITH YOUR IMAGE

IMAGE TITLE: THEN IMAGE DESCRIPTION

REPLACE THIS TEXT WITH YOUR IMAGE

IMAGE TITLE: THEN IMAGE DESCRIPTIONimageimageimage

A typical installation might look like this:
image

I have created a code example for a simple slave. For the encryption of the individual data blocks I use the M-BUS payload library from Allwize.

Consumption values ​​can be added or edited in the Encode_Payload() function. In this example I simply used constants for the measured values to not need additional hardware for the demo. Of course you can replace these constants with real measured values in your own programs. Be careful with MBUS codes of the "Device" domain. This code does not work or is already contained in the header of the protocol.

You can view the structure of the header in mbusslave.cpp and change parameters, e.g. the manufacturer ID, if necessary.

The default baud rate, default bus address and id of the device can be adjusted in mbusslave.h.

The code was tested with the following feather boards:

  • Adafruit Feather Huzzah32
  • Adafruit Feather nRF52840
  • Adafruit Feather M0 Express
  • Sparkfun ESP32 Thing Plus
  • Sparkfun Thing Plus RP2040

For the test you need a MBUS master, which supplies the MBUS and can exchange data with the slave. For example you can use a Raspberry Pi with libmbus and our MBUS Master HAT.

Another possibility is to use a PC interface and a M-BUS Master simulator e.g. Lorus Free.

image

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube