Most mains energy meters have an LED which flashes 500 or 1000 pulses for every measured kWh. A photo-diode mounted in front of this LED detects the flashes. Every pulse is converted to a clean digital signal by an adjustable comparator with hysteresis followed by a 74HC14 Schmitt-trigger. The resulting pulses can be inverted by means of a jumper. A falling edge triggers an interrupt of the ATMega328. The firmware counts the interrupts and calculates the equivalent energy in Wh. Every 60 seconds the result is published to the MQTT broker on topic 'distributioncabinet/energy/solar'.
To set the ip address of the MQTT broker use the command ": <ipaddress>". For example, to set the ip address to 192.168.1.10 type ": 192.168.1.10" and hit enter.
To set the port number of the MQTT broker use the command "P <portnumber>". For example, to set the port number to 1883 type "P 1883" and hit enter.
To show the current settings type "I".
To save the settings to EEPROM type "S" and hit enter.
IMPORTANT: after making changes, power cycle the device.