Skip to content

Demo (Raspberry Pi Image)

Mario C edited this page May 19, 2023 · 9 revisions

Introduction

We provide a customized Raspberry Pi image (based on Raspberry Pi OS) which contains a ready to use software for receiving and visualizing data from your smart meter. This image is thought as a demo and consist of the following parts:

  • Smart Meter Data Collector service
  • Smart Meter Data Collector Configuration web interface
  • Demo
    • mosquitto as a local MQTT broker to receive and distribute measurements from the Smart Meter Data Collector
    • Telegraf to receive measurements from the MQTT broker and forward them to InfluxDB
    • InfluxDB to store measurements
    • Grafana to visualize measurements

The following diagram illustrates this setup:

System overview

Setup Instructions

This setup allows the user to install the image on a Raspberry Pi and immediately get started with receiving data from the smart meter. The following steps are required:

  1. Download the Raspberry Pi image from the latest release.

  2. Flash the image on a (micro)SD card, using the Raspberry Pi Imager.

    • Since the version bullseye of Raspberry Pi OS no default user (e.g. pi) is available anymore and therefore needs to be created on first boot. Use the settings in the Raspberry Pi Imager to define this user in advance.
    • Optional: Additionally some settings (e.g. hostname, Wi-Fi SSID & password, SSH) can be applied to the image.
  3. Since the image does not contain a desktop environment, it is handy to set up the network directly on the SD card before the first boot of the Raspberry Pi. By default, the Raspberry Pi connects itself to the LAN over Ethernet or Wi-Fi and requires an IP address from the router (DHCP).

    • Ethernet:
      • Dynamic IP (DHCP): No further modifications are required. The Raspberry Pi receives an IP address from the local router if an RJ-45 cable is attached.
      • Static IP: If you want to set a specific IP address you require a running Linux distribution to be able to open the root partition of the SD card. Follow these instructions.
    • Wi-Fi:
      To connect the Raspberry Pi to a local Wi-Fi you need to provide the SSID and Wi-Fi password either using the optional Raspberry Pi Imager step as described above or by following these instructions.
      • Dynamic IP (DHCP): No further modifications are required. The Raspberry Pi receives an IP address from the local router when connected to the WLAN.
      • Static IP: Follow the same instructions as described above for "Ethernet -> Static IP" but set up the wlan0 interface instead.
  4. Prepare the Raspberry Pi.

    1. Push the (micro)SD card into the proper slot.
    2. Connect an RJ-45 cable if Ethernet is chosen for connectivity.
    3. Attach one or more smart meter dongles to the Raspberry Pis USB ports.
    4. Connect the power cable to the Micro USB port. The Raspberry Pi boots up now.
  5. After a few minutes, the Raspberry Pi has booted up and is ready for configuration. Depending on the chosen network connectivity, you need to find out the IP address the Raspberry Pi received by your router. Usually this is possible on the web interface of the router. You can also try to address the Raspberry Pi by its hostname using raspberrypi.local (or the hostname you specified using the Raspberry Pi Imager).

  6. Open the configuration web interface at http://<Raspberry Pi IP|Hostname>:8000/ in your favorite browser.

  7. Adjust the settings of the connected smart meter as explained in Configuration.

    Also verify that an MQTT sink is activated with the following configuration:

    • Host: localhost
    • Port: 1883
    • No TLS protected connection (unchecked)
    • No authentication (unchecked)

    A Logger Sink is optional.

    After deploying the configuration measurements sent by the smart meter should be forwarded to the demo applications.

  8. Open Grafana at http://<Raspberry Pi IP/Hostname>:3000/ in your favorite browser or use the Grafana link on the configuration web interface which directly opens a new browser window. Enter the default username admin and password admin and set a new password in the next window.

  9. On Grafana open the preinstalled dashboard, choose a time horizon and a refresh interval. Now, you are able to observe the measurements from your smart meter while they arrive periodically. The measurements are kept in the database for 7 days, you can therefore only inspect the data from the previous week. A second preinstalled Grafana dashboard called Schema Overview lists all the available smart meters and measurement type names.

Tweaking the Demo

InfluxDB Retention

By default the retention time of the InfluxDB is set to 7 days (i.e. data is only stored for 7 days and deleted afterwards) to avoid running out of free disk space. If you need to change the retention time of the InfluxDB so that the measurements are stored longer or shorter than 7 days, open an SSH connection to your Raspberry Pi and execute the following commands:

# opens a console
influx
# replace <duration> with e.g. 365d for a retention time of one year
ALTER RETENTION POLICY oneweek ON smartmeter DURATION <duration>

Grafana Dashboard

You are free to adjust the dashboard and other Grafana settings as you like. Your setup will be kept on the Raspberry Pi as long as you use this image version.

Export Dashboard

A Grafana dashboard can also be exported to your computer and later imported again if you choose to flash an updated version of the Raspberry Pi image. Please follow the instructions in the Grafana documentation.

Change Resolution

To change the resolution of the measurements in a Grafana dashboard edit the corresponding panel and modify the time(30s) in the matching query.