Background
Our flat uses gas for heating. But since our gas supplier was unable to reduce our advance payment from over 100 Euro pro Month to a reasonable amount, we needed a convenient way to display our current gas consumption.
Hardware
Many gas counters have a reflective digit and/or a magnet which rotates with a specific digit.
The reflective area may be detected by a photo sensor, whose LED has to be constantly supplied with current. In contrast, a Reed contact only draws a little current when it is closed.
The gas meter in the right picture has a hole to the right where a reed contact may be inserted. The meter with inserted contact may be bought for 30€ from the Gasag, if I remember correctly.But it is much simpler to put the reed contacts before the counter window, where the magnetic field is measurable.The contacts are hold by a magnet on top of the counter. So, the counter doesn’t need to be opened at all.
The circuit in the left picture processes the impulses from the reed contact, on the top is a MAX232 level converter. The counter value is incremented by the impulses and sent via the serial port. The initial counter value is also set via this interface.Power is supplied over a 4-pin cable besides the serial data. If the power fails, the circuit works on a capacitor and writes the current counter value to the internal EEPROM to be on the safe side. After the power is restored, this saved state is loaded.
Computer software
The computer runs a Perl software that stores the received data in an RRD database.
Another perl script generates the diagrams (seen on the last picture) from this data: The gas flow is presented in cubic meters per hour or Euro per day for each day, week, month and year.
The database, supplied by RRDtool, reduces the data’s resolution automatically as it gets older. This ensures the inhabitant’s privacy in so far that you can’t determine who has washed himself exactly when after a year.
Schematic and code
The license of the UART code is unclear, but it was taken from Atmel’s application note AVR307, so should be relatively lax.The remaining code is released under a 2-clause BSD license.
RRDtool is empoyed as database to store the counter values and flows, which is licensed under the GPL.
Files |
---|
gasd-r1910.tar.bz2 |