How does a PLC convert a 120VAC input, to a voltage that can be read with surface mount components? Most PLCs have around 10 inputs. I doubt they use a transformer for each 120v input. Does anyone understand the inner workings of a PLC? ~ Thanks
Beefy resistor + optocoupler.
They use an optoisolator. This is an LED and a phototransistor in one package. The mains drive the LED (current limited by resistors, of course) and the phototransistor can be used on the low voltage side to do whatever. Frequently, it just acts as a pulldown in concert with a resistor pull-up.
Given we are talking about analog measurements they use an extra-cheap A/D converter that transmits the digital data over an optocoupler. The voltage to measure is scaled-down by a resistive divider before the A/D.
To keep it simple and low cost all of this electronics on the 'primary' side is powered from the same voltage it is trying to measure via a high voltage mosfet and a regulating zener.
For digital ON/OFF data, driving the led of an optocoupler in an analog way will work
When it is a digital input and we're only interested in ON or OFF, an optocoupler will do the job just fine. Sooner or later the signal needs to be converted to DC and, perhaps, filtered before stuffing it into an IO port. There will also be some input protection circuitry at the 120V level.
Stripped to the essentials:
https://www.myodesie.com/images/wiki/2/PLC23.PNG
Dedicated galvanically isolated ADCs are pretty cheap now so that is one way. Another way is to use a linear optocoupler and then do the measurement on the non-isolated side.
The same way they read DC inputs, except then with some additional current limiting by means of capacitor.
You can use a bidirectional optocoupler to save the diode and have one cycle lower latency.
(
source)
If you just want to measure the presence of 120VAC or 240VAC, then that is much easier with just the optocoupler circuit as shown.
Another easy method is to use a small 120 vac coil reed relays for each AC channel being read.