2
\$\begingroup\$

enter image description here

I´m trying to detect mains voltage (230 VAC) across AC_SENS_L and AC_SENS_N. AC_SENS_IN goes to an Arduino input with pull-up.

I only need to detect if voltage is present, not what voltage.

Any prediction if this circuit will work? Any improvements?

\$\endgroup\$
3
  • 2
    \$\begingroup\$ Welcome! Depends on what's connected to AC_SENS_IN. You have a CRT of about 1 so that 4.7 uF would take about 15 ms to sink, assuming you have 3.3 V weak pull up. Seems resonable. But a bit reverse logic. You don't want high signal when AC is present? \$\endgroup\$
    – winny
    Commented Jan 9, 2023 at 11:24
  • 1
    \$\begingroup\$ CTR, not CRT. Damn you autocorrect... \$\endgroup\$
    – winny
    Commented Jan 9, 2023 at 11:55
  • \$\begingroup\$ Have you thought about using a simulator? \$\endgroup\$
    – Andy aka
    Commented Jan 9, 2023 at 13:00

1 Answer 1

4
\$\begingroup\$

I predict that it will work with that optocoupler.

Minimum CTR (Current Transfer Ratio) of the PC354N1J000F at 1 mA LED current is 0.5. The average current through 300 kΩ from 230 VAC to the optocoupler LEDs is ~0.67 mA. That means the optocoupler output transistor should pull down with an average current of at least 0.5 times that, ie. ~0.34 mA.

The Arduino's pullup resistance is guaranteed to be > 20 kΩ. 5 V / 20 kΩ = 0.25 mA, so the transistor should be able to pull down to ground and hold it there over most of the mains cycle.

As mains voltage gets close to zero crossing the transistor will turn off, and the output voltage will rise as the capacitor charges through the pullup resistor. Calculating the smoothed output voltage is a bit tricky, so I simulated it in LTspice. Here is the result:-

enter image description here

Red trace is current into the optocoupler LEDs, blue is current through the output transistor to ground, and green is the output voltage. It takes ~130 ms for the capacitor to discharge down to ~0.25 V.

I lowered the simulated mains voltage to 150 VAC and it still worked, though the output voltage rose to ~1.0 V.

This is pretty much the worst case scenario. The optocoupler will probably have a higher CTR, and the Arduino will probably have a higher value pullup resistance, so it will probably perform better than this.

\$\endgroup\$

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.