Reading the P1 port of a NTA8130 Dutch Smart Meter

Forum about Smart meters for Energy, Gas and Water and all related

Re: Reading the P1 port of a NTA8130 Dutch Smart Meter

Postby Bwired » Fri Jun 15, 2012 8:20 pm

pjanssen wrote:I got a PM from pietervanharen but i am not able to replay. Too less posts i guess.

your a full member now, able to PM, but try to put as much as possible on the forum so everybody can enjoy
also make a seperate topic for this
User avatar
Bwired
Administrator
Administrator
 
Posts: 5309
Joined: March 2006
Location: Netherlands

Re: Reading the P1 port of a NTA8130 Dutch Smart Meter

Postby pjanssen » Fri Jun 15, 2012 9:51 pm

Bwired wrote:your a full member now, able to PM, but try to put as much as possible on the forum so everybody can enjoy
also make a seperate topic for this

Thanks,
I will when i have all the details (also want to put it on googlecode).
pjanssen
Starting Member
Starting Member
 
Posts: 6
Joined: February 2012

Re: Reading the P1 port of a NTA8130 Dutch Smart Meter

Postby ChrisPW » Mon Jun 18, 2012 3:44 pm

Problem is solved. I had two problems. Reading 7E1 instead of 8N1 and a timing problem.
The first is solved by a comparison of the byte received. By subsracting 128 if the byte is larget than 128 , you get the same result as 7E1.
The second problem was solved by altering the timing of the arduino by 9600 baud. it's sampeling was to slow. By lowering the timings in SoftwareSerial.ccp the data was comming in correctly.

I now have an Arduino with Ethernet sending some counters to a syslog server in my network.
Now i just need a way to visualise this info.
ChrisPW
Starting Member
Starting Member
 
Posts: 5
Joined: May 2012

Re: Reading the P1 port of a NTA8130 Dutch Smart Meter

Postby pjanssen » Mon Jun 18, 2012 7:58 pm

