How to design an optocoupler circuit for raspberry pi
It seems your problem is that you have a 24 V signal that you want to get into a 3.3 V digital input.

Since the signal is coming from some industrial equipment, I agree that opto-isolating it is a good idea.  So here is what you do:

Pick a opto-coupler.  Just about any will do since you seem to have plenty of input voltage and presumably current available.  Use whatever your company already has in stock.  If you don't already have something available, check out the FOD817 family.  They are cheap, widely available, and have good CTR.  They aren't for high speed applications, but should be instantaneous for a signal from a conveyor belt.

Read the datasheet.

Look at what kind of digital input is available.  The best would be one that has a internal pullup, because then you need not other parts than the opto itself on the digital side.  If all you have is a regular digital input, then you have to supply your own pullup resistor.  10 k&Omega; is usually a good value for such things.

Either way, find how much current the opto has to sink to pull the digital input low.

Divide the minimum required pulldown current by the minimum guaranteed CTR (current transfer ratio).  Now at least double that.  This is current you want to drive the input of the opto with.

Check the specs for the 24 V signal and verify it can source the current computed in the previous step, with some margin.  I'll assume it can.  If it can't, you'll have to get more clever and the solution isn't as simple as hooking up a opto-isolator.

Look at the minimum guaranteed signal voltage (24 V nominal might only be 22 V min guaranteed, for example), and subtract off the maximum LED voltage from the opto datasheet.  This is the minimum voltage that will be across the resistor.

Use Ohm's law to calculate the maximum allowed resistor in series with the LED on the opto's input side.  Go one or two standard values down from that, or some value you already stock that is a bit lower than the calculated value.

Connect everything up.  Put the opto physically close to the digital input it drives.  In other words, the long pair of wires should be between the conveyor and the opto, not the opto and the digital board.