Reading your Electricity Meter. IEC 62056-21

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 Electricity Meter Reader article. It worked almost first time using a just an uno and a TSL261 TSL261 Datasheet(PDF) - List of Unclassifed Manufacturers 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 :0 , 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.

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 AltSoftSerial Library, for an extra serial port 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 NewSoftSerial | Arduiniana

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.

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

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.

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

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.

I know this is an old thread but if you need diagrams or info etc:

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

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?

ffimon:
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

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

eeyoresan:
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

narg:
@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.

ffimon:
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 Electricity Meter Reader article. It worked almost first time using a just an uno and a TSL261 TSL261 Datasheet(PDF) - List of Unclassifed Manufacturers 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 :0 , 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.

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

If you follow the Sonsivri link that Dunker provided, there is an algorithm there for generating the correct password response... at least for one type of meter. It's definitely worth a try. Did you ever try that, and did it work?

Failing that, couldn't you just leave something continually attempting different 4-digit responses and logging which ones work and which don't. If it's really only 4 digits in the reply, we'd probably be able to work it out fairly quickly.

Ah, I've just noticed that Dunker was pointing at his (or her) own post on Sonsivri. Since it's non-trivial to respond there, I'll ask here:

You said in your first post that you had both a Siemens S2A and an Ampy 5235. All your later examples all use the S2A. Was the password algorithm for the Ampy the same, and if not did you work out what it is? How did you work out the algorithm for the S2A?

I could just leave something trying random(ish) responses and logging which responses work for which challenges, and eventually see if I could work out the pattern. Is that how you did it? Does the meter lock you out after a few failed attempts? And if you have a test meter to play with, can you reset the lockout period by cycling its power?

I have an Ampy 5162E and a there's a cheap probe from eBay on the way, and I'm wondering if I should also get a second Ampy meter to play with... although I can't actually find any 5162Es for sale anywhere.

FWIW there are also password hints in this dump: Communication capture between application and energy meter via RS-485 (IEC62056-21) · GitHub.

Hi all , i made my own optic probe.i mentioned about schematic and how it works. Here is the description video :

Hi, I wrote some paper about the solution I prepared for reading the IEC 62056-21 meters.

https://www.researchgate.net/publication/333248821_Building_Advanced_Metering_Infrastructure_using_Elasticsearch_database_and_IEC_62056-21_protocol

Hope it will be usefull for someone

1 Like

Hi, have somebody solution for this topic with Arduino? Idealy full code. I need this And i want learn from this.