Atmega328p MQTT energy meter
My old solar inverters do not have the option to read out the produced energy. But I do have a production meter installed in my distribution cabinet. But of course, this meter also does not have a data port. But it does have a pulsating LED. This LED flashes 1000 times 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’.
2023-01-11