I am working on a home automation system and I need to detect if an appliance is getting power or not.

I need a AC current detection switch which can be mounted on a power line and send a DC voltage signal as output to a micro-controller whenever it detects an AC current in the line.

I did some searching and found Hall effect sensors which provided detection with isolation but since the magnetic field will fluctuate so will the output. I need a Hall effect sensor which just gives a DC voltage when it detects a magnetic field from an AC current line and gives a DC output which could be fed to a comparator.

I am a newbie in electronics and work on DIY projects.

I have planned to design my own board to keep the cost low.

Appliances work on 230 VAC and 5 A max current.

  • 2
    \$\begingroup\$ You can Google "current switch" for a zillion hits. BTW, what's the minimum current you want to detect? \$\endgroup\$
    – EM Fields
    Mar 5, 2016 at 8:06
  • \$\begingroup\$ 0-5 A, I did googled but found most solutions like using CT (current transformer) to be expensive. Using hall effect sensor with a comparator was a cost effective option. \$\endgroup\$ Mar 5, 2016 at 8:18
  • 2
    \$\begingroup\$ 1.Zero to 5A is the range, but it's unrealistic. What's the minimum current you want to detect? 1A? 100mA? What? 2. What Hall effect sensor and comparator have you chosen? 3. What is it you expect us to do for you? 4. Check this out \$\endgroup\$
    – EM Fields
    Mar 5, 2016 at 9:13
  • 1
    \$\begingroup\$ I think omnipolar hall effect sensor can be the solution. I don't know how they will react to magnetic field due to power line. \$\endgroup\$ Mar 7, 2016 at 18:09
  • 1
    \$\begingroup\$ Any type of magnetic core could be used as your "current sense transformer". Doesn't need to be expensive. You could use ACS712 or similar followed by low-pass filter followed by low-cost comparator. Then you won't lose any ADC. \$\endgroup\$
    – user57037
    Jul 20, 2019 at 20:53

7 Answers 7



simulate this circuit – Schematic created using CircuitLab

Figure 1. Simple diode-drop current sensor with opto-isolator.

  • The diodes drop a maximum of about 2.1 to 3 volts depending on current.
  • OPTO1 is a bi-directional LED opto-isolator. These have infra-red LEDs internally and so forward voltage drop is about 1.2 V. R1 will limit the current to 10 mA.
  • The diodes need to be rated for the maximum current (including any switch-on surge) will dissipate about 0.8 x I watts each. They don't need to be high voltage because there is a maximum of 3 V across this part of the circuit.
  • C1 will hold the voltage between pulses from the opto-isolator and simplify the micro code.
  • 1
    \$\begingroup\$ The diodes waste a lot of power if the device that is plugged into the mains draws say 10 Amp which could occur if this device is installed in say a multibox .R1 could be reduced in value and R2 could be increased in value.Your opto circuit as it stands is good for detecting small currents but the diode system reduces efficiency which may be a problem at low power and will be a problem at high power. \$\endgroup\$
    – Autistic
    Mar 5, 2016 at 20:29
  • \$\begingroup\$ Agreed. I gave the power calculations for that reason. \$\endgroup\$
    – Transistor
    Mar 5, 2016 at 20:41
  • \$\begingroup\$ Given that the value of R1 has come way down so its just an idiot resistor that stops the opto blowing up you could get it down to 4 diodes instead of 6 .I used a bridge rectifier with the DC terminals shorted together .It worked. The reasoning being that the LEDs in garden variety optos like 4N26 which I used are in the infra red spectrum and therefor have a lower terminal volts than a red led . \$\endgroup\$
    – Autistic
    Mar 5, 2016 at 21:01
  • \$\begingroup\$ Using diodes/optocoupler combination to detect mains current, I wonder whether there will be a minimum threshold of mains current below which the optocoupler will not detect the current. In this design there is no amplifier to amplify very weak signal thus very low mains current will not be detected. \$\endgroup\$ Mar 6, 2016 at 2:41

You can use the Hall sensor. The AC signal you convert to a DC signal with a diode and a capacitance.

A problem with the Hall sensor can be that they have a offset drift.

  • \$\begingroup\$ Drift is not a problem as I am not measuring the current but just sensing if current is there or not. \$\endgroup\$ Mar 5, 2016 at 8:20
  • \$\begingroup\$ If, with no current exciting it, it drifts up to \ down to the comparator's reference, then you've got a problem. Likewise, if it drifts far enough away from the comparator's reference with current exciting it [the sensor] then that's a problem as well. \$\endgroup\$
    – EM Fields
    Mar 5, 2016 at 14:21
  • \$\begingroup\$ Capacitive coupling of the hall output will nail the drift. \$\endgroup\$
    – Autistic
    Mar 5, 2016 at 20:41

This diagram can control a three series lamp using SPDT switch and SPDT relay.

The circuit can measure the state of the light lamps and inform the microcontroller (LED green) of state of the light lamp (if LED green on the state of the lamp off and the led green off the lamps on.)

enter image description here

enter image description here2


The CR2550-R is a cheap-ish current transformer specifically designed to directly drive a LED indicator. It can drive an optoisolator just as easily. Use a bidirectional optoisolator, and it becomes bridge rectifier, amplifier, and pulse remover all in one part.


Above 2000PF at the base, the rise time can be significant.


Here's how to do it with a current transformer,

enter image description here

and here's the LTspice circuit list so you can play with the circuit if you want to:

