Hi to all.
I need to transform a sine wave to a square wave to be counted by a micro. The supply voltage can be 5V or 12V
The sine wave is variable from 0.5V peak-to-peak to 50V peak-to-peak, maximum frequency 50 kHz.
At the begin I started to play with a comparator LM311, after I made a circuit with a BC547 as switch and some resistors to work in the saturation zone, and all is OK: with low voltage sine wave from 0,65V p-p to 1,5V p-p, I read the 5V square wave on the BJT collector.
My problem is that the circuit should manage also voltage more than 1,5 V, up to 50 Volt p-p.
In fact now I calculated the base resistor with a reference of 1,5V at the input and the related base current. On the other hand if I would calculate the base resistor for 50 volt, then when the sine wave is 1 volt p-p maybe the base current is not enough to bring in saturation the transistor.
Until now I solved half problem clamping with two diodes (one to ground and one to +5) the base maximum voltage to -0.7 (on the lower sine) and +5.5 (on the upper sine) when the sine voltage is>5V.
Any idea?
Thanks a lot.
I need to transform a sine wave to a square wave to be counted by a micro. The supply voltage can be 5V or 12V
The sine wave is variable from 0.5V peak-to-peak to 50V peak-to-peak, maximum frequency 50 kHz.
At the begin I started to play with a comparator LM311, after I made a circuit with a BC547 as switch and some resistors to work in the saturation zone, and all is OK: with low voltage sine wave from 0,65V p-p to 1,5V p-p, I read the 5V square wave on the BJT collector.
My problem is that the circuit should manage also voltage more than 1,5 V, up to 50 Volt p-p.
In fact now I calculated the base resistor with a reference of 1,5V at the input and the related base current. On the other hand if I would calculate the base resistor for 50 volt, then when the sine wave is 1 volt p-p maybe the base current is not enough to bring in saturation the transistor.
Until now I solved half problem clamping with two diodes (one to ground and one to +5) the base maximum voltage to -0.7 (on the lower sine) and +5.5 (on the upper sine) when the sine voltage is>5V.
Any idea?
Thanks a lot.