Pages: [1]   Go Down
Author Topic: Reading your Electricity Meter. IEC 62056-21  (Read 17220 times)
0 Members and 1 Guest are viewing this topic.
Manchester UK
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

I have had a search round on this site and others for information in reading the data from my Electricity Meter.

I found this http://arduino.cc/forum/index.php/topic,22225.0.html topic but it was closed so I could not reply to it.

I just got into arduino kit (In the past week or so) and have done the usual experiments temperature probe, RTC, LED Blink etc. But now I wish to move on to what I wanted to do. 

I installed 3.75KW of solar on my house and I wish to monitor not only how much I produce but how much I export. I have two electricity meters the First is An Elster A100C this is the one I had fitted and measures my "GENERATION" i.e. the Total energy produced by the PV. I have managed to read this meter after reading this http://www.rotwang.co.uk/projects/meter.html article. It worked almost first time using a just an uno and a TSL261 http://www.alldatasheet.com/datasheet-pdf/pdf/92399/ETC/TSL261.html PhotoIR optical sensor. This meter constantly transmits its data about once every couple of seconds or so so was pretty simple to read.
 
The second meter I have is the one fitted by NORWEB my electricity supplier this records both my "IMPORT" i.e. the electricity I get from the grid and my "EXPORT" i.e. the excess electricity I produce that goes back to the grid. Unfortunatly this meter only displays the "IMPORT" figure but I am reliably informed that deep in its registers are the "EXPORT" values too.This meter an Ampy 5196A I have had some success in reading this meter too. I used the TSL261 as a receiver and this http://dx.com/p/38khz-ir-infrared-transmitter-module-for-arduino-135040 as my transmitter.  Before I dived into reading the meter with the UNO I thought I would see if I could read the meter with a PC using a USB to TTL adapter (cp210x).

I hooked it up as follows.

Serial adapters tx Pin ----> signal pin on the transmitter
Serial adapter Ground -----> Transmitter Ground
Serial Adapter RX Pin <----- Receiver Signal Pin
Serial Adapter Ground ------> Receiver Ground
Serial Adapter 5V -----> Receiver VCC

I opened up "termite" and sent /?!{cr}{lf} to the meter at (300 Baud 7Bit Even Parity One Stop Bit) but no joy  smiley-mad , other than /?!{cr}{lf} being received back by the receiver (Echo was turned off). After a little head scratching I had a flash of inspiration, I thought what happens if the "1" should be "0" and vice versa. So I dug out a 74c04 Hex Inverter and inverted both transmitter signal  and the receive signal. I opened up "termite" again and sent the command 20 or so times and eventually got a reply something on the lines of /AMP05196A-21 (I think). The receiving was very Hit and mis only got a reply about 7 or 8 times out of about 100. The transmission was working though as the meters Red led flickerd for about 5 seconds every time I sent the command. The receiver seems to need to be pointed precisely at the RED led to work, at first I thought the TSL261 may need amplifying. In writing this post I found this http://www.abacuselectrics.com/f6zd09r.pdf data sheet It appears that my Utility company have fitted one of the only meters that replies in the RED spectrum not the IR spectrum. There must be just enough IR being emitted to operate the TSL261 if the wind is blowing in the right direction and I balance on the right leg.

My original question was going to be can I invert the tx/rx  serial port signals in the "UNO" in software or am I still going to need to  still use an inverter. I figure I can get away with an inverter for the transmitter by connecting it like so.


UNO tx Pin ----> Ground transmitter
UNO 5V -----> Signal Ground.

Thus when the TX is low the LED will be transmitting.

My second question, In the light of my RED/IR discovery is, Am I best trying to amplify the TSL261 output or can someone recommend a TSL261 equivalent for RED light and am I going to have to stop daylight getting to it. 

I have a copy of the IEC 62056-21 specs and getting the data out of the meter is relatively simple one you have the optical probe. I hope that this will allow access to the data IEC 1107 optical port for less than $10 rather than the $80-100 everyone seems to charge for the a probe. This would be more accurate and simpler to implement than say a CT clamp.   
Logged

New River, Arizona
Offline Offline
God Member
*****
Karma: 19
Posts: 927
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

