DIY Automatic Shower Timer

22K14517

Intro: DIY Automatic Shower Timer

We've all been told to take 5 minute showers. However, do we really know how long our showers actually are?

Here's a simple weekend project that is both fun and practical. This circuit uses an ATtiny85 chip that automatically starts a timer as soon as you close your shower door. When 5 minutes are up, a piezo speaker starts beeping to let you know that time is up. If you finish your shower early, the timer resets.

STEP 1: Gather Materials

Parts and Components

  • ATtiny85
  • 8-Pin IC Socket
  • SPST or SPDT Limit Switch (also called Microswitch)
  • 8 ohm Piezo Speaker
  • Green LED
  • Red LED
  • LED Holder - 5mm (2x)
  • 220 ohm Resistors (2x)
  • Male and Female Header Pins
  • Mini Solder-able Breadboard
  • Stranded Hook-up Wire 22 AWG
  • 2x AAA Battery Holder
  • AAA Batteries (2x)
  • Adhesive Velcro Strips
  • Small Project Box or Enclosure

( Most of these materials can be purchased from Sparkfun Electronics )

Tools

  • Soldering Iron
  • Diagonal Cutters
  • Rotary Tool (with drill bits)
  • Screwdriver
  • Multimeter

To program the Attiny, you will also need an Arduino and a few jumper wires, as well as the latest version of the Arduino IDE.

STEP 2: Program the ATtiny

Download the attached "ShowerTimer.ino".

Open the sketch and select "ATtiny85 @ 1MHz" under Tools > Boards. Hook up your Arduino to the Attiny and upload the sketch.

If you do not know how to program Attiny chips using an Arduino, check out this tutorial.

STEP 3: Wire Up the Circuit Board

While your soldering iron heats up, examine the circuit shown above for a couple of minutes. Notice that the limit switch acts as a power switch, turning the Attiny on and off.

To begin with, solder the IC socket somewhere in the middle of the PCB. You may have to tape it down first. Then solder on the piezo speaker, connecting the positive lead to Attiny pin 6 and the negative lead to ground (Attiny pin 4). Next, solder the LEDs and their respective resistors to Attiny pins 2 and 3.

Here comes the interesting part. Using your diagonal pliers, snip off two pins of both the male and female headers. Bend the leads of the female pins at a right angle, and solder one pin to ground. Finally, connect the positive wire of your battery holder to Attiny pin 8 and the negative wire to the second pin of the female header. The female header should jut out from the side of the circuit board as shown above.

When you have finished soldering, carefully insert the programmed Attiny chip into its socket and place the batteries in their holder.

STEP 4: Hook Up the Switch

You will now need your hook-up wire, a tape measure, and a pair of wire strippers.

Measure out a couple feet of wire and cut it off. Repeat so that you have two identical lengths of wire. Strip half an inch off of both, and twist the ends slightly to keep them from fraying.

Solder one end of both wires to the male header you previously prepared. Then solder the remaining ends to the leads of the limit switch. When the limit switch is depressed, current should be able to run from one pin to the other.

Note: It's a good idea to add heat-shrink tubing to insulate any solder joints you have made in this step. Just remember, put the heat-shrink on before you solder.

STEP 5: Make the Enclosure Case

Hopefully you have purchased a project enclosure that is sturdy, but easy to cut through, like the Radioshack plastic project enclosure shown above.

Measure the approximate diameter of the speaker and note the spacing of the LEDs. Using your rotary tool, cut out a large hole for the speaker and two smaller holes for the LEDs in the lid of the enclosure. Insert the LED holders into the smaller holes.

Now carefully place the circuit board into the lid, so that the speaker and the LEDs fit into their respective slots.

Note where the female header is and cut a small hole in the side of the enclosure so that the female header can be accessed.

Once you are satisfied with your enclosure, place the battery pack and the circuit board inside the case, and screw the lid on.

STEP 6: Mounting Your Project

At this point, you should have a nice looking enclosure housing your circuit board and a spool of wire with a limit switch at one end. Notice that the male header on the wire spool fits nicely into the female header of your project enclosure.

