 Hi. My name's Derek Kozell and I'm going to be talking about math, physics and SDR. I apologize for the lack of math in this, but I will try and compensate using the whiteboard a bit. And thankfully, resources on the Internet cover most of that quite well, and I'll have links at the end in the notes for people who really do want to dive into that. So my main points are going to be talking about noise, DC offset, IQ imbalance, intermodulation distortion, the type of effects that you see that are kind of inevitable as a result of physics when you're dealing with software-defined radio in the real world. A lot of people have this perception when they're coming at this from a communications background, from a math background that a software-defined radio is this magical device which will translate what's in the air into bits with absolutely no effect in the middle, effectively acting as a black box between you and the electromagnetic spectrum. Unfortunately, you crack open this lid of the black box and you end up seeing that there's a lot of effects which contribute to distortion and degrading your signal as you're receiving it. I will focus on the receive side of things, but all of these effects do end up affecting the transmit side as well. They just tend to be a little bit harder to demonstrate. So my background, why should you listen to me at all? I'm an electrical engineer with a background also in software. I work at Edis Research doing the drivers for their SDRs. And very, very recently, as of this week, I'm part of the new radio project leadership and we'll be spinning up and contributing more and more to the code over the next year. And what got me into radio originally was becoming an amateur radio operator and my two call signs are up there. I live in Wales and will be integrating new radio into the amateur radio training programs there, which will be great fun. So starting off, noise. What is noise? It's that annoying floor that you get whenever you're looking at your spectrum. As devices heat up, the electrons within them just bounce around. And this is your base thermal noise. It defines the absolute limit of how small of a signal you can detect. What's interesting is with math you can end up extracting below that, but fundamentally if you're just looking at your spectrum, you're going to end up with this noise floor at the bottom. Additionally, we have all sorts of devices. If you look at a spectrum in this room right now at 2.4 gigahertz, the noise floor is going to be about here and if you don't have a 30 watt amplifier, your signal is going to be down here. We just have so many other devices that are radiating into the spectrum. So that's what's out in the air. However, once you start receiving that signal into your radio, there's a whole bunch of devices in between your antenna port and the ADC, and including the ADC in fact, that are going to contribute noise of their own. And so this is what the noise figure measurement ends up calculating and representing. And I'll throw up a flow graph in a minute that starts demonstrating that. Fundamentally what we see is as the signal passes through these different components, even if it's just a simple attenuator, that attenuator is going to add the thermal noise and it's going to reduce the amplitude of the signal. And so your signal to noise floor ratio is going to reduce. And the noise figure ends up capturing that. So if you had a 3 dB attenuator, your signal to noise ratio is going to drop by 3 dB as you pass through that. So yeah, resistors and attenuators contribute to the noise. What's much more interesting is when you start looking at amplifiers, you think of an amplifier, you've got a low level signal, you've got some noise. You want to pull that up so that you're using, you just have a higher level signal. And one of the reasons why we want to do that is that your ADC may have a minimum detectable level just because of how it's architected. But a lot of the time it's because you have an attenuator way out in a field, you want to amplify the signal before it runs through a bunch of coax. So you stick a great big amplifier on there, you know, 100 dB of gain, and you're like, yeah, no problem, I'm going to have tons of signal. The problem is that that amplifier itself is going to have some internal noise. And so when you look at an amplifier, you'll see 30 dB of gain, a noise figure of 3 dB. What does that actually end up meaning if I have some chalk? Alright, so if we're looking at over-frequency power, you have some input signal somewhere. And then you have the noise floor sitting on top of it. Let's reduce this a bit so I have some room. So say that's your original signal. And then you pass it through an amplifier, and it's going to amplify, you know, by this much. So we're getting, you know, say 10 dB of amplification there. Great. The noise floor, so I'll also try standing on this side so I'm not at least standing in the middle there. The noise floor is also going to be amplified by 10 dB. Simply because the amplifier has no concept of what's the signal and what's your noise. Everything is going to be universally lifted up. But there's also going to be some internal noise which is contributed. Let's say this is a pretty good low-noise amplifier. You get a 1 dB increase there. Now, that's the end effect here. So your SNR has been reduced by 1 dB. And that's what the noise figure ends up representing. How do you measure this? You can get calibrated noise sources. And these plug into your device, and they will, when turned on, add a specific amount of noise to your signal. So you can get them, the standard ones are 6 and 15 dB of excessive noise ratio. And that's basically saying if you plug this in and turn it on, it will raise your, it will contribute that much noise power to your signal. That won't necessarily raise the noise floor by that much, but it'll contribute that much power above thermal noise to it. And so the end result, and I'll switch whiteboards just so you each, both sides get equally bad math here. You can do a y-factor test. And that ends up just being a ratio of the power with the noise, the noise source turned on versus the noise source turned off. And because we're expecting to be a positive value, the larger value, or greater than one value, it'll be, you know, P with it on over P with it off. And depending on, and the reason why you would select a lower or higher excessive noise ratio is that the uncertainty of your measurement generally increases with the higher ENR sources. So you want to pick basically as low as possible. Now the limit is that you can't measure a noise figure that's more than about 1.2, 1.5 times your ENR. So if you have a very low noise amplifier, you pick the 6 dB, nice results. If you use the 15 dB, you'll just get a little bit of a less accurate result. They make specialized ones if, for some reason, your device has like a 40 dB noise figure. But that tends not to be designed. Now if you're using an SDR, an important thing to realize is that when they say, oh, we've got a fantastic noise figure of like 2 dB at your frequency of interest, that's going to be with the maximum gain turned on. For every dB of gain that you decrease from there, you're going to raise your noise figure. And it's not always by 1 dB. So this means that you have an interesting opportunity to optimize your signal-to-noise ratio. If you have a very strong signal, you can turn down your gain a bit and still get a good noise figure. But you're generally going to want to end up asking the manufacturer if they have these plots or generate them yourself using a noise figure setup. I was hoping to be able to show a flow graph that was actually running that was measuring this live. Unfortunately, I didn't get that development done and working. But on the GNU Radio mailing list just in the last two days, somebody posted up that they had actually gotten a full working setup and were using it within their company. So I've sent them an email asking if they plan on releasing it. If not, then I do have a half working setup and we'll be posting that up on the mailing list and hopefully getting it up on GitHub and sharing it in the next month or so. So here's where I believe I have a flow graph. So this flow graph is quite simple and it's going to be a very similar flow graph for each of the other distortions that I show. We just have a basic signal source and interestingly this doesn't have an infinite signal to noise ratio because of the limited precision of a floating point number. I had a flow graph that does show that but it ended up not showing what I was expecting. So to not lie to you, I'm not going to present that one. And then I've added in noise here because every real world signal is going to have some noise. This noise level I believe is about negative 150 dB so you're getting an exceptionally good dynamic range but at least it looks like a real world signal. Adding them together and putting it through a throttle because I don't have any hardware in line. Just out of interest, who here has never used GNU radio? Okay, a few people. So GNU radio. This is a flow graph and it basically does what it looks like. The signal is passing in the direction that the arrows go. So we've added these two signals together. The throttle just prevents it from running at an infinite sample rate. So we're limiting to one mega sample per second complex which is what the blue is representing so we're going to end up with a complex signal here. So here I have a frequency sync. We're going to see an FFT plot. It has two inputs and we're doing 4096 bins. The original signal with just a little bit of noise is passing directly through on the top and on the bottom I'm multiplying in order to simulate an amplifier's gain and then contributing noise afterwards to simulate the noise figure. So here we can see the original plot and the impaired plot. The signals on the top, if I can zoom in well enough, we see there's about a 10 dB gain occurring here and we can see that the noise floor has risen as well and if the noise floor is zero we would expect this to be about a 10 dB difference, turn up the averaging and we see about 10 dB. I turn down the averaging a bit. So if we increase the noise figure by a lot or none, apologies, there's an error in my flow graph. We would expect this noise floor to rise excessively. Unfortunately that's not working. I've got 10 minutes so I'll move on. So you can use the y-factor method and measure the noise floor into there and in order to convert between E and R, the photo didn't show up. This is the final equation to take the y-factor and the E and R of your source and get out a noise figure in dB. What's interesting is that because you're amplifying the noise floor and the signal and you're only contributing hopefully less noise than your amplification, any further gain stage that you add will have a lower impact on the noise figure. So if you have a large signal chain you do want to add a lot of gain. You can have a very low noise amplifier at the beginning and then a higher noise figure amplifier later on and that high noise figure amplifier will have less of an impact on your total system noise. DC offset. This is another very common occurrence. If you've ever thrown up like an RTL-SDR and looked at a spectrum, you see a spur right in the middle. That's almost certainly a DC offset. There's a small imperfection in the system that's adding DC right before the ADC. This ends up being a spur at the zero-hurt spin unsurprisingly because it's DC, but it's annoying and it's a spurious signal that's not actually there in the air because it can't broadcast DC very effectively. Which we see here. So GNU Radio has a built-in block called the DC blocker for removing this and I'll show what that looks like in a flow graph. So here's just a signal with DC offset and we see the spur appearing in the middle. So this is independent of our input frequency. If I turn down the averaging a bit. And the DC offset, you can see, really doesn't need to be very large. The input signal is plus minus one. So we're adding only, you know, one ten-thousandth of a, you know, of a volt or a unit compared to it. And we're still seeing a spur that's rising nearly a hundred or nearly 80 dB above the noise floor. So it doesn't take much to end up as a very strong signal which is part of the magic. And so all of that was just adding in a constant that's controlled by that range slider that I had there. So if we put the DC blocker in. So here we see the original signal, some noise and DC being added in and then with and without the DC blocker. And this was the default settings. I just threw it into the signal and we'll see it running. So let's look at the original impaired signal. We have the DC spur here and our tone of interest sitting on the side. And if we look at the corrected signal and zoom in, we can see what this is acting as is a low pass filter on the eye and cue. So we end up with a notch filter centered right around the middle. If I turn back on the impaired, we can see that it's, we're getting a nice reduction here of what? 88 to native 120th. We're getting 30 dB of rejection or so there. And it notches out from a fairly narrow range. But what if our signal of interest actually ranges into that spectrum there? We can see that the corrected signal turned down the averaging. We can see that the corrected signal is starting to lose amplitude compared to the original input signal. It's a notch filter. It doesn't care what it is. So do we have a better option? We do have a better option. And that's actually to do a digital shift on the signal. So receive at an IF frequency and then do a shift. So if we receive our signal of interest on the side, and this requires that your signal of interest is less than half of the bandwidth because we're going to receive it like in this block. Shift up, do the filtering and then shift back down to the middle. So I've done a very excessive filter here so that we can clearly see it. In this shifted signal, we've shifted up by, I believe, 200 kilohertz. Sorry, the frequency isn't showing there. Shifted up by 200 kilohertz and we've completely removed the DC component. Some radios have the ability to do this in hardware where they have an FPGA that can actually do the digital shift. So you don't have to transport twice the amount of bandwidth that you need back to your host and process it. And then after we've shifted it, we can shift it back down to the original frequency. And so if I shift this down to DC, we see that the impaired signal is right at the middle. By shifting it up and then removing here, we've removed the DC that was added by the DC and then correcting it back, we get the original signal at the same amplitude without any distortion. So you can see they're completely overlaid. And in the flow graph, what that looks like is all of this would be actually done in hardware. This is the only part that we would end up doing in processing. You would have a high-pass filter removing that, which is basically what was happening before. But the local oscillator would have been tuned like 100 kilohertz away from your signal of interest. And everything's just being plotted at the bottom. And all of these flow graphs will be posted up along with the slides. So the final one I think I have time for is offset tuning. This is what I just described. Shift the signal away from DC, DC being your baseband frequency. Filter out the DC and shift it back. Some radios can do it in the FPGA. IQ and balance, we saw what happens when a DC is added. What happens if there's a little bit more gain on the I or Q size side? You get a mirroring of the spectrum. Let's run this. And out of interest, the new radio does have an IQ and balance generator. So I didn't have to construct that. There's an entire library of hardware impairment blocks. But if we look at the original signal, this is what we should be receiving. And if you have that imbalance and you're not correcting for it, then you get a mirror image across the center frequency. So if I change the input frequency, we see it move in and out. And there is a block available for correcting this. But unfortunately, I wasn't able to get it to compile on my laptop. And I've sent it out to the original author asking for a bit of help there. An interesting point, which I think is going to have to be my last point, unfortunately, is that if you're looking at this in the time domain, the actual amplitude and balance required to generate a large signal, again, is extremely small. The reference is at 1, and the impaired is only 0.003 above or so. And that's generating, again, like a 60 dB above noise floor impairment. So this isn't something that you'll see in the time domain, really. You have to be plotting it in the frequency domain to have the effect be visible. And if you were doing a spectrum analyzer application, this would be quite the problem. Am I out of time? I'll just throw this up. This is what it looks like when you have a nonlinear amplifier and you put two tones in. You get the sum and difference frequencies of the two tones as they're multiplied and then multiply with themselves. And unfortunately, this is something that really needs to be corrected in hardware. But it is something to be aware of. And as these fundamental input tones rise, these will actually rise three times faster. So getting as low of an intermodulation distortion figure on your receiver ends up being quite important if you have strong signals. Sorry, that was quite rushed. If there's, I guess, one question, we can start handing off to the next speaker. If you had just simple one tone ones, the math is pretty straightforward. If you had a wider baseband complex signal, the math becomes very difficult. So if you go into a block that's not totally trivial, go into advanced comment, that will appear beneath the block.