There's a bunch of experts at reading pulses and other stuff from a meter over at http://openenergymonitor.org that you can consult with on this.  Also, if you use software serial in its latest incarnation, you can read reverse signals on the serial input.  This allows you to use the regular serial as a monitor or command port.  The page for it is at http://www.pjrc.com/teensy/td_libs_AltSoftSerial.html  I haven't used it with signal inversion, so you'll have to take a look at the library to see how to set it up for this.  More info on this at http://arduiniana.org/libraries/newsoftserial/

I tried reading my meter which gives out red (can you believe it) pulses.  I was getting terrible interference from ambient light and had to get some modeling clay and mash it all over the sensor and about an inch out to the side.  This gave me enough signal to reliably count pulses, but the clay melted in the sun and I haven't gone back to the project to see what is better to do.  Took about an hour to clean up the melted clay from the meter and the concrete under it.  There are lots of silicon based solutions that I could have used, but I happened to have some dark blue clay.....  When you get that far along, google oogoo for a material that works really well for stuff like this, you can even tint it to the color you need.
Logged

Trying to keep my house under control http://www.desert-home.com/

Poland
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If somebody is interested in meter's optical probe project, please read Elektor's article:
http://pl.scribd.com/doc/50612482/Iec-1107-Electricity-Meter-Interface
Logged

Kuba_eM

Manchester UK
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have ordered one of these http://www.vishay.com/docs/81532/bpw96.pdf Photo Transistors with a 10K variable resistor. From what I can make out if I put the emitter to ground and use the 10K to pull the collector to 5v. I can then connect the collector to the input of my inverter. By adjusting the POT I should be able to adjust the light threshhold to cut out the effect of ambient light.
 
The Lamda for the BPW96B goes below 640nm and upto 1000nm so hopefully this device will work for my meter and conventional IR meters. The problem with the TSL261 I have is is low end cutoff is 800nm which is why its flaky with my red led meter.

Logged

Manchester UK
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well there's "Good News & Bad News"

The good news is that the BPW96 photo transistor with a 10K Pot did the trick. Also the signal doesn't need inverting.

Now I send this request message @ 300 Baud 7bit Even Parity one stop Bit 

2f 3f 21 0d 0a  /?! {cr}{lf}

Then get this reply...

 2f 41 4d 50 30 35 31 39 36 41 2d 36 31 42 0d 0a              /AMP05196A-61B {cr}{lf}

(This is the model of the meter)

All well and good. smiley

Now for the bad news....

If I send an acknowledgement and read command I get no reply.

This should give me a meter read but unfortunately returns no data.

Just as a test I sent an Acknowledgement with the programming command 

06 30 30 31 0d 0a                                            .001 

And got this supply

01 50 30 02 28 30 30 34 30 29 03 64                  .P0.(0040).d

Which from the I.E.C. specification means give me a password using a manufacture specific algorithm and 0040 is the key.

So my conclusion is that "Yes you can make an optical port for less than a couple of £'s" but not all meters allow you to read them without a password. 

A lot of meters give up there data only after the initial handshake. Others like the Elster A100C dribble the data out constantly without any request.

So now I need to go to plan B a current transformer. The optical output goes solid red when the power when the power flow is reversed so combined with a current transformer I should be able to get the data I need.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It's been quite a while since I've looked at IEC 62056-21. I used to have a Siemens S2A at home and now I have an Ampy 5235. I bought an S2A from ebay (couldn't really be playing with the official meter could I). I made the common 741 op-amp based interface and it worked ok but I almost immediately figured it wasn't good enough (and I wanted far better quality of signal and also USB) so I designed my own. I did get a fair old way into it before the buggers changed my meter to the 5235 and then other commitments soaked up all my time. I've recently been thinking about having another bash at it (prompted by the zero'd 5235 meters I have seen for sale and to be fair I could do with something to keep me out of the pub).

For development of things like this I use Linux and Perl before porting to whatever the final platform needs to be. I have reversed the Siemens P0/P2 password exchange algo and can freely communicate with the S2A. I did a bit of fuzzing with the meter and did get some interesting preliminary results before I got sidetracked with work. I'm just wondering if your meter supports, and how to get it in to, 'mode D'. You would need a meter to strip down and I suppose you'd have to have a Linux box and build my interface to move forward with this. I can dig the files out if needed.
Logged

