Software Defined Radio - how does it work? Part 1
Hi, Habr.
Continuing the series of articles about radio, it makes sense to talk about the latest achievements in this area - Software Defined Radio. I do not know an adequate translation of the term into Russian, so let’s leave it like that, and the term SDR has already taken root in technical and amateur circles.
Over the past 100 years, the radio has changed so much that it is unlikely that the then engineer would have understood how it works.

We still try to figure it out.
The software defined radio idea is based on two pillars:
As suggested in the comments, the SDR, in principle, can work autonomously, without a PC, if all the “math” is done right in the device. However, it is rather exotic, so we will consider the receivers "ordinary". Although recently, new models of receivers and transceivers began to be made on the principle of SDR, which of course is good.
It’s quite difficult to tell the exact date when the first SDR receivers were on sale. The very idea of digitizing radio signals with a sound card existed for a long time - for example, RTTY or paging messages were decoded, but there were no suitable algorithms to combine all this together.
The first version of Winrad dates from 2007, and it looked something like this (you can pay attention to system requirements :)

As you can see, the interface is very minimalistic, but the program already knew how to play AM, FM, USB and LSB, and show the signal spectrum. Compared to the bandwidth of the usual headphone output of any receiver, it was ... well, almost a breakthrough. Of course, in prof. panoramic consoles existed in the systems before, but it was practically inaccessible to mere mortals, and everyone has a sound card in a PC.
A typical budget solution for amateur radio enthusiasts was Softrock receivers - single-band receivers, switchable quartz content, a mixer and sound card output.

Of course, this was only the beginning. Tunable frequency receivers appeared, and in just 2 years Winrad has noticeably evolved, and in 2010 it already looked like this:

Professional solutions began to appear, then in 2010 the Perseus SDR appeared - a receiver with a 14-bit DDC ADC, a frequency range of 10KHz-30MHz and a bandwidth of 1.6MHz (in principle, the parameters are quite sufficient for today).
The receiver price was 825 Euro, which was not so small for those years.

By the way, the page http://microtelecom.it/perseus/ still exists, and screenshots for XP also hang on it, although the receiver is sold or not, it is not clear.
The beginning was made, then, as they say, it’s a matter of technology - different models began to appear, chips began to become cheaper, and so on. The next breakthrough in amateur technology was the appearance of the receiver on the rtl-sdr chip. Message from the 2012 radioscanner forumyou can quote verbatim, as they say, not diminish, not add:
It turned out that DVB dongles based on the Realtek RTL2832U chip, sometimes advertised also as supporting FM, DAB (+), are capable of transmitting 8-bit quadrature streams to a computer with a sampling frequency of about 3- x MSPS.
The accepted range is limited to the tuner used in a particular dongle model, for example, the Elonics E4000 from 64 to 1700 MHz. This tuner is also used in the FunCube dongle, but with an optional LNA.
A project is based on this . TETRA (~ 430 MHz) and satellite signals of Turaia (~ 1550 MHz) have already been successfully received, which is very, very good for 8-bit quadrature.
In general, as it turned out, cheap USB-TV receivers priced at $ 10-20 after replacing the driver can give an IQ stream, which allows you to use them with existing SDR software. The receivers themselves looked like this:

