กลับไปหน้ารวมไฟล์
smartmetering-with-portenta-h7-654fd5-en.md

Due to rising prices for oil, gas and heat as well as climate change, it is becoming more and more important to monitor energy consumption in order to keep an eye on energy costs, but also to be able to check the effectiveness of savings. Many meters for oil and gas, but also for water, are equipped with a special bus system, the M-BUS or meter bus, for monitoring consumption values.

This article describes how such meters can be read out via the M-BUS interface using a special M-BUS MKR Shield connected to an Arduino Portenta H7 running MicroPython.

M-BUS installation with Arduino M-BUS Shield

Install MicroPython on Portenta

In addition to C++ programming via the Arduino IDE, the Arduino Portenta can also run MicroPython scripts. In order to be able to use MicroPython on the Portenta board, the OpenMV IDE must be installed on your computer and then the MicroPython interpreter must be set up on the Portenta via OpenMV.

Please follow this tutorial to install OpenMV on your system.

Install the Meterbus library & examples

After successfully setting up OpenMV on your computer and the Portenta, a new drive will appear on your computer that stores the MicroPython scripts on the Portenta.

The MicroPython code from our GITHUB repository is now copied to this drive, including the subdirectory.

Since MicroPython does not contain any floating-point libraries, the 'mpy_decimal' directory must also be copied from the micropython-decimal-number repository.

Portenta drive with files and subfolders

Running the examples

Our code includes 3 example scripts. You can open these scripts via OpenMV IDE. Please ensure that the Portenta configuration lines are properly enabled/disabled in these examples:

disable the Pico lines and enable the Portenta lines

Don't forget to activate the terminal window below. Now you can run any of these 3 examples in OpenMV by pressing the green arrow button in the lower left corner:

Terminal Window output

EXPANDED TECHNICAL DETAILS

Industrial-Grade Energy Diagnostics

Leveraging the dual-core power of the Arduino Portenta H7, this project is a high-speed energy auditing tool for smart grid applications.

  • High-Fidelity Signal Processing: The H7's M7 core (480MHz) performs real-time RMS (Root Mean Square) calculations and Fast Fourier Transforms (FFT) on incoming current and voltage data to measure power factor and harmonic distortion.
  • Non-Invasive Current Sensing: Uses SCT-013 current transformer clamps to measure AC current without breaking the circuit.

Edge Machine Learning

  • Anomaly Detection: (Advanced version) Utilizing the H7's AI capabilities, the system identifies the "Electronic Signature" of different appliances, allowing for a detailed breakdown of which machines are consuming the most energy even if they are on the same circuit.

ข้อมูล Frontmatter ดั้งเดิม

title: "Smartmetering with Portenta H7"
description: "Use the Portenta H7 for smartmetering via MicroPython and Arduino MKR M-BUS shield"
author: "hwhardsoft"
category: ""
tags:
  - "energy efficiency"
  - "greener planet"
  - "monitoring"
views: 3436
likes: 0
price: 699
difficulty: "Intermediate"
components:
  - "1x Arduino Portenta H7"
  - "1x M-BUS MKR Shield"
tools: []
apps:
  - "1x OpenMV IDE"
downloadableFiles:
  - "https://github.com/mpy-dev/micropython-decimal-number"
  - "https://github.com/HWHardsoft/micropyMeterBus"
  - "https://github.com/mpy-dev/micropython-decimal-number"
documentationLinks: []
passwordHash: "fa64bc11d9c21725e5aef55c05ff767d7d73398bffe51cf627fdead5526468a8"
encryptedPayload: "U2FsdGVkX1+WF5hCvLUrrtElGJR5hBjqJO3aFklXEE1oFf3tX2qX84UT9pLxfeRQVJhELAJrPPgX1SUL+Yf2OFfxMDGmJC+Uz1puW43EajA="
seoDescription: "Learn how to use Portenta H7 for smartmetering with MicroPython and Arduino MKR M-BUS shield for efficient energy management."
videoLinks: []
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/smartmetering-with-portenta-h7-654fd5_cover.jpg"
lang: "en"