I did it with PHP&Mysql/Jquery (http://code.google.com/p/flot/). Indeed the data is 7 bit
This is what i did:
value & B01111111; //clear first bit as it is not used
If i am not mistaken the bit is parity.

To give u an idea on how i visualized the data. This is the data from our solar system. I have the same for the smart meter but the data is not publicly accessible. I have to clean up the code (when i am done with school for this year). Than ill share a cleaned version of the code at google code or github.
http://solarduino.rko.nu/
pjanssen
Starting Member
Starting Member
 
Posts: 6
Joined: February 2012

Re: Reading the P1 port of a NTA8130 Dutch Smart Meter

Postby gjniewenhuijse » Tue Jun 19, 2012 7:43 am

Hello ChrisPW & Pjanssen,

Is it possible to share your arduino code and electric setup?
gjniewenhuijse
Member
Member
 
Posts: 140
Joined: July 2009
Location: Netherlands

Re: Reading the P1 port of a NTA8130 Dutch Smart Meter

Postby foo » Tue Jul 24, 2012 1:00 pm

Received my Kamstrup 162JxC smart meter today.

First tried a USB -> TTL (5v) cable. after some googling I found out only 3 cables are needed

the data ready (pin 1) has to be pulled high (connect to 5 Volt)
the ground (pin2) has to be connected to ground
and the data pin (pin 4) has to be connected to the RX (the data is inverted but you can have the FTDI do the work for you)
Code: Select all
download FT_Prog and set the RX pin to inverted


connected through putty with the following settings:
Code: Select all
(9600baud, 7 data bits, 1 stop bit, even parity and no flow control)


the data now is received just fine every 10 seconds

Now I''m trying to connect directly to an arduino as I do not want to use a computer.

found out the new softSerial Library of arduino 1.0 supports inverted data
Code: Select all
#include <SoftwareSerial.h>

SoftwareSerial mySerial(RXpin, TXpin, true);

setup()
{
Serial.begin(9600);
mySerial.begin(9600);
}

loop()
{
  if (mySerial.available()) {
    char inChar = (char) mySerial.read();
    inChar = inChar & B01111111;
    Serial.print(inChar);   
  }
}


hooked up the cables and data is comming in but is all messed up.

used some bit shifting to fix the protocol to 7 databits
Code: Select all
inChar = inChar & B01111111;


now the data is partly ok, but there seems something wrong with the timing.
tried messing with the softserial setting but no success

Does anyone here know what to do?
foo
Starting Member
Starting Member
 
Posts: 18
Joined: January 2009
Location: Netherlands

Re: Reading the P1 port of a NTA8130 Dutch Smart Meter

Postby foo » Wed Jul 25, 2012 8:06 am

ChrisPW wrote:Problem is solved. I had two problems. Reading 7E1 instead of 8N1 and a timing problem.
The first is solved by a comparison of the byte received. By subsracting 128 if the byte is larget than 128 , you get the same result as 7E1.
The second problem was solved by altering the timing of the arduino by 9600 baud. it's sampeling was to slow. By lowering the timings in SoftwareSerial.ccp the data was comming in correctly.

I now have an Arduino with Ethernet sending some counters to a syslog server in my network.
Now i just need a way to visualise this info.


I now have the same weird data, what timings did you use?

Foo
foo
Starting Member
Starting Member
 
Posts: 18
Joined: January 2009
Location: Netherlands

Re: Reading the P1 port of a NTA8130 Dutch Smart Meter

Postby Linor » Wed Jul 25, 2012 2:46 pm

I too would be interested in knowing how you did this with the arduino, most importantly how you hooked it up physically. I've done some attempts already, but have thus far not seen any data arrive on the Arduino. However, I assumed that my Iskra meter was based on the DSMR 4.0 standard, but from the reading I've done today, it's based on 3.0 and uses the 9600 baud 7E1, rather than the 115k2 8N1 from the 4.0 specs. I'll be experimenting more tonight.
Linor
Starting Member
Starting Member
 
Posts: 2
Joined: July 2012

Re: Reading the P1 port of a NTA8130 Dutch Smart Meter

Postby Linor » Fri Jul 27, 2012 8:51 pm

I actually got a working thing now. I grabbed a 7404 inverter, put that between pin 5 on the meter, and RX0 on the arduino, hooked pin 3 of the meter up to arduino ground, and pin 2 to +5v. If you got an ethernet shield, you can use the code below. It will open up port 23 on the arduino on a DHCP address and will echo all data received on the serial port if you connect to it. I added 2 status leds to pin 3 (receiving data) and 5 (ready and waiting), but those are optional. Ideally I wanted to put an optocoupler between it, but haven't been able to get that working without giberish on the serial port.

Code: Select all
#include <SPI.h>
#include <Ethernet.h>

byte mac[] = { 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 };
EthernetServer server(23);

void setup() {
  Serial.begin(9600); // set baud to 9600
UCSR0C = (2<<UPM00)|(0<<USBS0)|(2<<UCSZ00)|(0<<UCPOL0); // 7E1
 
  pinMode(2, OUTPUT);
  digitalWrite(2, HIGH);
 
  pinMode(3, OUTPUT);
  Ethernet.begin(mac);
 
  pinMode(5, OUTPUT);
  digitalWrite(5, HIGH);
}

void loop() {
  if (Serial.available() > 0) {
    char serialByte = Serial.read();
    server.write(serialByte);
    digitalWrite(3, HIGH);
  } else {
    digitalWrite(3, LOW);
  }
}
Linor
Starting Member
Starting Member
 
Posts: 2
Joined: July 2012

Re: Reading the P1 port of a NTA8130 Dutch Smart Meter

Postby Maverick » Sat Mar 02, 2013 11:31 am

PietjeNL wrote:IR requires a code to be send to the meter before it releases the telegram.

@PietjeNL, do you know the code or where to find it?

I can't read out the measurements from my meter; it gives a (ER23) error. See my post here.
Maverick
Starting Member
Starting Member
 
Posts: 3
Joined: March 2013

Previous

Return to Smart Metering Forum

Who is online

Users browsing this forum: No registered users and 1 guest