S0 Impulse Counter for tracking the current reading of power and gas meters with S0 output. Consists of Arduino based hardware for capturing impulses (and storing the current reading in EEPROM) and a Python program to log the data to InfluxDB and publish via MQTT. Can also calculate power/current usage from duration between impulses.
FloKra 2408eff3f7 ## 2023-09-09 | 1 year ago | |
---|---|---|
Hardware | 4 years ago | |
NodeRED-UI | 4 years ago | |
Notes | 4 years ago | |
S0Meters_py | 1 year ago | |
README.md | 4 years ago |
Impulse Counter for keeping track of the current reading of power and gas meters with S0 impulse output.
Consists of Arduino based hardware for capturing impulses and saving the current reading in EEPROM and a Python program to log the data to InfluxDB and publish via MQTT. Also measures duration between impulses, to calculate power/current usage from that.
Intended to run (but not limited to) on a Raspberry Pi. I developed this project because directly logging impulse counters with the Raspberry Pi using GPIO inputs proved to be unreliable. I experienced missed impulses because the Pi was not running all the time, ghost impulses I don´t know why, even when always using optocouplers on the impulse inputs, and also other issues. So I decided to develop a hardware based impulse capturing module which also saves everything to EEPROM and makes losing of the total values unlikely in the future. Also this module should provide an accurate (well, relatively) measured time between impulses, in order to calculate current power or momentary usage.
The Arduino based impulse capturing unit counts impulses, increments a counter in a unit like kWh, saves this counter to EEPROM on change, and also saves impulses in between to EEPROM regularly. Impulses count is saved to a large EEPROM area organized as a ring buffer to accomplish little EEPROM wear.
Regarding the power supply there is buffer capacitor as well as a power loss detection, so that the current values can be saved to EEPROM just before power goes out. Apart from that, saving is performed in configurable intervals and when there was no impulse detected for a timeout (useful for gas counters).
Details: Arduino counter hardware
Details: Python S0Meters
Straightforward Node-RED flow providing a simple UI to set current readings.
Connects to "middleware" S0Meters.py over MQTT.
Details: NodeRED-UI