The first 1-2 years of rtl-sdr's sense was pretty small - there simply wasn’t any interesting software for them. Then came SDR #, various plugins, a community of enthusiasts began to grow, and now rtl-sdr is probably the most popular (primarily due to price) SDR receiver. Modern versions of RTL SDR V3 can already accept HF (albeit with a small sensitivity and dynamics), but at a price of $ 30 and this is very good. How RTL SDR works on HF, you can watch the video .
Existing SDRs can be divided into 3 types:
- Already outdated models based on a sound card - the signal is digitized in them on a PC, and the signal is transmitted to the line input via an audio cable. Now they have long been discontinued, but can sometimes appear at a flea market. To take, by and large, it makes no sense, unless they give it away for free - the price of a good sound card will exceed the price of the SDR itself. Those interested in “digital archeology” can read messages on cqham for 2010 about choosing a sound card for SDR.
- SDRs with built-in ADCs and transmitting signals to a PC in digital format. These are the majority of modern mid-range devices. They are built on the principle of heterodyne reception, only after transferring the frequency, the ADC stands in place of the LF block. Such receivers have a bandwidth of 2 to 10 MHz, there are different models for different frequencies and ranges (rtl sdr, SDRPlay, Airspy). The disadvantage of any superheterodyne receiver is the presence of mirrored reception channels - since the filters are not ideal, stations are received where they really are not. Even if the filters are more or less good, the signals of powerful stations can still “creep through” and play in the form of interference.
- DDC (direct down conversion) SDR. This is the most advanced technology to date. The bottom line is that a local oscillator is not needed here - an ultrafast ADC with a sampling frequency of the order of 100 million samples / s digitizes the input signal directly from the ether, which allows (according to the Kotelnikov / Shannon theorem) to receive up to a frequency equal to half the sampling frequency, i.e. in our example, up to 50 MHz. Those who wish can figure it out on their own - of course, it is not transmitted to a computer, but processed in a high-speed FPGA directly on the board, and the desired band (usually up to 6 MHz) is transmitted to the computer. Such a receiver does not have mirror channels, and everything is fine in it (except for the price :).

The upper limit of the frequency of DDC receivers is usually limited to 30-50 MHz, because either there are no faster ADCs on sale, or they cost space money (by the way, ultrafast ADCs seem to fall into US restrictions on the supply of high-tech electronic components to third world countries, but this is not accurate). Their most top-notch, that it was possible to see in the price lists - Flex 6600 with 16bit 245.76Msps ADC costs about 4000 $, i.e. they can be received in DDC mode up to a frequency of 122 MHz. It is unlikely that we will soon see DDC receivers up to gigahertz, although we would like to. Is there something faster, for example for a military - probably there is someone who knows, write in the comments.
Another important parameter is the type of connection.. Most SDRs are connected via USB, but there are models with a LAN port (Afedri, Colibri):

It can be convenient for organizing remote reception or transmission - the receiver or transceiver can be placed in the country / village and used from the city. KiwiSDR even makes ready-made devices that you can access directly through the web-based interface. Owners of KiwiSDR can even “share” their receiver with others, you can see a list of available devices at https://sdr.hu .
The last, but no less important parameter is the ADC capacity. Cheap RTL SDRs have only 8bit ADCs, and this is not enough, the receiver is easily overloaded with strong signals, an attenuator and a preselector are extremely desirable for it. SDRPlay have a 12-bit ADC, more expensive models have 14-bit, which is enough for most cases. Top-end are 16-bit ADCs, and in principle, not every antenna is capable of delivering a range of signals that can overload such a receiver.
And finally, about the prices. Their range varies greatly, from $ 30 for RTL SDR v3, $ 150 for SDRPlay RSP2 to $ 600 for ELAD FDM-S2. SDR transceivers (capable of working not only on reception but also on transmission) are more expensive, SunSDR2 costs about $ 1,500, FLEX-6400 costs $ 2,000.
We should also mention boards for digital signal processing. This is for example, HackRF, LimeSDR, USRP, Red Pitaya. These devices were originally intended for experiments with radio signals within the “desktop”, and were simply not designed for long-distance reception - there is often simply no amplifier or attenuator or filters in the circuit. They will catch something, but it’s very bad, or they will need a “file completion”. They can also work on transmission, but with a capacity of about 100mW (where “m” is milli and not mega;), and often there is simply no software other than a pair of DLLs and SDKs for them.
About why all this is needed, the advantages and disadvantages of SDR, and how to get data from SDR using Python, will be discussed in the second part.
Continuing the series of articles about radio, it makes sense to talk about the latest achievements in this area - Software Defined Radio. I do not know an adequate translation of the term into Russian, so let’s leave it like that, and the term SDR has already taken root in technical and amateur circles.
Over the past 100 years, the radio has changed so much that it is unlikely that the then engineer would have understood how it works.

