So, I finally got the parts to put this all together. It doesn't work. I'm thinking it has to do with the FOD814. I am using the last schematic that BrianHG posted. I think that the C and E of the 5V side are backwards. Is that all that it could be? The NC and NO sides work with just the 12V line connected, but when I connect the 24VAC it doesn't light the LED or swap the closed to open and vice versa.
Yup, the C&E are backwards. If the 74HC14 is powered and wired correctly, applying 24v should turn it on.
Also check pin1 of the 74HC14, it should be high/5v, then, when you apply 24v ac, or even dc at the input, it should go to GND/0v.
Thank you. I tried swapping it earlier and it did work.
Thank you. I tried swapping it earlier and it did work.
Good, I'm glad it works but is it safe?
Have you left sufficient creepage and clearances between the mains and 24V sides?
Is it build on a breadboard, stripboard or proper PCB? What's the minimum distance between anything on the mains side of the opto-coupler and 24V side?
It's on a PCB with some stuff jumped around for the optocoupler. My creepage and clearance should be good. I used one of the calculators on a website.