# Controlling an output based on level of AC signal

This is my first post on this StackExchange after years of lurking, so please be gentle!

I would like to be able to enable an output (for example an LED) based upon an AC voltage from a split-core non-contact sensor like the following: https://www.mcielectronics.cl/website_MCI/static/documents/Datasheet_SCT013.pdf

I want to detect when three to seven 50W incandescent bulbs (racing circuit start lights) connected to the AC supply are switched on and then off.

From my reading of that datasheet, the SCT013-005 and its voltage output siblings, all induce an AC voltage in proportion to the current flowing through the wire around which it is clamped (0-1V).

I would like to enable an output (for example a MOSFET in the below diagram) if the current flow in the clamped cable is above a certain (adjustable) level.

Since the amplitude of the signal voltage is so low, I thought to use an Op Amp with part of the feedback loop (R5) being adjustable with a potentiometer trimmer, however since I haven't worked with either AC signals or OpAmps before, I wanted to check my design was sane.

(It works in the circuit simulator, but I don't think that guarantees anything!)

D3 and R7 represent the hypothetical load. In reality, this would be the input of an optocoupler inside a piece of proprietary hardware.

I expect that the smallest load I will detect will be 2x 50W incandescent bulbs, with no other load on the mains supply cable, giving a mains current of 0.23A = (100W / 230V).

This should induce a voltage of 0.046V = (0.23A / 5A). Picking round numbers, if I aim for a max gain of 100x then using a potentiometer (R5) with a maximum of 10k and an R3 resistor of 100 Ohms should give a gain of (1 + 10k / 100) = 101x gain, giving an output from the OpAmp of around 4.3V (or whatever the amp can drive, I don't expect I need a rail-to-rail part here), more than sufficient to drive the gate on a BSS138 or similar MOSFET.

In use, the operator would adjust the gain using the R5 potentiometer until switching the start lights on just enables the output.

A few more questions, should all that be sane:

Are there any caveats I should be aware of before I try building this?

Do I even need the diode D2?

Is it reasonable / correct to tie one leg of the AC signal to Ground?

• What is your timing accuracy? I know that timing on some race-lights (drag-race) is very critical. Since you're sensing 50 Hz signals, the best you could possibly hope for is +/- half a cycle. It is likely a trade-off between timing accuracy and noise immunity - a noise-immune sensor would likely give you a delayed output signal. – glen_geek Nov 29 '18 at 15:14
• 50 Hz is indeed slower than would be ideal, but the technology we are replacing is a person, staring at the lights in question, and pressing a thumbswitch when they go out. To do this properly, I would have the lights controlled by the same equipment generating this start pulse, but that's an improvement for a few years time. If I can get around a 50ms response time, I'll be very happy. – bradfier Nov 29 '18 at 15:17

A comparator might provide a simpler way to sense the 50 Hz. incoming signal. An open-collector type comparator doesn't need a detecting diode - it simply discharges a capacitor every cycle.
If the R1*C1 time constant is chosen properly, the capacitor is discharged before its voltage reaches the MOSfet gate's threshold voltage.

The circuit shown includes a 400mV reference voltage on the comparator's inverting input. The comparator includes a 4mV hysteresis voltage which adds a bit of noise immunity. The threshold voltage can be raised to set the sensitivity level by adjusting R4. In the schematic below, it is 50k, which provides an input voltage DC of 0.196V. Riding on top of that is the 50 Hz signal (0.3v peak in this case).
Response time is very fast (within half a cycle) on "light-go-on" event, and slower at 40ms for "lights go off" event.
R3 represents a simple load - your infrared LED could be included in series with this resistor. An opto-coupler LED would likely require less current, so R3 would be sized to provide 10mA - 20mA current.

• From your diagram it looks like the 400mV reference is on the noninverting input? I suppose this doesn't matter with an AC signal. Just to check my understanding is correct, when the DC component + AC component exceeds the reference voltage on the comparator, the comparator will go open-collector and discharge C1. – bradfier Nov 29 '18 at 16:44
• Yes, when input exceeds threshold, the open-collector yanks "low" and turns off the MOSfet. The 20uF capacitor might be a bit large (discharge current is high). A 50k*2uF might be better for R1*C1 pair. You show a +5V supply: I'd change component values to R4=22k, M1=2N7002, R2=180. – glen_geek Nov 29 '18 at 16:56
• Thanks! Do you mind explaining how you arrived at values for R4? I understand the concept of biasing the AC signal but I don't know how you arrived at that resistance to produce a 0.196V bias. – bradfier Nov 29 '18 at 17:17
• You can disregard that comment, I realised it was just a divider about 15m after writing that comment. Thanks again for the answer! – bradfier Nov 29 '18 at 17:40
• Just two observations- the comparator output max current is 40mA, so discharging a large cap without a limiting resistor may be a reliability issue. The second is the IN- resistor network should be biased such that the pin doesn't see a voltage below ground (the CT rating of 1V is likely to be an RMS value,not peak). See details on sheet 11 of the datasheet for details, you can limit the current to prevent damage, but they don't guarantee proper operation (output polarity reversal was an issue on some chips). – isdi Nov 29 '18 at 18:42

I wanted to suggest a pre-amplifier you might also consider. It's not a solution to all your requirements. But it provides a concept you might be able to consider to precondition your input signal. Part of my motivation to add something is that I'm not sure how much of a load your AC signal can support and I noticed you were considering the idea of using a high-impedance input of an opamp, too. So in that vein:

simulate this circuit – Schematic created using CircuitLab

The only purpose here is to develop an averaged voltage at DC OUT. There will be ripple on the order of a few tens of millivolts. But this isn't terribly important because of $$\R_4\$$. Near its lower end of resistance the output stays close to the top rail. But as you adjust (increase) its resistance from there, the AC signal magnitudes required to cause this output voltage to dive down below the half-way point between the rails changes. So I believe the potentiometer usage here will be okay for your needs.

As shown, it's also slow to respond. On the order of seconds, obviously ($$\R_3\$$ and $$\C_2\$$.) But you can adjust that.

Input loading is light. On the order of a microamp or two.

The BJTs used here are NOT critical.

Cost is low. No boutique parts involved, which may become unobtainium someday. But it's only a start of an idea. Not the whole thing.