Using your Soundcard as a Software-defined Radio

Getting hands-on experience on wireless communications

Do you always wonder how you can apply the things you learned in lectures in real-world experiments?

Are you bored of just simulating things without real-world applications?

Have you ever wondered, how wireless communications really work, despite all the simulations and math?

Use a cheap soundcard as a low-cost software-defined radio!

With a soundcard, a speaker and a microphone you have all the things necessary for a wireless transmission system:

  • The speaker mimics the transmit antenna.
  • The soundcard performs analog/digital conversion and sampling.
  • The microphone equals the receive antenna.
 

Using your soundcard to study wireless communications has several advantages:

  • Soundcards are cheap, you can get a simple USB card for below 10 bucks.
  • With an audio sampling rate of 44.1kHz, the amount of data is small enough to be processed on a normal PC without the need for powerful FPGA or other resources.
  • As the transmit signal is actual sound, you can literally hear the signal you transmit, which makes the experiment much more accessible.
  • Python offers superb support for sound streaming from and to the soundcard, so that you can focus on the signal processing. For example, playing a pure tone is as simple as
import sounddevice as sd
import numpy as np
t = np.arange(0,2,1/44100)
sd.play(np.sin(2*np.pi*440*t), 44100)

Despite virtually every PC having a built-in soundcard, I recommend to use a dedicated soundcard for your experiments. In case the soundcard gets damaged by e.g. overvoltage, you would not destroy your whole PC but just the cheap soundcard. In addition, you can use your builtin soundcard to play music while you program.

The soundcard

The experiments shown on this site are done using a simple and cheap Sabrent USB sound card from Amazon which is completely sufficient for the used purpose.

The Speaker

There are no strong requirements on the speakers used for playing the signal. You can virtually use any speaker you have available. The experiments on this site were carried out using these simple speakers from Amazon.

The Microphone

As for the microphone again there are not high requirements. As an example, I have carried out the experiments using this simple NAVISKAUTO microphone from Amazon.

Loopback Cable

Even though it's nice to hear your signal fly through the air, it can quickly become quite annoying. For this case, one can use a loopback cable which directly connects the audio output with the microphone input. For example, I used this standard cable from Amazon to connect output and input.

The Course on DSPIllustrations

On dspillustrations.com I offer a complete walkthrough of establishing a wireless link between the audio output and audio input of a USB soundcard. Within 10 parts, the following aspects are covered:

  • baseband transmission of real-valued signals
  • passband transmission including up- and downconversion
  • modeling the audio channel as an LTI system for reproducable simulations
  • eye diagram drawing
  • symbol timing recovery
  • channel coding
  • definition and implementation of a frame structure, including header, payload and checksum
  • integration of the wireless transmission into a UDP data stream

Download the first 3 parts for free

Buy the full course for

Do you have questions or comments? Let's dicuss below!


DSPIllustrations.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to amazon.com, amazon.de, amazon.co.uk, amazon.it.