Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Software decoding of FSK modulated signal

948 views
Skip to first unread message

Daniel Ayers

unread,
Sep 17, 1996, 3:00:00 AM9/17/96
to

Hello Everyone,

I am developing a program to decode FSK modulated signals using a
SoundBlaster soundcard. The plan is to digitize the signal from the
radio's audio output and then analyse it in software to produce binary
data for further analysis.

I pretty much know how FSK works (this is not AFSK), I have hooked the
radio up and digitised some test samples.

My question is: What are the best techniques for decoding the FSK signal
into a binary stream?

I have seen this done using a data slicer circuit based on a 741 IC,
some resistors and capacitors ... however I want to do it entirely in
software using a soundcard.

I know it can be done, as I have a program that receives HF FAX
transmissions via a soundcard. I have obtained a suitably fast PC for
this application, so the analysis can be performed in real time.

My best guess at this stage is that once you have worked out how to
divide the signal into bits (ie. time quantums depending on the baud
rate) you need to work out how many cycles occurred in that period -
which of course gives you the frequency.

Does anyone have any experience doing this? Any sample code or other
technical information?

I'd appreciate any pointers.

Regards,
Daniel.
dan...@securicor.co.nz

Peter Onion

unread,
Sep 17, 1996, 3:00:00 AM9/17/96
to

Daniel Ayers (dan...@securicor.co.nz) wrote:
: Hello Everyone,

:
: I am developing a program to decode FSK modulated signals using a
: SoundBlaster soundcard. The plan is to digitize the signal from the
: radio's audio output and then analyse it in software to produce binary
: data for further analysis.
[SNIP]:
: My best guess at this stage is that once you have worked out how to

: divide the signal into bits (ie. time quantums depending on the baud
: rate) you need to work out how many cycles occurred in that period -
: which of course gives you the frequency.
:
: Does anyone have any experience doing this? Any sample code or other
: technical information?
:

Easy way is to look for zero-crossings. Either work out how many in a
period of time , or time between crossings to get frequency. These
may not perform well on weak/noisy signals in the presence of other
interfering signals.

Harder ways include writting digital bandpass filter code or transform
code (Fast Fourier Transform is fun to play with!) which should
perform better in the presence of interference.

Note I'm no expert in this field, just played a bit with a Gravis
Ultrasound sound card and the Fast Fourier Transform to decode MSF
time signals on 60Khz (which is a bit of over kill, but it was
interesting).

Peter Onion G0DZB
pon...@srd.bt.co.uk


Message has been deleted

Dr Pepper

unread,
Sep 17, 1996, 3:00:00 AM9/17/96
to

Daniel Ayers <dan...@securicor.co.nz> wrote:

>Hello Everyone,

>I am developing a program to decode FSK modulated signals using a
>SoundBlaster soundcard. The plan is to digitize the signal from the
>radio's audio output and then analyse it in software to produce binary
>data for further analysis.

snippy dee deeee

>I'd appreciate any pointers.

>Regards,
>Daniel.
>dan...@securicor.co.nz

I'm curious, Daniel, , , , Why are you trying to reinvent the wheel?
If it is just an excercise in design and building, I can understand
it. There is, however, software and hardware on the market that does
just what you are trying to do. Try the "Personal Code Explorer" and
it's software. I think that it may be what you want.
This isn't a shot, just curious, , , :-}

Dr Pepper
10 - 2 - 4

Matthew Francey

unread,
Sep 18, 1996, 3:00:00 AM9/18/96
to

pon...@srd.bt.co.uk (Peter Onion) writes:

>Daniel Ayers (dan...@securicor.co.nz) wrote:
>: Hello Everyone,
>:
>: I am developing a program to decode FSK modulated signals using a

>: SoundBlaster soundcard. [...]


>[SNIP]:
>: My best guess at this stage is that once you have worked out how to
>: divide the signal into bits (ie. time quantums depending on the baud
>: rate) you need to work out how many cycles occurred in that period -
>: which of course gives you the frequency.
>:

>Easy way is to look for zero-crossings. Either work out how many in a


>period of time , or time between crossings to get frequency. These
>may not perform well on weak/noisy signals in the presence of other
>interfering signals.

This will likely fall apart badly in the presence of even trivial amounts
of noise. And if you managed to make it work, it probably wouldn't be
very simple either...

