# How to generate 2-FSK signal from the bit stream(symbols)?

I’m trying to generate a 2-FSK Signal, Let’s just consider the following,

Symbol Rate : 1 MS/s Sample Rate : 10 MHz, Frequency Deviation: 150 KHz & -150 KHz

And assume I’ve 100 symbols : {1,0,0,0…..0}

Now, I want to generate a FSK signal from the above parameters, along with a Gaussian filter. How do I start from here?

Edit:

I’m trying to implement this on C#, I found the following formula,

from the formula, f1 & f2 are the frequency deviations but I'm not sure about the t?

• Sounds like homework. What have you tried so far? – Dave Tweed Apr 15 '14 at 15:50
• It's not a home work, but this is something I wanted to learn.! – SanVEE Apr 15 '14 at 16:02

Your modulated signal needs to look like this

$$s(t)=A\sin[2\pi(f_0\pm \Delta f)t]$$

where you choose the positive sign for a '1' and the negative sign for a '0' (or the other way around). $\Delta f$ is the frequency deviation from the mean frequency $f_0$. The independent time variable $t$ is sampled in your case, so $t=n/f_s$, $n=0,1,\ldots$, where $f_s$ is the sampling frequency.

Note that with your symbol rate one symbol interval lasts $10^{-6}$ seconds. The difference between the two frequencies of the FSK signal is $2\Delta f=300$ kHz. This means that within 1 symbol interval, the higher frequency signal traverses $0.3$ cycles more than the lower frequency interval. This is definitely not enough. Normally, the minimum frequency distance should be such that the higher frequency signal traverses 1 cycle more per symbol interval than the lower frequency signal. This means the the frequency difference should be $2\Delta f=1$ Mhz (if your symbol rate is 1 Mbaud).

EDIT: In the comments to this answer it was pointed out that I might not have sufficiently motivated my statement that the frequency separation suggested by the OP is insufficient. I'll try to fix this in the following paragraphs. (Please note that this topic usually fills several pages of books on digital communications, so excuse me if you feel I'm being too concise or not clear enough.)

If $T$ denotes the length of a symbol interval, and $s_1(t)$ and $s_2(t)$ are the two FSK signals with frequencies $f_1=f_0-\Delta f$ and $f_2=f_0+\Delta f$, then their similarity can be measured in terms of their correlation coefficient $r$. It can be shown (e.g., Digital Communications by Glover and Grant) that $$r = \frac{2}{T}\int_{0}^T\cos(2\pi f_1t)\cos(2\pi f_2 t)dt$$

Ideally, $s_1(t)$ and $s_2(t)$ should be orthogonal (i.e., $r=0$). Then the FSK modulated signal can be detected coherently with minimum possible error probability. However, a small correlation coefficient is also important for non-coherent detection. In traditional binary FSK ("Sunde's FSK") the frequency separation $2\Delta f$ is chosen as $2\Delta f=1/T$ (this is what I referred to above). In this case orthogonality is guaranteed. For successful coherent as well as for non-coherent detection of FSK, a minimum frequency separation of $2\Delta f=1/T$ is recommended (cf. Digital Communications by Glover and Grant).

(A last side note: MSK (minimum shift keying) is a special case of continuous phase FSK which achieves the absolute minimum frequency separation of $2\Delta f=1/(2T)$ while still guaranteeing orthogonality of the signals.)

• Minimum for what? You seem to be making assumptions that don't exist in the question. You also seem to have missed the part about Gaussian shaping. – Dave Tweed Apr 15 '14 at 18:03
• @DaveTweed Minimum frequency separation for FSK, such that it works. My assumption was simply that it is supposed to work (i.e. a receiver can deal with it). You seem to have missed some basics about FSK. – Matt L. Apr 15 '14 at 18:14
• Then maybe you should explain exactly why you'd have so much trouble receiving the signal that the OP describes. – Dave Tweed Apr 15 '14 at 18:41
• Minimum separation frequency for digital counting demodulators has to yield an integer difference in counts and I think this is what you are talking about. It's also right you should point this problem out because although traditional analogue demod can get closer than +/-1 count, they are certainly impaired (performance wise) with a spec like this. +1 for that inference. – Andy aka Apr 15 '14 at 19:20
• @Andyaka I edited my answer adding more details about the necessary frequency separation of FSK signals. – Matt L. Apr 15 '14 at 21:15

Why don't you use a colpitts oscillator with varactor tuning so that data can modulate the carrier frequency between two limits. You can keep the oscillator stable using a phased lock loop such as the ubiquitous CD4046 - this would also use the varactor diode to keep nudging frequency to the nominal midpoint.

Basically it's an FM modulator. It's basic output is a sinewave so no real issues about using a filter to keep it clean. I realize "FM modulator" is a tautology so please no need to remind me.

I don't know what you're planning to use as receiver but half the work is done with the PLL circuit - it can be used as a detector.