Giter Club home page Giter Club logo

watermeter's Introduction

Measuring home water usage with sensor on watermeter

I decided to measure the water use at home, and based my own implementation on the following sources:

I am using a NodeMCU ESP8266 board with an inductive proximity sensor, and the sensor is connected to the Vin, GND, and D4 (GPIO2). The board is powered with a micro USB connection. I put the board in a watertight case, and used a long micro USB cabel to put the power supply away from the watermeter, as the (underfloor) area is quite humid in my case.

(picture missing)

This is how the sensor is 'attached' to the Elster / Honeywell V200 watermeter (which is owned by the water utility company, so don't make any modifications to it!):

Setup

This watermeter has a rotating element with iron, which rotates once per liter. Note that there are different sizes and voltages and NPN/PNP proximity sensors, so make sure to buy the correct one (I use 5V NPN).

I uploaded the Watermeter.ino file to the board; it does the following setup:

  • Open serial connection to write monitoring / debugging messages
  • Connect to WiFi
  • Connect to MySQL database and download the latest logged pulse count
  • Set an IRQ callback on falling pulse of induction / prox sensor In the loop it does the following:
  • See if SEND_FREQUENCY time has passed (default 30 seconds), and upon passing
    • Update the flow
    • If there are pulses received
      • Re-calculate the used water volume based on pulses
      • Upload the new pulse count, water volume and flow to the MySQL database

The used MySQL table can be created with:

CREATE TABLE `water` (
 `datetime` datetime NOT NULL,
 `pulseCount` int NOT NULL,
 `volume` decimal(10,3) NOT NULL,
 `flow` decimal(4,1) NOT NULL,
 PRIMARY KEY (`datetime`),
 UNIQUE KEY `datetime` (`datetime`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Water meter readings'

The NodeMCU does not do to sleep (yet?), as pulses can come all the time. Maybe in a next release I can connect the sensor to the wake-up pin, but need to check later...

watermeter's People

Contributors

edwingh avatar

Watchers

 avatar

watermeter's Issues

Cant conect to MYSQL?

Connects to WiFi, have existing working MySQL server, have setup a new database called water, and imported the water table using the provided instruction, however upon programming / reboot, the ESP dosnt seem to connect... Have configued IP / User / Pass and database name...

Just get a cycle:

....trying...
...got: 0 retrying...
...trying...
...got: 0 retrying...
...trying...
...got: 0 retrying...
....trying..

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.