Shower Flow Monitor

Shower Flow Monitor

Category: Water
Communication: None
Components: Internal
Created By: Sairam Problem Solver
Difficulty Level: Beginner
Input Sensor:
Microcontroller: Arduino UNO
Output Device:
Status: Complete

The Shower Flow Monitor is a tech-solution that monitors water usage in the shower.

It helps to nudge the user to be conscious of their water consumption at the shower.



Refer to the first booklet Discover in the Solve Ninja Techno Kit for information on the components available with the Solve Ninja Techno Kit.

Things you will need

Solve Ninja Techno Kit which will contain:

Additional materials:

  • 2 x FTA (Female threaded adapter) - to attach flow sensor to pipe
  • PVC pipe of 1/2 inch diameter
  • Spanner - to tighten parts
  • Teflon tape - to prevent leakage through pipe joints
  • Electrical wire and sockets for extension


Questions you need to ask

Get data. Examples:

  • What is the difference between water usage and water wastage?
  • What are the relevant units of measurement when we take bath?
  • What is the maximum flow rate of the shower? At what point of opening the tap does this happen?
  • What is the ideal flow rate of the shower to take bath?

What are the things you need to learn about the user? Examples:

  • Who is the user?
  • How much water is being used?
  • How often is it being used?
  • How much is being wasted? How?
  • Is there any time when the user opens the tap gradually/not fully?
  • Does the user think they are wasting water?
  • Does the user recognize this as a problem?
  • What is stopping the user from recognizing the problem and taking action?

What are the things you need to think about to convince the user that wasting water is a problem? Examples:

  • Why is it a problem?
  • What would influence the user’s behaviour? How do they want the problem to be solved/notified?

This will help you decide what output device to use, for example-

  • Buzzer with an annoying beeeep or a gentle music (like a water filter), or,
  • Multicolour LED that blinks red when there’s a lot of water flow/usage, yellow when there’s very little, and green when it’s optimal, or,
  • LCD screen that displays how much water is being/has been used.

Refer to the second booklet Investigate in the Solve Ninja Techno Kit for information on which Input sensors and Output devices to use.


Refer to the third booklet Solve in the Solve Ninja Techno Kit for information on making connections and Arduino IDE.

Steps to follow

  1. Take the Solution Box from the Solve Ninja Techno Kit.
  2. Connect the 3 pin wire connector to the PCB in the port named “Flow Sensor”.
  3. Connect the flow sensor to the 3 pin wire connector.
  4. Connect one end of the USB cable to Arduino and other to Computer/laptop.
  5. Plug in one end of the power adapter to the DC jack, and the other end to a power socket.

You will need a 9V 1A power adapter for using this kit. It will not work with the USB cable alone.

  1. Switch on the Solution Box.

  2. Open Arduino IDE on computer/laptop.

  3. Download, Copy, Paste code from here to the Arduino IDE:

  • Click here for code - Without WiFi (Beginner Level)

    /* Prototype Name: Shower Flow Monitor 
      Input Sensor   : Flow Sensor,
      Output Device  : Multicolor LED, Buzzer
      Libraries Used : LiquidCrystalPCF584, FastLED
    #include <LiquidCrystal_PCF8574.h>
    LiquidCrystal_PCF8574 lcd(0x3F);
    #define DATA_PIN 9 // Digital pin number for LED (Multicolor)
    #define NUM_LEDS 3
    CRGB leds[NUM_LEDS];
    int buzzer = 8; //digital pin 8
    int pulsecount = 0;;
    byte sensorInterrupt = 0;
    byte sensorPin       = 2; //digital pin 2
    float calibrationFactor = 4.5;
    volatile byte pulseCount;
    float flowRate;
    unsigned int flowMilliLitres;
    unsigned long totalMilliLitres;
    unsigned long oldTime;
    void setup() {
      FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
      leds[0] = CRGB::Black;;
      pinMode(buzzer, OUTPUT);
      pinMode(sensorPin, INPUT);
      digitalWrite(sensorPin, HIGH);
      pulseCount        = 0;
      flowRate          = 0.0;
      flowMilliLitres   = 0;
      totalMilliLitres  = 0;
      oldTime           = 0;
      attachInterrupt(sensorInterrupt, pulseCounter, FALLING);
    void loop() {
    void flow_sensor() {
      if ((millis() - oldTime) > 1000)   // Only process counters once per second
        flowRate = ((1000.0 / (millis() - oldTime)) * pulseCount) / calibrationFactor;
        oldTime = millis();
        flowMilliLitres = (flowRate / 60) * 1000;
        totalMilliLitres += flowMilliLitres;
        unsigned int frac;
        Serial.print("Flow rate: ");
        Serial.print(int(flowRate));  // Print the integer part of the variabley
        Serial.print(".");             // Print the decimal point
        // Determine the fractional part. The 10 multiplier gives us 1 decimal place.
        frac = (flowRate - int(flowRate)) * 10;
        Serial.print(frac, DEC) ;      // Print the fractional part of the variable
        // Print the number of litres flowed in this second
        Serial.print("  Current Liquid Flowing: ");             // Output separator
        // Print the cumulative total of litres flowed since starting
        Serial.print("  Output Liquid Quantity: ");             // Output separator
        pulseCount = 0;
        attachInterrupt(sensorInterrupt, pulseCounter, FALLING);
    void shower_indicator() {
      if (totalMilliLitres > 0 && totalMilliLitres < 15000) {
        leds[0] = CRGB::Green;;
        tone(buzzer, 1000, 500) ;//beeps at frequency of 1000Hz
      else if (totalMilliLitres > 15000 && totalMilliLitres < 30000) {
        leds[0] = CRGB::Blue;;
        tone(buzzer, 10000, 500) ;//beeps at frequency of 10000Hz
      else if (totalMilliLitres >= 30000) {
        leds[0] = CRGB::Red;;
        tone(buzzer, 45000, 500) ;//beeps at frequency of 45000Hz
    void pulseCounter()
      // Increment the pulse counter
  1. Then Check for Tools→ Board→ Port in the IDE.

  2. Compile and Upload the code.

  3. Disconnect USB cable.

  4. Switch off the Solution Box.

  5. Switch on the Solution Box.

  6. Test by blowing air into the flow sensor in the direction of the arrow. Test if value increases in the serial monitor/ LCD screen.

  7. Disconnect the flow sensor from the Solution Box.

  8. Connect the flow sensor to the tap as shown. Use FTA/Threaded Collars to fix the sensor to the pipes. Tighten the FTA using a spanner and use the teflon tape to prevent any leakages that might happen.

  9. Re-Connect the 3 pin wire connector to the PCB in the port named “Flow Sensor”. Extend if needed. You can use Jumper cables for this.

  10. Connect the flow sensor to the 3 pin wire connector.

  11. Hang the Solution Box on the wall at a suitable distance from the shower and flow sensor. To check if the distance is suitable,

  • make sure that water doesn’t splash till that distance
  • the flow sensor wire/power adapter wire should not be too taut.
  1. Connect the flow sensor to the Solution Box.

  2. Power up the Solution Box.


Refer to the fourth booklet Share inside the Solve Ninja Techno Kit to know how you can share your solution.

  • Locally: Once you install the solution near a tap, observe how the user interacts with the tap and the water meter. Talk to them about the solution and learn what they think of it.
    • Has their perspective on water consumption changed? Are they consciously reducing their water consumption?
    • Is there any way to collect data to prove that their water consumption has reduced, as a result of reinforcing the behavior of reducing the water flow rate when they take a bath in shower?
  • Globally: Share your solution on the Solve Ninja App, and inspire 5 of your friends to take similar action. Continue collecting data; real victory is when your family, school mates, community members realise that in addition to saving water as a resource, they are also saving money in their water bills!