What is the impact of ambient light on the optocoupler?
Incident light will increase the baseline leakage current in the photodiode. To minimize the baseline leakage, shield the optocoupler from stray-light sources. If possible, test your circuitry in darkness and ambient light to determine whether ambient light will increase the leakage current to unacceptable levels.