I am designing a circuit to convert 24VAC signal to 5V DC signal. The 24VAC signal is designed where 24VAC is on and 0VAC is off. The signal needs to be fed to an MCU which is 5V DC.
The circuit designed has to be very cheap so more expensive ICs and full wave rectifiers are not options.
There are two designs that I came up with
The first design outputs a 5V DC signal for high and about 0VDC for LOW.
The second design eliminates the capacitor but outputs a 5VDC for low and 5VDC square wave for high which will be accounted for in code.
I would like to know if there is an advantage for one over the other considering that the circuit needs to be as cheap and safe as possible since it will be used in an industrial environment and will be heavily affected by dust, debris, and humidity.