>Harder ways include writting digital bandpass filter code or transform
>code (Fast Fourier Transform is fun to play with!) which should
>perform better in the presence of interference.

What follows isn't likely to be optimal, but it is simple:

Rather than a full-blown FFT, you could simply do one slot centered
on the frequency Fmid = (f0+f1)/2 where f0 and f1 are the tone frequencies.

So you'll have two tables:

S is a sin(-2.0*M_PI*Fmid*Ts*i) for i=0 to N-1 samples
C is a cos(-2.0*M_PI*Fmid*Ts*i) for i=0 to N-1 samples

where Ts is your sample interval, and how N is chosen is left as an exercise.
Note that as indexes increase, you are going back in time (ie, to earlier
samples).

As each sample comes in, you add it to a table X of the last N values
taken. Compute s and c:

s = S.X, ie, S[0]*X[0] + S[1]*X[1] + ... S[N-1]*X[N-1]
c = C.X, (ditto)

ie, your basic FIR computation.

Then with s and c in hand, compute:

phase = atan2(s, c)

This quantity alone is not important. It is how it *changes* that is the
key. For example, if f1 is being received, and is the higher frequency,
then as successive values of 'phase' are computed, it will "increase"
(the expected value is (f1 - Fmid)*Ts*2.0*M_PI radians per sample). If
'f0' is being received, then 'phase' will "decrease".

You probably get the idea: keep track of the last 'phase' computed,
compare to the current. Call the difference dphase. Subject this to
some weak smoothing -- a simple exponential filter will likely do --
and should the smoothed 'dphase' be above some value, you can decide
you are receiving a "1", below some othe value a "0".

Actually, you'll likely want to use a better algorithm than that (indeed,
if you are a FEC kind of guy, simply *don't* decide what the value is --
pass up the probability, a "soft decision" as it is called, to the FEC
decoder to deal with). And I haven't addressed the issue of deciding where
the data edges are -- what the cognescenti call "clock synchronization" --
but all this is what books are for.
--
Matthew Francey | VE3RQX | NAD27: N43o40.663' W079o18.519' +0130m

Peter Onion

unread,
Sep 18, 1996, 3:00:00 AM9/18/96
to

Rob Janssen (r...@pe1chl.ampr.org) wrote:

: In <323E1D...@securicor.co.nz> Daniel Ayers <dan...@securicor.co.nz> writes:
:
: >I am developing a program to decode FSK modulated signals using a
: >SoundBlaster soundcard. The plan is to digitize the signal from the

: >radio's audio output and then analyse it in software to produce binary
: >data for further analysis.
:
: I'm afraid you haven't quite understood how FSK works... in combination
: with an FM transceiver.

Hmmm, we are working a bit in the dark here. I (in my reply) had
assumed he (Daniel) was talking about RTTY type FSK and SSB Rx for
lowish data rates. You (Rob) are assuming Packet type signals.

So Daniel, give us some more clues, what is the desired
application/modes/Rx type/data rates......

Peter Onion.
G0DZB
pon...@srd.bt.co.uk


Peter Onion

unread,
Sep 18, 1996, 3:00:00 AM9/18/96
to

Matthew Francey (m...@vigard.mef.org) wrote:

: pon...@srd.bt.co.uk (Peter Onion) writes:
:
: >Daniel Ayers (dan...@securicor.co.nz) wrote:
: >: Hello Everyone,
: >:
: >: I am developing a program to decode FSK modulated signals using a
: >: SoundBlaster soundcard. [...]
: >[SNIP]:

I said....
:
: >Easy way is to look for zero-crossings. Either work out how many in a


: >period of time , or time between crossings to get frequency. These
: >may not perform well on weak/noisy signals in the presence of other
: >interfering signals.
:
: This will likely fall apart badly in the presence of even trivial amounts
: of noise. And if you managed to make it work, it probably wouldn't be
: very simple either...

:

But I believe this is the way that the packages which use trivial 1
bit interfaces work (and work they do), but as we agree they prob fall
over in the presence of "any" noise.....


: What follows isn't likely to be optimal, but it is simple:

[SNIPed an interesting idea...]

Matthew, I'll give you're ideas a try and see how it works.


