1.0.1 • Published 7 years ago

water-flow-sensor v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

Water flow sensor

Get flow rate and volume consumption from water flow sensors

Features

  • :electric_plug: Initialize sensor on GPIO pin
  • :articulated_lorry: Set the sensor model
  • :shower: Flow detection
  • :droplet: Get flow rate (L/m)
  • :baby_bottle: Get volume consumption (L)

Install

$ cd <project-folder>
$ npm install water-flow-sensor --save

Usage

  1. Require water-flow-sensor module
  2. Initialize sensor with pin and model values and a callback
  3. The callback gives (when flow start/stop)
    • res.pin: sensor pin
    • res.model: sensor model
    • res.isRunning: whether the sensor is running or not
    • res.flow: instant flow rate in L/min
    • res.volume: volume in L
  4. Get status, as well as flow and volume data anytime
// Initialize the sensor
var wfs     = require('water-flow-sensor')
  , sensor  = new wfs(17, 'POW110D3B', wfsCb)

// Callback
function wfsCb(res) {
  console.info(`${res.pin} | ${res.model} | ${res.flow} L/m | ${res.volume} L | ${res.pulses}`)
}

// Access to status and data
console.info(`Sensor is running: ${sensor.isRunning}`)
console.info(`Flow rate: ${sensor.flow} L/min`)
console.info(`Volume: ${sensor.volume} L`)

Contributing

Please read the Code of Conduct.

Technical details

Water flow sensor models

Platforms

Developed on Rapsberry Pi model B

Dependencies

  • onoff ^1.1.2
1.0.1

7 years ago

1.0.0

7 years ago