1.0.1 • Published 7 years ago
water-flow-sensor v1.0.1
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
- Require
water-flow-sensor
module - Initialize sensor with
pin
andmodel
values and acallback
- The callback gives (when flow start/stop)
res.pin
: sensor pinres.model
: sensor modelres.isRunning
: whether the sensor is running or notres.flow
: instant flow rate in L/minres.volume
: volume in L
- 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