joel wassermanRushdMohamed AyadiPrashis Raghuwanshi
Published

Water Usage Metric Provider (WUMP)

A smart tracker for water usage that provide metrics for something as small as a shower to something as large as an entire city.

Showcase (no instructions)1,060
Water Usage Metric Provider (WUMP)

Things used in this project

Hardware components

Intel Edison
Intel Edison
The Intel Edison board for sending data to the server and reads the data from the ADC Sensor
×1
Hacked up Water flow sensor
We hooked up magnetic sensor with ADC module of Intel Xeon processor to calculate the water usage.
×1

Software apps and online services

PGADMIN3
DATABASE MANAGEMENT
AWS EC2
Amazon Web Services AWS EC2
SERVER IS RUNNING ON AWS EC2

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
We used soldering iron to solder the jumper wires with the Intel Xeon processor and with the magnetic sensor

Story

Read more

Code

Intel Edison Code

JavaScript
The Intel Edison XDK platform was used. This source code measures the water flow using the hall sensor on the water flow meter. Its uses the ADC on the Intel Edison and uses it to measure the voltage change and that is bound to the water flow through the water meter.
//Import the mraa library for intel Edison board
var mraa = require("mraa") ;
//Using node-rest-client npm package for sending data to the AWS backend
var Client = require('node-rest-client').Client;

var client = new Client();

//helper sleep function
var sleep = function(milliseconds) {
  var start = new Date().getTime();
  for (var i = 0; i < 1e7; i++) {
    if ((new Date().getTime() - start) > milliseconds){
      break;
    }
  }
};

console.log('MRAA Version: ' + mraa.getVersion()); //write the mraa version to the console

//Initialize analog pin A0
var analogPin0 = new mraa.Aio(0);

//flags for measuring the water flow
validMeasurementCounts = 0;
count_so_far = 0.0;
valid_measurement = false;
value_incremented = false;


while(true)
{
    //measure the voltage across the hall efect sensor on the hackedup water flow meter
    var analogValue = analogPin0.read(); //read the value of the analog pin

    console.log("Water sensor value:" + analogValue); //write the value of the analog pin to the console

    //Below block of code is relevant to the hacked up water flow meter,
    //it should be different for each  water flow meter
    //Logic to calibrate and ignore erroneous measurements  //
    if(analogValue > 700)                                   //
    {                                                       //
        validMeasurementCounts++;                           //
    }                                                       //
                                                            //
    if(analogValue < 100)                                   //
    {                                                       //
        value_incremented = true;                           //
    }                                                       //
                                                            //
    if((validMeasurementCounts > 5) && value_incremented)   //
    {                                                       //
        valid_measurement = true;                           //
        validMeasurementCounts = 0;                         //
    }                                                       //
    //////////////////////////////////////////////////////////

    if(valid_measurement)
    {
        //resetting the flags
        valid_measurement = false;
        value_incremented = false;
        count_so_far += 0.1;

        //creating the post request args
        var args = {
            data: {
                serialNumber: "firstDevice",        //should be the serial id of the device
                amount: 0.1                         //should be double value of water flow incremental value
            },
            headers: {
                "Content-Type": "application/json"
            }
        };

        //Executing the post request to the AWS backend
        client.post("http://ec2-54-84-48-230.compute-1.amazonaws.com/api/v1/device/transaction", args, function (data, response) {
            // parsed response body logging
            console.log(data);
        });

        //local debugging logging
        console.log("Water usage so far:" + count_so_far + " gallons");
    }

    sleep(200); //sleep 200ms
}

WUMP

Credits

joel wasserman

joel wasserman

1 project • 1 follower
Rushd

Rushd

1 project • 2 followers
Mohamed Ayadi

Mohamed Ayadi

1 project • 1 follower
Obsessed with iOS -> Love creating apps -> Crazy about writing software -> LOL
Prashis Raghuwanshi

Prashis Raghuwanshi

1 project • 0 followers
Thanks to .

Comments

Add projectSign up / Login