Skip to content

This repo contains all documents related to the MeWater Project's Cloud Infrastructure

License

Notifications You must be signed in to change notification settings

codewithlennylen/mewater-cloud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

MeWater

MeWater is a water conservation solution that uses IoT Devices (Solenoid Valves, Flow Meters, etc) to detect and monitor water leakages in realtime. The system auto-shuts down detected leakage lines thus saving on water.
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project


(back to top)

Built With

  • AWS
  • Python

(back to top)

Getting Started

I would ideally share this architecture via Infrastructure as Code such as AWS Cloudformation or Terraform. But I'll deliver that sometime in the future as I iterate and improve on the architecture.


There are 4 major functions that this architecture serves:

  1. Getting IoT Data from IoT Core and Storing it in an S3 Bucket (Raw)
  2. Processing the raw data into something useful to display to end-users
  3. Sending alerts to users in case a leak is detected
  4. Sending 'valve shutdown' command to IoT Devices in case a leak is detected

1. Storing Raw Data

We use an IoT rule provided by AWS IoT Core to push data from a subscribed MQTT topic to an S3 Bucket.


2. Data Processing & Data Display

A lambda function sits at the heart of our solution. It takes the data from S3 via a trigger event (anytime data is pushed into the bucket, it's immediately processed) -> we were aiming for a realtime solution

The processed data is stored in a DynamoDB Table, which allows for near-realtime queries.

We've then set up an EC2 Instance to serve our web application where users can view a live dashboard allowing them to monitor the system status. The web-app access our DynamoDB Table via the Python Boto3 SDK.


3. Leakage Detection Algorithm & User Alerts

The current leakage detection algorithm is a poor man's version, in that we only subtract output water volumes from the input. We are working on a more sophisticated algorithm.

leaked_volume = inlet_volume - (outlet1_volume + outlet2_volume)

Once a leakage is detected, the lambda pushes a message with the leakage info to an AWS SNS Topic.

  • Another Lambda function is subscribed to this topic and this function sends a command to the IoT Devices via AWS IoT Core to shutdown the valves thus stopping the water leak
  • An SMS is sent to the user informing them of the detected leak
  • An Email is sent to the user informing them of the detected leak

(back to top)

Roadmap

  • Use AWS Secrets Manager to securely store environment variables
  • Use Kinesis Data Analytics to analyze IoT realtime events
  • Build an API to query the Raw Data -> AWS API Gateway

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Lenny Ng'ang'a - @codewithlenny - [email protected]

Project Link: https://github.com/codewithlennylen/mewater-cloud

(back to top)

Acknowledgments

(back to top)

About

This repo contains all documents related to the MeWater Project's Cloud Infrastructure

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages