<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Shower Monitor]]></title><description><![CDATA[<p dir="auto">I have a bunch of teenagers at home... showers can be (are in fact) endless.</p>
<p dir="auto">This can be analysed from different points of view :  waste of money, waste of precious resources, waste of energy to heat that water, ...</p>
<p dir="auto">One could simply "lock" the amount of water allowed for one shower, by using a flow meter and an electric valve.</p>
<p dir="auto">Let's try a more civilised approch first: a visual way of knowing instantly the amount of water used.</p>
<p dir="auto">We shall use :</p>
<ul>
<li><a href="https://www.amazon.com/GREDIA-Flowmeter-Fluidmeter-Counter-Length%EF%BC%89/dp/B086W6WFDM/ref=sr_1_1_sspa?crid=2KQGRY0ALVHP9&amp;dib=eyJ2IjoiMSJ9.85zqo8IybL7Vj1aNamDJjHnu6Ds0VewMzS6hsRQjihnlo_qQtHV9y7ChimNu_mIXE5lBbU424qlYkoI8ZhvtyI18Lqqnnxa7Vu4MNma7naMVG-5Fh3trtoGtaKTu29R5lLP6tXg1bB7Uol1zGCihKKsfCTNFqtpSu_VCKPk14ns6zQ4Ei9jP44l5uFfhuw9uFp_a7kUB_J1hXqKZTxRjxuhoRaP2rVIa1JoVwlGezT0.S1kV-5YpICDA-D_-Ec2J6sTmMuWwdPhHX_vdNqvfHBw&amp;dib_tag=se&amp;keywords=5v+flow+meter+G1%2F2&amp;qid=1782894011&amp;sprefix=5v+flow+meter+g14%2F2%2Caps%2C822&amp;sr=8-1-spons&amp;sp_csd=d2lkZ2V0TmFtZT1zcF9hdGY&amp;psc=1" rel="nofollow ugc"> flow meter</a></li>
<li>arduino</li>
<li>1 unit NeoPixel</li>
<li>power bank</li>
</ul>
<p dir="auto">FlowMeter is connected to INT0.  Once calibrated it gives "X pusles per minutes" which is the base for the whole program.<br />
LED will be glowing from blue to red.  Quantity of water used can be modifed by user.<br />
Water flow can be paused and resumed during the wash.<br />
If a certain amount of time (user modified) is elapsed, the arduino goes to deep sleep and timers/counters are reset.<br />
This project has not been "MySensorised" yet but it might be.</p>
<p dir="auto">I am also willing to integrate the whole lot into the shower head and replace the flow-meter  with a water-powered generator (to charge a supercap) and some hall effect sensor (to get pulses from the generator's magnets). An ATTiny85 would do the job!</p>
<p dir="auto">Here is the code, comments welcome to make it more efficient :</p>
<pre><code>#include &lt;Adafruit_NeoPixel.h&gt;
#include &lt;avr/interrupt.h&gt;                        //libraires to manage sleep mode
#include &lt;avr/sleep.h&gt;                            //libraires to manage sleep mode

#define FLOW_PIN    2                             //waterflow sensor pin
#define LED_PIN     A0                            //neopixel data pin
#define LED_COUNT   1

/***********************
 * user defined values *
 ***********************/
uint32_t maxLitres = 50;                               // max water quantity.  led goes RED !
const float pulsesPerLiter = 570.0;               // pulses per litre (adjust after calibration)
unsigned long delayBeforeReset = 120000;          // delay between last pulse and going to sleep
uint32_t startHue = 43690;                             // hue of blue ( 65536*2/3 )
uint32_t endHue = 0;                                   // hue of red ( 0 )
/***********************
/*          end        */
 ***********************/
uint32_t hueNow;
float hueIncrementPerPulse;                       // = ( startHue - endHue ) / ( pulsesPerLiter * maxLitres
float litres = 0;                                 // total water consumption given by "pulses" and "pulse per liter"
volatile unsigned long totalPulses = 0;           // 
volatile unsigned long prevTotalPulses = 0;       // last total of pulses before next pulse
unsigned long timeOfLastPulse = 0;                // when the last pulse occured

Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800); //data sequence GRBW

void setup() {
  Serial.begin(115200);
  strip.begin();
  delay(200);
  strip.clear();
  strip.show(); // Initialize pixel to 'off'
  pinMode(FLOW_PIN, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(FLOW_PIN), flowISR, RISING);
  hueIncrementPerPulse = ( startHue - endHue ) / ( pulsesPerLiter * maxLitres );
  Serial.print("hueIncrementPerPulse:");
  Serial.println(hueIncrementPerPulse); // 3 decimals
}

void loop() {
  /****************************
      water volume management
   ****************************/
  static unsigned long lastPrintMs = 0;
  unsigned long now = millis();
  if (now - lastPrintMs &gt;= 1000) {
    noInterrupts();
    unsigned long pulses = totalPulses;
    interrupts();
    litres = pulses / pulsesPerLiter;
  }
  showHue();
  /********************
     sleep management
   ********************/
  if ( (millis() - timeOfLastPulse &gt;= delayBeforeReset) &amp;&amp; (totalPulses == prevTotalPulses)) {
    delay(200);
    enterSleep();
  }
  prevTotalPulses = totalPulses;
}


void flowISR() {
  totalPulses++;
  timeOfLastPulse = millis();
}


void showHue() {
  if( litres &gt;= maxLitres ) {
    hueNow = 0;
  }
  else {
    hueNow = startHue - (totalPulses * hueIncrementPerPulse ) ;
  }
  uint32_t rgbcolor = strip.ColorHSV(hueNow);
  strip.setPixelColor(0, rgbcolor);
  strip.show();
 
}


void enterSleep(void)
{
  sleep_enable();
  attachInterrupt(digitalPinToInterrupt(FLOW_PIN), pin2Interrupt, LOW);  // Setup pin2 as an interrupt and attach handler
  set_sleep_mode(SLEEP_MODE_PWR_DOWN);
  strip.clear();
  strip.show(); // Initialize pixel to 'off'
  totalPulses = 0;
  litres = 0;
  timeOfLastPulse = millis();
  delay(1000);
  sleep_cpu();
  /* Program will start from here on after wake up */
  sleep_disable();
  }


void pin2Interrupt(void)
{
  Serial.println("Exiting sleep");  // This will bring us back from sleep
  detachInterrupt(0);  // We detach the interrupt to stop it from continuously firing while the interrupt pin is low.
  attachInterrupt(digitalPinToInterrupt(FLOW_PIN), flowISR, RISING);
}
</code></pre>
<p dir="auto">I am using "Hue" instead of "RGB" as it simplifies a lot the process of following a ranibow !</p>
]]></description><link>https://forum.mysensors.org/topic/12345/shower-monitor</link><generator>RSS for Node</generator><lastBuildDate>Thu, 02 Jul 2026 02:27:12 GMT</lastBuildDate><atom:link href="https://forum.mysensors.org/topic/12345.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 01 Jul 2026 08:18:21 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Shower Monitor on Wed, 01 Jul 2026 15:25:38 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/oldsurferdude" aria-label="Profile: OldSurferDude">@<bdi>OldSurferDude</bdi></a> :D that's the smell of experience !</p>
<p dir="auto">Even though things come eventually to an end (with great sadness i'm afraid) this had to be addressed.</p>
<p dir="auto">What kind of flow do you measure then ?</p>
]]></description><link>https://forum.mysensors.org/post/114742</link><guid isPermaLink="true">https://forum.mysensors.org/post/114742</guid><dc:creator><![CDATA[ben999]]></dc:creator><pubDate>Wed, 01 Jul 2026 15:25:38 GMT</pubDate></item><item><title><![CDATA[Reply to Shower Monitor on Wed, 01 Jul 2026 14:29:23 GMT]]></title><description><![CDATA[<p dir="auto">First, my sympathies and empathies.  Remember, this, too, shall pass.  Perhaps you will become a grandparent and get your revenge by spoiling the grandkids rotten.</p>
<p dir="auto">Cool project!  I use the same flow meter and have found it very reliable.  I, too, think the idea of realtime feedback is much better than the shut-off valve which would also double the cost of the project.</p>
<p dir="auto">And, if you do become a grandparent, you can offer to remove and install it in your offspring's abode. ;)</p>
<p dir="auto">-OSD</p>
]]></description><link>https://forum.mysensors.org/post/114741</link><guid isPermaLink="true">https://forum.mysensors.org/post/114741</guid><dc:creator><![CDATA[OldSurferDude]]></dc:creator><pubDate>Wed, 01 Jul 2026 14:29:23 GMT</pubDate></item></channel></rss>