Loading 3D model… large boards can take a moment.
Flash in the PIN for my utility electricity meter via white LED, then keep the PIN active by flashing the LED briefly every 100 seconds.
In parallel, read INFO-DSS SML datagrams via IR diode input, decode for a number of OBIS codes and expose the received values via Modbus RTU over a serial line, in my case RS-485.
The electricity power meter supplied by my local power company came mis-configured so there's no way to enable extended INFO-DSS IR datagrams permanently. The respective menu item has been configured away. Thank you very much!
After PIN entry, the extended datagrams do appear, but only for 120 seconds. After that, the unit falls back to basic datagrams again, requiring another PIN entry. Alternatively, we just simulate some activity so that the 120 second window does not close. By repeated light signals, we're keeping the unit in "extended" mode, so to say.
Without the PIN, my meter emits 1.8.0 and 2.8.0 with kWh resolution only (xxx000 W) and does not emit instantaneous power at all. After PIN entry, all three values are emitted and with Watt granularity.
A button is connected to a small microcontroller (ATtiny841) and makes a LED light up when pressed. The button is de-bounced so that a minimum LED "on" duration of around half a second is maintained. The button can be pressed for longer, extending the "on" period, which enables entry of "long" press light impulses.
In short, this function converts the error-prone manual flashing contraption to simple button presses.
Upon reset, the microcontroller enters austomatic mode. It remains in automatic mode unless the button is pressed. In automatic mode, the unit first
Then, for each of the (four) digits of the PIN,
As we do not have any feedback from the meter (neither IR nor visual) we can do nothing but try and wait for a similar amount of time. Note this cannot be super reliable. If the period is set too short, we're bumping up the current digit too much and if we wait for too long we can skip a digit, causing one or more spurious 0 digits.
The PIN is hard-coded in the source code / microcontroller. To define the PIN, copy file meterpin-sample.h to meterpin.h and adjust that copy to your PIN. Then build and upload. Setting the PIN to an empty string disables PIN entry, leaving only the Modbus-RTU function, see below.
After the automatic PIN entry or the last button press, the unit waits for 100 seconds, then emits a half-second LED flash and repeats. Pressing the button interrupts this waiting period and causes an immediate flash.
This short flash once in a while simulates some activity to the power meter so it does not ever reach the 120 second (2 minute) PIN timeout.
Consequently, the extended SML datagrams continue to be emitted. Mission accomplished.
One reviewer suggested to enter the PIN again, regularly, to guard against unexpected meter resets and/or unexpected microcontroller resets. So, after about 20 minutes, the unit now waits for a bit longer than the keep-alive period (130s, extended wait period), then blinks in the PIN again.
I still have not found the reason why anybody would want to configure away the option to emit extended datagrams permanently. What's the purpose?!
While my unit is an Easymeter Q3A, I believe there may be other types of meters with similar (stupid?) config options.
The unit's address is fixed to 0x09. Function code 0x04 (Read Input Registers) is the only function code supported.
Four values are exposed. Each value is a 32bit value, readable through two consecutive registers.
| Address | Content | Unit | Data type |
|---|---|---|---|
| 256, 257 | Version number | 32 bit unsigned integer | |
| 258, 259 | 1-0:1.8.0 Positive active energy (A+) total | Wh | 32 bit unsigned integer |
| 260, 261 | 1-0:2.8.0 Negative active energy (A+) total | Wh | 32 bit unsigned integer |
| 262, 263 | 1-0:16.7.0 Sum active instantaneous power (A+ - A-) | W | 32 bit signed integer |
Example readout using "modpoll" (https://www.modbusdriver.com/modpoll.html):
modpoll -t 3:int -a 9 -0 -r 256 -c 4 -i -1 -b 115200 -s 2 COM6
modpoll -t 3:hex -a 9 -0 -r 258 -c 6 -1 -b 115200 -s 2 COM6
The SML decoder accepts 64-bit raw values internally, but after application of the "scaler" it is expected that the resulting value fits into 32 bits. Indeed my unit always uses an 8-octet fixed-length zero-padded integer representation for all measurement values:
07 01 00 01 08 00 FF 1–0:1.8.0
62 1e Unit
52 03 Scaler 10^3
59 00 00 00 01 18 CB 47 05 0x118CB4705 <=> 4710942469, scaled to 471094 Wh, displayed on the unit as 471 kWh
I've prepared the schematics and a PCB using KiCad 8.0.2. Find respective project files under the kicad/ folder:
DIGIT_GAP2_TICKS in code and re-try.
No comments yet. Be the first to ask about this board.