Thirding the digital isolator suggestions, they're a much better solution than actual optos for applications like this. They're available in varying channel count/direction combinations, so it's pretty easy to get a single part that will isolate all of the channels you need in the correct directions for most common applications.