Current activated switch

From DIYWiki
Jump to navigation Jump to search


This article describes a versatile electronic switch circuit that can be used to switch a load when it senses current flowing in another circuit. The current sensing is done in a non invasive way that does not require modification of the circuit being monitored.


This circuit was born out of a need to ensure that a shower enclosure extractor fan, which would normally be controlled from a household lighting circuit, would always run when the shower was used, regardless of whether the user had turned on the lights or not, and would not run continuously if the lights were left on. The shower in question was pump assisted, so that seemed the place to be looking for a control signal. The design aim was to allow sensing of when the pump was running, but without the need to "tee in" to the circuit in anyway. Hence this non-intrusive sensing circuit, which has the added advantage of being electrically isolated from the pump circuit.



1. For 12V power supply make R2 1K5. Ensure the relay coil voltage matches that of the supply voltage chosen.
3. For sensing loads greater than 3kW, add R5 (can be omitted otherwise)

For the original application the relay was integrated into the fan control like this:


How it Works

One leg of the mains feed to the load is threaded through the centre hole of the current transformer. When the load turns on, an AC voltage appears across the secondary winding of the transformer. This voltage is rectified by Schottky diode D1, and smoothed by C1 to produce a DC voltage which, up to a point, is proportional to the amount of current being drawn by the load. R3 is included to ensure that C1 is discharged within a couple of seconds of the pump switching off.

The DC voltage is next applied to the inputs of a CMOS NAND gate via R1. Schottky diode D3 shunts the internal static protection diode, and ensures that the voltage being applied to the gate cannot exceed rail plus approximately 0.3 volts. R1 limits the clamping current through the diode.

Gate U1a inverts the C1 voltage, so pin 3 drops close to zero volts. This point drives gates U1b,c & d, which are also connected as simple inverters. Thus, pin 4 will rise to near rail, and LED 1 will illuminate to show that the circuit has switched. R2 limits the LED current to a value that the gate can cope with.

Gates U1c and U1d are connected in parallel to double their current drive capability. This would only be an issue if the relay was a particularly "meaty" one, and the transistor did not have a lot of gain. Q1 is the relay driver transistor, R4 limiting its base current to a safe value. When its base is driven high by the signal from U1c & d, its collector will drop close to zero volts, causing the relay to pull in. Diode D2 is needed to clamp the reverse voltage spike produced by the relay coil, when Q1 turns back off. Without this diode, the transistor would be damaged.

The relay used has mains rated contacts, and will typically be located close to the load to be switched (in the case of the original fan switching application it was placed in the fan control unit itself with the contacts connected across the "Live"’ and "Switch" contacts. Thus, the relay takes the place of the light switch connection which would normally go to the fan unit).

Notes on Choice of Components

The circuit was designed to use components that "came to hand" and most are not critical. However, that said, in order to get best sensitivity from the circuit, the specified current transformer type TA17-04 should be used. This is readily available from a number of Far East and eBay traders at very reasonable cost. See for instance, see this item

D1 can be any small signal diode. A BAT85 Schottky was used because I had some lying about and this type of diode will improve sensitivity. C1 can be any value in the vicinity of 4u7 but should be rated at least 35v. R3 can be any value from about 470k up to a couple of meg. The higher the value, the longer the circuit will take to switch back off after it stops sensing the load being monitored. Diode D3 needs to be a Schottky to ensure that it conducts to clamp the input voltage to a safe level, before the IC's internal "normal" diode would conduct. If using the circuit to sense very high currents (say 25A or more), then one could substitute a different Schottky diode with a higher reverse voltage threshold since the output from the current transformer may exceed the rated value at high loads (experiments have shown however the device specified functions without failure even at very high sensed currents). R1 can be any value from about 2k2 to 10k.

U1 is a common CD4011 quad 2 input NAND gate, but ensure that you use the buffered variety, which most that you will buy, are. R2 needs to be chosen to ensure that the current that the gate is sourcing to drive the LED, does not exceed about 10mA. With a 5v supply, and a red HE LED, 560 or 680 ohms should be used. For a 12v supply, use 1k5 or 2k2. For different colour LEDs, a different value may be needed.

Q1 is any general purpose NPN transistor. The 2N3704 shown is good for 500mA of collector current so should be capable of driving most modern relays. It also has very good gain, allowing R4 to be 2k7 or higher, ensuring that the gates are not overloaded. I would not recommend the use of a power transistor in this position due to their poor gain, and high drive current requirements. D2 should be at least a 1N4004. Others, higher in the same series, are also OK. The relay coil voltage should be chosen to suit the supply voltage being used.

