Looks good for the inputs but the PC817 is only rated for 50ma
collector current. If the light bulbs require more the TPIC6595 or
a different opto-isolator might be a better solution for the outputs. With the scheme you posted you will need to use the
INPUT_PULLUP directive for your input pins.