I've got the following circuit going:
A Vishay opto-isolator (CNY74-4) that takes input from buttons that work on 24V, and outputs to microcontroller pins (an Olimex ESP32-PoE-ISO in my case).
A ULN2803 darlington array connected to the microcontroller, +24V and GND, driving LEDs.
Initially I had designed the circuit so that the 24V of the buttons had its own separated GND. But to use the ULN2803, I need to connect the GND of the microcontroller to the GND of the 24V power supply, or it won't work.
This entire setup works perfectly, but I'm wondering if I should also put an opto-isolator between the microcontroller and the ULN2803. It might be overkill, but then the 24V power supply is completely separated electrically from the microcontroller.
I discovered the Vishay ILQ30, an opto-isolator with darlington output. It could take care of this in one DIP. Or the Toshiba TLP627-4, that one is in my KiCad library :)
editbutton below the question and click the schematic button. Pretty easy to use. :) \$\endgroup\$