Electrical – Using a Schmitt-Trigger to transform sine to square wave

schmitt-trigger

I have a myRIO from NI. I use the FPGA to generate a sine and a cosine digitally for signal processing of a photo acoustical signal. The sine and cosine have the same frequency. I now want to output the sine over the 12 bit DAC and transform it into a square wave with the exact same frequency and 50% duty cycle. The maximum output rate is 345kSPS and the sine has a 5Vpp amplitude (0V to 5V). The square wave can have a high level between 3.33V and 5V, the low level should be 0V with a duty cycle of 50% to control a laser switch. The output Frequency can vary between 1kHz and 35kHz. That is why I also want to implement a low pass filter before the sine enters the Schmitt-Trigger.
The picture shows my try in LTSpice, but although I use this calculator to get the right component values, I only have a DC signal after the LPF. If I try it without the LPF the output of the Schmitt-Trigger has no 50 duty cycle and the high voltage level is too low.
Maybe the comparator is no good choice. I hope you can help me on that.
current circuit

With LPF (LTC6244HV is uesd from LTSPice) I get this result:
With LPF
Any comments on the picture and on the low pass filter?

Best Answer

Presuming that pin5 is output of LM393 (not sure where you got that model for LM393). Also presuming pin2 is the (+) input.

LM393 is an open collector output op-amp. This means that the output of LM393 cannot go high (towards Vdd) without an external pull up resistor.

You could simply tie R4 to the positive rail, Vdd, instead of to ground.

Your resistors R1, R2, R3, are very low value. Things might work in a simulator with those low values. However, low resistance values require higher current and will effect the output transistor in a bad way. Look at the current required with 5v/100 ohms, that's 50mA current.

The LM393 output transistor isn't going to like that 50mA. Maximum sink current is 18mA.

EDIT : I made assumption R4 would change to value of 100 ohms so that output could pull higher. That is why I mentioned the caution on sinking high current.

2nd EDIT : The LTC6241 has maximum TOTAL supply voltage of 7 volts. You are using total of 10 volts. Move up to the LTC6241HV.

enter image description here