# Transmit filter for Amplitude-shift keying

I want to transmit an ASK signal with GNU Radio and HackRF, the parameters are:

• Frequency: 27.12 MHz (ISM)
• Sample rate: 2MSPS
• Symbol rate: 2000 bps
• Samples per symbol: 1000

The flowgraph currently looks like this (SDR sink is not included here):

What bothers me, is the following: in the baseband I have a square wave. Square waves have infinite bandwidth. After amplitude modulation with the carrier, this means that in the passband, the signal will also take infinite bandwidth? This somehow doesn't feel right. So I think that I need to lowpass filter it first, but I don't know how to compute the lowpass filter parameters (cutoff frequency, etc)?

• A square wave does not have "infinite bandwidth", but it does have lots of nasty even harmonics. Easily reduced (even removed) by a LPF set slightly above the fundamental frequency, no? – Scott Earle Dec 31 '20 at 2:57
• @ScottEarle an ideal square wave does indeed have infinite bandwidth. – Phil Frost - W8II Dec 31 '20 at 14:56
• But it’s all in the harmonics. A simple RC filter would fix that – Scott Earle Dec 31 '20 at 15:00
• Perhaps, but as you can see the question is about software, not hardware. – Phil Frost - W8II Dec 31 '20 at 15:01
• I am aware - and because of that, there are filters way better than a simple RC pair available. I was just saying that any kind of LPF would do the job – Scott Earle Dec 31 '20 at 23:57

A low-pass filter is one way to do it. Due to the interpolation done in the repeat block, you are representing a symbol with 1000 samples, and your sample rate is 2 million samples per second (the samp_rate variable). So your square wave has a frequency of:
$$\require{cancel} {2000000\ \cancel{\text{samples}} \over \text{second}} {1\ \text{symbol} \over 1000\ \cancel{\text{samples}}} = {2000\ \text{symbols} \over \text{second}}$$
Or more simply, 2 kHz. Square waves have odd harmonics, so the first harmonic you need to worry about is $$2\:\mathrm{kHz} \times 3 = 6\:\mathrm{kHz}$$. So you want a filter with a cutoff a little above 2 kHz with a transition width of a little less than 4 kHz, so he harmonic at 6 kHz gets attenuated.