Looking for the right Optocoupler

Just about any regular optoisolator will do, including the first one you linked to. Things to remember:

  • the peak voltage will be about 24 * 1.414 so choose the series resistor to limit current to below the current rating of the emitter at this voltage

  • connect a diode capable of withstanding that voltage in series with the emitter, to protect it from negative voltage. Alternatively, use a small signal diode connected in parallel, in the reverse direction.

  • voltage rating of the transistor side only needs to be above 5v

  • the factor that does matter is current transfer ratio. For example, if the current transfer ratio is quoted at 20% then this means (roughly) that when there is 10mA flowing through the emitter, the transistor will sink up to 20% of 10mA. So the pullup resistor needs to be high enough for this. I suggest you use the internal pullup in the Arduino. This has a value of around 20k so the transistor only needs to sink 0.25mA. Just about any opto isolator driven with 10mA or 20mA peak on the emitter side should provide this.