Offline Offline
Jr. Member
**
Karma: 1
Posts: 85
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Following is a link to Silicon chip mag here in Australia where a power meter monitor is described using a picaxe.
The picaxe code is downloadable and possible to rewrite similar in Arduino code. This artical uses RF modules for remote connection and a LCD display.
Of course the pulse counting feature is all that you may need but the RF monitoring is a good idea and maybe power the metter end from a cheap solar panel salvaged from a garden light.
 
http://archive.siliconchip.com.au/cms/A_112867/article.html
Enjoy 
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I'm thinking along the same path, regarding reading of power-meters. And i noticed this thread.

After browsing documentation regaring IEC 1107 protocol I'm wondering, arn't you trying to enter programming mode with baudrate 300, in your example?


Just as a test I sent an Acknowledgement with the programming command 

06 30 30 31 0d 0a                                            .001 

If i understod the specs correctly the last digit after ack reads: 0- read, 1-program

what would happen if you try:
06 30 30 30 0d 0a                                            .000

Will you still get the password request?

BR
/Per
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@ffimon

Can you please share with us the code for transmitting and receiving the data with the "reader".

Can you please share too the schematic or an idea of the schematic how to do an reader.
Logged

Manchester UK
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


If i understod the specs correctly the last digit after ack reads: 0- read, 1-program

what would happen if you try:
06 30 30 30 0d 0a                                            .000

Will you still get the password request?

BR
/Per

Hi

As I said in mo post I sent the read command and got no reply at all. As the communication is In visible red light you can see there is no reply. I tried .001 just to see if I was getting any response and it replied asking for a password. So I think the meter can only be read with a password.

Simon 
Logged

Manchester UK
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@ffimon

Can you please share with us the code for transmitting and receiving the data with the "reader".

Can you please share too the schematic or an idea of the schematic how to do an reader.

Sorry have not been back to the forum for a while.

The Circuit I used was very simple on the transmit side it was a simple IR LED fed from the TX Pin through a 3k3 Resistor I don't know the Brand  Ive found this picture I got 5 and 5 recievers for £8. Ignore the fact it says its 38Khz, Its baseband. Also if you get the model Pictured Ignore the + 5v its NC its the same pcb used for several components.



For the receiver I used a  bpw96  photo-transistor, which works in the visible Red band (as well as the IR band I think). I wired the emitter to ground and the Collector 5V via a 10k variable resistor I think I replaced this with a 10K resistor in the end as 10k worked. I took the signal from the collector into a 74hc04 inverter as the signal was inverted IE when the LED was off the Output was High the output of the Inverter I connected to my receive Pin. From what I have read if you use software serial you can invert the input in the software serial declaration.

As for software I can't find it sorry as I hadn't got anything useful back from the meter I didn't keep the code. The code I rote simply converted  the 7 bit characters to 8bit ones with even parity. I then sent the commands to the meter with a short delay between the command and the Acknowledge and echoed the responses back to my laptop. If it turns up on my NAS I Will post it.

In the end I just ended up counting  pulses to get my import. I can read my generation using simple IRDA and I used a currrent CC128 with a clamp meter to get my Consumption. The arduino pro mini reads the Generation meter and the import count. It decodes the XML from the ct128 and extracts the Consumpion data and temprature. The data is summed and collated into Minute, Hour and Day Readings and sent to A raspberry PI. I can see for any given minute/hour/day what my consumption/import/export and generation is.  The raspberry Pi (Model A) stores the data to its SD Card In a database, I have done some software in VB.Net to run on the Pi which converts the data Into graphs in a JPG format which I hope to send to My Digital photo frame Via bluetooth. I have done some simple graphs using open flash charts in PHP on the pi which I can access from my laptop.

 Hopefully all the data will help me to determine whether it would be worth me storing some of the excess consumption from my solar panels and using it for my lighting which now averages 200W now I have LED and low energy Lighting. I get paid for the energy whether I export it or not so I just need to work out how much it will cost me to store the energy and how much storage I need. I should easily be able to charge 2 * 163Ah 12v Batteries everyday that should be enough to provide power for 8 hours of lighting a day and run my NAS, Router and switches total 50w. The best part being It gives me a UPS functionality too, so If the power goes off I will still have Lighting and My Nas drives wont need Rebuilding after a brown/black out.                 
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