I have been playing with full-blown FFTs and getting very good results on
low speed data. It's fun to tune a SSB Rx to some aviation beacons
that send very slow CW idents, and look at the spectrum. A single
frequency for the carrier, and to single tone side-bands as the id is
keyed :-) Proof the sidebands are real :-)

Peter Onion G0DZB
pon...@srd.bt.co.uk


Daniel Ayers

unread,
Sep 18, 1996, 3:00:00 AM9/18/96
to

: So Daniel, give us some more clues, what is the desired
: application/modes/Rx type/data rates......

My main interest right now is in the data tones used by local emergency
services, with secondary interests in FAX/RTTY/CW/etc.

Actually what's happening on the air and in the radio aren't so important,
the issue that I'm looking at is...

given an audio output from a (A)FSK signal - ie. an audio tone of
changing frequency - what is the best way to demodulate that waveform into
frequency-versus-time and then into binary data?

I know about the zero-crossing method, and I can apply that in software.
Are there any better methods?

The data rate won't be high. Our ambulance service puts FSK data over their
voice channel - I believe it's pager traffic, so I'd imagine data rates of
600 or 1200 baud, 2400 at the outside.

I reckon I have it mostly figured out, the next question is how to work out
where the bit boundaries are. ;-)

Daniel.


Daniel Ayers

unread,
Sep 18, 1996, 3:00:00 AM9/18/96
to

Dr Pepper (ches...@ridgecrest.ca.us) wrote:

: I'm curious, Daniel, , , , Why are you trying to reinvent the wheel?

Because I need a square wheel, and everyone else's is round! :-)

Yes, I'm aware of the data slicer circuit, the Universal M400/M1200/etc
and all those other decoders.

What I want to do is multi-channel demodulation/decoding of digital
signals. I want to monitor/analyse/record certain things, like the
tones our fire and ambulance services use, and I'd also like to demodulate
RTTY/FAX/CW (as a secondary interest).

There are two reasons why the various kits and off-the-shelf products are
no use to me. First, they all need one PC per channel (as they invariably
use DOS software). Secondly, I want to do some realtime analysis and have
actions taken (eg. paging me) when certain things occur.

And there's always the cost factor. ;-)

I've set up a fast PC running Linux with (initially) one soundcard. That
system digitises the audio output from the radio (scanner). That's all
working. Once I have done the demodulation step, its then simple to write
software to decode the demodulated data into whatever type of traffic I'm
listening to.

It's not a particularly hard thing to do, I have a fair idea how to do
the demod - I only asked because I knew other people have done this with
a soundcard before and I wanted to know if someone knew a better way.

For the record, at this stage it appears that the "zero crossings" method
(ie. basically a software implementation of the data slicer) is the best
way to go.

Daniel.


James D. Cronin

unread,
Sep 23, 1996, 3:00:00 AM9/23/96
to

In article <51mmig$3...@ash.ridgecrest.ca.us>,

Dr Pepper <ches...@ridgecrest.ca.us> wrote:
>
>just what you are trying to do. Try the "Personal Code Explorer" and
>it's software. I think that it may be what you want.

What is it, where can you get it and what does it cost?

73..Jim N2VNO

Phil Karn

unread,
Sep 27, 1996, 3:00:00 AM9/27/96
to Daniel Ayers

Dan,

There's another interesting way to demodulate FSK, as long as it's
*continuous phase* (no sudden phase jumps between symbols).

See "The Viterbi Algorithm" by G. David Forney, Proceedings of the
IEEE, March 1973, p. 268. This is a tutorial on the Viterbi
algorithm that had been invented six years earlier as a way to
decode convolutional codes, but turns out to have many other uses
as well, such as decoding FSK, dealing with intersymbol interference,
and recognizing text.

Forney claims that Viterbi decoding of phase-continuous FSK that
takes into account the "memory" of the modulator performs 3 dB
better than the best you can do with coherent detection over only
one symbol interval, and as good as coherent detection of
antipodal BPSK.

I believe Dave Mills, W3HCF, has implemented something like this
for the TAPR DSP-93 box.

Phil

John D. Erskine

unread,
Sep 29, 1996, 3:00:00 AM9/29/96
to

Phil Karn (ka...@unix.ka9q.ampr.org) wrote:
: Dan,

: Phil


