0
\$\begingroup\$

I'm looking to detect HVAC thermostat calls using ESP32 GPIO inputs. I have a total of six inputs (two compressor speeds, blower, reversing valve, and two aux heat levels). Nominally 24 VAC, but my transformer shows more like 28 VAC RMS.

I'm using Vishay SFH620a optos. I'm using the ESP32 internal pull-down resistors for simplicity, assuming they're about 30 kΩ. I'm using the pull-down option mainly because the pull-up option blocks the internal "delayed off" command for smoothing.

The SFH620 has a bipolar emitter, so no need to use a diode on the input. I have it working with a 1 kΩ resistor on the input side. 2 kΩ is on the ragged edge, as about half of my optos don't trigger at this level. Somehow, my setup requires about 26 mA forward current to activate the opto.

Problem is, 1 kΩ means a very warm resistor, dissipating about 640 mW, too much for my 1/4 watt resistor kit. I see a few options:

  1. Order some 1 W resistors. Not ideal as I'd really just rather decrease the forward current requirement somehow.
  2. Find another "AC input" phototransistor optocoupler with higher CTR.
  3. Do some series/parallel arrangement of a different resistor value to get greater power dissipation with my existing 1/4 W kit. Disadvantage: clutters up my breadboard.
  4. Add some components to the output side of the opto to decrease the forward current requirement.

Thanks for the EE advice in advance for this electronics amateur.

schematic sketch

\$\endgroup\$
4
  • 1
    \$\begingroup\$ Can you show a schematic of the connections between the coupler and the ESP32? It is very unusual, that you need 26 mA to control 0.1 mA on the coupler output side. This would be the case if collector and emitter are exchanged. \$\endgroup\$
    – Jens
    Nov 6, 2022 at 20:05
  • \$\begingroup\$ @Jens, Sorry for the slow reply. Other projects took over but I've circled back. I've added a schematic sketch. \$\endgroup\$
    – johnmyster
    Dec 7, 2022 at 1:31
  • \$\begingroup\$ The vishay.com/docs/83675/sfh620a.pdf has a minimum CTR of 40%, and they can be selected for 100% minimum (-3 devices), with 10 mA input. But you might be able to use a 1/4W 1.5k resistor with a diode in series which will result in detection on half-cycles only. This would be 210 mW with 25V on the resistor. \$\endgroup\$
    – PStechPaul
    Dec 7, 2022 at 4:13
  • \$\begingroup\$ According to your schematic, you DO have emitter and collector reversed. The 3.3V would be connected to the collector, and the pull-down for a GPIO input on the emitter. I see that @Jens noticed this as well. \$\endgroup\$
    – PStechPaul
    Dec 7, 2022 at 4:18

2 Answers 2

1
\$\begingroup\$

Somehow, my setup requires about 26 mA forward current to activate the opto.

You're not using the output of the SFH620A in the conventional way. Usually the output emitter (pin 3) is grounded and a higher voltage is fed into the collector (pin 4) like shown here:

enter image description here

(image taken from http://hallard.me/demystifier-la-teleinfo/ )

Transistors can work with the collector and emitter roles reversed but they are not as effective.

Concerning the choice of resistors for R1 and R2, this is an excellent answer to basically the same question which also uses the SFH620A with a mains AC signal and goes into how to use the CTR to determine the best resistor values:

How do I select the accompanying components for an optocoupler?

\$\endgroup\$
1
\$\begingroup\$

Facepalm. Thank you. I don't know how I arrived at the backwards polarity when prototyping without noticing. With the correct output polarity, I'm detecting 24 VAC even with a 100k resistor. Thank you for the direction @ErikR.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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