Hi All,
I am designing a ATmega328P based PCB control board that has a function of sending and receiving discrete digital signals to and from a PLC. The PLC has sinking outputs. The PLC can accept sinking or sourcing inputs.
I want the PCB to output Sourcing (PNP) signals to the PLC. (mostly because the rest of the switches we use are PNP output prox switches, so to stay consistent)
This is a motor control board and I would like to isolate the signals from the PLC using optocouplers. For the PNP output I used a PNP transistor. The 24V PLC and GND PLC is the PLC's power supply. The 5V and gnd is the power supply that is powering the ATMega 328P
For the output from the PLC, i expect that when the PLC output is LOW, the ATMega328P input is HIGH, when the PLC is HIGH, the optocoupler is activated, and the input on the ATMega328P is LOW. For the input to the PLC, I expect that when the ATMega328 output is LOW, the output of the PNP transistor is LOW, when the ATmega328P is HIGH, the PNP input to the PLC would show HIGH. Will this circuit work as intended?

Data Sheets:
PLC: https://cdn.automationdirect.com/static/specs/d005dr.pdf
PNP transistor: https://datasheet.lcsc.com/lcsc/220...*MTcwOTgyNTc2My42Mi4xLjE3MDk4MjU4NDIuNjAuMC4w
optocoupler: https://www.mouser.com/datasheet/2/143/EVER_S_A0008471837_1-2548735.pdf
I greatly appreciate any feedback!
I am designing a ATmega328P based PCB control board that has a function of sending and receiving discrete digital signals to and from a PLC. The PLC has sinking outputs. The PLC can accept sinking or sourcing inputs.
I want the PCB to output Sourcing (PNP) signals to the PLC. (mostly because the rest of the switches we use are PNP output prox switches, so to stay consistent)
This is a motor control board and I would like to isolate the signals from the PLC using optocouplers. For the PNP output I used a PNP transistor. The 24V PLC and GND PLC is the PLC's power supply. The 5V and gnd is the power supply that is powering the ATMega 328P
For the output from the PLC, i expect that when the PLC output is LOW, the ATMega328P input is HIGH, when the PLC is HIGH, the optocoupler is activated, and the input on the ATMega328P is LOW. For the input to the PLC, I expect that when the ATMega328 output is LOW, the output of the PNP transistor is LOW, when the ATmega328P is HIGH, the PNP input to the PLC would show HIGH. Will this circuit work as intended?

Data Sheets:
PLC: https://cdn.automationdirect.com/static/specs/d005dr.pdf
PNP transistor: https://datasheet.lcsc.com/lcsc/220...*MTcwOTgyNTc2My42Mi4xLjE3MDk4MjU4NDIuNjAuMC4w
optocoupler: https://www.mouser.com/datasheet/2/143/EVER_S_A0008471837_1-2548735.pdf
I greatly appreciate any feedback!







