square wave -->sine using passive bandpass filter

Discussion in 'General Electronics Chat' started by windell747, Jun 21, 2008.

  1. windell747

    Thread Starter New Member

    Jun 21, 2008

    I'm designing a circuit that will take a square wave generated by a microprocessor and feeds it through a bandpass filter to get a sine wave. The application will be to provide a tone for morse code to a handheld ham radio on board a small satellite. Right now im considering remaining simple by using a 1st order passive bandpass filter that uses a capacitor and inductor in series. Assuming this I have a few questions.

    1) How should I choose the impedance of the bandpass filter? I do not know the impedance of the GPIO of the microprocessor. Does this impedance matter much?

    2) Should I filter more to get a truer sine wave? Any experienced hammers out there? I will be transmitting the morse code tone from a ham radio from a 400km orbit (LEO). I will then feed the tone through a morse decoder to convert the morse to text using a freeware program.

    3) Finally, I wanted to use a passive filter to save power, however, I'm open to an active filter that uses an opamp. Are there any advantages to this?

    4) What would the gain of a 1st order series LC filter be at the center frequency? I know that the coefficient of the Forier series for a square wave is (4/pi)*Vpp of square wave. I would like to take the output of the bandpass filter and scale it down to 5mV at 2000ohm at knowing the gain of the filter I decide to use would be good for calculating the scale factor.

    If possible, could you provide references for your answers so that I can have good confidence in the answers? Any guidance would be greatly appreciated!

  2. SgtWookie


    Jul 17, 2007
    What is the maximum source/sink current for the GPIO? Run that through Ohm's Law to get you in the ballpark.

    The more filter stages you put it through, the more true the output will be (within reason, of course). You'll be less likely to cause splatter.
    There are several on the forum; I'm not one of them.
    Interesting project.

    It will be far easier to build an active filter than a passive one. You won't have to deal with inductors, which can be a headache particularly at low frequencies (not to mention VERY bulky).

    This depends largely upon the Q of the inductor, how close the input and output impedance match is, and how well the filter is tuned.
    This will be a snap to calculate with an active filter.

    Texas Instruments has Filter Pro software available for a free download. It's very handy.
    See the attached for a 2 pole 600Hz Butterworth bandpass unity gain filter created using TI's FilterPro 2.0

    Linear Technology's LTSpice/SwitcherCad has switched-capacitor filter designer in it.
    See the 2nd attachment for a 600Hz 8th order switched capacitor elliptical bandpass filter that's 100Hz wide with -40dB stopbands and unity gain.

    If you wish to experiment with LC filter design, download AAED Filter Design freeware located here:

    I spent a few years tuning and troubleshooting LC and crystal filters. They can be quite cantankerous if not properly designed.
    Last edited: Jun 22, 2008
  3. Wendy


    Mar 24, 2008
    I'm trying to do something vaguely similar here.

    A simple RC network is a filter. If you were to take 4 low pass filters in series at "resonance" I think you would get very close to what you want, but the trade off is amplitude. Active filters have the gain included in the design, and there are some incredibly efficient op amps out there, that can go very low in supply voltages.

    I used resonance in quotes because it is basically incorrect to use this word in this context. Having said that, you can build low pass, high pass, and band pass filters using nothing but resistors and capacitors. A Wien Bridge is and example of a band pass filter. I think you'll find its formula for resonance interesting.

    The RC low pass and high pass filter is very similar, when the reactance of the capacitor equals the resistor that is its "resonance" point.


    I picked 4 stages because at three I know you will see some distortion, there will still be some on the 4th stage output, but it is a case of diminishing returns. The above circuit might even do what you want with just 3 stages. If you were using op amp integrators the output would be almost perfect on the 3rd stage, with no losses.

    You may have noticed I used a low pass instead of a band pass. You are after the root frequency of your square wave, and since it doesn't have any frequencies below the root frequency you don't care, so this was an opertunity for simplification. Just make sure the square wave is a symmetrical one, 50/50 duty cycle.

    Active filters are as simple or as complex as you want to make them, so are passive filters.

    Wook: There is another bandpass RC filter circuit out there, but I'm drawing a blank, you remember what it is called?

    As for active Hams, check this thread out.
    Last edited: Jun 22, 2008