Version 4
SHEET 1 880 680
WIRE -112 -32 -640 -32
WIRE 0 -32 -112 -32
WIRE 128 -32 0 -32
WIRE -112 0 -112 -32
WIRE 128 0 128 -32
WIRE 0 96 0 -32
WIRE -112 112 -112 80
WIRE -32 112 -112 112
WIRE 128 128 128 80
WIRE 128 128 32 128
WIRE -416 144 -544 144
WIRE -240 144 -336 144
WIRE -32 144 -240 144
WIRE -544 192 -544 144
WIRE -416 192 -416 144
WIRE -336 192 -336 144
WIRE -240 192 -240 144
WIRE 128 192 128 128
WIRE -384 288 -384 176
WIRE -368 288 -368 176
WIRE 128 304 128 256
WIRE 224 304 128 304
WIRE 320 304 224 304
WIRE -544 320 -544 272
WIRE -416 320 -416 272
WIRE -416 320 -544 320
WIRE -336 320 -336 272
WIRE -240 320 -240 272
WIRE -240 320 -336 320
WIRE 224 336 224 304
WIRE -640 352 -640 -32
WIRE -416 352 -416 320
WIRE -112 352 -112 112
WIRE 128 352 128 304
WIRE -640 464 -640 432
WIRE -416 464 -416 432
WIRE -416 464 -640 464
WIRE -240 464 -240 320
WIRE -240 464 -416 464
WIRE -112 464 -112 432
WIRE -112 464 -240 464
WIRE 0 464 0 160
WIRE 0 464 -112 464
WIRE 128 464 128 416
WIRE 128 464 0 464
WIRE 224 464 224 416
WIRE 224 464 128 464
WIRE -640 528 -640 464
FLAG -640 528 0
FLAG 320 304 OUT
SYMBOL ind2 -432 176 R0
WINDOW 0 -34 42 Left 2
WINDOW 3 -53 69 Left 2
SYMATTR Value 100µ
SYMATTR Type ind
SYMBOL ind2 -320 176 M0
WINDOW 0 -48 44 Left 2
WINDOW 3 -61 69 Left 2
SYMATTR Value 1.3m
SYMATTR Type ind
SYMBOL current -544 192 R0
WINDOW 3 24 80 Invisible 2
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR Value SINE(0 .1 50)
SYMBOL voltage -640 336 R0
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMBOL res -432 336 R0
WINDOW 0 -36 40 Left 2
WINDOW 3 -41 66 Left 2
SYMBOL res -256 176 R0
SYMATTR Value 60
SYMBOL Comparators\\LT1716 0 128 R0
SYMBOL res 112 -16 R0
SYMATTR Value 510
SYMBOL schottky 112 192 R0
SYMATTR Description Diode
SYMATTR Type diode
SYMBOL cap 112 352 R0
SYMATTR Value 2µ
SYMBOL res 208 320 R0
SYMATTR Value 100k
SYMBOL res -128 -16 R0
SYMATTR Value 10k
SYMBOL res -128 336 R0
SYMATTR Value 20
TEXT -424 104 Left 2 !K L1 L2 .9
TEXT -618 496 Left 2 !.tran .5 startup uic

You said current transformer is expensive.... But if you think about it, current transformer can be DIYed easily... Just check your electronic scrap bin, look for small smps toroids core.

Wind five turns primary on the toroid using well insulated, at least 1mm thick copper wire. 0ne mm thickness should bear 5Amps well. Insulation on the wire should be good for mains voltage operation.

The secondary can be very fine insulated wire. You can salvage this kind of wire from any small magnetic relay solenoids. Make at least 20 turns on the toroid. The primary and secondary can be wound without overlapping.

Since you most likely will have to do this winding manually, first calculate the length of the wire needed for the number of turns beforehand. Simply measure the length of one loop thru the toroid and multiply by the number of turns will be just fine.

Signal amplification and conditioning can be implemented easily using a cheap op amp and a comparator.

enter image description here

  • \$\begingroup\$ You might want to edit and add a resistor across the 20 turns of the transformer. Hint : calculate the current through the 2.2K and zeners. Also, you want the secondary (20 turns) to be low impedance, so that the 5 turn primary is also low impedance. \$\endgroup\$
    – Marla
    Mar 5, 2016 at 16:44
  • \$\begingroup\$ I looked at using an old SMPS doughnut as a poormans CT in a previous life .I resisitively loaded it like you have .My transformer voltage waveform was nothing like what I expected .I then set up Channel 2 of my old scope on a metal film resistor and found that the transformer waveform was way different to the resistor waveform.The waveform was so far out that simple orthodox college calcs for threshold would not work .I did not produce this despite having a large number of spare doughnuts. \$\endgroup\$
    – Autistic
    Mar 5, 2016 at 20:39
  • \$\begingroup\$ Autistic, I agree with your comments about the waveforms... Here the purpose of the CT is not for measurements thus fidelity or linearity is not a concern. The approach is only to detect current is flowing or not in the primary. At 50 or 60 Hz the impedance of the CT is negligible to the 5Amps current, thus the secondary is not even need to be loaded. \$\endgroup\$ Mar 6, 2016 at 2:10

I have used a current sense transformer in the past and hooked it up to an ADC via some circuitry to turn the current into a voltage and then the voltage into a digital signal. Worked for me although I needed more than just to know if a current existed.

  • \$\begingroup\$ ...if a voltage is present it's safe to assume there is also a current... Ed-wright, this is not a current assumption. Voltage across a load not necessarily cause current thru the load because the load may have open circuit internally. That is the reason why About Kumar wanted to check the current to understand the real status of the load. \$\endgroup\$ Mar 5, 2016 at 15:25
  • \$\begingroup\$ @soosaisteven is absolutely right \$\endgroup\$ Mar 7, 2016 at 17:26
  • \$\begingroup\$ @soosai absolutely correct, updated accordingly, my bad \$\endgroup\$
    – ed-wright
    Mar 7, 2016 at 17:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.