I am trying to make a AC Mains detection circuit with ESD protection. The AC switch is located 30 meters away from the circuit board.

Of the two circuits, which is better for ESD protection & mains isolation? In Schematic One, is connecting the other end of TVS diode to AC Neutral correct?

Please suggest if there need to be any modification.

TVS Diode: TPD1E10B066 http://www.ti.com/lit/ds/sllseb1d/sllseb1d.pdf

Schematic: One enter image description here

Schematic:Two enter image description here

EDIT: Let me explain the scenario in detail. There are quite a lot of switches to be monitored. Inductive loads are also there. All the switches have very long wires & I am concerned about the excess energy that reach the optocoupler during switching, spikes in the line or by lightning. What is the best way to protect from such occurrences?

  • 3
    \$\begingroup\$ Are you connecting the TVS and the Zener to the low-voltage ground on purpose? \$\endgroup\$
    – marcelm
    Sep 1, 2017 at 15:26
  • 4
    \$\begingroup\$ The bottom circuit with TVS and ZD to ground is no good. You're making a conductive path between mains (neutral and live) to ground. Best case: your GFCI will trip. Worst case: all grounded equipment will have a live voltage. Top circuit should be OK. I do not like using a ground symbol for AC neutral though, often AC neutral is not neutral and can have some voltage. \$\endgroup\$ Sep 1, 2017 at 15:30
  • \$\begingroup\$ @Bimpelrekkie There's no indication at all that signal ground is connected to earth or chassis or anything. \$\endgroup\$
    – marcelm
    Sep 1, 2017 at 15:34
  • 1
    \$\begingroup\$ Regarding ESD protection: you do not actually need it. The mains live side (the LED and everything to its left) are not ESD sensitive and you're not going to touch the connections anyway as they're not safe to touch (neutral not always being without a voltage). MCU side: The only real sensitive component is the MCU and it will have proper ESD protection. No additional protection is needed. \$\endgroup\$ Sep 1, 2017 at 15:35
  • 2
    \$\begingroup\$ I'd like you to explain what you mean by ESD. I don't think you mean the same thing as the rest of us, judging from this question. ESD is normally not a problem with line voltage circuits. \$\endgroup\$
    – pipe
    Sep 1, 2017 at 15:37

4 Answers 4


I would create a Zero Crossing Switch narrow pulse (ZCS) instead of sine to square. Set the output R high (not 2k) to obtain CTR of 1%. Add cap to input R for <1kHz LPF to adjust phase shift but attenuate spikes. This is a bidirectional opto with isolation rating >5kV.


A Cap Voltage transformer using X rated 0.047 uF to ceramic 1 uF results in 1% sine voltage at lower impedance then series RC to opto can use low power R.

enter image description here Here shown with Rin only between line and neutral may give a wider positive output pulse at zero crossing.

Alternatively, a square wave to pulse conversion just uses both inputs of an XOR gate with 1us RC delay on one input.


Neither A or B. Remove the TVS, zener,...


simulate this circuit – Schematic created using CircuitLab

  • \$\begingroup\$ I agreem the TVS and zener do not harm but are overkill and not needed. \$\endgroup\$ Sep 1, 2017 at 15:30
  • \$\begingroup\$ Vac threshold will vary with load , CTR and needs a LPF on input. R needs to be rated for 2kV transients minimum. \$\endgroup\$ Sep 1, 2017 at 15:43
  • \$\begingroup\$ @TonyStewart.EEsince'75 I just purged out unnecessary components as an example. OP has to calculate the CTR and other things to suit the needs. He was concerning just about ESD. \$\endgroup\$ Sep 1, 2017 at 15:47
  • \$\begingroup\$ I think he meant PLT, not ESD \$\endgroup\$ Sep 1, 2017 at 15:55
  • \$\begingroup\$ @TonyStewart.EEsince'75 I can read only ESD from his post, anyway what's a PLT? \$\endgroup\$ Sep 1, 2017 at 16:05

The TVS, zener and 100R resistor do nothing of value. If you want to protect against transients, make sure that the 220K resistor is rated for very high breakdown voltage. For example the 1W VR68 series (leaded). You need a diode inverse parallel across the LED- a 1N4148 or LL4148 is plenty good enough- those are rated for 75V or so PIV (it will see less than 1.5V) and 200mA.

Even with 5kV on the resistor only 23mA will flow, which the LED and diode will have no problem with. If the resistor arcs over, even the TVS may not be enough to preserve functionality.


This doesn't address your question but provides an alternative solution.


simulate this circuit – Schematic created using CircuitLab

Figure 1. Neon opto-isolator circuit.

enter image description here

Figure 2. Neon indicator heat-shrunk to LDR.

\$ R1 = \frac {V_{MAINS} - 90 }{I_{NEON}} \$. (90 V is typical neon operating voltage.) The LDR's slow time constant should keep the reading stable during mains zero-cross.

See International Light for more details on the neons.


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.