We still try to figure it out.
History
The software defined radio idea is based on two pillars:
- Broadband transmission from a radio to a computer. The width of the processed band can be from 48KHz (PC sound card) to 50MHz (ultrafast ADC with signal transmission via Gigabit Ethernet or USB3.0).
- Signal demodulation - all that a "normal" radio receiver (AM, FM, filters, etc.) does in hardware - in SDR it is done on a computer using mathematical algorithms. The radio itself, of course, is still needed, but only its “half” is the part that actually receives the radio signal.
As suggested in the comments, the SDR, in principle, can work autonomously, without a PC, if all the “math” is done right in the device. However, it is rather exotic, so we will consider the receivers "ordinary". Although recently, new models of receivers and transceivers began to be made on the principle of SDR, which of course is good.
It’s quite difficult to tell the exact date when the first SDR receivers were on sale. The very idea of digitizing radio signals with a sound card existed for a long time - for example, RTTY or paging messages were decoded, but there were no suitable algorithms to combine all this together.
The first version of Winrad dates from 2007, and it looked something like this (you can pay attention to system requirements :)

As you can see, the interface is very minimalistic, but the program already knew how to play AM, FM, USB and LSB, and show the signal spectrum. Compared to the bandwidth of the usual headphone output of any receiver, it was ... well, almost a breakthrough. Of course, in prof. panoramic consoles existed in the systems before, but it was practically inaccessible to mere mortals, and everyone has a sound card in a PC.
A typical budget solution for amateur radio enthusiasts was Softrock receivers - single-band receivers, switchable quartz content, a mixer and sound card output.

Of course, this was only the beginning. Tunable frequency receivers appeared, and in just 2 years Winrad has noticeably evolved, and in 2010 it already looked like this:

Professional solutions began to appear, then in 2010 the Perseus SDR appeared - a receiver with a 14-bit DDC ADC, a frequency range of 10KHz-30MHz and a bandwidth of 1.6MHz (in principle, the parameters are quite sufficient for today).
The receiver price was 825 Euro, which was not so small for those years.

By the way, the page http://microtelecom.it/perseus/ still exists, and screenshots for XP also hang on it, although the receiver is sold or not, it is not clear.
The beginning was made, then, as they say, it’s a matter of technology - different models began to appear, chips began to become cheaper, and so on. The next breakthrough in amateur technology was the appearance of the receiver on the rtl-sdr chip. Message from the 2012 radioscanner forumyou can quote verbatim, as they say, not diminish, not add:
It turned out that DVB dongles based on the Realtek RTL2832U chip, sometimes advertised also as supporting FM, DAB (+), are capable of transmitting 8-bit quadrature streams to a computer with a sampling frequency of about 3- x MSPS.
The accepted range is limited to the tuner used in a particular dongle model, for example, the Elonics E4000 from 64 to 1700 MHz. This tuner is also used in the FunCube dongle, but with an optional LNA.
A project is based on this . TETRA (~ 430 MHz) and satellite signals of Turaia (~ 1550 MHz) have already been successfully received, which is very, very good for 8-bit quadrature.
In general, as it turned out, cheap USB-TV receivers priced at $ 10-20 after replacing the driver can give an IQ stream, which allows you to use them with existing SDR software. The receivers themselves looked like this:

