Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Ryan Chan
Published © GPL3+

Shower Regulator

Learn how to make a device to limit your shower time!

IntermediateFull instructions provided1.5 hours16,498

Things used in this project

Hardware components

Arduino 101
Arduino 101
×1
Normally Closed Solenoid Valve
Make sure it can withstand the temperature of the shower water; if you are using a metal one make sure it contains no lead. ALSO: Measure your own plumbing before buying
×1
Fittings for Solenoid Valve
Make sure it can withstand the temperature of the shower water; if you are using a metal one make sure it contains no lead. ALSO: Measure your own plumbing before buying
×1
Breadboard (generic)
Breadboard (generic)
×1
RGB Backlight LCD - 16x2
Adafruit RGB Backlight LCD - 16x2
×1
Buzzer
Buzzer
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Power MOSFET N-Channel
Power MOSFET N-Channel
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×1
Flip Switch
×1
Battery Bank
×1
Resistor 221 ohm
Resistor 221 ohm
220 ohm will also work aswell
×2
1N4007 – High Voltage, High Current Rated Diode
1N4007 – High Voltage, High Current Rated Diode
×1
Plastic Container
×1
Velcro Wall Strips
×2
Cheap USB Cable
×2

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Hot glue gun (generic)
Hot glue gun (generic)
Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

Schematics Image

Schematics

Code

Code

C/C++
//User settings:-----------------------
const float showerTime = 5; //In minutes
const int warmupTime = 20; //In seconds
//-------------------------------------

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int stat = 0; //This keeps track of the status 

void setup() {
  // put your setup code here, to run once: 
  lcd.begin(16,2); 
  pinMode(13,OUTPUT); //Set pin 13 as output (For solenoid valve)
  pinMode(10,OUTPUT); //Set pin 10 as output (For piezo buzzer)
}

void loop() {
  // put your main code here, to run repeatedly:
  if(stat == 0){ //If the status is 0, begin warmup
    digitalWrite(13,HIGH); //Open solenoid valve
    tone(10,2000,1000); //Gives the warmup buzz
    for(int  i = warmupTime; i > 0; i--){
      lcd.clear();
      lcd.setCursor(0,0);
      lcd.print("Water Warmup:"); //Text for line 1
      lcd.setCursor(0,1);
      lcd.print(String(i) + " seconds"); //Text for line 2
      delay(1000);
    }
    stat++; //Update status
  }
  if(stat == 1){ //If the status is 1, begin the shower timer
    tone(10,2000,1000); //Gives the shower buzz; warmup is over
    delay(1500);
    tone(10,2000,1000);
    for(int i = showerTime * 60; i > 0; i--){
      if(i == 120){ //If there are 2 minutes left, give a warning buzz
        tone(10,2000,1000); 
      }else if(i == 60){ //If there is 1 minute left, give a second warning buzz
        tone(10,2000,1000);
      }
      lcd.clear();
      lcd.setCursor(0,0);
      lcd.print("Shower:"); //Text for line 1
      lcd.setCursor(0,1);
      lcd.print(String(i) + " seconds"); //Text for line 2
      delay(1000);
    }
    stat++; //Update status
  }
  if(stat == 2){ //If the status is 2,stop the shower and notify user that it is over
    digitalWrite(13,LOW); //Close solvenoid valve
    tone(10,2000); //Gives buzz until it is shut off
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("Shower Over"); //Text for line 1
    lcd.setCursor(0,1);
    lcd.print("Have a Good Day!"); //Text for line 2
    delay(2000);
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("Turn me off"); //Text for line 1
    lcd.setCursor(0,1);
    lcd.print("Turn water off"); //Text for line 2
    delay(5000);  
  }
}

Credits

Ryan Chan

Ryan Chan

9 projects • 232 followers
I like turtles. I also like robots.

Comments