It's a depletion mode N-channel, I checked the output characteristics and they seem correct.
I'm afraid about the type of transistor: BFR30 is a field-effect transistor (FET) while BSS126 is a MOSFET (SIPMOS). Is it suitable for this application?
Actually I don't need a constant current to detect the input status in the 5-24V range. But I have very limited space on the PCB board so I'm looking for a minimum-components solution.
I tried with the simplest scheme:
I selected a zener with a reverse voltage slightly below the minimum input voltage
R2 can be selected to allow about 5 mA through LED and opto-coupler: (4.3V - 2.1V - 1.1V) / 5mA = 860 ohm
with 5V at input, R1 should let flow 5mA towards the opto-coupler and a couple more for the zener, say (5V - 4.3V) / 7mA = 100 ohm
with 24V, the current flowing in R1 is: (24V - 4.3V) / 100 ohm = 197 mA it's too much (about 4W!)
This is why I was looking for a more efficient way to acquire such a signal with few components.