Timer for bathroom ventilation
Use a microcontroller to get a simpler and more stable timer.
The idea
A replacement was needed for a burned timer, which switches on the fan if the light is switched on and switches it off some time after the light has been switched off. The original PCB contained a cmos chip (MC40106), a big electrolyt (100uF) and a big resistor (1M + 10M potmeter) for the timing.
In my new version I wanted an additional timer: the fan will be switched on some time after the light is on to prevent a running fan if someone just looks in the mirror for a few seconds. This would require a second RC-network and a more complicated circuit.
Using a microcontroller can make things a lot simpler. But I wanted to keep one feature of the old timer: the potmeter(s) to set the timing.
Hardware
The new circuit contains a small PIC microcontroller, which consumes only 400 uA at 500 kHz clock frequency. For the setting of the timers, 2 potmeters are connected to analog inputs. Because they are used as voltage dividers their value is not critical. The only big capacitor is in the power-supply, which consist of only a few parts. A series capacitor is used to limit the current (use an X2-capacitor for this purpose!) and a zener diode determines the voltage. Further a circuit is needed to determine if the light is on. This is done by a diode and a resistor (use at least 2 in series because of the voltage). In my timer I used a TIC206 triac, but if only a small fan has to be driven you can use the TO92 version (TICP206), which is much smaller.
Software
The program contains an interrupt routine which is called ~256 times each minute or once each 234 ms. If no pulse from the lamp circuit is received during this period of time, the lamp is considered to be off.
The main loop of the program is a simple state machine; more information can be found in the source code.
In the EEPROM of the PIC 2 numbers are stored: the max. number of minutes delay (default 5) and the max. number of minutes run time (default 15). With the potmeters the timers can be set between 0 (zero) and the max. number of minutes. And because of the principle used, the potmeters have a linear scale, which makes it easy to estimate the time set.
The program is compiled by CC5X of B. Knudsen, but porting to another compiler should not be too complicated.
A replacement was needed for a burned timer, which switches on the fan if the light is switched on and switches it off some time after the light has been switched off. The original PCB contained a cmos chip (MC40106), a big electrolyt (100uF) and a big resistor (1M + 10M potmeter) for the timing.
In my new version I wanted an additional timer: the fan will be switched on some time after the light is on to prevent a running fan if someone just looks in the mirror for a few seconds. This would require a second RC-network and a more complicated circuit.
Using a microcontroller can make things a lot simpler. But I wanted to keep one feature of the old timer: the potmeter(s) to set the timing.
Hardware
The new circuit contains a small PIC microcontroller, which consumes only 400 uA at 500 kHz clock frequency. For the setting of the timers, 2 potmeters are connected to analog inputs. Because they are used as voltage dividers their value is not critical. The only big capacitor is in the power-supply, which consist of only a few parts. A series capacitor is used to limit the current (use an X2-capacitor for this purpose!) and a zener diode determines the voltage. Further a circuit is needed to determine if the light is on. This is done by a diode and a resistor (use at least 2 in series because of the voltage). In my timer I used a TIC206 triac, but if only a small fan has to be driven you can use the TO92 version (TICP206), which is much smaller.
Software
The program contains an interrupt routine which is called ~256 times each minute or once each 234 ms. If no pulse from the lamp circuit is received during this period of time, the lamp is considered to be off.
The main loop of the program is a simple state machine; more information can be found in the source code.
In the EEPROM of the PIC 2 numbers are stored: the max. number of minutes delay (default 5) and the max. number of minutes run time (default 15). With the potmeters the timers can be set between 0 (zero) and the max. number of minutes. And because of the principle used, the potmeters have a linear scale, which makes it easy to estimate the time set.
The program is compiled by CC5X of B. Knudsen, but porting to another compiler should not be too complicated.
Updates vom Autor