Nov 28, 2018:
Revised: v1.0

A Compact AC Delay Timer for use with

Bathroom Heated Towel Rails, Heaters and Fans

A compact timer with solid-state relay used to automatically turn off an AC-powered bathroom wall heater, a fan, a heated towel rail or similar appliances after 30 minutes to 4 hours. 


The ever-increasing price of electricity and the effect on the cost of running some household appliances led me to look at ways to improve the efficient use of power around our home. We have a 500W heated towel rail in our bathroom. It’s physically quite large, measuring about 1m wide and 1.6m high. It’s very high power makes it particularly useful in winter, drying out our towels quickly.

The problem we had was that it was all too easy to leave the heated towel rail turned on. There is no power indicator light on our towel rail. Once the showers are over for the morning, it’s unlikely that anyone would visit that bathroom until evening. Even then, you needed to touch the towel rail and feel its heat to realise that it had been left turned on, again.

I needed a timer that would start when the heater was switched on and automatically turn it off again several hours later.

Figure 1 : A typical wall-mounted heated towel rail 

Figure 2 : Typical low cost programmable AC timer

One possible solution was to use a standard timer like the one pictured here in Figure 2, but these simple timers meant the towel rail heater would come on every day whether we needed it or not. I wanted the delay timer  to handle the 
variations caused by daylight saving and holidays, too. That was really well beyond the capabilities of these basic plug-in or wired timers to solve.

Another alternative was to purchase a low cost AC timer via the internet, sourced from the depths of China similar to the one shown in Figure 3. The variable quality of such products and its actual ability to handle the potentially high peak currents of typical bathroom heaters or towel rails over the long term put me off that approach.

Figure 3 : Low cost AC timer module

Being in a damp bathroom environment, it was very important to ensure user safety and long term reliability. For that reason, I also looked carefully for a commercial solution. I thought many people must face a similar problem, but I could not find a suitable product at any of the local electrical suppliers.

Actually, some months after I had completed this design, I stumbled across something suitable. It consisted of a compact commercial timer and a relay module. Together, these units cost over $US150, with professional installation adding further considerable cost. My solution, described here, took a few hours to design, build and test, with parts costing about $US30 if I purchased everything new.

Defining the Specification

In this case, I wanted my timer to start when the AC power to the heater was turned on by the first person entering the bathroom in the morning. If no-one used the bathroom, it must not turn on.

After it is manually turned on, I wanted the timer to then automatically turn the power OFF to the heater after a preset timeout period. I thought a selection of ½, 1, 2 and 4 hours for this time delay would be satisfactory for most bathroom applications.

For simplicity, the timer also needed to be powered from the same AC supply as the heater, and have a suitable (i.e. simple, safe and reliable) 
method to switch the heater mains voltage (230VAC in my case) on and off. I checked the rating of the heater, and allowing for a safety margin, I assumed a peak design load of up to 5A.

Design Issues

Switching high AC currents is not as easy as it might appear. The obvious choice is to use a mechanical relay. However, relay contacts can become pitted and erratic over time particularly when switching high currents. A relay also consumes a surprising amount of power. Of course, in comparison with the heated towel rail or a heater, or even a simple fan, it’s nothing. However, the relay coil usually runs at 5V, 12V or 24V, and typically draws 100 – 200mA, or sometimes more. Such a relay requires a driver transistor to turn it on and off. While switching transistors are cheap, a relay capable of handling the required load reliably is relatively expensive. The required relay current also complicates the power supply design.

The power supply forms another fundamental design issue in these types of systems. Initially, you might decide to use a transformer, a bridge rectifier, a smoothing capacitor and a regulator to build such a power supply for the timer, but that all adds up to many more (large) parts, considerable additional complexity, and extra cost. It’s certainly possible to opt instead for a small switchmode power supply. However, while these may be cheaper, that switching power supply suddenly gets a lot larger if it has to handle the power required to drive a relay reliably. Suddenly, things just got a little more complicated. Again.

Table 1 : Design issues influenced the method chosen to switch the high current AC load

