Firstly, remember that on the Arduino based PLCs all the optoisolated outputs are DIGITAL, NOT ANALOG!
As shown in the Figure below, optoisolated outputs always have two additional connections on the outputs column (Q/Vdc and COM(-)):
Both of these connections need to be wired for the proper functioning of the outputs.
Q/Vdc is the reference voltage for all the digital outputs of the same column; for example in the image above, if we are powering Q/Vdc to 12V, from Q0.0 to Q0.7 it will be returning a digital signal of 12V when HIGH.
COM(-) is the common ground for the column of digital outputs. You can use the same used for the external power supply of the equipment.
Simplified scheme of optoisolation in digital outputs and connections:
IMPORTANT:So, before using any optoisolated digital output, a reference voltage and a reference GND must be connected for all those digital outputs that are part of the same column.