I'd like to detect thermostat events (heat, fan, ac etc) with an Arduino. I've done quite a bit of investigation but haven't found a definitive solution. Most projects I see involve controlling the thermostat however I simply want to detect on/off events.

Based on what I've gathered so far, I'd like to use an optocoupler to protect the furnace/thermostat from damage -- protecting the Arduino is important but of lesser concern. I plan to run a separate wire (cat5) from the thermostat to my project so I don't mess with the furnace wiring.

This is the optocoupler I've seen recommended http://www.digikey.com/product-detail/en/HCPL3700/HCPL3700-ND/401373 via this howto https://www.adafruit.com/blog/2012/10/04/ask-an-educator-how-can-i-measure-ac-voltage-with-my-arduino/

But where I'm confused is how to wire it altogether and what values to select for resistance.

Here's the circuit in HCPL3700 datasheet

enter image description here

  • 1
    \$\begingroup\$ Note that that is a test circuit. In actual use, you would connect the AC inpupt only to pins 1 and 4, with no connection to pins 2 and 3. The ground connection between pin 4 and 5 should also be omitted - otherwise you bypass the optical isolation. \$\endgroup\$ Jan 11, 2014 at 20:30
  • \$\begingroup\$ Ok, good to know. I'm not sure what value to choose for the resistor between 5V and Vo. Also that cap across Vo and GND. On the AC side would the thermostat pin go in pin 1, then GND pin 4. I'm guessing a current limiting resistor is needed too? \$\endgroup\$
    – Andrew
    Jan 12, 2014 at 0:34
  • \$\begingroup\$ High gain transistor input (isolated) could be used. \$\endgroup\$
    – Ranger1
    Jan 12, 2014 at 21:49

1 Answer 1


The schematic for use of HPCL3700 is provided in the HP Application Note AN 1004, Figure 6:


The same section of the application note provides the calculations for determining Rx and thus the values of the two resistors on the input side, Rx/2 each, based on the desired trigger threshold (see Example 2). A graph to directly obtain Rx values is provided in Figure 7.

For monitoring a 24V AC line and with some margin for low voltage conditions, referring to Figure 7 and considering high and low thresholds of around 25 and 15 Volts yields Rx = 20k: use 10 kOhms 2 Watts resistors to be on the safe side, one on each leg i.e. pin 1 and 4.

If you also plan to monitor 110V mains voltages, the values used would be 18k 2 Watts each. Ensure that the resistor used is rated for AC mains operation, not the common or garden variety which is not safe for mains voltage applications.

  • \$\begingroup\$ Did you ever post your shield code for the analog pin? I am trying to create the same ac voltage check with the same hpcl-3700. \$\endgroup\$
    – user57835
    Nov 8, 2014 at 19:49
  • \$\begingroup\$ Vo is an open-collector output. Don't forget a pull-up resistor! \$\endgroup\$
    – skot9000
    Aug 27, 2021 at 21:35

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.