Simplicity suggests a basic capacitor-dropper arrangement of the type commonly used inside modern AC-powered LED lights. Of course, these must be mounted in a suitable double-insulated enclosure for safety. Once more. however, the use of a relay complicates things. Capacitor-dropper supplies are more demanding to design if you have large differences between the standby and operating current as would be the case with using a relay.

The solution to these problems is to use a triac-based switch rather than a relay. However, these require much more attention to the interface with the microcontroller to ensure they switch properly, and at the correct moment. Ideally, the triac should turn on or off when the AC voltage is near or at zero volts on the AC voltage cycle. Additional parts need to be fitted to handle any switching transients. Things start getting a little more complicated again.

To make things easier and safer, I opted to use a commonly available ‘solid state switch’ module. They are inexpensive and (arguably) more reliable than a relay. Internally, they contain a triac, surge protection components, and an optically isolated DC input. Usefully, this input can be directly driven from a microprocessor.

As a consequence, the simple capacitor-dropper power supply becomes straight-forward to design given the minimal difference between standby and operating timer current. With a triac-type switch, the high AC current only passes through the triac switch, just like a relay isolates the switched voltages from the relay driver circuit.
A further advantage of these modular triac ‘solid state switches’ is that the vendor has considered all of the factors required to ensure excellent isolation between the AC side and the DC switching input side, conveniently addressed using an easy to mount encapsulated package.

Circuit Description

With all of that out of the way, it’s now possible to look more closely at the actual timer schematic.

Figure 4 : Delay Timer Schematic (Right click for full-size view)

A low cost 8-pin Atmel ATtiny45 controls the timer. Two jumpers set the timeout period. If no jumpers are fitted, the timer assumes a delay of two hours.

The Tiny45 directly drives the switching input of the solid state relay module. I used a module I had in my junkbox, but these are readily available from many suppliers. My module is designed for input DC switching at 5V, ideal for microprocessors, and can handle 10A loads at 250VAC, providing a worthwhile (3x) margin of safety for my application. This is a much greater rating than required for most applications, but it’s wise to select a module with at least twice the current rating you require. Peak switching currents can be much higher than you imagine.

Two LEDs are used to show the user what’s going on. An orange LED is used as a simple Power On indicator, confirming at a glance that AC is connected to the timer. The blue LED blinks on and off at a one second rate when the timer is running.

When I reach down and turn the wall switch on to the timer and heated towel rail, usually early in the morning when the bathroom and shower are first used, the orange LED turns on, and then the blue LED starts flashing. I now know that in two hours, the timer will turn the heated towel rail off automatically. At that point, the orange LED stays on (i.e. Power is still applied to the timer) but the blue LED will turn off (i.e. The power to the heated towel rail is off).

The next time I am passing, perhaps that night, I can turn the wall switch off. Or, the next morning, I can briefly turn the wall switch off and then back on again to restart the heated towel rail and the timer.

The schematic also shows an optional pushbutton switch (SW1). I added this for possible applications where a pushbutton is preferred to start (or restart) the timer. However, it is not normally fitted, and I did not fit it in my prototype.

Warning! You MUST be very careful in bathrooms to select an appropriately rated pushbutton. It MUST provide at least 250VAC isolation in damp environments due to the use of the capacitor-dropper power supply. Such switches tend to be quite expensive. They are also physically much larger than the usual pushbuttons.

The capacitor-dropper power supply shown in the schematic is quite conventional. A 220nF capacitor rated for 250VAC operation rated with X2 protection is essential. Two resistors are connected in series across it to ensure it is discharged promptly when power is turned off. Typical 1/4W resistors are only rated for a few hundred volts hence two in series are required. The 5V6 1W Zener handles the regulation of the resulting supply, dropped and rectified via D2, and smoothed by C2. The modest load of the orange LED in addition to the few milliamps required by the ATtiny45 keeps the 5V voltage supply rail constant. 

Power dissipation is a critical consideration. It is essential to avoid component overheating. Examination of the datasheet for the solid state switch module showed that it would be required to dissipate about 4W during the two hours it was operating. In many higher powered applications of these types of modules, it is often essential to use an additional heatsink mounted onto these modules. However, in this case, the datasheet indicated the module should not require an additional heatsink with this load, and that proved to be the case after testing.


