Controlling an AC load

For the recent solar care race timer project, we needed to control a large AC load (a bank of 2.4kW of lights) with the output of a micro-controller (just 5V and less than 20mA). There are a number of ways to do this including relays and transistors. We wanted a quick and in-expensive option. I saw an electronic time switch and realised that this off-the-shelf unit was doing exactly that – a low voltage circuit controlling a much larger AC load.

Warning: Do not attempt this unless you are confident with and happy to use 240V ac circuits. These are potentially fatal. Do not take risks. If in doubt consult a qualified electrician.

This timer unit was bought for around £6 from a high street retailer (I wanted to find one at a car boot sale, but I had a deadline).


Unscrewing the back from the unit you can see the relay (blue box), clock unit (the grey wires go to this), control transistor (hidden behind the grey wires in this picture) and small back-up battery (the green circular thing). Also note the diodes (4 x black cylinder in a row) which rectify the AC to give a local DC voltage. The relay is 24V dc to control 16A ac.


I could see the (only) transistor which I presumed controlled the relay. This was a 2N5551 general purpose NPN transistor, which was easy to google for the datasheet. The base pin was in the middle. Applying a voltage to this pin relative to the ground (or emitter) would switch on the transistor and hence the relay. I tried this and it worked (using a 1k limiting resistor and a 10k pull down resistor), but, due to the power supply circuit, this is all at a very high voltage relative to earth. There is no isolation hence an electric shock risk – trust me, I know this.

To solve this I used an opto-coupler/opto-isolator. I was in a rush so I bought this one (4N25) from Maplin. This allows a small current into an LED to control a larger current via a photo-transistor. This has 5000V of electrical separation, hence no voltage would be seen on the input side to the opto-isolator.

I was providing a 5V (ish) signal from an output from an Aruino clone. This needed to power the LED in the opto-isolator, with around 10mA. A resistor is required to limit the current. There is a 1.5V drop across the LED, hence 5V-1.5V = 3.5V. Remember V=IR, hence R = 3.5V / 0.01A = 350ohm. I used a standard 330ohm resistor.

On the other side the output only needed the 24V supply and a pull down resistor (10kohm). This then feeds through a 1kohm resistor to the base of the 2N5551 transistor. The circuit diagram is shown here:


I found the +24V and 0V on the circuit board by following the path of the relay pcb tracks.Warning: Only do this when switched off and unplugged! This will be different for different manufacturers. All of them I have seen have a 24V relay though. Find the pins for powering the relay coil (the other ones are for switching the 240V AC). Trace them back – one will go to 24V positive supply. The other will go to the transistor (it is switched in the negative path). Follow through the transistor (C to E) and that should be ground. In this case the ground was actually after one more diode (to ensure no current flows the wrong way).


A hole was drilled into the case and the 3.5mm jack plug fitted. I ensured all cables inside the box were not near high voltage cables and suitably insulated. It probably does not conform to class II design, though.

Plugging in the microcontroller the unit clunks on and off as as I apply 5V. Also – the function of the timer is still there – so it can still be used for its original purpose.

Leave a Reply

Your email address will not be published. Required fields are marked *