Giter Club home page Giter Club logo

toilet-sensor's Introduction

toilet-sensor

An Arduino-based toilet cistern monitor.

Concept

Sometimes the toilet needs an extra flush, and the cistern takes a while to fill up. How full is it? How long should I wait?

These are important questions.

Finally, we have answers.

Installed sensor

Sensor at work:

Sensor at work

Overview

An ultrasound distance sensor is installed within the toilet cistern. It emits ultrasound pulses which are reflected from the water surface and indicate the tank fill level. The sensor is controller by an Arduino microcontroller which reads the data, and generates the "image" to be displayed on the connected 8x8 LED matrix.

Overview

Materials required

Electronics:

Other:

  • 1 Small plastic box
  • Double-sided sticky tape
  • Cardboard
  • Small screws
  • Drill and assorted bits
  • Various small pliers, screwdriver, common tools

Construction

This was done in 2 parts, with the sensor adapter and the display module built seperately

Sensor

Within the toilet cistern I found that there were 2 removable plastic clips which hold a protective plate onto it's front. Each of these had a small pre-existing hole bored through it, which was ideal for mounting the sensor in the right direction. To this plastic clip I attached an angled piece of metal, and the mini breadboard on the other end. The sensor sits here facing downward and "secured" by a tie-wrap. I cut open an Ethernet cable and used 4 of the inner wires to connect the breadboard.

Display

Initially I prototyped the project using the Ethernet cable trailing out and everything hooked up to a breadboard:

This was enough to prove the concept worked within the cistern and interference didn't occur with the sides of the tank.

Next I moved on to mounting the components in a case. This was a repurposed 200g Ferrero Rocher box. I drilled two holes in the bottom (not visible here) large enough to admit the Ethernet cable and micro-USB power supply.

And connecting them with some 12cm lengths of ribbon cable:

And with this complete, I tidied up the wiring, reattached the flush button, mounted the whole unit to the wall, and powered it up:

Code

See the full Arduino C++ code in toilet-sensor.ino.

Circuit

Circuit diagram

This can also be viewed in the Fritzing software using the diagram.fzz file.

Calibration

Once the sensor and display were installed, the readings needed to be calibrated, since there's no way to know exactly how high or low the water level will be in comparison to the test runs (The sensor angle might have shifted during installation, etc). Calibration can be done very easily by capturing the serial output of the Arduino and exporting it to a spreadsheet.

Flush graph

Due to the confined space within the cistern and the natural movement of the water as it refills, the data at the start and end of the refill cycle is quite noisy. Ideally this would be solved by taking higher frequency measurements and smoothing for an average value, but this can come later.

For simplicity, in this example I take the top value as 400 and the bottom value as 1900. These values are configured at the top of the code file.

References

These tutorials and guides proved useful during the project

toilet-sensor's People

Contributors

skhg avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

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.