Using an opto-coupler could make things simpler. A series resistor from the torch node to the LED, then to ground clamp node. You did not say what the function of your circuit is, and accuracy required?