Hello, i have created simple schematics whics has digital and analog parts. I am most interested on analog part, mostly on transistors Q1 and Q2.
So how everything should work:
1. Signal comes to connector J2 from the sensor. Sensors can be three different types. These types mainly are different by sensors output type. So there are three different output versions: npn (open collector), pnp (open collector) and push-pull output. I need to accomodate my circuit to all three types of the sensors.
2. Sensors are digital, they generate square wave at the output. Sensors have three wires: +, - and output.
3. To make my circuit work with all three types of sensors jumper JP1 will be used which will allow to the user to setup the schematics according to the type of sensor used. JP1 jumper will have two positions - for npn and pnp sensors. I suppose that sensor with push-pull output must work when JP1 is set to any of two positions.
4. Sensor voltage is 12V, but chips U1 and U2 inputs are designed for 3.3V input so zener D1 is used to change 12V voltage to 3.3V.
5. Despite of sensor type used chip U2 must get low level voltage (0V) in it's input when sensor produces 12V high level in it's output. Sensors have weak output so i am using transistors Q1 and Q2 to amplify signal.
I have tested this circuit with Proteus but i also want to hear your opinion about the schematics.
If JP1 will be set to pnp position, maybe i need to set protection diode to the Q2 collector?
Maybe the analog part of the schematics can be simplified?

So how everything should work:
1. Signal comes to connector J2 from the sensor. Sensors can be three different types. These types mainly are different by sensors output type. So there are three different output versions: npn (open collector), pnp (open collector) and push-pull output. I need to accomodate my circuit to all three types of the sensors.
2. Sensors are digital, they generate square wave at the output. Sensors have three wires: +, - and output.
3. To make my circuit work with all three types of sensors jumper JP1 will be used which will allow to the user to setup the schematics according to the type of sensor used. JP1 jumper will have two positions - for npn and pnp sensors. I suppose that sensor with push-pull output must work when JP1 is set to any of two positions.
4. Sensor voltage is 12V, but chips U1 and U2 inputs are designed for 3.3V input so zener D1 is used to change 12V voltage to 3.3V.
5. Despite of sensor type used chip U2 must get low level voltage (0V) in it's input when sensor produces 12V high level in it's output. Sensors have weak output so i am using transistors Q1 and Q2 to amplify signal.
I have tested this circuit with Proteus but i also want to hear your opinion about the schematics.
If JP1 will be set to pnp position, maybe i need to set protection diode to the Q2 collector?
Maybe the analog part of the schematics can be simplified?
