Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fabian-dev/gasmeter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

9 Commits

Repository files navigation

Gasmeter reading using Raspberry Pi, an Inductive Proximity Sensor and InfluxDB

This project sets up a Raspberry Pi to read my gasmeter by a metal sensor. The gasmeter is a Pipersberg G4 RF1 c.

The metal sensor must be placed on the gasmeter and will read each 0,01m3 consumption.

The project is inspired by a blog post from rutg3r.com and I adopted it to InfluxDB and gpiozero.

Requirements

  • A Raspberry Pi
  • A Metal Inductive Proximity Sensor / Proximity switch operating at 5V. I use the 5V Metal Proximity Switch by DFRobot

Setup sensor

Connect the sensor to the Pi's GPIO pins:

Sensor cable color GPIO pin Description
Black 6 Ground
Brown 4 5V
Blue 7 (GPIO4) Signal

(see Pi's Pin numbering)

Attach the sensor to the gasmeter and ensure, that the sensor light switches on/off on each 0,01m3 consumption.

See my setup for a reference:

Push readings to InfluxDB

Install Docker on the Raspberry Pi and bring up the Docker Compose file.

This will launch InfluxDB and a small Python script which forwards consumption readings at the GPIO pin to InfluxDB.

Configure InfluxDB

Navigate to http://<pi host>:8086 and create a Dashboard with the following query

consumption = from(bucket: "sensors")
 |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
 |> filter(fn: (r) => r._measurement == "gas" and r._field == "consumption")
 
consumption
 |> aggregateWindow(every: 1h, fn: sum)
 |> yield(name: "/h")
consumption
 |> aggregateWindow(every: 1d, fn: sum)
 |> yield(name: "/d")

The Dashboard will show you a per hour and a per day consumption graph:

InfluxDB Dashboard

About

Push gasmeter readings to InfluxDB using Raspberry Pi and an inductive proximity sensor

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

AltStyle によって変換されたページ (->オリジナル) /