Separate out Grounds fom eachother

There is no point in using optocouplers if the grounds are common. You must also have an isolated power supply.

Please post your entire schematic so we can see what you are trying to do.