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): ask_flowgraph

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)?

  • $\begingroup$ 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? $\endgroup$
    – Scott Earle
    Dec 31, 2020 at 2:57
  • 2
    $\begingroup$ @ScottEarle an ideal square wave does indeed have infinite bandwidth. $\endgroup$ Dec 31, 2020 at 14:56
  • $\begingroup$ But it’s all in the harmonics. A simple RC filter would fix that $\endgroup$
    – Scott Earle
    Dec 31, 2020 at 15:00
  • 1
    $\begingroup$ Perhaps, but as you can see the question is about software, not hardware. $\endgroup$ Dec 31, 2020 at 15:01
  • $\begingroup$ 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 $\endgroup$
    – Scott Earle
    Dec 31, 2020 at 23:57

1 Answer 1


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.

But this isn't a great way to do it. Consider transmitting a single '1' symbol, surrounded by infinite '0' symbols. Assuming 1 is represented by "full amplitude", and 0 by "zero amplitude", then the result is some kind of pulse. Due to the filtering, this pulse will happen gradually, with the transmitter amplitude rising gradually to a maximum, then gradually going back to zero, maybe with some ringing, and maybe with some time held at maximum.

But what exactly is this pulse shape? If we want to build the best receiver, we need to know. Also, will the pulse for one symbol interfere with the pulses for adjacent symbols? Hopefully not, if we want the best performance. The low-pass filter approach isn't especially amenable to addressing these concerns.

So, the canonical solution to this problem is a pulse shaping filter. In GNU Radio you'll probably implement this with the Interpolating FIR Filter block, and calculating the taps for that block with RRC Filter Taps. The PSK tutorial or the BPSK tutorials give some examples in context. Unfortunately there isn't and ASK tutorial, but consider that BPSK and ASK are nearly the same thing: in ASK the amplitude is either 0 or 1, whereas in BPSK the amplitude is -1 or 1. Otherwise they are essentially the same thing.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .