Skip to content

www.rolfje.com

Reading an ISKRA AM550 P1 Port with a Pi

Posted on 2020-01-18 By rolfje 3 Comments on Reading an ISKRA AM550 P1 Port with a Pi

Although I am the guy with a soldering iron and a bit of software development experience, I am not a fan of the “internet of things”, “smart meters” or smart anything really. Not because I don’t like technology, but because of the potential security and privacy problems it brings with it. That said, because of some unfortunate events I now have a smart meter my home. So when life gives you lemons, you make Pi!

I’ve got an AM550 Smart meter with a P1 port. Seeing all the online content and suggestions about reading your smart meter, I decided to have an hour of fun trying to read the P1 data. Here’s how I did it:

The P1 port on the AM550 sends serial data, but the signal is inverted. It is possible to invert that in software, but it is a kludge that requires some bit banging. Bringing the data in the right polarity and connecting it to the Rx serial input on the GPIO port is the cheapest and fastest way to go if you happen to have an RJ11 connenctor, a PNP transistor and a few resistors lying around. Here are my notes on how I wired the P1 to the Raspberry:

All that was left is reading the data from the serial port. Pin 10 maps to GPIO15 and happens to also be the Rx pin on the Raspberry Pi’s internal Serial adapter, which is available as a device at /dev/ttyAMA0 (I did not choose this pin by accident ;-). I wrote a simple Python script to read the serial port so I could change it to produce munin graphs later:

import serial
ser = serial.Serial(
   port='/dev/ttyAMA0',
   baudrate = 115200,
   parity=serial.PARITY_NONE,
   stopbits=serial.STOPBITS_ONE,
   bytesize=serial.EIGHTBITS,
   timeout=1
)
while True:
   print ser.readline()

When running this program, you should see a whole blob of text scroll by about every second or so. It is readable ASCII and can be parsed by many libraries out there. I tried a few but they were sometimes buggy, or sometimes overengineered and requiring a lot of external resources. So I wrote my own, very crude, parsing. It is not like the meter will be updated every week with new software and ssl certificates.

There are actually only a few lines in the output that interest me:

  • Lines starting with 1-0:1.7 contain the current power usage in Watts
  • Lines starting with 1-0:1.8.1 are the T1 (low tariff) meter reading in Watt-hours.
  • Lines starting with 1-0:1.8.2 are the T2 (high tariff) meter reading in Watt-hours.

A few lines of additional python gave me three separate munin plugins to produce the graphs I wanted. Here is a nice one showing the power usage of last week, split between high and low tariff.

This nice graph also shows one of the problems with smart meters: Given enough resolution, you can see at which times devices and lights are switched on. This can provide some interesting patterns, and enables anybody with access to your meter data to determine when you are home or on vacation. Of course there are some tricks to create constant or confusing usage patterns, I’m sure you’ll come up with something smart now that you can see the graphs.

You can find all three munin plugins in my munin-plugin repository, in the “plugin” folder. There may also be other interesting stuff there for you munin enthausiasts.

Have fun!

Electronics, Hardware, Software Tags:environment

Post navigation

Previous Post: Logging in with SSH certificates
Next Post: Voor uw eigen veligheid

Comments (3) on “Reading an ISKRA AM550 P1 Port with a Pi”

  1. blazeej says:
    2020-08-02 at 18:43

    First of all, great post, I found it very useful! Do you have any technical documentation of this smart meter communication protocol? I bought a cable with FTDI chip and it does the inversion (invert_RXD and invert_RTS flags are set to true). When I open the connection on my laptop using cu, the voltage on the 2nd pin (REQIN) goes from 0V to 5V, which should make the smart meter to start the transmission, but there’s no data. I tried different settings but I’m running out of ideas how to debug this further. So I thought maybe you’d have some tips or docs?

    Reply
    1. rolfje says:
      2020-10-01 at 17:45

      I googled for the specs of my meter, and I totally forgot to put it in the article, I don’t have the link anymore, I guess you have to google a bit.

      Reply
  2. Hallmar Gauti Halldorsson says:
    2021-08-11 at 17:52

    Hey! quick question, the produced serial data from the short example above, is it human readable? That is can I see the active power and so forth directly or would I have to translate OBIS codes?

    Could you maybe post an example of how the serial messages look like?

    Thanks!

    Reply

Leave a Reply Cancel reply

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

           

Recent Comments

  • rolfje on Methode Buijs uitgelegd
  • LinkedIn is at Peak Enshittifaction – Will Chatham's Blog on Linked-In not really Opt-in?
  • Hans j on 1N4148 diode as RF switch
  • Roaming Rhonda on DLNA on OSX, done right
  • Frans on How to fix a Krups XN2001 Nespresso machine

Tags

Anonimatron Apple backup design DIY DRM eclipse environment Fun gmail google hacking hamradio Hardware helicopter iphone ipod iTunes Java Keynote maven modelling motorcycle music news opinion oracle osx photo photography programming repair review security Software Steve Jobs T-Mobile technology Time Machine Ubuntu usability Utilities vacation windows Workshop

Categories

  • Apple (105)
  • Divorce (1)
  • Electronics (3)
  • Fun (57)
  • Games (7)
  • Hardware (72)
  • Microsoft (18)
  • Racing (14)
  • Software (134)
  • Uncategorized (65)
  • Workshop (20)

Archives

Copyright © 2025 www.rolfje.com.

Powered by PressBook WordPress theme