Introduction: Bathroom Timer
This project is a simplified version of the Sleep Enough Timer that I posted some years ago. I created this Bathroom Timer for my partner who had to keep stuff in her hair for a certain amount of time when taking a shower. Initially I wanted to make a timer that produced sound but the piezo resonator I had did not make much noise so I decided to make a version with a blinking LED. Because of that it has even more similarities with the Sleep Enough Timer but there are some differences.
The previously posted Sleep Enough Timer runs on a crystal clock of 32 kHz and has to run for at least 8 hours after which you switch the power of the timer off. This Bathroom Timer only has to run for at most 3 minutes and so it uses the internal oscillator of a micro controller. When the timeout is passed, the Bathroom Timer goes to standby so the power is never switched off. Restarting this timer is done by pressing a push button.
As always I built this project around my favorite micro controller the PIC, using the JAL programming language.
Step 1: Required Components
You need to have the following components for this project:
- A piece of breadboard
- PIC microcontroller 12F675
- An 8-pin IC socket
- Ceramic capacitors 100nF
- Resistors: 1 * 10k, 1 * 100 Ohm
- High Brightness Amber LED (or any other color)
- Push button
- Battery holder for 2 AA or 2 AAA batteries + batteries
- A plastic housing
See the schematic diagram on how to connect the components.
Step 2: Designing and Building the Electronics
The operating voltage range of the PIC is between 2 Volt and 5.5 Volt which makes it suitable using 2 AA or AAA batteries as power supply, operating the device at 3 Volt.
All timing is done in software by the PIC12F675. The PIC runs on an internal clock of 4 MHz. When active it consumes around 460 uA at 3 V. I could not measure the power consumption when the device goes to standby since my multi meter showed 0 uA. According to the datasheet it consumes 1 nA at 2 Volt when in standby mode.
In the pictures you can see the circuit as I built it on the breadboard including the final result when put in a plastic housing. Here you also see why I chose to use 2 batteries. In that way it could fit the electronics in a small plastic housing.
Step 3: The Software and Final Result
As already mentioned, the software is written for a PIC12F675 using the JAL programming language. The program is very simple and straight forward. Everything is done in sequence without the need to use timers or interrupts.
When the device is activated by the push button, the LED will blink 2 times and the 3 minute timer delay starts. After 3 minutes the LED blinks 10 times after which the ‘sleep’ command is executed, putting the PIC in standby mode. The pushbutton is connected to the reset input of the PIC so that it gets the PIC out of the standby mode when pressed and restarting the program.
Since the PIC has some floating input pins, the weak pull-up resistors in the PIC are activated. When testing I noticed that the internal oscillator was not very accurate so I tuned the oscillator in software by lowering the value of the oscillator tuning register.
The JAL source file and the Intel Hex file for programming the PIC are attached. If you are interested in using the PIC microcontroller with JAL – a Pascal like programming language – visit the JAL website.
Have fun building your own project and looking forward to your reactions and applications.