District Heating / City Heating (Stadsverwarming) Mysensor IR sender/Receiver



  • Hi guys,

    I've been looking for a while on internet to find a way to log the heating usage (District Heating) on my Kamstrup Multical 401. I have come across this thread https://www.domoticz.com/forum/viewtopic.php?f=31&t=5390&hilit=Stadsverwarming. This thread mentions the use of an IR convertor cable (25 euro see image below) and python script.

    alt text
    [img]http://www.smartmeterdashboard.nl/_/rsrc/1355181399073/webshop/IR Convertercable.jpg?height=181&width=200[/img]

    Since I've already been logging my energy and water usage using Mysensor pulse sensor, I though this might also work with the Kamstrup meter (Although I have not find any one on internet using Mysensor to log).

    So I bought this IR Transmitter and receiver [img]https://www.mysensors.org/light/ir.png[/img].

    Uploaded the script found on this url [url]http://frack.nl/wiki/Stadsverwarming[/url] to my arduino. Note that there is no Mysensors components in this script. I only use serial monitor of the ArduinoIDE to test if this works.

    I have set the baudrate to 300 and 1200. Unfortunately I did not get any feedback from the Kamstrup meter. I was wondering if anyone know if this IR transmitter will acturally communicate with the Kamstrup meter. Or am I really stuck with the IR converter cable.

    Thanks everyone.

    Controller: Domoticz
    Server: Raspberry Pi

    [code]
    #include <SoftwareSerial.h>
     
    const int LEDPIN   = 5;
    const int DIODEPIN = A1;
     
    SoftwareSerial mySerial(DIODEPIN, LEDPIN); // RX, TX
     
    long d;
     
    void setup() {
      pinMode(LEDPIN, OUTPUT);
      pinMode(DIODEPIN, INPUT);
      digitalWrite(DIODEPIN, LOW);
      Serial.begin(9600);
      d = millis() + 5000;
    }
     
    char ch;
    boolean rx;
     
    void rx300() {
      boolean done=false;
      mySerial.begin(300);
      mySerial.println("/?!");
      while (!done) {
        if (mySerial.available()) {
          ch = mySerial.read() & 0x7F;
          if (ch == 2) rx = true;
          else if (ch == 3) {
             rx = false;
             done = true;
          }
          else if (rx == true) 
            Serial.print(ch);
            //Serial.write(ch);
        }
      }
    }
     
    void rx1200(char k, long* val, char n) {
      boolean done=false;
      char str[12];
      char i=0, j=0;
      String req = "/#";
      req += k;
      mySerial.begin(300);
      mySerial.println(req);
      mySerial.begin(1200);
      while (n>0) {
        if (mySerial.available()) {
          ch = mySerial.read() & 0x7F;
          if (ch != 0x7F) {
            if (ch == 13) ch == 32;
            //Serial.print(ch);
            if (ch == 32) {
               str[j] = 0;
               *val = atol(str);
               j = 0;
               val++;
               i++;
               n--;
            } else str[j++] = ch;
          }
        }
      }
    }
     
    void loop() {
      long vala[10];
      if (d < millis()) {
        rx300();
        rx1200('1', vala, 10);
        Serial.print("energy [GJ]: ");
        Serial.println(vala[0]/100.0);
        Serial.print("water [m3]: ");
        Serial.println(vala[1]/100.0);
        Serial.print("hourcounter [j]: ");
        Serial.println(vala[2]);
        Serial.print("Tin [.C]: ");
        Serial.println(vala[3]/100.0);
        Serial.print("Tout [.C]: ");
        Serial.println(vala[4]/100.0);
        Serial.print("deltaT [.C]: ");
        Serial.println(vala[5]/100.0);
        Serial.print("power [kW]: ");
        Serial.println(vala[6]/10.0);
        Serial.print("flow [l/h]: ");
        Serial.println(vala[7]);
        Serial.print("peak power/flow [?]: ");
        Serial.println(vala[8]);
        Serial.print("info: ");
        Serial.println(vala[9]);
        while(1);
      }
    }[/code]```

  • Contest Winner

    Hello @Chakkie,

    I examined the example you provided. Maybe it's because I'm a bit tired. Just can't get used to the DLS. But I think it's not the best Arduino sketch I've ever seen. But the question is. Have you tried that one? Is it working? I see that the mySerial.begin() is called three times. I don't know if that's a good thing or not. Also the measuring starts after 5 seconds and I can see no reason it has to do that. And after one reading the sketch goes into an infinite loop.

    But if you've got that sketch working, MySensorfying is real easy.
    I also looked at the cable. The website is stating the following:
    Opmerking: Als er een IR poort op een meter aanwezig is, is die niet altijd geactiveerd. Dat is met zekerheid het geval bij "Flonidan Uniflo" slimme gasmeters (Enexis en Liander) en veel meters van netbeheerder Enexis.

    So it would be a good thing to check if it's a possibility that the IR led of your meter is inactive.



  • Hi @TheoL

    Thank you so much for your quick reply and pointing out that the IR port of the meter may not be active. Now I only have to find out if the IR port is active :).

    You mentioned that there is another sketch for reading the Kamstrup meter. May be I have to look around on internet. If you happen to know where I can find this sketch then it would be nice :). I will try to modify the sketch according to your advise. Hope this is going to work.

    Thanks again TheoL


  • Contest Winner

    Hi @Chakkie,

    I watched the sketch in the link you provided http://frack.nl/wiki/Stadsverwarming My comments where all about the sketch in that link.

    Also it's a good practice to change code lines like the following to #defines. It'll save memory usage in the arduino:
    const int LEDPIN = 5
    const int DIODEPIN = A1;

    Change that to:
    #define DIODEPIN 5
    #define DIODEPIN A1



  • First thing you can try to see if the IR is working is to point your smartphone camera at it. That should light up as if your looking into a flickering light bulb.
    There is also a possibility there is no module installed in your meter.

    As far as I can see you can always read the Kamstrup via M-bus, but those gateways are not really cheap.

    As a last resort there's always the solution with a cheap USB camera and some text-recognizing software. That will require some skill though.

    Good luck!


  • Admin

    @Chakkie

    The kamstrup meter might use a reed relay to shutdown their transmitter if there is no magnets detected in the reading eye. So maybe you should try and add a couple of magnets to your setup?

    A local hackerspace group here in Denmark is selling reading heads for about 14$, http://wiki.hal9k.dk/projects/kamstrup (Google translate might be able to make it into something readable, for non-danish people :))



  • @DavidZH
    Yes thank you so much. This a really nice tip. I have already tried using my phone camera to see if I'll get any response from the meter. Unfortunately no IR feeback.

    Via the M-Bus is not possible because the meter is sealed by the provider and opening the seal may get me in to trouble :).

    ThANKS



  • @tbowmo

    Wowww I did not know that this is a very nice info. I will definitely tried using a couple of magnets. Thank you so much for this info. Any the website you provides is pretty solide too. I've been looking on the internet for while and did not come across a hack like this one before.

    I am a step further thanks


Log in to reply
 

Suggested Topics

  • 5
  • 2
  • 2
  • 5
  • 1
  • 5

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts