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 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.

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

Uploaded the script found on this url http://frack.nl/wiki/Stadsverwarming 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.
Code: Select all
#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);
}
}
Thanks everyone.
Controller: Domoticz
Server: Raspberry Pi