0
\$\begingroup\$

I've designed a simple mains detector which I have drawn below. The theory of operation is pretty simple. A capacitor is used to reduce the current so that my optocoupler can operate (represented by the LED below). With LTSpice, I get a nice sine wave @60Hz with ~3.5mA. I have omitted the other side of my opto for simplicity's sake. Now I'm interested in doing some safety analysis.

The first thing that comes to mind would be to add a high resistor in parallel with the capacitor to reduce the risk of someone getting a discharge from the capacitor, but I've purposely omitted that because it would burn a lot of heat and ultimately I can put this whole thing in a place where no fingers should be reaching it. The fuse should protect me against the case where the capacitor fails with a short. An open circuit would simply fail nicely. Any other thoughts I may have missed in my safety design?

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
4
  • 3
    \$\begingroup\$ (1) Put your fuse in the live wire rather than in neutral. (2) Check in your simulator what happens if you switch on the mains at 90° into a cycle (peak voltage). I suspect that you will get a very high current spike through the LED. (3) Do your calculation on power dissipated in your high value capacitor discharge resistor. You can make its value high enough that it's not a problem. \$\endgroup\$
    – Transistor
    Sep 7, 2018 at 9:35
  • \$\begingroup\$ Your device should be able to handle quite high voltage spikes between live and neutral, few kilovolts are typical EMC requirements, so some transient protection is a good idea. \$\endgroup\$
    – Martin
    Sep 7, 2018 at 11:00
  • \$\begingroup\$ What opto-coupler have you chosen? \$\endgroup\$
    – Andy aka
    Sep 7, 2018 at 11:53
  • \$\begingroup\$ I've chosen the 4N37 in this case and yes the C1 is a 7kV X2 cap which should handle the spikes. Does it mater where the fuse is? I'd love to understand the reasoning :) \$\endgroup\$
    – ti_chris
    Sep 9, 2018 at 7:45

2 Answers 2

2
\$\begingroup\$

The first thing that comes to mind would be to add a high resistor in parallel with the capacitor to reduce the risk of someone getting a discharge from the capacitor, but I've purposely omitted that because it would burn a lot of heat and ultimately I can put this whole thing in a place where no fingers should be reaching it.

Bad idea. If this is a pluggable device (not permanently wired to the mains), then anyone can touch the two prongs of the plug and get a discharge from the capacitor. And in any case, a 1MΩ resistor, which would discharge the capacitor in a fraction of a second, would only dissipate 15 mW @ 120VAC in normal operation. (Pay attention to the voltage rating of this resistor — use multiple resistors in series if necessary.)

Second, as Transistor pointed out in the comments, the capacitor limits the current at 60 Hz, but has little effect on higher frequencies, including those produced during switch-on, as well as fast transients on the line caused by nearby lightning, other equipment switching, etc. Such currents might blow your fuse, but not before destroying your LED.

So, at a minimum, I would suggest:

  • Add the 1MΩ resistor in parallel with the capacitor
  • Raise the series resistance (R1) to 10kΩ (it will dissipate about 130 mW in normal operation)
  • Raise the value of the capacitance (C1) to 100 nF in order to compensate for the increased drop across R1.
\$\endgroup\$
3
  • \$\begingroup\$ Thanks for the reply. I tried making the suggested changes and it seems a little problematic. According to my spice simulation anyhow, the 1M resistor would burn around 31.5mW (it would be connected to the main where no fingers could touch it - still dangerous if someone opens the box). When I make the other suggested changes, the 10k resistor starts to take 385mW which is pretty darn high. Would you mind explaining how you arrived at 10k? BTW: I'm planning to use a 4N37 opto for this project. The other side is a simple pull-up GPIO detection circuit. \$\endgroup\$
    – ti_chris
    Sep 9, 2018 at 7:42
  • \$\begingroup\$ First of all, 31.5 mW is NOT dangerous in any way. The 10K resistor has the same RMS current as the LED flowing through it, so I don't see how you're getting 385 mW (6.2 mA). I picked 10k based on keeping the LED current the same as your original design (3.7 mA) and the dissipation around 125 mW -- approximately half of the rating of a 250 mW resistor. \$\endgroup\$
    – Dave Tweed
    Sep 9, 2018 at 12:13
  • \$\begingroup\$ Ah I just realized my mistake. I was testing and using Spice to calculate power dissipation and realized now that my voltage was set at RMS instead of peak while LTSpice requires Peak. Yes your math is indeed correct. Now that I'm fixing everything, I realized that I need 2.6mA (not 3.X) which makes my choice of C1 & R1 appropriate now. That makes R1 dissipate roughly 1.4mW and adding a parallel resistor would add ~14mW which is low enough. \$\endgroup\$
    – ti_chris
    Sep 10, 2018 at 7:00
1
\$\begingroup\$

This is something like what I made in 1975 as a " green weeny" grad. (What we were called).

I quickly read all the Mil Stds on passive components characteristics to dispel the title. ( plastic X vs Y rated, ceramic, NPO vs XR7, electrolytes, ferrite, crystals etc.)

    • Take note the 1M act as 250V rated bleeder Rs and the 1K act as fuses and it was only rated for about 4x Vpeak inductive 100us transient and about 3kV lightning powerline transient or PLT (1~10us).
    • Surface creepage is critical with a 2.5 to 3mm air gap between AC and DC onm FR4 (G10 back then)

schematic

simulate this circuit – Schematic created using CircuitLab

An X cap is line to line rated plastic film cap that wont short out, but I used R's as a fuse.

\$\endgroup\$
2
  • \$\begingroup\$ You can raise C1 to 300nF for 30mA peak half wave. \$\endgroup\$ Sep 7, 2018 at 14:50
  • \$\begingroup\$ If you raised C1 to 300n however, you would need some dissipate a lot of power through your resistors. It would have to go from ~9mW to ~1W (Total - 3 resistors). \$\endgroup\$
    – ti_chris
    Sep 9, 2018 at 7:55

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.