The software for this project was, as usual for me, written in rapid fashion using BASCOM, the Basic language compiler for AVR/ATmega/ATtiny family of microcontrollers. The target chip for this design is the small 8-pin ATtiny45 but ATtiny25 and ATtiny85 devices can also be used. the software is very compact.

The fuse settings for the chip are specified in the source code. They are identical to the fuse settings configured by Atmel at time of manufacture. These set the basic operating mode of the chip such as its clock speed. In this application, I use the internal RC clock set at 1MHz. It's quite fast enough for this very simple design.

The source code and the HEX file (for direct programming of your own chip) are available for download at the bottom of this page. Details about programming your own chip are found on other pages of my website, such as the page about the OBD Speedo


The timer was built using a small prototyping board and installed behind the standard wall switch panel used for wired appliances such as bathroom towel heaters.

The wall-mounted switch panel was modified slightly by drilling two tiny holes for the two orange and blue 3mm LEDs. 
The use of a standard AC switch panel and switch to turn on and off the supply is very desirable. It is rated for this type of application and environment, and provides excellent isolation, all at a modest cost.

Figure 5: The small prototyping board holds all of the components including the two optional jumpers for setting the required delay time

Figure 6:  The completed assembly prior to mounting in the wall switch plate.

The large block at lower right is the 250VAC 10A rated solid state switch made by Crydom which has been in my junkbox for a number of years. These excellent high quality modules are still available, as are many compatible modules from other manufacturers. The DC inputs (Thin red and yellow wires) are well isolated from the AC switched output pins (Heavy black and blue wires, lower right). A screw connector block (upper centre) allows easy connection to the switch and AC wiring for the heater and AC supply.

All AC connections were covered for safety once mounted on the rear of the switch plate.

It's likely you will use a diffferent type/brand of solid state switch. Some cheaper solid state switch modules made in China (and elsewhere) have been found to contain under-rated parts. Take particular care to test the timer before finally mounting into place for long-term use. I spent several days testing my version before finally mounting it just to make sure the switching module and power supply did not get hot (The switch module got warm, about 35C or so) and the timer correctly turned on and off. It is possible for under-rated parts to actually explode and/or burst into flame, so be careful.

A clearer wiring layout diagram is shown in Figure 7. This diagram assumes the solid state switch module is wired separately from connections on the AC Delay timer board. The AC wiring to the external load used standard double insulated AC cable rated for the service. The towel rail metalwork was grounded using the third conductor in the cable back to the AC ground  and not just via the two separate wires illustrated (for clarity) here in the diagram.

Figure 7 : Wiring is required to the off-board solid state switch, the switch on the switch panel, the incoming AC supply, and to the heater. The board layout shown matches my prototype. (I have not designed a PCB for this timer. However, if enough folk ask for a PCB design, I can add one here)

The switchplate I used is shown in Figure 8. It is widely available where I live and it is IP56 rated. That rating means the internal parts of the switch are protected from water splashes and dust. It also prevents users from contacting any internal wiring. The switch is at the top, and the hole below is for the AC cable to the wall-mounted heater. It includes a main-cable clamp on the inside surface of the switchplate.

Figure 8 : Typical wall-mounted switch plate for bathroom appliances

Experience with the Timer

Since installing the timer several years ago, it’s performed flawlessly. I no longer have to remind myself (or others) to turn off the heated towel rail.

The two hour timer setting has been found to be almost ideal for us. If this setting has not dried out the towels – That can occur occasionally in the depths of winter or if the towels are particularly wet – then all that is required is a quick off-on flick of the wall switch and the timer kicks off for another cycle of two hours. That’s only been necessary on a couple of days over the past two years.


1. Crydom D2410 SSR specifications (Copyright - Crydom Inc.)


AC_Delay_Timer_Software:  This zip file contains the BASCOM source file for the project for those wanting to make changes to the software (or who simply want to see an example of my poor software writing skills) and the HEX file for those just wanting to program their  ATtiny45 chip.

Want to go back to the main page? Click here to return directly.