Bathroom Minder
In our house, we have two teenagers and 1.5 bathrooms. Since they both like to spend a very long time taking showers and getting ready, this means that much of the time my wife and I are left with only the half-bath to use. This is a problem.
We've tried several approaches in the past, including:
- Asking them to set a countdown timer on their smartphone to 30min.
- Placing an actual clock in the bathroom.
- Turning down the hot water.
- Starting the dishwasher and/or the washing machine.
- Yelling, begging, etc.
Nothing has worked.
I decided that what we really needed was a door alarm, but in reverse - an alarm that sounds when the door is closed, instead of opened. To be fair, the alarm should give the occupant ~30-40 minutes to do their business before sounding, and give plenty of warning that the clock is running.
Enter the Arduino!
Gather Your Parts...
To replicate this project, you will need an Arduino Uno or Mega 2560 and...
- A few RGB LED lights. I used three Grove LEDs, but you can use as many or as few as you want.
- A speaker to play the chimes and alarm on. I used this one, also Grove.
- If you are using Grove components, which I strongly recommend to keep everything simple, you'll also want to buy a handful of cables, like these.
- A magnetic reed switch. I chose this one, from Amazon.
- A power supply. I selected this one so that I could use either a 9V battery or AA batteries, for longer life if needed, and it basically came with a "free" Arduino Uno clone as a bonus.
My Arduino came from an older version of the Seeed Studio ADK Dash Kit (mine did not come with the cables). If you can find one on Amazon or Ebay, it is a pretty good way to get started. It includes the Grove megashield, RGB LEDs, an Arduino Mega 2560 (clone) with built-in USB, plus of collection of other Grove modules that could be fun for other projects.
Write the Program
My specifications for the program were as follows:
- Must have an audible alert at regular intervals to attract the attention of the occupant.
- Must have a visual status to indicate, in a macro sense, how much time was left.
- The visual aid must be easily viewed and interpreted through glass shower doors and/or off the reflection of a fogged up mirror.
- The visual should clearly show danger red as the countdown approaches the end.
- Must have an audible alarm that does not stop.
- System should be armed when the door closes, and disarmed when the door is open.
I did not want to use a digital readout, simply because I felt that viewing it through steamy shower doors or off the mirror reflection would be difficult at best. My first attempt used only one RGB LED blinking faster and faster (using a decay function) as time ran down, but this approach doesn't give the occupant any real sense of time passed or remaining.
I decided that having three RGB LEDs was the way to go (and it didn't hurt that I had three on hand). Each one would countdown 1/3 of the total allowed time. This could give the occupant a clear sense of time passed and remaining, with only a quick glance at the three LEDs.
To attract attention to the timer, I decided to play a two-tone chime at the start of each interval.
Finally, when the timer is done, a two-tone alarm sounds and continues to sound until the system is disarmed, by opening the door.
I went through 3 major iterations of the program, each time simplifying and coming with fewer and fewer lines of code that worked better than the previous attempt. I am sharing only the "final" version here, since it does what needs to do without extra complexity.
Assemble Parts and Test
Since I was using Grove, the assembly was probably the easiest part of this project.
Connect the RGB LEDs into a chain (e.g. out from LED1 to in of LED2). Once you have the chain, connect in of LED1, the first RGB LED in your chain, to the Arduino.
In my case:
- Ground to black (ground)
- +5v to red (+5v)
- D7 to white
- D6 to yellow
At this point, you can compile and load the program to the Arduino to test the lights. I suggest setting the TimeInt value to 1, so that you don't have to sit through a long countdown while testing.
Connecting the speaker, also a Grove module, is just as simple. Connect the speaker on D8-D9.
In my case:
- Ground to black (ground)
- +5v to red (+5v)
- D9 to white
- D8 to yellow
You can test again, or if you haven't tested it yet, test it now. Play with the TimeInt and anything else that you want to change and compile,load, then test.
Finalize and Deploy
I wrote the program and performed all of the prototyping and testing on using the Seeed Mega clone, but I felt that was "too expensive" to deploy as the final solution. Using the Uno clone, I went ahead and soldered the connections (after testing) and mounted everything to spare piece of wood.
For an enclosure, I wanted something that was clear (so that the user could see the RGB LEDs), but also somewhat water resistant. The bathroom, the target deployment location, can have very high humidity from long showers, and I wanted the Arduino to have some level of protection. The solution was to reuse a Chinese take-out container. It came with a tight, well sealed, clear lid and had plenty of room inside to mount Arduino and battery!
I then mounted the system in the bathroom using 3M Command strips.