Notes on safety

This circuit uses a current transformer with a high turns ratio (2000:1). Current transformers have a bit of a reputation for posing shock risks in some circumstances (e.g. if their outputs are not adequately terminated/loaded). Experiments with the specified device have shown however that the voltage output does not rise above around 14V even at at 3kW sensed load. When monitoring higher loads then ensure that R5 is fitted and there should be no risk. It is strongly advised that only the specified current transformer is used. Other devices may give significantly different results.

Adjusting circuit sensitivity

As shown powered from a 5V supply, the circuit will sense loads ranging from around 30W to over 4kW (with a 12V supply the minimum trigger load will rise a little to around 40W). Note that on very light loads the circuit may take a few moment to switch the relay.

For reliably sensing low loads, one can fool the current transformer into seeing a bigger load than is actually present by looping the wire being monitored through it two or three times. This will double or triple the current that it "sees".

The current transformer used in this design has a theoretical maximum current sensing capacity of 20A. Attempting to sense larger current will have two effects. Firstly the output voltage could rise higher than really wanted. This can be dealt with by adding R5 to load the transformer a little and reduce its output voltage. The other effect of exceeding the 20A threshold is that the transformer begins to saturate and lose its linearity. For applications where one is attempting to accurately sense the value of the current being monitored this would matter, however in this application where all we care about is is it "on" or not, it does not matter.

Power supplies

As previously described, the circuit was designed with cheapness and using what came to hand in mind. To this end, I chose to use a regulated 5v DC ‘brick’ that I had lying around from a long-deceased external hard drive, so the cost of this was nothing. I’m sure that most people will have redundant mobile phone chargers lying around, and many of these will be 5v. The actual current requirement of the circuit is almost nothing, being mainly the current to drive the LED plus that needed for the relay coil. Any commercial power supply that you might have surplus, will be fine in that regard. The circuit has been tested with a range of supply voltages, and it works without problem from 5v to 12v, so any power supply – either regulated or unregulated – will be ok to use. The main proviso is that the output voltage must not under any circumstances exceed 15v, as this is the upper voltage supply limit for the IC. If intending to use an unregulated supply with any declared output voltage of 10v or higher, I would suggest that its off-load voltage is actually measured first, as some unregulated supplies can deliver a light-load voltage of 50% more than the marked value.


In the event that you want to use a power supply that delivers in excess of 15v, but not more than 25v, you can add a regulator to the output as shown below. This circuit uses only three components – a cheap three terminal regulator IC and two small capacitors. The value of these capacitors is not critical, but note that they should be mounted as close to the IC pins as possible. Either the 1 amp version of the IC or its little brother, the "L" version, will be fine. With input voltages at the high end of the range, a small heatsink may be required.


Built in PSU

For some applications it would be neater to actually custom build a PSU into the project. The circuit below shows a very simple linear supply than can be constructed from a small mains transformer.

Note  Unless you have experience of building mains power supplies safely, I would not recommend doing so, 
especially as ready-made power supplies are usually lying around the house unused



Shower pump run detector

This was the original design application for the circuit. You can see it built up here on some vero board, with a spare regulated 5V PSU used to drive it. (note this early version pictured did not include D3 to add protection to the IC, and instead relied on the internal static protection diode in the IC to perform this function - this is taking liberties really and any "real" versions you build should include D3)


The current transformer can be placed near to the circuit being monitored. Keep in mind that it is sensing currents at Mains Voltages, so care must be taken to ensure than anything dealing with the mains side of things is done to proper wiring standards, and is kept separate from the low voltage side of things.


Here an insulated wire is looped out of a junction box and through the sense transformer (ideally the wire loop and transformer would be better enclosed in a box of some sort).

Tool controlled dust collector

Another application would be for powering a dust extractor in a workshop and making it slaved to a power tool you are using. Here the circuit could be built up in a self contained box with at least a pair of normal 13A sockets. One for the sense load, and another for the switched load. plug a tool (e.g. a sander) into the sense socket, and the dust collector in the slave socket. Each time the main tool is turned on, the slave socket will also turn on and run the collector, and then stopping it shortly after the main tool is turned off.

Auto power saving socket

In many homes there are a plethora of small appliances that are used together - e.g. games consoles, satellite TV boxes etc used with a TV, or a large number of peripherals devices used with a computer. This circuit can be used to automatically power up and down all the slave devices when the main one is turned on.

See Also