board
I use "NodeMCU 1.0" (ESP-12E Module) It is a dev board with USB (used for power supply and Serial interface. The Serial Interface is used to flash EEPROM and debug code).
The board has 2 UARTs.
Serial:
TXD0
RXD0
These Pins are also connected to USB.
Flashing the 8266 is only possible, if IR-Reader is not connected.
But Serial.swap() will changes the UART pins to GPIO13 and GPIO15.
So IR-Reader connection and Flasing EEProm is possible. Disadvantage: Serial println for debugging fails.
Serial1:
TXD1
FLASH
So Serial1 could be used only for sending data.
IR-Reader could not be connected!
IR-Reader
I used this Reader:
IR serial read
My smart-meter sends each second.
It starts with an ESC sequence of 0x1B 0x1B 0x1B 0x1B.
The end is detected by waiting for data some time
if (!Serial.available()) delayMicroseconds(1200);
and leaving the endless read loop if there are no more received.
My Equipment
I use a standard USB charger to provide 5V to 8266 via USB.
A 220V twin socket is used for 220V on the left side.
On the right side, 220V connector is removed and
the 8266 is inserted.
Enable ITRON Info
To receive current power data, Info status needs to be enabled.
SML Data
Data received from IR-Reader are binary encoded.
There is the following structure used: