SSQ-2P Sine to Square Wave Processor with Phase Detection and Output Pulse Width Control

October 10, 2001

Revised to correct schematic errors on August 25, 2004

This page describes an audio signal processor which converts many audio waveforms into clean square waves which are suitable for modulating Rife/Bare RF systems. This circuit is a modification of my earlier SSQ-2 processor, but this version incorporates the ability to vary the pulse width of the square wave by phase comparing the left and right audio channels. When combined with Fred Walter's program FreqGen, this circuit provides high-quality variable pulse width square waves suitable for driving a Rife/Bare system.

The component parts are readily available from sources such as Radio Shack, Mouser Electronics, MCM, and others.


Click HERE to download a PDF Diagram (Page 1)

Click HERE to download a PDF Diagram (Page 2)


SSQ-2P Circuit Diagram, Page 1


SSQ-2P Circuit Diagram, Page 2


Circuit Description and Calibration of the SSQ-2P

What does it do?

This circuit is designed to perform two functions. First, it converts a sine wave audio signal to a very high quality square wave. Secondly, it will compare the instantaneous phase difference between the two audio signal input channels and vary the duty cycle ratio of the output square wave depending on the phase deference between the channel signals.

If both of the channels receive an in-phase signal (0 degree difference) the square wave output will be generated with a 50/50 on/off duty cycle. If both of the channels receive an out-of-phase signal (180 degree difference) the square wave output will be generated with a 0/100 on/off duty cycle. For phase differences between zero and 180 degrees, the duty cycle will be roughly proportional to the phase difference. The relationship is not perfectly linear however, so a calibration chart must be made at least once if the researcher needs to have the unit generate a specific duty cycle square wave.

Circuit Description:

The circuit uses a pair of LM-324 amplifier-clippers, wired they same way they are used in the input channel of my original SSQ-2 circuit. A trimmer pot was added to allow for minor DC bias differences between the LM324 amps. Adjusting the trimmer pot sets the square wave for exact 50-50 ratio when each channel is driven by the same sine wave signal.

The outputs from the LM324 amps feed a dual input Schmidt trigger 74HCT132 NAND gate which does the actual phase comparison.

The output of the NAND gate drives the output buffer amplifiers using the same arrangement as in the original SSQ-2. While the circuit is fairly tolerant of amplitude variations, input signal waveform distortion causes problems with the phase comparison since these errors mimic a phase change in the input signals. This causes non-linearity in the output pulse width when compared to the actual input signal phase a set by the software. A calibration chart must be made at least once if the researcher needs to have the unit generate a specific duty cycle square wave.


Initial Calibration:

Using an Oscilloscope:

Using either a laboratory grade frequency generator and a variable phase delay network or FreqGen software, the calibration procedure is as follows:

1) Apply a 400 Millivolt sine wave signal at a frequency of 20,000 Hz to both input channels. The inputs are in phase (phase difference = 0 degrees.)

2) Adjust the balance potentiometer so that the output square wave has a ratio exactly equal to 50% on-to-off ratio.

3) Decrease the applied frequency by 1000 Hz and note the ratio. It should remain at 50-50.

4) Continue decreasing the frequency by 1000 Hz each time and check the ratio. Continue this process until a frequency of 1000 Hz is reached.

5) From 1000 Hz to 100 Hz, decrease the frequency by 100 Hz each iteration. The ratio should remain the same.

6) From 100 Hz to 10 Hz, decrease the frequency by 10 Hz each iteration. The ratio should remain the same. (It should be found that the ratio is constant within plus or minus one percent throughout the frequency range.)


Using an Analog Voltmeter instead of an Oscilloscope:

You really do need an old-fashioned analog voltmeter to calibrate the 50/50 point without an oscilloscope. Digital meters tend to give incorrect readings when connected to digital signals, but analog meters average out the on-off cycles and give you an average reading.

Using either a laboratory grade frequency generator and a variable phase delay network or FreqGen software, the calibration procedure is as follows:

1) Connect your analog voltmeter to pin 3 of the 74HCT132 and ground.

2) Force pins 1 and/or 2 of the 74HCT132 HIGH in order to drive pin 3 LOW. Record the value of the LOW voltage.

3) Force pins 1 and/or 2 of the 74HCT132 LOW in order to drive pin 3 HIGH. Record the value of the HIGH voltage.

4) Subtract the LOW voltage from the HIGH voltage. Divide the result by 2. Add the answer to the LOW voltage. This is your calibration voltage.

5) Apply a 400 Millivolt sine wave signal at a frequency of 20,000 Hz to both input channels. The inputs are in phase (phase difference = 0 degrees.)

6) At this point, the output from pin 3 of the 74HCT132 should equal your calculated calibration voltage. If it does not, then adjust the R Balance pot to obtain the correct calibration voltage at pin 3 of the 74HCT132. This adjusts the circjuit balance so that the output square wave has a ratio exactly equal to 50% on-to-off ratio.

7) Decrease the applied frequency by 1000 Hz and note the ratio. It should remain at 50-50.

8) Continue decreasing the frequency by 1000 Hz each time and check the ratio. Continue this process until a frequency of 1000 Hz is reached.

9) From 1000 Hz to 100 Hz, decrease the frequency by 100 Hz each iteration. The ratio should remain the same.

10) From 100 Hz to 10 Hz, decrease the frequency by 10 Hz each iteration. The ratio should remain the same. (It should be found that the ratio is constant within plus or minus one percent throughout the frequency range.)


Phase Calibration:

1) Feed each channel a 400 Millivolt sine wave at a frequency of 20,000 Hz. Using either the phase delay network or FREQGEN software, the phase of one channel may be varied in phase by between zero and 180 degrees with respect to the other channel.

2) Construct a table for the applied frequency in Hz showing the output pulse width in percent of total cycle time versus the phase angle as declared by FREQGEN.

3) Decrease the applied frequency by 1000 Hz and repeat step 2 for each frequency. Continue this process until a frequency of 1000 Hz is reached.

4) Decrease the applied frequency by 100 Hz and repeat step 2 for each frequency. Continue this process until a frequency of 100 Hz is reached.

5) Decrease the applied frequency by 10 Hz and repeat step 2 for each frequency. Continue this process until a frequency of 10 Hz is reached. Consolidate the data by eliminating any frequencies which have matching cycle time versus phase angle data. When the data table is complete, it will show at which frequencies the data input to FREQGEN must be adjusted to obtain the desired output pulse width.


Sound Card Test Results:

Using a Soundblaster Pro card, there was very little waveform distortion, and the resulting pulse output tracked within a few percent of the phase change. Using a poorer quality sound card, there was significant harmonic distortion at phase angles between 40 and 120 degrees. This distortion created a very non-linear ratio between the output pulse width and the input phase change. At low frequencies, below 100 Hz, the distortion was severe enough that at some phase angles, the direction of the pulse width change actually reversed! At other frequencies and phase angles, double output pulses were generated.

Using a generic built-in sound system on the motherboard of a computer, it was determined that while the waveform distortion was negligible, there was a moderate error in the actual phase angle of the signal delivered from the sound card channels when compared to the value set by the software. In other words, the phase of the signals from the sound card do not track each other evenly.

Conclusion: Use a good soundcard!

Comments on Operation:

A researcher should run a series of frequency sweeps at various phase angles and make sure that the waveform is undistorted under all conditions. If the sound card passes this test, then the researcher should construct a table of pulse widths vs. declared phase for a range of frequencies between, say, 15 to 20,000 Hz. He can then build his frequency sets using the data from this table as a guide. Accomplishing this will require nothing more complicated than an oscilloscope. I think it will be necessary to calibrate each sound card individually for best results. I know this is a bit of trouble, but it will undoubtedly produce the most accurate results.


[ Home ]