I need to detect by if one o more pumps are really connected to the 230 Volt main supply. Each pumps is activated by means of a triac isolated by a MOC3021. Arduino commands the optoisolators and I need to detect if really the triac has switched on (e.g. the triac didn't switched due to a fault).

The solution has to be possibly cheap and reliable. I found this simply circuit from a site, and I would like to know your opinion. The optocoupler is a 4n35 or pc817 or similar. What also I need to know is if the 390K resistor should be dimensioned more than 1/4 W and if has to be a special resistor for high voltage. Thanks a lot.

enter image description here

  • 5
    \$\begingroup\$ I notice that "safe" is not in your user requirements. Properly built opto-isolation should provide the required level of safety however. You need to calculate the power dissipated in the resistor and you need to check the voltage rating of the resistor. It is common on 230 V circuits to use two resistors in series to achieve the voltage rating. \$\endgroup\$ – Transistor Mar 25 '19 at 16:27
  • \$\begingroup\$ Can you get small current transformers cheaply? \$\endgroup\$ – ThreePhaseEel Mar 25 '19 at 23:51

With the circuit above, the main thing is sizing the rectifier and the resistor for the amount of power and current they would need to handle.

The 390k resistor looks ok, even with the LED shorted it only consumes roughly 1/8W max which is well within the heating tolerances of a 1/4W resistor,

One thing to consider is creepage and clearance of the 220V circuit, the traces need to be spaced adequately to meet IPC requirements if there going to be used in a product (and if there not, they still need to be spaced correctly for saftey).

A hall effect current sensor might be considered in this application instead of the circuit above. I'm not sure if it's cheaper, but it's easier, I'll let you do the pricing. The circuit would have lower loss (no rectifier), and fewer components, and still have isolation. If you had an ADC you could actually report the current to a microprocessor or use a comparator with a set voltage level to detect the current.

enter image description here
Source: https://makerselectronics.com/product/current-sensor-module-acs712

  • \$\begingroup\$ Thanks for the answers. So about the voltage rating I could choose a 400V rated resistor or put two 200V rated resistor (half value) in series. But I'm still a bit confused because I read in this site (Olin answer) and in a slide here slideplayer.com/slide/3187597 that for any resistor the max voltage rating is ever Vmax=sqrt(W*ohm) derived from the ohm's law. In my case sqrt(0,5*390K)=441 Volt. So I could connect only a 0.5W resistor to achieve the 400volt specification? I would like to understand this passage please! \$\endgroup\$ – daigs Mar 25 '19 at 22:19
  • \$\begingroup\$ Thats for power ratings, voltage is dependent upon the size of the resistor and the spacing of the gaps (read the link in the answer, the whole thing). For example, you can get an 0603 390k resistor, but it would not be appropriate to put 220V across it because of arcing, you need at least a 50mil gap (0603's have a 30mil gap, you'd probably need more depending on your environment). So you'd need two resistors OR a through hole resistor. \$\endgroup\$ – Voltage Spike Mar 25 '19 at 22:25
  • \$\begingroup\$ meta.stackexchange.com/questions/126180/… \$\endgroup\$ – Voltage Spike Mar 25 '19 at 22:25

The 390K resistor value is too high. That works out to less than 1 mA peak of opto LED current - and only 700 uA at 200 Vac "low line". That is not enough for a predictable current transfer through the opto.

For 5 mA peak current and a normal 220 V line, R works out to 65K at 1.63 W. A good solution is two 33K / 2 W resistors in series.

You can cut the power dissipation in half by using a single diode (half-wave), but this increases the detection lag.

Add a small rectifier diode (1N4006, etc.) in anti-parallel across the LED to prevent excessive reverse voltage.


The circuit that you have shown can be made to be much more reliable by simply rearranging the elements.

The input current-limit resistors (R1, R2) should be metal-oxide. These have significantly-better transient power capability.


simulate this circuit – Schematic created using CircuitLab

Pick the resistor value (R1, R2) to ensure that the output photo-transistor is saturated. This current depends on the particular opto-isolator chosen.

This can be enhanced by adding zener diodes in series with each of the input leads. That can stop the circuit from detecting leakage currents. Adjust the resistor in parallel with the LED accordingly.

The advantage of this circuit arrangement is that the bridge rectifier is not exposed to high-voltage transients. The maximum steady-state voltage applied to the bridge is less than 5V. You can use small-signal diodes (1N4148) or use a packaged bridge rectifier.

  • \$\begingroup\$ There is not any reverse voltage across the LED because it is being fed by a bridge rectifier. The purpose of R3 is to help minimise the response to leakage current. Obviously, 10k is a ballpark value for starting purposes. \$\endgroup\$ – Dwayne Reid Mar 26 '19 at 9:19
  • \$\begingroup\$ Thanks Dwayne, but the bridge shouldn't be rated for main power source? In this new circuit the transient could affect the resistors on not? Thanks. \$\endgroup\$ – daigs Mar 30 '19 at 16:31
  • \$\begingroup\$ The maximum voltage that the bridge rectifier is exposed to is the voltage drop across the LED plus the voltage drop across the diodes in the bridge. All of the remaining voltage is dropped across the input resistors. \$\endgroup\$ – Dwayne Reid Mar 30 '19 at 16:44

The simplest way would use a optocupler that has two LEDs back to back. There are many options, you can probably find one with a darlington output that will work at microamp levels. I can't think of any part numbers off hand but have used them for just this purpose. You will still have to use two resistors on the input probably. Put one of these across each triac and you can tell if it is on or off.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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