You might also take a look through the ham news groups for a circuit and
software called HAMCOM(M?). The schematic is included in the
documentation and is pretty easy to assemble. The accompanying software
has a freq specturm display, and decoders for CW, RTTY, AMTOR/SITOR and I
believe PACKET. Quite a few folks around here have built them AND used
them successfully. Have fun. 73, John

John D. Erskine VE6OTC/VE3OTC
ersk...@cuug.ab.ca
jers...@freenet.calgary.ab.ca
ve6...@ve6ipg.ampr.org


Bob

unread,
Oct 1, 1996, 3:00:00 AM10/1/96
to

The accompanying software
>has a freq specturm display, and decoders for CW, RTTY, AMTOR/SITOR
and I
>believe PACKET. Quite a few folks around here have built them AND used
>them successfully.


There's also other software available (all shareware) that will allow
you to decode slow-scan TV and POCSAG (with a scanner).

Gerry Moersdorf

unread,
Oct 2, 1996, 3:00:00 AM10/2/96
to Peter Onion
Peter Onion wrote: > Daniel Ayers (dan...@securicor.co.nz) wrote: > : Hello Everyone, > : I am developing a program to decode FSK modulated signals using a > : SoundBlaster soundcard. The plan is to digitize the signal from the > : radio's audio output and then analyse it in software to produce binary > : data for further analysis. > [SNIP]: Hey this is a great idea, the entire world has a soundcard. im tired of the "box clutter" in my swl site and would love to trash the decoder de' jour from aea. while ur writing the software,, make it for swl'ers ,, that is a dx'er's interface not a ham interface. so it needs hf / vhf frequency storage with point and click interface on win 95,, use win 95 soundblaster drivers, support all modes with one program and selectable interface including cw / fax / amtor / baudo, etc. have a "signal acquisition mode" like AEA that's actually worth a shit. automatic controls on freq shifts baudrate and bit inversion. automatic audio level controls via stock soundblaster interface. hey,, u want my $100 bucks up front? Gerry Moersdorf, President/CEO Applied Innovation INC 5800 Innovation Dr, Dublin OH 800-247-9482

Thomas Sailer

unread,
Oct 3, 1996, 3:00:00 AM10/3/96
to

> vhf frequency storage with point and click interface on win 95,, use win
> 95 soundblaster drivers, support all modes with one program and
Won't work, Win95 soundcard drivers will produce much too much
transition times between receiving and transmitting. You'll need
to write your own soundcard driver to do anything reasonnable
in the modem field...

Tom
--
Thomas (Tom) Sailer EMail: sai...@ife.ee.ethz.ch
Weinbergstrasse 76 Ham Radio: hb9jnx @ hb9w.che.eu
CH-8408 Winterthur Phone: ++41 52 222 32 81

CatDaddy

unread,
Oct 12, 1996, 3:00:00 AM10/12/96
to
Hey, I agree -- good luck with the programming and let us know when it's ready -- I, too, am tired of all these add on boxes and cables!! Michael On Wed, 02 Oct 1996 12:10:28 -0400, Gerry Moersdorf <ge...@aiinet.com> wrote: >Peter Onion wrote: >> Daniel Ayers (dan...@securicor.co.nz) wrote: >> : Hello Everyone, >> : >> : I am developing a program to decode FSK modulated signals using a >> : SoundBlaster soundcard. The plan is to digitize the signal from the >> : radio's audio output and then analyse it in software to produce binary >> : data for further analysis. >> [SNIP]: Hey this is a great idea, the entire world has a soundcard. im tired >of the "box clutter" in my swl site and would love to trash the decoder >de' jour from aea. while ur writing the software,, make it for swl'ers >,, that is a dx'er's interface not a ham interface. so it needs hf / >vhf frequency storage with point and click interface on win 95,, use win >95 soundblaster drivers, support all modes with one program and >selectable interface including cw / fax / amtor / baudo, etc. have a >"signal acquisition mode" like AEA that's actually worth a shit. >automatic controls on freq shifts baudrate and bit inversion. automatic >audio level controls via stock soundblaster interface. hey,, u want my >$100 bucks up front? >-- >Gerry Moersdorf, President/CEO Applied Innovation INC 5800 Innovation Dr, Dublin OH 800-247-9482
0 new messages