Hauke’s Projects

Playin' around with Electronics and Computers

Interfacing EasyMeter Q3M via Info-Interface

The installation of my fuel cell heating required a bi-directional power meter. Bonn Netz, my local power network provider, uses meters of type EasyMeter Q3M which have two infrared interfaces: A bidirectional D0 interface, and a read-only info interface. I use the info interface (INFO-DSS) to read out power consumption and production of the three phases. For this, I built an optical interface, a 3D printed housing for it, and use the UART of a Raspberry Pi with python to get the values.

The Power Meter

The EasyMeter Q3M’s documentation (in German) states that the infrared interfaces run at 9600,8,N,1 and use the protocol “Smart Meter Language” SML 1.03, which seems to be a pure German “Standard”. The bi-directional interface is sealed, so I could not access it, but the info interface is freely accessible from the front of the device.

Zähler
The EasyMeter Q3M

Unleashing the Full Power of the INFO-DSS Interface

When the power meter is delivered, it only outputs the summary energy consumption, but not the full set with the information on the individual phases. But the manual says that there is a PIN to unlock the full information set. I wrote an email to Bonn Netz and asked for the PIN, and they sent it out to me, professional in a sealed letter like an online banking PIN! Cool, thanks Bonn Netz! The PIN needs to be keyed in using a flashlight and moving it across a light sensor – a bit cumbersome, but a good idea to have a fully sealed housing and no mechanical parts. Worked very well in the end!

Info DSS
The Info DSS interface

Electronics

I started with the interface that Sven Jordan describes on his webpage (German), but I could not get the exact same components. With those I got, the signals coming out from the circuit, even after changing the resistors, were awful and did not register with the UART. So I used half the circiut that makes up the OptoLink adapter for my Viessmann heating, which works nicely. Here’s how I did it:

EasyMeter Circuit
EasyMeter infrared interface for the INFO-DSS

Parts add up to approximatly 1,- €. The IR phototransistor PT333-3C was the cheapest on stock at Conrad Bonn, so I took it – I guess more or less any IR phototransistor should work. From comparing a few datasheets, most are very similar in terms of specification, and the wavelength sensitivity covers such a broad window, that any should work.

And here’s how to connect it to the Raspberry Pi:

Circuit pin Function Raspberry GPIO pin Function
1 3.3 V 1 3.3 V
2 GND 6 GND
3 TxD 10 RxD

Starting now to make my own PCBs using the CNC mill in my Fabtotum Personal Fabricator, I advanced a bit in KiCad. Here’s what came out:

PCB simulated
The simulated PCB with parts

You can download the EasyMeter Interface KiCad files here.

Housing

Now having my own 3D printer, the aforementioned Fabtotum, I created a housing for the circuit:

EasyMeter Box
The housing for the interface board

The housing has the following features:

  • The KiCad designed PCB fits snugly into it, with the photo transistor matching up exactly with the IR emitter of the EasyMeter.
  • The bottom side has holes to match the fixation notches of the EasyMeter.
  • The bottom side has holes to put neodym magnets into which hold the box in place. However, the magnets I had (cylindrical with 5 mm diameter and 3 mm height) are barely strong enough, so perhaps you want to find stronger ones and modify the housing accordingly.
  • It has an outlet for a flat 4 wire telephone cable that can be put either on top or bottom of the housing.
  • Four 2 mm screws of 18 mm length with matching nuts hold everything together.

You may download the 3D model files for the housing here or from Thingiverse. I was a bit optimistic with regard to the notch and screw holes – I had to widen them with a drill. Perhaps you should modify them a bit before printing your own. By the way: I am totally surprised how well the 3D builder app that comes with Windows 10 works! It has a few nasty bugs, but all in all its surprisingly versatile and intuitive!

Interface Ready
The assembled interface

Software

As mentioned above, the meter “speaks” SML 1.03, which seems to be a German invention by the VDE. And personally I find it a rather crappy standard – I started to write a “generic” python implementation and gave up after half an hour, because a) the definition is over-complicated and b) the documentation is written in a *very* confusing way. So I followed the approach of Stefan Weigert (sorry, all in German) and just hard-coded the decodings. This is rather stupid and unflexible, but it does the job. Thanks to Stefan Weigert for publishing the code! The OBIS numbers used are explained in this document (you guessed it: in German…).

There is libSML, which is a generic implementation of SML written in C, and SMLlib for AVR, but I did not take the time to fiddle with these, since I am currently very python minded. There is also the Volkszähler project (surprise: German…) that’s worth a look if you want to do more.

