Pages: . I'd appreciate any help, insights or pointers you may have. I've done a lot of digging but most of it involves reading through an optical port, while I'm using RS Here is the code I'm using.
Once again, pretty basic. Code: [Select].
I have realized that the protocol uses 7E1 which creates a multitude of problems with SoftwareSerial. Can anyone point me to any tutorials or instructions for setting up such a connection? Hiddenvision Sr. Also check that nothing else on the same wires is not pulling the lines in any direction and stunting the data. Check your setup also. You open the Serial port and start transmitting data on it while waiting for it to be available.
Just seems a little illogical.! Better not to use the serial while waiting for it to start.
IEC 62056-21 Power Meter Data Logging
Thanks for the response. I don't think the setup was causing any problems but that was probably because the delay 10 was enough to let Serial to initialize. Your version makes a lot more sense though, so I'll switch to that. I think the best course of action will be to order a USB cable and start troubleshooting that way.
And yeah, switching to ESP will have a few challenges - one being a logic level converter, and another being the lack of debugging capability from the serial port since that will be used up by the connection. I just checked the projects you linked, and it looks like I've already read through all of them before I did quite a bit of digging before posting here.
They did help me get started but unfortunately they don't have anything concrete that would help. But anyway, the USB will hopefully let me start untangling this web of problems. Thanks again for the help, I'll probably post again when I make some progress on the issue. If you have a known working connection everything else will be a breeze. The ESP also supports Softserial so you can have debug as well as I guess it depends on the ESP module you are developing with.
Grab a NodeMCU 12e or similar that gives you a complete full pinned platform. You can use a smaller more dedicated ESP once you have things sorted if preferred. The level convertors are 10 a penny on eBay so it is no obstacle either. If you are going the ESP route then make sure you scratch up on doing http updates.
It makes developing with them much faster and handy for updating down the road. Best of luck. Yep, I already have a bunch of LLC's. I'll look into http updates.You think I am funny guy huh? Welcome, Guest.
Please login or register. Did you miss your activation email? It's been quite a while since I've looked at IEC I bought an S2A from ebay couldn't really be playing with the official meter could I. For the infra red interface I made the common op-amp based interface from the net 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.
For development I used Linux and Perl and recently someone asked me to port to Python which I have just started when time permits. I did a bit of fuzzing with the meter and did get some interesting preliminary results I can talk about this more later on. Seeing as a lot of the meters out there seem to be from the same base manufacturer I was wondering if my Siemens algo will work on other meters.
It could now be time to revive this project on meter interaction what with the new daisy chain smart meters that are apparently on their way.
Anyway, if anyone fancies having a go at building an interface and joining in then the more the merrier. Only XP though. I have various scopes including a Picoscope and a logic analyzer to aid in the project from my end and can test for unknown problems in submitted code snippets for people that don't have the facilities.
The components for the interface are not expensive and test meters can be easily and cheaply bought from ebay etc. I have tried a number of these modules and the FTDI ones are by far the best. Both chips on these are the same but just have different packages. This is the diagram for the infra red interface: Quality diagram I know.Communication protocol IEC 62056-21
Don't get me wrong, the Op-Amp interface does work but without a scope it can be a pain to set up. My USB interface uses a standard timer IC as a schmitt trigger to clean up the received signal and then a transistor to invert the output. If anyone does want the based diagram it is out there on the net somewhere but I can't find my diagram. It looks complicated but when you get your interface up and running and can see some data going in and out the clouds do begin to clear a little.
If all is well the meter sends back its ID message. Serial ser. CR LF' ser. Explanation of the options is covered further in the iec pdf file. To do anything worth while with these meters we need to get them in to programming mode.
This involves a password exchange. According to the standard there can be different ways in which this can be implemented. Certain meters use a simple ascii password but the S2A I'm testing uses the P0 - P2 password exchange. It might have a simple password but I haven't looked for it - maybe I should have done, it would have saved a lot of work. I have attached a file named 3.
If in future anyone needs help with anything the name of the zip file is important as modules contained in the zip only work with the scripts in that particular zip - they may be modified in the future and I can't be arsed with version numbers at this point. Formerly FML Ltd. I think V80 is the firmware version number.Released: May 2, View statistics for this project via Libraries. You'll need this to process information from your smart meter e.
DSMR P1. The code differs from other libraries in several ways:. This module is targeted to be compatible with all kinds of digital meters outputting IEC formatted telegrams. It implements several sub standards. I've used knowledge from these projects:. May 2, Apr 16, Apr 15, Apr 13, Apr 11, Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Normally I would set things like:. But the meter is not connected via serial connection but, instead, it has a sim. Using a modem I can call the meter using:. The modem calls the meter with different settings baudrates, stopbits, parity compared to the protocol ones, e.
I am reading and trying several libraries like J, pyserialbut I've found nothing about sending data via gsm call.
I'm using two third party libraries to perform similar functionalityI need to be able to decide which library to use at runtime each one is superior at a different kind of task and I only know which one is needed for a specific task at runtime. The protocol IEC tells us how to deal with enegy meters, it's quite easy! Normally I would set things like: baudrate 1 stopbit 1 parity bit even But the meter is not connected via serial connection but, instead, it has a sim.
Device address! CR LF Here's the missing piece, I don't know how to send this data over the call I am reading and trying several libraries like J, pyserialbut I've found nothing about sending data via gsm call.
Home Java IECimplement the protocol over a gsm connection. How to replace plain URLs with links no error? Understanding sys. Date Pipe in Angular 8.Released: Jun 12, Former IEC View statistics for this project via Libraries.
Tags metering, amr, iec It is designed to operate over any media, including the Internet. The physical media are usually either modulated light, sent with an LED and received with a photodiode, or a pair of wires, usually modulated by a 20mA current loop. The protocol is usually half-duplex. Some manufacturer are using a derivative protocol to IEC They comply with most things but might for example not use the access request features according to standard or they have a slightly different flow in command execution.
This library can be used with some of them. You just need to be aware of the differences. We provide special handlers for some unique parts that is included in this library. They might be split into separate libraries in the future. A protocol for Elster devices. Main difference is that they have the concept of locks instead of password and instead of answering the password request you need to write the password to a certain register.
Project links Homepage. Maintainers Krolken. Limitations of this library. At the moment we only support Mode C. We assume that only protocol mode Normal is used.
Example usage: Reading a meter using a optical usb probe via the D0-interface. They comply with most things but might for example not use the access request features according to standard or they have a slightly different flow in command execution This library can be used with some of them.
LIS A protocol for Elster devices.Other IEC parts deal with Electricity metering - Data exchange for meter reading, tariff and load control. Any real-world thing mapped to an appropriate class type can be described by the attributes defined in the standard, and the methods defined therewith allow operations to be performed on the attributes. The attributes and methods constitute an object. Conventionally, the first attribute in an object is the logical name, also defined as the OBIS code in case of LN referencing.
It is one part of the identification of the object. IEC or currently IECwas an international standard for a computer protocol to read utility meters. It is designed to operate over any media, including the Internet.
The physical media are usually either modulated light, sent with an LED and received with a photodiodeor a pair of wires, usually modulated by a 20mA current loop.
The protocol is usually half-duplex. The following exchange usually takes a second or two, and occurs when a person from the utility company presses a meter-reading gun against a transparent faceplate on the meter, or plugs into the metering bus at the mailbox of an apartment building. The general protocol consists of a "sign on" sequence, in which a handheld unit identifies itself to the metering unit. During sign-on, the handheld unit addresses a particular meter by number.
The meter and hand-held unit negotiate various parameters such as the maximum frame length during transmission and reception, whether multiple frames can be sent without acknowledging individual frames windowingthe fastest communication rate that they can both manage only in case of mode E switching to HDLC etc. Next, the meter informs the handheld unit about the various parameters that are available with it in various security settings viz. If the parameter required is in the no-security group, just a get.
If the parameter required is in the low-security group, a password authentication of the HHU is required before information can be read.
In case of high-security parameters, the meter challenges the handheld unit with a cryptographic password. The handheld unit must return an encrypted password. If the password exchange is correct, the meter accepts the handheld unit: it is "signed on.
After signing on, the handheld unit generally reads a meter description. This describes some registers that describe the current count of metered units i. Occasionally a manufacturer will define a new quantity to measure, and in this case, a new or different data type will appear in the meter definition. Most metering units have special modes for calibration and resetting meter registers.
These modes are usually protected by anti-tampering features such as switches that sense if the meter enclosure has been opened. The handheld unit then sends a sign-off message. If no sign-off message is sent, the meter automatically signs off after a previously negotiated time interval after the last message.
From Wikipedia, the free encyclopedia. List of International Electrotechnical Commission standards.The protocol IEC offers five different protocol modes that can be used by tariff devices.
In the modes A, B, C, and E data exchange takes place in both directions whereby the data are collected via request. In mode D data are only transmitted in one directions in fact from the tariff device to the master. The readout data can be saved with the checksum or transmitted without protection depending on agreement.
IEC : Configuration. With the channel button channel An individual modem can be installed and connected for each channel. Each modem, that is assigned to the selected channel is indicated. Normally this assignment will be recognized by LIAN 98 and the corresponding modem will be set. The settings of the modem must be executed via the windows control panel " telephone and modem options ".
With this button you can check these modem settings and see if they concur with the LIAN 98 configuration. Most of the modems are full duplex and can transmit data in both directions simultaneously. None of both transmitters has to wait for clearance for transmitting data. In case of a half duplex connection DTE LIAN 98 as well as DCE Modem can work as transmitter and receiver, hereby only one data line 2-wire connection is available that can be used alternately for transmission or receipt of data.
After the receipt of the signal CTS the data are transmitted and after the transmission of the data the signal RTS is set to 0. In each other case LIAN 98 is working as receiver only. This function is deactivated if the "Leading and the Trailing" is set to NULL and therefore the control signals are analyzed diectly from the modem. Transmission speed : 25 - baud variable, default baud The start baud rate for the first connection is always baud.
IEC : Simulation. The request message to be sent are provided with the device address of the SIM list during master simulation. The time out interval and maximum number of retries are configurable and appropriate values will depend on the transmission system.
This parameter determines the time in milliseconds that the program LIAN 98 as master station at most has to wait for an acknowledge before the last transmission is repeated. Note : The response timeout should be set at least 5 seconds for a baud rate of and a message size of ca. In order to ensure that the acknowledge has been transferred completely the change of the baud rate is delayed with this parameter. It determines the time in milliseconds that LIAN 98 as master waits after the receipt of the identification message before the new baud rate is adjusted.
The device address is only used in order to validate the request message during connection establishment. In order to ensure that the master has also changed the baud rate the transmission is delayed with this parameter.
LIAN 98 assigns internal an unambiguous type identificaton to each message type for protocol IEC that also can be used for filtering. In the following list you will find the assigned values. Request message Sign on Used from the master as sign on at the tariff device. Identification message Answer of the tariff device caused by the sign on of the master. Data message Readout This message is normally used for the transmission of tariff data by the tariff device.
Transmission starts immediately after the transmission of the identification.