
I want to detect if this latching solenoid relay has been activated. The switch is a momentary manual push button. I want presence of 24VAC to produce logic 1 and absence to produce logic 0 (or vice versa it doesn't matter I can invert in software or on PCA9555 config). My original design used a jelly bean opto and it works fine - I can handle the square wave produced in software. But I want to cram 8 of these detectors on to a small board along with the i2c expander. The 8x opto's are relatively huge compared to a couple of SMD resistor arrays. VCC is 24VAC (HVAC transformer) and feeds a 5V regulator for the logic side - shared grounds. I can't change the switch and solenoid and diode part of the circuit. That is an existing system I am tapping into to detect relay state changes into an MCU.
I am struggling with the voltage divider. It seems like when the switch is open the pin would get pulled to 24VAC so would get 34V+ on it.
If the switch was on the high side I think I could figure this out but its on the ground side. I have played with replacing R2 with a 4.6V Zener also. Another idea was to use a ULN2801 (or similar) with 8 channels on one small chip but it seems like its used mostly to go in the opposite direction of low to high and was outside my skill level to figure out.
Any ideas gratefully appreciated.