I have had a search round on this site and others for information in reading the data from my Electricity Meter.

I found this http://arduino.cc/forum/index.php/topic,22225.0.html topic but it was closed so I could not reply to it.

I just got into arduino kit (In the past week or so) and have done the usual experiments temperature probe, RTC, LED Blink etc. But now I wish to move on to what I wanted to do.  

I installed 3.75KW of solar panels on my house and I wish to monitor not only how much I produce but how much I export. I have two electricity meters the First is An Elster A100C this is the one I had fitted and measures my "GENERATION" i.e. the Total energy produced by the PV. I have managed to read this meter after reading this http://www.rotwang.co.uk/projects/meter.html article. It worked almost first time using a just an uno and a TSL261 http://www.alldatasheet.com/datasheet-pdf/pdf/92399/ETC/TSL261.html PhotoIR optical sensor. This meter constantly transmits its data about once every couple of seconds or so so was pretty simple to read.
 
The second meter I have is the one fitted by NORWEB my electricity supplier this records both my "IMPORT" i.e. the electricity I get from the grid and my "EXPORT" i.e. the excess electricity I produce that goes back to the grid. Unfortunatly this meter only displays the "IMPORT" figure but I am reliably informed that deep in its registers are the "EXPORT" values too.This meter an Ampy 5196A I have had some success in reading this meter too. I used the TSL261 as a receiver and this http://dx.com/p/38khz-ir-infrared-transmitter-module-for-arduino-135040 as my transmitter.  Before I dived into reading the meter with the UNO I thought I would see if I could read the meter with a PC using a USB to TTL adapter (cp210x).

I hooked it up as follows.

Serial adapters tx Pin ----> signal pin on the transmitter
Serial adapter Ground -----> Transmitter Ground
Serial Adapter RX Pin <----- Receiver Signal Pin
Serial Adapter Ground ------> Receiver Ground
Serial Adapter 5V -----> Receiver VCC

I opened up "termite" and sent /?!{cr}{lf} to the meter at (300 Baud 7Bit Even Parity One Stop Bit) but no joy  smiley-mad , other than /?!{cr}{lf} being received back by the receiver (Echo was turned off). After a little head scratching I had a flash of inspiration, I thought what happens if the "1" should be "0" and vice versa. So I dug out a 74c04 Hex Inverter and inverted both transmitter signal  and the receive signal. I opened up "termite" again and sent the command 20 or so times and eventually got a reply something on the lines of /AMP05196A-21 (I think). The receiving was very Hit and mis only got a reply about 7 or 8 times out of about 100. The transmission was working though as the meters Red led flickerd for about 5 seconds every time I sent the command. The receiver seems to need to be pointed precisely at the RED led to work, at first I thought the TSL261 may need amplifying. In writing this post I found this http://www.abacuselectrics.com/f6zd09r.pdf data sheet It appears that my Utility company have fitted one of the only meters that replies in the RED spectrum not the IR spectrum. There must be just enough IR being emitted to operate the TSL261 if the wind is blowing in the right direction and I balance on the right leg.

My original question was going to be can I invert the tx/rx  serial port signals in the "UNO" in software or am I still going to need to  still use an inverter. I figure I can get away with an inverter for the transmitter by connecting it like so.


UNO tx Pin ----> Ground transmitter
UNO 5V -----> Signal Ground.

Thus when the TX is low the LED will be transmitting.

My second question, In the light of my RED/IR discovery is, Am I best trying to amplify the TSL261 output or can someone recommend a TSL261 equivalent for RED light and am I going to have to stop daylight getting to it.  

I have a copy of the IEC 62056-21 specs and getting the data out of the meter is relatively simple one you have the optical probe. I hope that this will allow access to the data IEC 1107 optical port for less than $10 rather than the $80-100 everyone seems to charge for the a probe. This would be more accurate and simpler to implement than say a CT clamp.  


Are you able to save money with the usage of these panels? I do have similar plans of  installing solar power but I am worried about expense.
« Last Edit: January 25, 2014, 12:24:10 pm by GuadalupeByrd » Logged

Pages: [1]   Go Up
Jump to: