1
\$\begingroup\$

I want to use home automation, so I am thinking of using an input to an ESP8266 from a PC814 bi-directional optocoupler for a 230 VAC mains physical switch.

Using this scheme I don't have to modify my house wiring, and I can just connect a physical wall switch output, which was going to a device, to go to a PC814 optocoupler using a 100 kΩ resistor. The PC814 output NPN switch will be connected to a NODEMCU's GPIO.

I am concerned that at 50 Hz my input will be toggling every 20 ms. How can I avoid this toggling, and using a mimimum number of components get a continuous signal until power is present on the input of the PC814?

enter image description here

\$\endgroup\$
7
  • 1
    \$\begingroup\$ Possible duplicate of Opto-coupler output \$\endgroup\$
    – Long Pham
    Jul 31, 2018 at 12:57
  • 1
    \$\begingroup\$ Is Nodemcu not capable of processing an interrupt every 20ms? \$\endgroup\$ Jul 31, 2018 at 13:08
  • 2
    \$\begingroup\$ What does "continuous pulse signal until Power is present on input of PC814" mean? It's not clear what you want. \$\endgroup\$
    – Andy aka
    Jul 31, 2018 at 13:30
  • \$\begingroup\$ have seen one simple circuit to detect low frequency pulsing in this form by Vince Patron. I have not tested it. Check your luck - electronics.stackexchange.com/questions/325118/… \$\endgroup\$
    – user19579
    Jul 31, 2018 at 18:38
  • \$\begingroup\$ Sorry typo error. Its not pulse signal. Simple if 230 VAC is present input of Nodemcu should be 1. As soon as power is off input to GPiO is 0 \$\endgroup\$
    – Kalpesh
    Aug 1, 2018 at 0:45

1 Answer 1

0
\$\begingroup\$

50Hz input gives 100Hz positive pulses at zero crossings. ( power on = logic “0” out)

With 22k pullup the collector voltage needs to be below 1/3Vdd for marginal “0”. Since RC=T is 63% towards Vdd the Cap load on collector needs to be 2T min. to cut slew rate voltage rise < Vdd/3 or 2RC=10ms or C>=0.47uF.

Making C too big may delay the detection of power due to current limiting and cap pull down rate from input Current Transfer Ratio (CTR). You could use C>=0.047 and Rc=220k

A power switch rated for >2A cannot be used for <10% of rated current due oxidation of contacts so if you are planning to do this, use a gold plated switch rate for >=2A.

\$\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.