So here is the code, based on Stefan Weigerts code from other smart meters:

In order for that to work you may need to modify the Raspberry Pi serial configuration as desribed in my OptoLink blog post.

Here’s a picture of the interface in place:

Interface in Place
The interface mounted to the meter

Final Remarks

My thanks go to Sven Jordan, Stefan Weigert, the authors of KiCad, Microsoft (sic!) for 3D builder, and to Bonn Netz!

22 thoughts on “Interfacing EasyMeter Q3M via Info-Interface

    1. Hi Stephan,
      my PIN would not work for your meter, they are assigned individually. I just PM’d you and sent you the details about how I got my PIN from Bonn Netz.
      Good luck!
      Hauke

  1. Note to myself: Just stumbled accross this page (surprise: in German…) – It seems that even my oldfashioned mechanic gas meter can be accessed “electronically” – new project born 🙂

  2. Hi Hauke,

    would be great if you could drop me a private mail on how you made your provider to hand out that pin.
    Thank’s in advance.

    Stephan

     

    1. Will do 🙂 But it’s basically as I wrote in the post: I e-mailed my provider, and received the PIN letter without much ado.

  3. Hi Hauke,
    wie sind denn Deine Erfahrungen im Dauerbetrieb? Ist die Infoschnittstelle (vorne am Gehäuse) wirklich sinnvoll und auf Dauer nutzbar? Warum ich frage: Im Wiki von volkszähler.org (https://wiki.volkszaehler.org/hardware/channels/meters/power/edl-ehz/easymeter_q3m) steht:
    “Die Infoschnittstelle liefert die Detailwerte NUR solange das Display mit PIN aktiv ist. Danach werden wieder nur die alten Werte geliefert. Besser also die MSB Schnittstelle nehmen, da funktioniert es dauerhaft nach PIN Eingabe und freischalten der Info-Funktion.”
    Die MSB-Schnittstelle ist ja oben am Gehäuse und mit einem Klebeband versehen, das entfernt werden muss.

    1. Hi Herbert,
      bei mir ist die Info-Schnittstelle seit ich die PIN eingegeben habe dauerhaft “offen”. Ich muss zwar einschränken, dass ich aktuell den Lesekopf nicht in Betrieb habe und mich evtl. irre, aber mit Eingabe der PIN hat sich auch die Basisanzeige des Zählers verändert, und das ist bis heute so.
      Die MSB-Schnittstelle ist bei mir auch zugeklebt, und ich zögere, das einfach zu entfernen. Ich bin mir unsicher, ob ich das einfach so darf.
      Viele Grüße
      Hauke

    2. Hallo Herbert!
      Ich habe heute erfolgreich mein Easymeter angezapft. Danke Hauke für diese Anleitung.
      Derzeit habe ich auch noch keinen “Code” für die ausführlichen Infos, habe aber eine Email an meinen Versorger geschickt.
      Sobald du den Code “eingeleuchtet” hast, gibt es zwei weitere Menüpunkte. Dort kannst du erstens die Codeabfrage abschalten und zweitens die erweiterten Infos auf “dauerhaft” einstellen. Das hat mir ein Kollege bestätigt und ich habe es auch in der Anleitung zum Easymeter gelesen.
      Viele Grüße

      1. denkste! Was bei meinem Kollegen funktioniert, ist bei mir nicht vorhanden.
        Leider waren bei mir die Menüpunkte zum dauerhften Abschalten der PIN oder zum dauerhaften Einschalten der erweiterten Infos ab Werk auskonfiguriert. Ich mußte dann den Fototransistor auch notgedrungen über die MSB-Schnittstelle ankoppeln, die sich auf der Oberseite befindet. Meinen vollständigen Bericht zur Realisierung gibt es hier:

        https://www.hgct.de/stromzaehler-easymeter-q3ma1020-auslesen

        Viele Grüße
        Jens

  4. Hallo Hauke,
    danke für den Beitrag. Er war eine Inspiration für mich. Ich habe auch so einen EasyMeter Q3M im Schaltkasten. Nachdem die bidirektionale Schnittstelle versiegelt ist, habe ich mich nicht weiter damit auseinandergesetzt. Aufgrund dieses Beitrags habe ich mich mit einer Taschenlampe bewaffnet und … der Zähler versteht mich. Dann habe ich meinen Netzbetreiber nach der PIN gefragt und … nach ein paar Tagen habe ich sie bekommen. Nach der Eingabe der Pin bleibt bei mir die zusätzliche Anzeige aktuell dauerhaft bestehen.
    Parallel habe ich mir die Bauteile besorgt und die Schaltung auf einem Steckbrett aufgebaut und … mit einer IR-Quelle funktioniert sie. Nächster Schritt ist die Schaltung an die Info-LED des Zählers zu bekommen und einen Raspi mit dem Programm zu beladen. Glücklicher Weise liegt noch ein Raspi in der Bastelkiste. Aktuell sind sie schwer zu bekommen.

    Hierzu eine Frage: Beim Versuch das Programm welches hier abgedruckt ist zu verstehen habe ich ein paar Fragezeichen:
    1) An welchem Pin erwartet der Raspi das Signal von der Info-LED?
    2) Was macht das Programm dann mit den Signal? Es wird encodiert und … kommt es zu einer Ausgabe der Werte die im Datenstrom liegen im Klartext auf der console?

    Gruß
    Eckart

    1. Hallo Eckart,

      bzgl. des Eingangspins ist die Zeile 196 im Code relevant:

      my_tty = serial.Serial(port='/dev/ttyAMA0', baudrate = 9600, parity =serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, timeout=0)

      Hier wird die serielle Schnittstelle ausgewählt, die verwendet werden soll. Bei älteren Raspberries gab es nur eine, der aktuelle Raspberry hat glaube ich 5. Wenn Du wie im Code beschrieben /dev/ttyAMA0 verwendest, dann musst Du den TxD-Ausgang der Info-DSS-Schaltung an Pin 10 des Raspberry (RxD) anschließen. Das ist der Standard-Serielle-Port.

      Das Programm entschlüsselt den Input der Info-DSS-Diode und stellt ihn lesbar auf dem Bildschirm dar. Das Programm ist in Python geschrieben, d.h. Du musst es in eine Datei auf dem Raspberry speichern (z.B. zaehler.py) und diese dann mit dem Kommando

      python zaehler.py

      aufrufen. Das Programm wartet dann auf Input von der seriellen Schnittstelle, versucht den zu dekodieren und stellt es lesbar dar. Und zwar so lange, wie Du willst – ggf. mit Ctrl+C abbrechen.

      Es ist evtl. möglich, dass python sich darüber beschwert, dass ihm Module fehlen – die muss man dann ggf. noch nachinstallieren. Falls Du da an Grenzen stößt, schreibe mich gerne an, dann helfe ich.

      Viel Erfolg!

      Hauke

      1. Danke für die Aufhellung. Ich bin jetzt eine Stufe weiter aber noch nicht beim Raspi. Ich habe die Schaltung nun auf einer Platine in einer Form die an den Zähler passt. Bevor ich nun mit dem Raspi auswerte, möchte ich sicher sein, dass es am Zähler funktioniert. (“Weniger Unbekannte”). Mit der Handykamera sehe ich, dass die Info-LED mit ca. 1 Hz blinkt. Aber aus meiner Schaltung kommt aber nix raus. Wenn ich den IR-Transistor mit einer Fernbedienung “beleuchte” sehe ich das die Schaltung funktioniert. Hast du eine Idee, warum meine Info-LED keine Reaktion auslöst?

        1. Der Fehler lag in meinem Schaltungsaufbau. Die Schaltung war scheinbar komplex genug um einen Fehler einzubauen. Der Fehler führte dazu, dass es teilweise funktionierte. Was mich zur Vermutung brachte, dass speziell die Info-LED nicht erkannt wird. Das war aber nicht der Fall. Wenn man deine Schaltung richtig aufbaut, funktioniert es auch an meiner Info-LED.
          Jetzt komme ich zum nächsten Schritt, Raspi in Betrieb nehmen und anschliessen…

          1. Gut zu hören – ich hatte noch keine Zeit, über Deine letzte Anfrage nachzudenken, von daher: Um so besser dass es nun geht 🙂

  5. Gut, nun habe ich einen Raspi 2 mit aktuellem Betriebssystem versorgt und habe das Script von deiner Seite in meinen Heimatordner auf dem Pi kopiert. Ich gehe davon aus, dass es ein Python3 Script ist? Also starte ich es mit “python3 zaehler_auslesen.py”. Wenn ich dies tue, kommt diese Fehlermeldung:

    File “/home/pi/zaehler_auslesen.py”, line 201
    except Exception, e:

    Kannst du mir sagen, was ich hier falsch gemacht habe? Grundsätzlich scheint er den Code ja bis Zeile 201 schon mal zu mögen…

    1. Ist glaube ich noch für Python 2 geschrieben, ich habe erst recht spät auf Python 3 umgestellt.. Probier’s mal mit “python zaehler_auslesen.py”.

  6. Den beschriebenen Fehler habe ich bei diesen Aufrufen:
    “python3 zaehler_auslesen.py”
    “python zaehler_auslesen.py”

    beim diesem Aufruf:
    “python2 zaehler_auslesen.py”

    kommt diese Fehlermeldung:

    Traceback (most recent call last):
    File “zaehler_auslesen.py”, line 9, in
    import serial
    ImportError: No module named serial

    Ich habe den Eindruck, wenn ich “python” verwende startet er “python3”. Nur wenn ich explizit “python2” verwende startet er “python2”. Ist das vielleicht eine Voreinstellung per Installation?

    – Unterscheiden sich python2 und python3 relevant bezogen auf dein Programm?
    – muss das Programm in einem bestimmten Ordner liegen? Bei mir liegt es im Home…

    1. mein Verdacht bestätigt sich:
      python2 –version ergibt 2.7.18
      python3 –version ergibt 3.9.2
      python –version ergibt 3.9.2

      dein Programm ist definitiv ein python2 programm. Wenn ich es aber – wie oben beschrieben – mit python2 starte findet er schon das Modul “serial” nicht. Ist dieses Modul für python2 und python3 unteschiedlich? Sorry, wenn ich dich mich diesem Kinderkram nerve. Soll ich auf Englisch weiter schreiben, damit mehr Leser war davon haben?

      1. Englisch/Deutsch: Wie Du magst – da die Diskussion nun schon in Deutsch läuft, bleiben wir vielleicht dabei.
        OK, mit Freude sehe ich, dass python3 inzwischen der Standard ist im Raspberry OS – das war überfällig.
        Zur Fehlermeldung in python2: es fehlt das serial-Modul für python 2. Du musst folgendes machen:
        sudo apt install python-serial
        Alternativ musst Du das Programm nach Python 3 portieren, das ist vermutlich gar nicht so schwer, aber mit etwas Forschungsaufwand verbunden, wenn Du das noch nie gemacht hast. Evtl.ist es aber auch ganz einfach – ändere Zeile 201 nach
        except Exception as e:
        Kannst ja mal gucken, ob es dann in Python 3 läuft.

        1. Hi Hauke,
          ok, danke für die weiteren Anregungen. Den Versuch mit
          > except Exception as e:
          hatte ich schon probiert. Leider fällt das Programm dann auf die Bretter wenn es zu einer Variablenumwandlung kommt. str-Variablen sind scheinbar auch eine “der” Unterschiede zwischen python2 + python3.
          Also habe ich es doch mit dem Ansatz probiert auf mein aktuelles Pi OS python2 und dieses modul serial zu bekommen. Alle Versuche ohne Erfolg. Er findet das Modul nicht.
          Dein Ansatz mit
          > sudo apt install python-serial
          führt leider auch nur zu einer Fehlermeldung:
          “Package python-serial is not available, but is referred to by another package.
          This may mean that the package is missing, has been obsoleted, or
          is only available from another source”

          Ich glaube ich brauche jetzt etwas Ablenkung… Vielleicht versuche ich es mal mit “p2to3.py”. Vielleicht komme ich so zu einem Skript in python3 syntax…

          1. Jetzt war ich neugierig… Das Problem scheint nicht das str() zu sein, sondern das hex-Encoding – siehe hier auf Stackoverflow. Im Stackoverflow-Artikel sind auch Alternativen benannt.
            In der aktuellen Bullseye-Disto scheint das phython2-serial-Paket anders zu heißen. Im Zweifelsfall statdessen so installieren:
            pip2 install pyserial
            Ich bevorzuge apt/Debian packages, aber wenn es nicht anders geht, dann eben pip…

  7. Meine Versuche mit “pip2 install pyserial” und auch mit “2to3.py” waren auch nicht von Erfolg gekrönt. Darum habe ich einen radikalen Schritt gemacht und bin von dem python2 programm weg. Ich habe mich ein paar Abstraktionsschichten noch oben bewegt und ioBroker auf dem Raspi installiert. Dort gibt es fertige Module für meinen Stromzähler mit Info-LED. Und … flups ich kann meinen Zähler auslesen.
    Mein Setup ist jetzt dein Lesekopf an einem Raspberry 2 und ioBroker. Nun folgen SQL-Datenbank, speichern der Werte und dann die Visualisierung. Danke für die Unterstützung!
    Gruß Eckart

Leave a Reply to Hauke Cancel reply

Your email address will not be published. Required fields are marked *

Scroll to top