Giter VIP home page Giter VIP logo

pump-monitor's Introduction

Pump Monitor

Once upon a time, there was a basement with below grade plumbing. Thanks to the wonderful technology of ejector pumps, this posed no immediate problems for the basement in question. One day a terrible thought occurred to the resident of said basement, "How can I be certain that the pump is working? How can I guarantee advanced knowledge of a potential shit flood?" The resident thought about this for a day or so, and finally determined that this was a job well-suited for an accelerometer attached to an Arduino board. And thus the shit pump monitor was born.

Logic Overview

  1. Connect to a wireless network
  2. Begin and continuously monitor the LSM6DS3 sensor's gyroscopic data
  3. When a threshold has been reached, make an HTTP call to a web endpoint
  4. Healthcheck: Periodically call out to webserver, regardless of gyro data
  5. Watchdog Timer: Reboots the device when it gets in an unresponsive state.

Getting Started

  1. Purchase a Nano 33 IoT Arduino (Is this strictly necessary? No, but you'll probably need to customize this sketch to support a different board)
  2. Create a file arduino_secrets.h in the same directory as the sketch file (See below section)
  3. Make some adjustments as needed. (eg. The default gyroscopic threshold is 5, which may or may not be valid for your plumbing situation)
  4. Upload the sketch to your arduino board
  5. Snugly attach the arduino board to the egress plumbing of your ejector pump
  6. Power the board
  7. Extra credit: Setup the pump backend for continuous monitoring of your, er, monitor

arduino_secrets.h

#define SECRET_SSID "Network SSID"
#define SECRET_PASS "Network password"
#define WEBSERVER "domain.name.of.webserver"
#define AUTH_CODE "some-unique-identifier-for-the-backend-to-recognize"

Note: The final endpoint will be https://<WEBSERVER>/flush.php?authCode=<AUTHCODE> along with some other query params.

Known Issues

  • The Nano will crap out after X HTTP requests. A watchdog timer has been put in place to reboot the device once it gets in this weird state.
  • The Nano 33 IoT clock runs slow by ~2% (YMMV). It does not have a crystal-based clock, so I've added an adjustment to keep the healthcheck closer to 12 hours.

pump-monitor's People

Contributors

thejart avatar

Watchers

 avatar

pump-monitor's Issues

a list of issues

  • requests should include an auth token
  • when wifi fails to connect, wait and retry
  • catch and retry http requests (including reconnecting to wifi when needed)

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.