The first 1-2 years of rtl-sdr's sense was pretty small - there simply wasn’t any interesting software for them. Then came SDR #, various plugins, a community of enthusiasts began to grow, and now rtl-sdr is probably the most popular (primarily due to price) SDR receiver. Modern versions of RTL SDR V3 can already accept HF (albeit with a small sensitivity and dynamics), but at a price of $ 30 and this is very good. How RTL SDR works on HF, you can watch the video .
Types of SDR
Existing SDRs can be divided into 3 types:
- Already outdated models based on a sound card - the signal is digitized in them on a PC, and the signal is transmitted to the line input via an audio cable. Now they have long been discontinued, but can sometimes appear at a flea market. To take, by and large, it makes no sense, unless they give it away for free - the price of a good sound card will exceed the price of the SDR itself. Those interested in “digital archeology” can read messages on cqham for 2010 about choosing a sound card for SDR.
- SDRs with built-in ADCs and transmitting signals to a PC in digital format. These are the majority of modern mid-range devices. They are built on the principle of heterodyne reception, only after transferring the frequency, the ADC stands in place of the LF block. Such receivers have a bandwidth of 2 to 10 MHz, there are different models for different frequencies and ranges (rtl sdr, SDRPlay, Airspy). The disadvantage of any superheterodyne receiver is the presence of mirrored reception channels - since the filters are not ideal, stations are received where they really are not. Even if the filters are more or less good, the signals of powerful stations can still “creep through” and play in the form of interference.
- DDC (direct down conversion) SDR. This is the most advanced technology to date. The bottom line is that a local oscillator is not needed here - an ultrafast ADC with a sampling frequency of the order of 100 million samples / s digitizes the input signal directly from the ether, which allows (according to the Kotelnikov / Shannon theorem) to receive up to a frequency equal to half the sampling frequency, i.e. in our example, up to 50 MHz. Those who wish can figure it out on their own - of course, it is not transmitted to a computer, but processed in a high-speed FPGA directly on the board, and the desired band (usually up to 6 MHz) is transmitted to the computer. Such a receiver does not have mirror channels, and everything is fine in it (except for the price :).

The upper limit of the frequency of DDC receivers is usually limited to 30-50 MHz, because either there are no faster ADCs on sale, or they cost space money (by the way, ultrafast ADCs seem to fall into US restrictions on the supply of high-tech electronic components to third world countries, but this is not accurate). Their most top-notch, that it was possible to see in the price lists - Flex 6600 with 16bit 245.76Msps ADC costs about 4000 $, i.e. they can be received in DDC mode up to a frequency of 122 MHz. It is unlikely that we will soon see DDC receivers up to gigahertz, although we would like to. Is there something faster, for example for a military - probably there is someone who knows, write in the comments.
Another important parameter is the type of connection.. Most SDRs are connected via USB, but there are models with a LAN port (Afedri, Colibri):

It can be convenient for organizing remote reception or transmission - the receiver or transceiver can be placed in the country / village and used from the city. KiwiSDR even makes ready-made devices that you can access directly through the web-based interface. Owners of KiwiSDR can even “share” their receiver with others, you can see a list of available devices at https://sdr.hu .
The last, but no less important parameter is the ADC capacity. Cheap RTL SDRs have only 8bit ADCs, and this is not enough, the receiver is easily overloaded with strong signals, an attenuator and a preselector are extremely desirable for it. SDRPlay have a 12-bit ADC, more expensive models have 14-bit, which is enough for most cases. Top-end are 16-bit ADCs, and in principle, not every antenna is capable of delivering a range of signals that can overload such a receiver.
And finally, about the prices. Their range varies greatly, from $ 30 for RTL SDR v3, $ 150 for SDRPlay RSP2 to $ 600 for ELAD FDM-S2. SDR transceivers (capable of working not only on reception but also on transmission) are more expensive, SunSDR2 costs about $ 1,500, FLEX-6400 costs $ 2,000.
We should also mention boards for digital signal processing. This is for example, HackRF, LimeSDR, USRP, Red Pitaya. These devices were originally intended for experiments with radio signals within the “desktop”, and were simply not designed for long-distance reception - there is often simply no amplifier or attenuator or filters in the circuit. They will catch something, but it’s very bad, or they will need a “file completion”. They can also work on transmission, but with a capacity of about 100mW (where “m” is milli and not mega;), and often there is simply no software other than a pair of DLLs and SDKs for them.
About why all this is needed, the advantages and disadvantages of SDR, and how to get data from SDR using Python, will be discussed in the second part.