Stick a strip of the adhesive Velcro to your enclosure. Then stick a similarly sized strip on the wall next to your shower. Your can now attach your project to your bathroom wall (make sure the female header side faces up).

Next, mount your limit switch in the corner of the frame of your shower door as shown above, so that when you close the door, the switch is depressed ( I used tape in the picture, but it's probably a better idea to use hot glue or something more permanent). Run the wire over and out of the shower stall and plug the male header pins into the female header pins of your enclosure.

To test your shower timer, gently close the door of your shower. The green LED should light up.
After 5 minutes (of patiently waiting), the red LED should switch on and the speaker start beeping.

STEP 7: Final Words

Congratulations! You just built your own Automatic Shower Timer.

I hope you enjoyed this making this project and spending the time to reduce water usage.
Taking 5 minute showers helps save thousands of gallons of water and hundreds of pounds of carbon dioxide emissions each years, so you can pat yourself on the back for helping lessen the impact of global warming.

18 Comments

hi, nice work;
please, take a look at the shower timer we have developed in Spain, with auto shut off; the Acqua Tempus; it is a universal water saving systema, suitable for most showers at hotels, homes, gyms, camp sites, etc...

It restricts the maximum shower timer and when it is gone, it shuts the shower off for a pre set time; it is programmable.
I hope you like it:

Video: https://www.youtube.com/watch?v=LzdXiNln0QU

Specifications: https://arelia.es/blog/19_shower-timer-acqua-tempus.html

kind regards

how can i add a potentiometer to the circuit to adjust the range of the timer length anywhere from 1 second to 5 minutes?

If you connect the pot to one the attiny's analog input pins, you can use functions analogRead() and map() to proportionally convert the pot's resistance into a time value. Then use that time value in the if() statement that triggers the alarm.

Great idea! I need something like this, because my kids constantly use up all the hot water . . . but I'm thinking this needs an automatic switch that turns the water cold at the five minute mark! :)

I've been thinking the same way. My kids will happily stay in the shower with an alarm going, but will get out pretty quickly if the shower became cold.

I don't think it would be too hard to rig a diaphragm valve to shut off the hot water supply, with perhaps a warning sound to allow a few seconds for a final rinse off.

you could give this a try. Set to go showertimer.co

For getting kids to use less water, it would be fun if you could gamify it, pitting siblings against each other in a friendly competition. That would require knowing how much water was output, but if your shower is one that only allows for ON or OFF water flow, then the time element would be the only thing to take into consideration. They might reinvent the Navy shower all on their own!

Nice idea, but I would worry that my kids would become so competitive that they wouldn't actually get clean.

You must have daughters to build this :-)
Anyway great project. Just something i was curious about you use milis 300.000 for 5 min and a delay of 600+400mS times 30 for 30 seconds. On an Arduino that is correct, but I was wondering if it is actually accurate on an attiny.
I have programmed some attinys at 8MHz even and found the delay() can take 5-8 times longer than specified.
If you find the times correct then obviously i am doing something wrong

I programmed the Attiny in this project at 1MHz, and everything seems to work at about the right tempo. It might be a couple milliseconds off on each delay, but overall it is accurate enough to function as a 5 minute timer.

Thanks for your feedback :-) . I already discovered my problem. I programmed on 8 MHz, but that doesn’t set the right fuses for internal speed.. The Attiny has an 8 MHz timer that is by default divided by 8.
So if one programs it for 1MHz, that is OK.
As I programmed it for 8 MHz, the program thought it was 8 MHz, but the chip still thought it had to divide the clockspeed by 8, hence the delays being some 8 times slower..
What I did was to first burn the bootloader. It doesnt actually do that but sets the right fuses. After that my 8 Mhz programs worked perfectly :-)

Great project by the way

No more long, long, long showers.:(

This is awesome! I'd actually love something like this because I tend to space out in the shower in the morning. I think it would motivate me to keep moving!

Ha I could see myself just quickly opening and closing the door again to reset it! Great looking project!

Haha thats totally something I would do too. I would imagine a reset time of at least 5 minutes would fix those types of shenannigans.

5 Minute showers are the cruelest of first world tortures.

Oh man, my worst nightmare!

Nice build. :)