1 00:00:00,000 --> 00:00:03,340 For those of you who don't know who this man is, what are you doing in this room? 2 00:00:04,020 --> 00:00:08,320 Seriously, if you have any interest in radio or anything like that, if you don't know who he is, 3 00:00:08,400 --> 00:00:13,960 you need to watch this, enjoy it, and then leave and just get on Google, find all the rest of his talks. 4 00:00:14,400 --> 00:00:22,500 This man has done everything from printing upside-down pictures of people's faces on the waveform that I was trying to decode 5 00:00:22,500 --> 00:00:28,640 through controlling 30-year-old space probes, which I'm not certain, was it launched before or after you were born? 6 00:00:29,180 --> 00:00:35,740 Before. The man is quite impressive. He's taken over things in space that were launched before he was born. 7 00:00:35,880 --> 00:00:41,960 I really don't know what else to say except for listen to everything he has to say, because I need to sit down and do the same. 8 00:00:42,980 --> 00:00:46,720 Thank you muchly for that introduction. Very kind. 9 00:00:47,200 --> 00:00:52,520 So thank you for attending and coming out today. My name is Balint Siva. 10 00:00:53,440 --> 00:00:57,060 I work at Bastille Networks. We're securing the Internet of Things. 11 00:00:57,220 --> 00:00:58,620 And today I'd like to... 12 00:00:58,640 --> 00:01:05,760 I'd like to go on this workshop with you to actually go through and show you some tools and tricks and techniques that you can use 13 00:01:05,760 --> 00:01:12,860 with open-source software, GNU Radio, and software-defined radio hardware to begin to reverse-engineer signals. 14 00:01:13,160 --> 00:01:17,800 So the idea is that you have something out there that you see on your spectrum, something that looks interesting. 15 00:01:17,980 --> 00:01:23,100 It might be coming from a terrestrial source. It might be coming from a satellite. 16 00:01:23,460 --> 00:01:26,700 And you have no idea what it is. There's no information about it. 17 00:01:26,740 --> 00:01:28,460 You can Google around. 18 00:01:28,640 --> 00:01:30,500 But what have you got to search for? What keywords? 19 00:01:30,720 --> 00:01:34,180 So the idea is that you can apply some pretty common little tricks. 20 00:01:34,380 --> 00:01:36,180 I'll show you what they are in GNU Radio. 21 00:01:36,580 --> 00:01:38,520 And you can go out, apply them. 22 00:01:38,580 --> 00:01:43,180 And once you learn a little bit more about the data, the modulation that you're looking at, 23 00:01:43,300 --> 00:01:47,120 then you can go and do some additional research about that on the Internet. 24 00:01:47,600 --> 00:01:53,820 So what I'm going to do today for those people that actually have their SDR set up with GNU Radio is 25 00:01:53,820 --> 00:01:56,620 I have recorded some signals off the air. 26 00:01:58,100 --> 00:02:05,840 And I will... I am actually now rebroadcasting them over the air. 27 00:02:05,940 --> 00:02:11,420 Well, let's just say if I'm being recorded, then I would ideally be transmitting them into a dummy load. 28 00:02:11,600 --> 00:02:14,560 So if you want to record anything, then you should be really, really close. 29 00:02:16,300 --> 00:02:25,640 But let's just say if you wanted to try and see if there was a signal there, I think 622 megahertz looked unoccupied at the moment. 30 00:02:30,260 --> 00:02:31,480 Yeah, something like that. 31 00:02:32,840 --> 00:02:35,580 So just a moment ago, I was running... 32 00:02:35,580 --> 00:02:38,240 So this is... Who's actually heard of or familiar with GNU Radio? 33 00:02:38,500 --> 00:02:39,780 Just a show of hands. All right, everyone. 34 00:02:39,900 --> 00:02:41,600 So everybody's seen GRC. 35 00:02:41,700 --> 00:02:45,460 Does anybody not entirely show what GRC is? 36 00:02:45,800 --> 00:02:50,120 The GNU Radio companion is a graphical user interface that sits on top of the GNU Radio runtime. 37 00:02:50,480 --> 00:02:56,400 And it's used to actually generate the Python code that invokes GNU Radio. 38 00:02:56,620 --> 00:02:59,760 So GNU Radio, all the performance stuff is written in C++ and assembly. 39 00:03:00,020 --> 00:03:04,280 And then you've got Python code that can be used to glue everything together at the application level. 40 00:03:04,440 --> 00:03:10,040 And then you have this GUI also if you want to attempt to run things there. 41 00:03:10,500 --> 00:03:12,400 And what's happened here? 42 00:03:12,520 --> 00:03:15,020 Naturally, the curse of the demo has struck me right away. 43 00:03:15,640 --> 00:03:16,840 Why didn't that work? 44 00:03:22,700 --> 00:03:23,140 Huh. 45 00:03:25,560 --> 00:03:26,000 Amazing. 46 00:03:31,020 --> 00:03:32,200 What happened there? 47 00:03:38,820 --> 00:03:40,480 I haven't been very lucky this week. 48 00:03:41,960 --> 00:03:42,440 Whoa. 49 00:03:46,900 --> 00:03:48,140 All right, never mind. 50 00:03:48,880 --> 00:03:49,660 We'll skip that. 51 00:03:49,680 --> 00:03:50,800 I just wanted to show you the radio spectrum. 52 00:03:51,080 --> 00:03:56,420 But maybe instead I can run... 53 00:04:06,740 --> 00:04:07,780 Communications error. 54 00:04:13,580 --> 00:04:16,560 So I'm just going to bring up the radio spectrum now. 55 00:04:19,060 --> 00:04:19,640 Ah. 56 00:04:20,300 --> 00:04:21,620 I know what's going on. 57 00:04:23,840 --> 00:04:25,300 The problem is... 58 00:04:26,580 --> 00:04:30,820 And this can happen sometimes when you have multiple SDRs connected to the one computer. 59 00:04:31,220 --> 00:04:32,620 You don't know what it's going to pick up. 60 00:04:32,860 --> 00:04:36,640 I actually have a B200 and an N210 connected. 61 00:04:36,800 --> 00:04:41,720 And I think it was trying to use the N210 and failing because it can't quite support the bandwidth. 62 00:04:41,860 --> 00:04:44,820 So let's give that one more go then. 63 00:04:44,920 --> 00:04:45,740 Where's my GNU Radio? 64 00:04:46,780 --> 00:04:47,180 There we are. 65 00:04:55,700 --> 00:04:56,500 There we go. 66 00:04:56,600 --> 00:04:56,880 All right. 67 00:04:57,940 --> 00:05:00,300 So if we go to 622 mega... 68 00:05:01,540 --> 00:05:03,060 Oh, that's sample rate. 69 00:05:03,220 --> 00:05:04,300 Probably can't go that high. 70 00:05:04,600 --> 00:05:09,820 Let's go to 2010 megahertz sample rate. 71 00:05:10,200 --> 00:05:14,480 And if we go to 622 megahertz, 72 00:05:15,420 --> 00:05:18,400 then can you see this central portion in the band there? 73 00:05:20,040 --> 00:05:21,940 There are these interesting signals there. 74 00:05:21,980 --> 00:05:25,280 If we now take it down to 1 megahertz, 75 00:05:25,300 --> 00:05:28,320 you can see we've got this spectrum here, right? 76 00:05:29,220 --> 00:05:30,520 And as it happens, 77 00:05:31,640 --> 00:05:36,400 I have recorded this at some point many years ago now, actually. 78 00:05:36,820 --> 00:05:40,080 And if you want to try and receive this signal, it'll be there. 79 00:05:40,160 --> 00:05:47,340 So I will try to increase the amplitude so that you can get a good clear capture of it. 80 00:05:49,240 --> 00:05:54,700 And this signal, as it turned out, was actually coming down from one of the transponders. 81 00:05:55,300 --> 00:05:58,200 On a satellite in geostationary orbit above Australia. 82 00:05:58,500 --> 00:06:02,580 I had a friend, and he had a dish pointed up at this particular bird. 83 00:06:02,880 --> 00:06:09,240 And the set-top satellite decoder boxes with which you use to watch satellite television 84 00:06:09,860 --> 00:06:13,260 has one of those LNB through ports on the back. 85 00:06:13,460 --> 00:06:16,160 So the dish has a low noise block down converter, 86 00:06:16,300 --> 00:06:20,040 and you get the down converted signal coming out the back of one of these boxes. 87 00:06:20,140 --> 00:06:23,200 And I thought, well, hook a USRP up to it, 88 00:06:23,240 --> 00:06:25,100 and then actually see what else is coming. 89 00:06:25,300 --> 00:06:25,880 And it's actually coming down from the bird. 90 00:06:26,200 --> 00:06:33,440 So, if we have a quick look at this presentation here. 91 00:06:35,840 --> 00:06:38,140 This one is an old one that I put together. 92 00:06:39,140 --> 00:06:40,420 And you can have a look. 93 00:06:40,960 --> 00:06:42,040 It's on my website. 94 00:06:42,200 --> 00:06:44,640 But this is sort of going to be the basis for what we're going to do today. 95 00:06:46,340 --> 00:06:49,480 So, a lot of satellites up there are actually known as bent pipes. 96 00:06:49,700 --> 00:06:52,100 So all they do is they receive signals from the ground, 97 00:06:52,260 --> 00:06:55,280 and then re-broadcast them back down to the earth. 98 00:06:55,300 --> 00:06:57,380 So, in a lot of instances, 99 00:06:57,540 --> 00:07:01,280 you might have various VSAT terminals or small transmitters 100 00:07:01,280 --> 00:07:04,600 that will transmit up to this satellite in geostationary orbit. 101 00:07:04,660 --> 00:07:07,300 It receives a signal like, in fact, transponder, 102 00:07:07,940 --> 00:07:09,540 certain satcom transponders on planes. 103 00:07:09,700 --> 00:07:11,060 You might think of MH370. 104 00:07:11,760 --> 00:07:15,120 It's come back into the light of the news lately. 105 00:07:15,880 --> 00:07:18,640 And they're sent back down and usually received at a central location. 106 00:07:21,960 --> 00:07:25,280 So, apart from just being a bent pipe on all of these transponders, 107 00:07:25,300 --> 00:07:28,740 on a satellite, they also send down telemetry. 108 00:07:29,020 --> 00:07:33,300 They send out information about the satellite and the health of the satellite. 109 00:07:33,540 --> 00:07:36,700 And they're also accepting commands from the ground station 110 00:07:37,300 --> 00:07:40,380 to change various subsystems on board. 111 00:07:40,900 --> 00:07:44,900 So, this is the particular satellite that we were looking at at the time. 112 00:07:45,560 --> 00:07:47,680 These are the uplink and downlink frequencies. 113 00:07:47,980 --> 00:07:50,040 Lots of transponders they use for TV, 114 00:07:50,140 --> 00:07:52,000 but some other interesting narrowband things. 115 00:07:53,060 --> 00:07:57,040 And if you look up the public manual for the satellite, 116 00:07:57,140 --> 00:08:00,040 it actually gives you the spot beam coverage 117 00:08:00,040 --> 00:08:02,420 for the continent that it's facing. 118 00:08:03,220 --> 00:08:08,560 It also gives you the band plan of the channels on the transponders. 119 00:08:09,260 --> 00:08:11,720 And they actually went to the ground station, 120 00:08:11,840 --> 00:08:13,180 so you can get pretty pictures of that. 121 00:08:14,500 --> 00:08:20,360 And if you go and look at your frequency regulatory authorities database, 122 00:08:20,560 --> 00:08:21,880 you can see that it's actually... 123 00:08:22,000 --> 00:08:23,780 got a whole bunch of point-to-point links 124 00:08:23,780 --> 00:08:27,760 and other frequencies allocated for television, digital television. 125 00:08:28,920 --> 00:08:29,700 And what do you know? 126 00:08:29,780 --> 00:08:31,000 They went into the ground station itself, 127 00:08:31,100 --> 00:08:33,320 so you can see what sort of modems they're using. 128 00:08:34,540 --> 00:08:37,460 So, once you actually have a look and zoom in, 129 00:08:37,540 --> 00:08:40,440 do a bit of analysis there, 130 00:08:40,500 --> 00:08:42,700 you can quickly figure out what style of modem they're using, 131 00:08:42,840 --> 00:08:43,760 get the manual, 132 00:08:43,940 --> 00:08:47,080 see what kind of tracking receivers and control systems they're using, 133 00:08:47,260 --> 00:08:48,380 read those manuals too, 134 00:08:48,440 --> 00:08:50,560 so you can do a little bit of background recon 135 00:08:50,560 --> 00:08:52,600 regarding the systems that might be in use. 136 00:08:52,660 --> 00:08:53,040 Yes, question? 137 00:08:54,660 --> 00:08:55,720 I didn't get in there. 138 00:08:56,220 --> 00:08:57,100 CNET got in there, 139 00:08:57,200 --> 00:08:59,400 and they published the photos publicly online. 140 00:08:59,920 --> 00:09:02,500 I mean, I'm sure they probably had to get permission 141 00:09:02,500 --> 00:09:03,560 and it was all vetted, 142 00:09:03,660 --> 00:09:06,440 but it was by accident that I found it. 143 00:09:06,480 --> 00:09:09,320 It was just interesting to see what information could glean from that. 144 00:09:10,020 --> 00:09:11,200 And as I did this research, 145 00:09:11,280 --> 00:09:13,880 I quickly discovered that there are particular protocols, 146 00:09:14,200 --> 00:09:14,600 particular scramblers, 147 00:09:15,280 --> 00:09:18,600 particular forward error correction processes 148 00:09:19,180 --> 00:09:21,480 that are quite common to satellite links. 149 00:09:21,740 --> 00:09:23,760 So, it gave me a good idea on where to start. 150 00:09:23,980 --> 00:09:25,540 So, to actually receive things, 151 00:09:26,860 --> 00:09:28,400 you need the satellite, 152 00:09:28,540 --> 00:09:29,160 a satellite dish, 153 00:09:29,380 --> 00:09:30,420 a low-noise block, 154 00:09:30,660 --> 00:09:31,320 down converter, 155 00:09:31,500 --> 00:09:34,380 because these signals are up at 11, 12 gigahertz, 156 00:09:34,460 --> 00:09:35,860 you want to get that down for something 157 00:09:35,860 --> 00:09:38,360 that a software-defined radio can actually receive. 158 00:09:39,220 --> 00:09:40,120 This is an example. 159 00:09:40,120 --> 00:09:41,460 One of them, if you're doing narrowband stuff, 160 00:09:41,680 --> 00:09:43,700 you want to get something with high stability 161 00:09:44,360 --> 00:09:46,720 so that your signal doesn't move around that much. 162 00:09:46,900 --> 00:09:48,580 A lot of the cheap dishes that you can get, 163 00:09:48,600 --> 00:09:49,960 that you mount on the side of the home 164 00:09:49,960 --> 00:09:51,180 to just receive television, 165 00:09:51,500 --> 00:09:52,880 they're very cheap 166 00:09:52,880 --> 00:09:55,920 and then don't have a very stable local oscillator later inside. 167 00:09:56,100 --> 00:09:56,880 But that's okay 168 00:09:57,640 --> 00:10:00,800 because the signals that are coming down for TV 169 00:10:00,800 --> 00:10:01,960 are very broadband. 170 00:10:02,480 --> 00:10:04,000 And if you have a very broadband signal, 171 00:10:04,200 --> 00:10:07,280 then your receiver can actually lock onto that signal 172 00:10:07,280 --> 00:10:09,060 and track it as it moves around 173 00:10:09,060 --> 00:10:10,360 due to the instability in your oscillator. 174 00:10:10,680 --> 00:10:12,260 If you're looking at very narrowband stuff, 175 00:10:12,560 --> 00:10:15,580 then that's harder to track if it moves around a lot. 176 00:10:15,780 --> 00:10:18,520 So, you need to pay extra for one of these. 177 00:10:20,060 --> 00:10:22,960 And then you can do some more googling around. 178 00:10:23,120 --> 00:10:25,720 I found that this Optus D1 bird 179 00:10:25,720 --> 00:10:28,080 might have had this sort of telemetry transmitter. 180 00:10:28,340 --> 00:10:29,800 It says it's using phase modulation, 181 00:10:30,120 --> 00:10:30,860 so that's another clue. 182 00:10:31,440 --> 00:10:34,340 And this is a picture of the telemetry there. 183 00:10:35,060 --> 00:10:36,000 We'll come to that. 184 00:10:37,020 --> 00:10:38,600 We'll come to the visualization too. 185 00:10:40,280 --> 00:10:42,780 And then, so what we're going to go through 186 00:10:42,780 --> 00:10:43,880 is actually decoding 187 00:10:44,800 --> 00:10:47,600 one of these interesting narrowband transmissions 188 00:10:47,600 --> 00:10:48,680 that I found from the bird. 189 00:10:49,980 --> 00:10:52,560 And we'll go through each of these steps 190 00:10:52,560 --> 00:10:54,660 to try and get at the raw data. 191 00:10:55,120 --> 00:10:57,800 And then eventually, once we get there, 192 00:10:58,440 --> 00:11:00,340 we'll talk about phase shift keying and scrambling 193 00:11:00,340 --> 00:11:01,180 and forward error correction. 194 00:11:02,080 --> 00:11:04,600 And we're basically going to go through this process 195 00:11:04,600 --> 00:11:08,240 that I'll demonstrate to you. 196 00:11:08,520 --> 00:11:12,320 So, I know that we have two hours blocked out. 197 00:11:12,660 --> 00:11:14,820 I've created a very ambitious schedule, 198 00:11:14,940 --> 00:11:16,740 and I'm sure we're not going to get through all of it. 199 00:11:16,740 --> 00:11:19,640 But if we can, 200 00:11:19,880 --> 00:11:23,340 I would have liked to get to a point 201 00:11:23,340 --> 00:11:26,640 where we reconstruct some of these flow graphs. 202 00:11:26,980 --> 00:11:27,680 Wrong way. 203 00:11:28,440 --> 00:11:30,140 So, we're going to try and look at 204 00:11:32,480 --> 00:11:36,860 that satellite downlink radar over HF 205 00:11:36,860 --> 00:11:37,780 and what that looks like 206 00:11:38,860 --> 00:11:40,840 using fast autocorrelation 207 00:11:40,840 --> 00:11:43,540 to discover periodic components to signals 208 00:11:43,540 --> 00:11:45,220 and then help ID them. 209 00:11:45,220 --> 00:11:47,120 So, that applies to the radar 210 00:11:47,120 --> 00:11:49,620 as well as to digital radio mondial, 211 00:11:49,720 --> 00:11:53,180 which is an OFDM narrowband transmission over HF. 212 00:11:53,280 --> 00:11:56,120 And that is used to actually broadcast digital audio 213 00:11:56,120 --> 00:11:58,440 around the world over very, very long distances. 214 00:11:59,220 --> 00:12:03,440 And then look at actually the beacon, 215 00:12:04,080 --> 00:12:06,580 the telemetry beacon coming down from that satellite 216 00:12:06,580 --> 00:12:09,920 and how you can create a flow graph to do that. 217 00:12:11,280 --> 00:12:11,800 So... 218 00:12:16,480 --> 00:12:18,160 We'll get started on that. 219 00:12:18,260 --> 00:12:20,580 Any questions so far? 220 00:12:21,880 --> 00:12:22,320 All right. 221 00:12:22,420 --> 00:12:24,140 All the people that are participating 222 00:12:24,140 --> 00:12:25,720 have got their receivers set up. 223 00:12:26,480 --> 00:12:28,200 Have you been able to tune to that frequency 224 00:12:28,200 --> 00:12:29,680 and you can see signals? 225 00:12:30,620 --> 00:12:31,060 Yeah? 226 00:12:32,040 --> 00:12:32,480 Okay. 227 00:12:33,040 --> 00:12:33,660 All right. 228 00:12:34,400 --> 00:12:34,840 So... 229 00:12:36,660 --> 00:12:39,820 Let's have a look at what's going on here then. 230 00:12:40,220 --> 00:12:41,480 I'm going to cheat a little bit, 231 00:12:41,600 --> 00:12:44,060 and I'm just going to replay it 232 00:12:44,060 --> 00:12:45,320 from a file. 233 00:12:45,460 --> 00:12:46,900 It's the same file that's going out. 234 00:12:47,400 --> 00:12:49,200 But I'm just going to replay it from a file here. 235 00:12:49,940 --> 00:12:50,340 So... 236 00:12:51,300 --> 00:12:53,540 What we'll do is we'll try and do things 237 00:12:53,540 --> 00:12:54,520 from first principles. 238 00:12:55,120 --> 00:12:57,860 And please, at any stage, if you have questions, 239 00:12:59,080 --> 00:13:00,740 then just shout them out, 240 00:13:00,840 --> 00:13:02,920 and I'll repeat it from the mic. 241 00:13:03,020 --> 00:13:05,460 I must say there's a guy here 242 00:13:05,460 --> 00:13:06,500 that's just stepped in the room. 243 00:13:06,600 --> 00:13:07,280 I have to point him out 244 00:13:07,280 --> 00:13:08,480 because he's an absolute legend. 245 00:13:08,780 --> 00:13:09,660 How are you going, Anders? 246 00:13:09,800 --> 00:13:13,580 This guy here helped me out big time last year 247 00:13:13,580 --> 00:13:14,060 at DEF CON. 248 00:13:14,280 --> 00:13:16,100 We were sitting in the Penn & Teller Theater, 249 00:13:16,240 --> 00:13:17,100 and there was a huge line. 250 00:13:17,280 --> 00:13:18,180 It was really difficult to get in, 251 00:13:18,240 --> 00:13:18,840 and we'd camped out, 252 00:13:18,920 --> 00:13:19,840 and we finally got a seat. 253 00:13:20,520 --> 00:13:22,460 And I got a call from my friend, 254 00:13:22,620 --> 00:13:23,420 Austin Epps, 255 00:13:23,460 --> 00:13:24,320 who was the lead engineer 256 00:13:24,320 --> 00:13:26,320 on the ISE E3 reboot mission, 257 00:13:26,800 --> 00:13:28,640 saying that one of the science experiments 258 00:13:28,640 --> 00:13:29,860 needed to be rebooted. 259 00:13:30,300 --> 00:13:31,860 And, of course, you don't get on the Wi-Fi 260 00:13:31,860 --> 00:13:33,260 at a place like this. 261 00:13:33,400 --> 00:13:34,800 And I need to SSH in 262 00:13:37,000 --> 00:13:38,660 to the computer that we left 263 00:13:38,660 --> 00:13:39,960 at the Arecibo Radio Telescope 264 00:13:39,960 --> 00:13:42,080 to send commands to the satellite 265 00:13:42,080 --> 00:13:43,080 to reboot this thing, 266 00:13:43,580 --> 00:13:44,120 to bring the flyby. 267 00:13:44,380 --> 00:13:46,060 And we only had a limited amount of time, 268 00:13:46,120 --> 00:13:48,180 and we were getting valuable science data 269 00:13:48,660 --> 00:13:52,900 from a particular solar science data recorder. 270 00:13:54,720 --> 00:13:56,160 And I didn't know what to do. 271 00:13:56,800 --> 00:13:58,880 Unfortunately, I had no cell reception, 272 00:13:59,060 --> 00:14:00,220 so I couldn't tether to my phone. 273 00:14:00,660 --> 00:14:02,180 But I was sitting next to Anders, 274 00:14:02,200 --> 00:14:03,160 and we were talking about SDR. 275 00:14:03,620 --> 00:14:04,200 And he said, 276 00:14:04,280 --> 00:14:07,040 Oh, look, I've got a phone here 277 00:14:07,040 --> 00:14:08,480 with tethering capability. 278 00:14:08,700 --> 00:14:09,080 I thought, ooh. 279 00:14:09,820 --> 00:14:10,800 I sized him up. 280 00:14:10,800 --> 00:14:11,800 He seems like a good bloke. 281 00:14:12,000 --> 00:14:13,360 I'll trust my judgment. 282 00:14:13,580 --> 00:14:15,160 And he was nice enough 283 00:14:15,160 --> 00:14:16,240 to let me tether to his phone. 284 00:14:16,580 --> 00:14:18,700 So we actually ended up communicating 285 00:14:18,700 --> 00:14:19,640 with the space probe 286 00:14:19,640 --> 00:14:20,780 flying toward the Earth 287 00:14:20,780 --> 00:14:22,540 at 4.2 kilometers a second, 288 00:14:23,060 --> 00:14:25,480 first from a laptop tethered over Wi-Fi 289 00:14:25,480 --> 00:14:26,020 to his telephone, 290 00:14:26,200 --> 00:14:27,240 then from his telephone 291 00:14:27,240 --> 00:14:28,080 over the cellular network 292 00:14:28,080 --> 00:14:29,060 to the core network, 293 00:14:29,300 --> 00:14:30,920 and then out an IP gateway 294 00:14:30,920 --> 00:14:33,260 to a laptop in Arecibo 295 00:14:33,260 --> 00:14:34,060 through SSH 296 00:14:34,060 --> 00:14:34,880 that was then connected 297 00:14:34,880 --> 00:14:36,100 to the Red Telescope 298 00:14:36,100 --> 00:14:37,060 via software-defined radio 299 00:14:37,060 --> 00:14:38,260 sending out at 2 point 300 00:14:38,260 --> 00:14:39,300 whatever gigahertz commands 301 00:14:39,300 --> 00:14:40,020 up to the boat. 302 00:14:40,220 --> 00:14:41,940 So thank you very much 303 00:14:41,940 --> 00:14:42,560 for your help there. 304 00:14:42,560 --> 00:14:43,940 That really pulled me out 305 00:14:43,940 --> 00:14:44,660 of a tight spot. 306 00:14:47,420 --> 00:14:48,900 It's generosity like that 307 00:14:48,900 --> 00:14:50,940 in the lack of reliable Wi-Fi 308 00:14:50,940 --> 00:14:53,240 that really makes it all worth it. 309 00:14:53,340 --> 00:14:53,760 So thank you. 310 00:14:54,640 --> 00:14:55,340 All right. 311 00:14:57,880 --> 00:15:00,080 So that file that I've got 312 00:15:00,080 --> 00:15:00,840 playing over the air 313 00:15:00,840 --> 00:15:02,240 is actually, I realized, 314 00:15:02,400 --> 00:15:03,540 I might actually use this 315 00:15:03,540 --> 00:15:04,340 because I need two hands. 316 00:15:17,140 --> 00:15:18,800 How do you operate this thing? 317 00:15:20,200 --> 00:15:20,980 It's mechanical. 318 00:15:21,540 --> 00:15:22,620 It's going to be too hard. 319 00:15:24,280 --> 00:15:24,900 All right. 320 00:15:24,940 --> 00:15:25,960 I'll just make do. 321 00:15:28,380 --> 00:15:30,300 So what we've got 322 00:15:30,300 --> 00:15:33,020 is we've got this WAV file. 323 00:15:33,220 --> 00:15:33,840 And usually, 324 00:15:34,700 --> 00:15:36,040 when you've got a WAV file 325 00:15:36,620 --> 00:15:38,080 or a CAPTCHA file, 326 00:15:38,340 --> 00:15:39,180 you need to know 327 00:15:39,180 --> 00:15:40,360 what sample rate 328 00:15:40,360 --> 00:15:41,300 you've recorded it at. 329 00:15:41,300 --> 00:15:42,780 And I know that I recorded this one 330 00:15:43,270 --> 00:15:46,560 at one mega sample per second. 331 00:15:46,680 --> 00:15:47,580 So you can put in a million. 332 00:15:47,840 --> 00:15:48,960 I generally like to do 333 00:15:48,960 --> 00:15:49,520 a bit of a shortcut. 334 00:15:49,700 --> 00:15:52,840 So you can go int 1e6, 335 00:15:53,040 --> 00:15:53,440 like that. 336 00:15:54,220 --> 00:15:55,740 And that gives you 337 00:15:56,300 --> 00:15:57,020 your sample rate. 338 00:15:57,120 --> 00:15:57,960 If you're capturing, 339 00:15:58,140 --> 00:15:59,120 you can probably sample 340 00:15:59,120 --> 00:16:00,620 at one mega sample per second 341 00:16:00,620 --> 00:16:01,700 because the original CAPTCHA 342 00:16:01,700 --> 00:16:02,700 is like that as well. 343 00:16:03,100 --> 00:16:04,340 So in this case, 344 00:16:04,360 --> 00:16:05,080 I've got a WAV file. 345 00:16:05,400 --> 00:16:06,440 It's a WAV file 346 00:16:06,440 --> 00:16:08,800 because I actually like to use 347 00:16:09,660 --> 00:16:11,080 HDSDR, which is this app. 348 00:16:12,360 --> 00:16:13,580 This is actually running 349 00:16:13,580 --> 00:16:14,900 under Wine on my Mac, 350 00:16:15,080 --> 00:16:15,940 but you can run it 351 00:16:15,940 --> 00:16:16,820 natively under Windows, 352 00:16:16,980 --> 00:16:18,340 and you can also run it 353 00:16:18,340 --> 00:16:19,420 under Wine on Linux. 354 00:16:20,080 --> 00:16:21,640 And with some trickery, 355 00:16:21,720 --> 00:16:22,820 you can connect them 356 00:16:22,820 --> 00:16:24,000 to all sorts of different 357 00:16:24,000 --> 00:16:25,200 software-defined radios too. 358 00:16:25,440 --> 00:16:29,360 So there's XIO plug-ins. 359 00:16:30,000 --> 00:16:31,600 I wrote one a while back, 360 00:16:31,640 --> 00:16:32,200 and it supports 361 00:16:32,200 --> 00:16:33,800 USURPS and RTL 362 00:16:33,800 --> 00:16:34,300 and FunCubes 363 00:16:35,820 --> 00:16:37,200 and UDP streaming 364 00:16:37,200 --> 00:16:37,940 to GNU Radio. 365 00:16:38,120 --> 00:16:38,900 There are other ones there 366 00:16:38,900 --> 00:16:40,420 that are sort of newer for RTL 367 00:16:40,420 --> 00:16:41,060 and things like this. 368 00:16:41,960 --> 00:16:45,260 But if you were to find that file 369 00:16:45,260 --> 00:16:46,280 and play it back... 370 00:16:46,280 --> 00:16:46,600 Is it this one? 371 00:16:50,160 --> 00:16:50,520 No. 372 00:16:52,280 --> 00:16:52,780 This one. 373 00:16:53,500 --> 00:16:55,100 So this is the file. 374 00:16:55,240 --> 00:16:56,000 This is what it looked like 375 00:16:56,000 --> 00:16:57,100 when I was originally recording it, 376 00:16:57,160 --> 00:16:57,980 and you can see all these 377 00:16:57,980 --> 00:17:00,460 narrowband signals there coming down. 378 00:17:00,640 --> 00:17:01,200 I thought, hmm, 379 00:17:01,300 --> 00:17:01,900 it would be interesting 380 00:17:01,900 --> 00:17:02,660 to try and figure out 381 00:17:02,660 --> 00:17:03,880 what these actually are 382 00:17:03,880 --> 00:17:05,920 and how the data is encoded 383 00:17:05,920 --> 00:17:06,640 and how it's modulated. 384 00:17:07,480 --> 00:17:09,280 And if this was coming in live 385 00:17:09,280 --> 00:17:10,520 through, say, a USURP, 386 00:17:10,520 --> 00:17:11,720 I would click record, 387 00:17:11,980 --> 00:17:13,660 and it will record this WAV file. 388 00:17:13,980 --> 00:17:16,020 Similarly, you could use other utilities 389 00:17:16,020 --> 00:17:17,600 like RxSamples to file, 390 00:17:17,720 --> 00:17:18,440 and that would just give you 391 00:17:18,440 --> 00:17:20,020 a baseband capture file the same way. 392 00:17:20,280 --> 00:17:21,820 But here, because we've got a WAV file, 393 00:17:21,940 --> 00:17:22,680 we have INQ. 394 00:17:23,220 --> 00:17:24,100 It's a complex recording. 395 00:17:24,380 --> 00:17:25,760 So we want to turn that 396 00:17:25,760 --> 00:17:26,800 into something complex. 397 00:17:27,060 --> 00:17:29,520 So we go float to complex. 398 00:17:33,460 --> 00:17:35,280 And we can hook that up easily 399 00:17:35,280 --> 00:17:35,920 like this. 400 00:17:36,480 --> 00:17:38,360 And because we're also playing back 401 00:17:38,360 --> 00:17:39,000 from a file, 402 00:17:39,000 --> 00:17:40,660 we're not actually using 403 00:17:40,660 --> 00:17:41,740 any hardware in the loop 404 00:17:41,740 --> 00:17:43,180 like a USURP or an audio card. 405 00:17:43,360 --> 00:17:45,600 We ideally want to use a throttle 406 00:17:45,600 --> 00:17:48,700 to make it look like it's a live stream. 407 00:17:48,900 --> 00:17:49,920 If you don't use a throttle 408 00:17:49,920 --> 00:17:50,560 and a flow graph, 409 00:17:50,840 --> 00:17:52,020 the flow graph will run 410 00:17:52,020 --> 00:17:53,380 as quickly as it possibly can 411 00:17:53,380 --> 00:17:54,520 because there's nothing 412 00:17:54,520 --> 00:17:56,180 supplying any back pressure. 413 00:17:56,700 --> 00:17:58,180 There's nothing with an external 414 00:17:58,180 --> 00:17:59,940 hardware clock to impose a rate 415 00:17:59,940 --> 00:18:01,240 across the entire flow graph. 416 00:18:01,480 --> 00:18:03,080 So sometimes you want flow graphs 417 00:18:03,080 --> 00:18:04,500 to run as quickly as they possibly can 418 00:18:04,500 --> 00:18:07,200 because let's say you want to process 419 00:18:07,200 --> 00:18:08,980 a bunch of files, 420 00:18:08,980 --> 00:18:10,460 in a batch system. 421 00:18:11,020 --> 00:18:12,340 There you don't want to be 422 00:18:13,140 --> 00:18:14,700 IO bound or anything like that. 423 00:18:14,800 --> 00:18:16,020 You just want it to be CPU bound 424 00:18:16,020 --> 00:18:18,040 so it runs as fast as you possibly can. 425 00:18:18,100 --> 00:18:19,700 Here we want it to run in real time. 426 00:18:19,880 --> 00:18:20,460 So we do that. 427 00:18:21,220 --> 00:18:23,340 So now you can just grab... 428 00:18:24,940 --> 00:18:25,880 Tim, where are you? 429 00:18:26,900 --> 00:18:28,260 So Tim O'Shea here, 430 00:18:28,340 --> 00:18:29,460 I should point out, 431 00:18:29,500 --> 00:18:31,560 is a very integral member, 432 00:18:32,340 --> 00:18:34,620 part of the GNU Radio development team. 433 00:18:34,800 --> 00:18:35,940 He's going to be speaking later 434 00:18:35,940 --> 00:18:37,240 on some interesting stuff. 435 00:18:37,240 --> 00:18:40,080 But he's made enormous contributions 436 00:18:40,080 --> 00:18:40,740 to GNU Radio. 437 00:18:41,200 --> 00:18:42,320 Really, really clever guy, 438 00:18:42,440 --> 00:18:43,600 done some amazing stuff. 439 00:18:44,380 --> 00:18:45,760 And I've got to apologize, 440 00:18:45,900 --> 00:18:46,580 especially to you. 441 00:18:46,700 --> 00:18:48,100 I'm still going to use WX today. 442 00:18:49,380 --> 00:18:50,780 So GNU Radio supports 443 00:18:50,780 --> 00:18:54,160 two different sorts of GUI frameworks 444 00:18:54,160 --> 00:18:55,680 for displaying stuff on screen. 445 00:18:55,880 --> 00:18:56,500 One's QT. 446 00:18:56,660 --> 00:18:58,300 This is the new world order. 447 00:18:58,580 --> 00:18:59,500 It's really nice, 448 00:19:00,420 --> 00:19:02,140 but I just happen to be old school 449 00:19:02,140 --> 00:19:03,260 and I like WX. 450 00:19:03,380 --> 00:19:04,800 So I'm going to switch it to WX. 451 00:19:05,560 --> 00:19:06,000 Now, 452 00:19:06,000 --> 00:19:09,120 you can drop in one of these FFT sinks, 453 00:19:09,460 --> 00:19:10,220 hook it up, 454 00:19:10,300 --> 00:19:11,960 and just run this. 455 00:19:12,280 --> 00:19:14,600 And we'll call it... 456 00:19:20,640 --> 00:19:22,060 And there, once again, 457 00:19:22,260 --> 00:19:24,180 we have that spectrum that we saw, 458 00:19:24,320 --> 00:19:25,320 both in HDSDR 459 00:19:25,320 --> 00:19:27,360 and that you guys should see on your laptops. 460 00:19:27,620 --> 00:19:29,480 So that means we're correctly 461 00:19:30,100 --> 00:19:31,720 now decoding this WAV file. 462 00:19:32,280 --> 00:19:33,500 The next step of this 463 00:19:33,500 --> 00:19:35,980 is that we want to actually focus in 464 00:19:35,980 --> 00:19:37,360 on one of these transmissions. 465 00:19:37,460 --> 00:19:38,600 So this is essentially step one. 466 00:19:38,720 --> 00:19:39,920 This is known as channel selection. 467 00:19:40,480 --> 00:19:41,800 And what you can do then 468 00:19:41,800 --> 00:19:44,540 is you can use what's called 469 00:19:44,540 --> 00:19:48,360 the frequency translating FIR filter 470 00:19:50,560 --> 00:19:53,740 to narrow in on a particular signal of interest. 471 00:19:54,100 --> 00:19:54,980 So what I'm going to do 472 00:19:54,980 --> 00:19:56,420 is I'm going to leave the main one there, 473 00:19:56,520 --> 00:19:58,400 and then I'm going to get this second FFT, 474 00:19:58,840 --> 00:19:59,620 hook this up. 475 00:19:59,960 --> 00:20:01,320 But we need to figure out 476 00:20:02,360 --> 00:20:04,820 how much we're going to decimate by. 477 00:20:04,940 --> 00:20:05,440 Because remember, 478 00:20:05,440 --> 00:20:07,460 initially we started with a one mega sample 479 00:20:07,460 --> 00:20:09,340 per second stream, 480 00:20:09,580 --> 00:20:10,760 and we want to narrow that down 481 00:20:10,760 --> 00:20:12,020 to a much narrower bandwidth. 482 00:20:12,320 --> 00:20:15,660 So I'm going to just completely guess 483 00:20:16,020 --> 00:20:18,020 and say we're going to decimate by 20 484 00:20:19,040 --> 00:20:23,340 and end up with a particular sample right there. 485 00:20:23,820 --> 00:20:27,500 So if you like to use GNU Radio Companion, 486 00:20:27,560 --> 00:20:29,780 then I highly recommend you get in the habit 487 00:20:29,780 --> 00:20:31,420 of using variable blocks. 488 00:20:31,660 --> 00:20:33,700 Because what variable blocks let you do 489 00:20:33,700 --> 00:20:35,420 is put in, 490 00:20:36,160 --> 00:20:37,680 these little expressions. 491 00:20:38,580 --> 00:20:40,400 And so when you change something 492 00:20:40,400 --> 00:20:42,360 somewhere in your flow graph, 493 00:20:42,600 --> 00:20:44,480 you only need to change one parameter once, 494 00:20:44,660 --> 00:20:46,660 and that'll ripple through the rest of your flow graph 495 00:20:46,660 --> 00:20:48,680 if you put these expressions in your variable. 496 00:20:48,880 --> 00:20:51,320 So instead of hard coding in numbers all over the place, 497 00:20:51,400 --> 00:20:51,900 if you think, 498 00:20:51,960 --> 00:20:54,240 oh crap, I've got to change that sample rate, 499 00:20:54,340 --> 00:20:55,700 if you have it in one variable 500 00:20:55,700 --> 00:20:56,920 and reference that everywhere else, 501 00:20:56,940 --> 00:20:58,260 just like in a normal programming language, 502 00:20:58,500 --> 00:20:59,840 then it makes it really easy 503 00:20:59,840 --> 00:21:02,600 to continue development and update things properly. 504 00:21:03,100 --> 00:21:04,420 So in this instance, 505 00:21:04,420 --> 00:21:05,320 what I've said is, 506 00:21:05,420 --> 00:21:08,340 I want to have a baseband rate 507 00:21:09,000 --> 00:21:11,280 of 50 kilohertz, right? 508 00:21:11,340 --> 00:21:12,780 So I'm going to go from a one mega sample per second 509 00:21:12,780 --> 00:21:13,560 down to 50 kilohertz. 510 00:21:13,800 --> 00:21:15,740 And that means that 511 00:21:15,740 --> 00:21:18,060 if you calculate your decimation factor, 512 00:21:18,720 --> 00:21:20,520 then that's the original sample rate, 513 00:21:20,600 --> 00:21:21,640 which is one mega sample per second, 514 00:21:21,680 --> 00:21:24,100 divided by 50 kilohertz. 515 00:21:24,200 --> 00:21:26,180 So that gives you a decimation factor of 20. 516 00:21:26,560 --> 00:21:28,920 And so for the translating FIR filter, 517 00:21:29,160 --> 00:21:32,720 you put in a decimation like that. 518 00:21:33,520 --> 00:21:34,860 Now the second part 519 00:21:34,860 --> 00:21:37,460 of the frequency translating FIR filter 520 00:21:37,460 --> 00:21:38,220 is that, sure, 521 00:21:38,340 --> 00:21:40,480 you can squish your narrowband stream right down, 522 00:21:40,680 --> 00:21:42,420 but you need to filter, 523 00:21:42,540 --> 00:21:44,580 because all of the other content 524 00:21:44,580 --> 00:21:47,340 in the original capture file 525 00:21:47,340 --> 00:21:49,160 will then wrap around inside that. 526 00:21:49,440 --> 00:21:51,080 So one very important part 527 00:21:51,080 --> 00:21:53,700 of interpolation decimation is filtering. 528 00:21:53,960 --> 00:21:55,120 And so what you've got to do 529 00:21:55,120 --> 00:21:57,920 is you have to define your filter taps, 530 00:21:58,180 --> 00:22:00,480 and that defines essentially 531 00:22:00,480 --> 00:22:01,560 how your filter's going to work. 532 00:22:01,720 --> 00:22:02,580 What we want to do 533 00:22:02,720 --> 00:22:04,100 is we want to use a low pass filter. 534 00:22:04,680 --> 00:22:06,820 And Canoe Radio's got this cool filter design tool. 535 00:22:07,360 --> 00:22:09,340 I don't know if that works on my Mac, actually. 536 00:22:09,440 --> 00:22:09,880 Oh, it does. 537 00:22:11,720 --> 00:22:12,080 Right? 538 00:22:12,660 --> 00:22:14,960 And I'm not going to use this too much, 539 00:22:15,040 --> 00:22:15,620 but what you can do 540 00:22:15,620 --> 00:22:16,580 is you can actually use it 541 00:22:16,580 --> 00:22:18,020 to design and analyze filters. 542 00:22:18,160 --> 00:22:19,540 So here we have one. 543 00:22:19,920 --> 00:22:22,760 We're going to bring this up. 544 00:22:22,840 --> 00:22:24,800 We said we have a sample rate of 32K. 545 00:22:25,140 --> 00:22:28,080 We want the pass band to end at... 546 00:22:28,080 --> 00:22:28,720 What's that? 547 00:22:29,240 --> 00:22:29,600 5K. 548 00:22:30,280 --> 00:22:31,180 Stop band at 6. 549 00:22:31,180 --> 00:22:32,940 And it will actually visualize 550 00:22:32,940 --> 00:22:34,860 the roll-off of your filter and the ripple, 551 00:22:34,980 --> 00:22:37,500 and you can look at the taps, 552 00:22:37,740 --> 00:22:38,760 the phase response, 553 00:22:39,240 --> 00:22:40,420 get the filter coefficients, 554 00:22:41,120 --> 00:22:42,140 and you can design 555 00:22:42,140 --> 00:22:44,000 all sorts of different types of filters here. 556 00:22:44,120 --> 00:22:44,940 So they're really, really handy. 557 00:22:45,900 --> 00:22:47,280 I'm not actually going to use this now, 558 00:22:47,360 --> 00:22:48,740 but just something to keep in mind 559 00:22:49,340 --> 00:22:51,720 as you go and use the utilities. 560 00:22:51,820 --> 00:22:53,500 That's just in tools, filter design tool. 561 00:22:53,740 --> 00:22:54,560 By the way, Tim, 562 00:22:55,020 --> 00:22:56,980 if I've missed anything 563 00:22:56,980 --> 00:22:58,000 or you can think of anything to add, 564 00:22:58,080 --> 00:22:58,900 just shout out. 565 00:23:00,320 --> 00:23:01,620 So in this case, 566 00:23:01,760 --> 00:23:03,260 I'm going to need some taps. 567 00:23:03,840 --> 00:23:06,140 And what I'm going to do is I'm going to... 568 00:23:06,140 --> 00:23:07,200 I can't see that. 569 00:23:16,420 --> 00:23:18,680 I'm going to use a variable. 570 00:23:19,700 --> 00:23:20,200 Right? 571 00:23:20,240 --> 00:23:21,780 I'm going to call it taps. 572 00:23:22,720 --> 00:23:24,940 And the value here is not just a number. 573 00:23:25,340 --> 00:23:27,820 It's actually calling a function. 574 00:23:28,300 --> 00:23:29,560 So within GNU Radio, 575 00:23:29,700 --> 00:23:31,580 there's a module called the FIR Designer, 576 00:23:32,260 --> 00:23:34,440 and that has a function called low pass. 577 00:23:34,740 --> 00:23:35,580 So what this is going to do 578 00:23:35,580 --> 00:23:36,940 is it's going to generate the taps 579 00:23:36,940 --> 00:23:38,440 for a low pass filter 580 00:23:39,140 --> 00:23:40,480 given these arguments. 581 00:23:41,120 --> 00:23:42,760 Now, you can go and look in the documentation. 582 00:23:42,840 --> 00:23:43,400 It's all there, 583 00:23:43,500 --> 00:23:45,400 but the first one is the gain. 584 00:23:45,580 --> 00:23:46,480 So I'm going to leave it at one. 585 00:23:47,080 --> 00:23:49,140 The second one is the incoming sample rate. 586 00:23:49,540 --> 00:23:51,700 So we know that's one mega sample per second. 587 00:23:51,820 --> 00:23:52,620 So we use that. 588 00:23:52,940 --> 00:23:54,760 And then the last one here 589 00:23:54,760 --> 00:23:56,720 is the transition bandwidth, 590 00:23:56,720 --> 00:23:58,720 which means over what gap 591 00:23:59,280 --> 00:24:00,720 you want your start... 592 00:24:01,380 --> 00:24:02,460 the end of your start band 593 00:24:02,460 --> 00:24:03,780 to go to the beginning of your stop band. 594 00:24:03,980 --> 00:24:05,400 So we just pick an arbitrary number there. 595 00:24:05,520 --> 00:24:06,520 One kilohertz is fine. 596 00:24:07,120 --> 00:24:09,320 And then this third value here 597 00:24:09,320 --> 00:24:11,200 is the translation... 598 00:24:11,200 --> 00:24:13,200 I just call it the translation bandwidth. 599 00:24:13,380 --> 00:24:15,880 So it's actually what the bandwidth 600 00:24:15,880 --> 00:24:17,940 of the filter is going to be. 601 00:24:18,140 --> 00:24:20,040 And because I have that as a variable there, 602 00:24:20,100 --> 00:24:21,540 it means that we can control it 603 00:24:21,540 --> 00:24:22,680 when the application's running. 604 00:24:22,800 --> 00:24:23,860 And I'll show you what that looks like. 605 00:24:24,480 --> 00:24:25,960 So we put that in there. 606 00:24:26,520 --> 00:24:27,320 Click OK. 607 00:24:28,420 --> 00:24:31,860 And then also, I've got here a slider now, 608 00:24:32,040 --> 00:24:34,360 which is called translate bandwidth. 609 00:24:35,100 --> 00:24:36,860 And the minimum is zero. 610 00:24:36,940 --> 00:24:38,780 The maximum is the base band rate. 611 00:24:38,900 --> 00:24:40,760 So it's zero to 50K. 612 00:24:43,760 --> 00:24:45,780 And this means that we can actually change 613 00:24:45,780 --> 00:24:47,720 the low pass filter while it's running. 614 00:24:47,960 --> 00:24:49,700 And the second one here I've got 615 00:24:49,700 --> 00:24:55,140 is the translation frequency. 616 00:24:55,140 --> 00:24:56,860 And this is the frequency 617 00:24:56,860 --> 00:24:58,560 that we're going to shift 618 00:24:59,060 --> 00:25:01,780 the original recording to, 619 00:25:01,940 --> 00:25:03,940 which is going to be the new base band signal. 620 00:25:04,120 --> 00:25:05,660 So let's run that and see what happens. 621 00:25:08,720 --> 00:25:09,880 Python quit unexpectedly. 622 00:25:17,400 --> 00:25:18,560 Oh, what does it say there? 623 00:25:19,160 --> 00:25:21,360 Terminating with unexpected exception of type 624 00:25:21,880 --> 00:25:23,000 buffer add reader 625 00:25:24,400 --> 00:25:25,880 N0 preload must be greater than zero. 626 00:25:28,120 --> 00:25:28,720 What am I? 627 00:25:29,020 --> 00:25:29,920 Oh, you know what it is? 628 00:25:31,580 --> 00:25:34,000 Um, bandwidth, this should be... 629 00:25:41,160 --> 00:25:42,540 Oh, I didn't set the taps. 630 00:25:43,120 --> 00:25:44,540 So we have that variable taps, 631 00:25:44,680 --> 00:25:45,980 but I never actually used it. 632 00:25:46,460 --> 00:25:48,060 That would do it. 633 00:25:48,200 --> 00:25:49,360 So I'm going to put taps in here. 634 00:25:49,620 --> 00:25:51,360 Now, one cool thing in GNU Radio is that 635 00:25:51,360 --> 00:25:53,940 when you enter in variables and expressions here, 636 00:25:54,060 --> 00:25:57,420 you can hover your mouse over that particular field, 637 00:25:57,600 --> 00:25:58,640 and it will give you a tool tip 638 00:25:58,640 --> 00:26:01,000 that will evaluate what's in that field. 639 00:26:01,200 --> 00:26:02,580 So you can see the decimation is 20. 640 00:26:02,840 --> 00:26:06,740 The taps, it's actually run the code, right? 641 00:26:06,800 --> 00:26:08,580 It's run that low pass function, 642 00:26:08,780 --> 00:26:10,120 and it's returned those taps. 643 00:26:10,300 --> 00:26:11,700 It's not showing you all of them there, 644 00:26:13,540 --> 00:26:15,220 but it's just giving you a preview. 645 00:26:15,680 --> 00:26:17,380 So now let's run it. 646 00:26:23,000 --> 00:26:23,900 Where's my GUI? 647 00:26:38,000 --> 00:26:38,720 There we go. 648 00:26:41,240 --> 00:26:42,700 Ah, there's one other thing I forgot. 649 00:26:42,920 --> 00:26:44,940 This gets me all the time, too. 650 00:26:45,020 --> 00:26:46,460 When you just drag GUI blocks in, 651 00:26:46,540 --> 00:26:49,600 it's really important that you actually check 652 00:26:49,600 --> 00:26:51,340 what your incoming sample rate is. 653 00:26:51,360 --> 00:26:52,780 Notice that here, 654 00:26:52,960 --> 00:26:55,360 it was valid to have one mega sample per second 655 00:26:55,360 --> 00:26:57,180 because it's coming from the original source file. 656 00:26:57,440 --> 00:26:59,300 But actually, we've decimated here, 657 00:26:59,440 --> 00:27:02,120 so everything after this has a sample rate of... 658 00:27:04,120 --> 00:27:06,000 Yeah, and what's the variable name for that? 659 00:27:06,780 --> 00:27:07,940 Somebody set it over here? 660 00:27:08,720 --> 00:27:10,280 BB underscore rate. 661 00:27:10,820 --> 00:27:11,340 Right. 662 00:27:14,100 --> 00:27:15,140 So now... 663 00:27:16,340 --> 00:27:17,440 No time to charm. 664 00:27:19,580 --> 00:27:21,120 So now at the bottom here, 665 00:27:21,120 --> 00:27:23,820 we have our original one-meg incoming signal, 666 00:27:23,900 --> 00:27:25,820 and you can see that it's from negative 50 to... 667 00:27:25,820 --> 00:27:27,760 500 to positive 500 kilohertz. 668 00:27:27,880 --> 00:27:30,220 And here, we've got nothing 669 00:27:30,220 --> 00:27:33,240 because our translation frequency is actually zero. 670 00:27:33,700 --> 00:27:36,200 So now if we move the slider... 671 00:27:39,600 --> 00:27:40,560 It's not going to do anything 672 00:27:40,560 --> 00:27:43,480 because I haven't actually added that variable in here either. 673 00:27:46,820 --> 00:27:48,680 So now when you change the slider, 674 00:27:48,680 --> 00:27:51,080 it's going to change that value. 675 00:27:51,880 --> 00:27:52,380 All right. 676 00:27:53,080 --> 00:27:53,700 Here we go. 677 00:27:55,700 --> 00:27:58,720 So if I move the slider across a little bit, 678 00:27:59,100 --> 00:28:00,040 you can see there, 679 00:28:00,120 --> 00:28:01,720 there's a particular signal, right? 680 00:28:01,940 --> 00:28:03,200 That's one of the narrowband signals, 681 00:28:03,340 --> 00:28:04,280 and I can keep moving that, 682 00:28:04,400 --> 00:28:05,480 and you get to the next one, 683 00:28:05,600 --> 00:28:06,780 and you get to the next one, 684 00:28:06,780 --> 00:28:07,640 and you get to the next one 685 00:28:07,640 --> 00:28:08,600 as you go through the band. 686 00:28:08,700 --> 00:28:09,400 So they're all there. 687 00:28:09,580 --> 00:28:10,860 And what this has allowed us to do 688 00:28:10,860 --> 00:28:12,540 is now zoom down into one of those, 689 00:28:12,660 --> 00:28:13,940 and we can analyze that further. 690 00:28:14,280 --> 00:28:16,200 Now there are a couple of other little tricks you can do. 691 00:28:17,140 --> 00:28:18,660 The first thing is that here, 692 00:28:18,680 --> 00:28:22,900 we know that the variable is called translation frequency. 693 00:28:24,280 --> 00:28:25,960 And what we're going to do is we're going to copy that, 694 00:28:26,100 --> 00:28:28,040 and in this GUI sync, 695 00:28:28,220 --> 00:28:30,640 we're going to set the variable here 696 00:28:30,640 --> 00:28:33,580 so that when you click on a particular point in the GUI, 697 00:28:33,660 --> 00:28:35,860 that's going to program the frequency. 698 00:28:36,640 --> 00:28:37,760 Now in addition, 699 00:28:38,840 --> 00:28:39,640 in the... 700 00:28:39,640 --> 00:28:41,540 I've modified GNU Radio a little bit, 701 00:28:41,640 --> 00:28:43,860 and this is all on my GitHub if you want to download it, 702 00:28:43,920 --> 00:28:46,460 but we need to maybe get this stuff merged 703 00:28:46,460 --> 00:28:47,480 even though it's WX. 704 00:28:48,140 --> 00:28:48,540 But... 705 00:28:48,680 --> 00:28:50,380 There are these extra options here. 706 00:28:50,480 --> 00:28:51,660 So you've got frequency of interest. 707 00:28:51,940 --> 00:28:54,340 So we're going to put this in there as well. 708 00:28:54,760 --> 00:28:56,600 And now when we run it... 709 00:28:56,600 --> 00:28:57,640 Check this out. 710 00:29:02,500 --> 00:29:03,860 See the green line here? 711 00:29:04,700 --> 00:29:05,780 You can click, 712 00:29:05,940 --> 00:29:08,000 and it will take the slider there 713 00:29:08,000 --> 00:29:09,640 and also the translation there. 714 00:29:09,840 --> 00:29:11,460 So now wherever I click 715 00:29:12,000 --> 00:29:12,960 is going to be 716 00:29:15,620 --> 00:29:17,780 where we're actually decimating to. 717 00:29:17,780 --> 00:29:19,120 And that's nice. 718 00:29:19,560 --> 00:29:22,020 It makes things a little bit more interactive and easy to do. 719 00:29:22,240 --> 00:29:24,140 Now the problem is when we close this, 720 00:29:24,340 --> 00:29:25,580 every time we run it again, 721 00:29:25,760 --> 00:29:27,880 our variables are going to be back to the defaults. 722 00:29:27,920 --> 00:29:29,760 And that's okay in certain situations, 723 00:29:29,860 --> 00:29:30,620 but in other situations, 724 00:29:30,760 --> 00:29:32,040 you want it to be persistent. 725 00:29:32,340 --> 00:29:34,260 And there's actually a nice block to do that. 726 00:29:34,580 --> 00:29:36,660 So if you look up in your tree, 727 00:29:36,840 --> 00:29:38,460 there's the variable config block, 728 00:29:38,960 --> 00:29:42,540 and that actually allows you to persist variables between runs. 729 00:29:42,720 --> 00:29:44,980 So the way it works is that you give it a configuration file. 730 00:29:45,180 --> 00:29:47,760 So I'm going to call this qpsk.txt. 731 00:29:48,820 --> 00:29:50,780 You can give it the section 732 00:29:50,780 --> 00:29:52,340 that you want to store it in the file, 733 00:29:52,480 --> 00:29:53,100 the option. 734 00:29:54,140 --> 00:29:57,420 So we're going to call this xlatefreg. 735 00:29:57,540 --> 00:30:00,480 I highly recommend for strings as general practice 736 00:30:00,480 --> 00:30:02,040 to always wrap them in single quotes. 737 00:30:04,080 --> 00:30:07,080 Otherwise they might get interpreted as stuff. 738 00:30:07,700 --> 00:30:09,300 And so the idea is that we want to write back 739 00:30:10,360 --> 00:30:12,120 the last value that it was set at, 740 00:30:12,180 --> 00:30:12,700 so we use this. 741 00:30:12,940 --> 00:30:14,740 And we're going to just by convention 742 00:30:14,740 --> 00:30:17,480 call this config xlatefreg. 743 00:30:17,760 --> 00:30:19,220 And when you run the flow graph, 744 00:30:19,500 --> 00:30:21,200 it'll load this variable up 745 00:30:21,200 --> 00:30:22,700 with whatever was stored in the file. 746 00:30:23,060 --> 00:30:25,680 So then the default value for the slider 747 00:30:28,260 --> 00:30:30,780 becomes instead of bvrate, 748 00:30:30,860 --> 00:30:31,680 it becomes... 749 00:30:32,380 --> 00:30:33,640 Oh, not the bandwidth, sorry. 750 00:30:34,140 --> 00:30:34,720 This one. 751 00:30:34,860 --> 00:30:35,600 Instead of zero, 752 00:30:35,680 --> 00:30:37,680 it becomes what we had in the file. 753 00:30:37,920 --> 00:30:39,260 So now when I run it, 754 00:30:42,940 --> 00:30:44,660 I can click over here, 755 00:30:44,760 --> 00:30:45,900 say on this one, 756 00:30:50,140 --> 00:30:53,520 and this is going to be remembering this offset now. 757 00:30:54,260 --> 00:30:55,060 So that's good. 758 00:30:57,000 --> 00:30:59,820 So the next step is we've identified the signal, 759 00:30:59,920 --> 00:31:01,980 and what we want to do now is try and figure out 760 00:31:01,980 --> 00:31:05,700 what kind of modulation it actually is using. 761 00:31:06,000 --> 00:31:09,020 Now, often on the ground, 762 00:31:10,400 --> 00:31:12,060 there are all sorts of modulations in use, 763 00:31:12,100 --> 00:31:13,380 but because this is a satellite link, 764 00:31:13,940 --> 00:31:15,360 often for satellite links, 765 00:31:16,620 --> 00:31:19,240 PSK, phase shift keying, is very popular. 766 00:31:19,460 --> 00:31:20,460 It's nice and simple, 767 00:31:20,600 --> 00:31:23,700 and one thing that is distinguishing 768 00:31:23,700 --> 00:31:26,280 about space links with satellites, 769 00:31:27,060 --> 00:31:28,080 unlike the Earth, 770 00:31:28,180 --> 00:31:30,020 is that because you're pointing directly up 771 00:31:30,020 --> 00:31:32,040 and the beams are coming directly back down, 772 00:31:32,180 --> 00:31:34,560 and there are no, for example, buildings in the way, 773 00:31:34,700 --> 00:31:36,900 you don't really have to worry about multipath. 774 00:31:37,060 --> 00:31:39,460 So these sorts of single-tone modulation schemes 775 00:31:39,460 --> 00:31:41,400 work quite well. 776 00:31:41,580 --> 00:31:43,720 On the ground, that's not the case. 777 00:31:43,840 --> 00:31:45,340 If you think about this sort of thing, 778 00:31:45,360 --> 00:31:46,140 it's a sort of urban environment. 779 00:31:46,380 --> 00:31:47,480 There are buildings everywhere. 780 00:31:47,700 --> 00:31:48,680 There are urban canyons. 781 00:31:48,720 --> 00:31:49,940 The signals are going to bounce around 782 00:31:49,940 --> 00:31:51,780 off all sorts of different things. 783 00:31:51,900 --> 00:31:53,560 You're going to get lots of RF reflections, 784 00:31:53,760 --> 00:31:55,940 and they're all going to destructively interfere 785 00:31:55,940 --> 00:31:58,500 at your receiver and degrade your signal. 786 00:31:58,740 --> 00:32:01,240 That's why in modern modulation schemes, 787 00:32:01,480 --> 00:32:04,480 OFDM is pretty much the scheme of choice 788 00:32:04,480 --> 00:32:07,560 because it's well designed to be equalized 789 00:32:07,560 --> 00:32:09,460 at the receiver so that your receiver 790 00:32:09,460 --> 00:32:11,700 can actually take into account that multipath, 791 00:32:11,700 --> 00:32:12,680 do some fancy processing, 792 00:32:12,840 --> 00:32:14,280 and recover a good signal. 793 00:32:15,360 --> 00:32:16,320 Not something you have to worry about 794 00:32:16,320 --> 00:32:17,220 for satellite links. 795 00:32:17,940 --> 00:32:19,500 So the next step is, 796 00:32:19,600 --> 00:32:21,100 we're going to take a wild guess 797 00:32:21,100 --> 00:32:22,880 that this might be some sort of phase shift keying. 798 00:32:23,420 --> 00:32:24,700 Now, with phase shift keying, 799 00:32:25,520 --> 00:32:29,380 you can have BPSK, QPSK, 8PSK. 800 00:32:29,480 --> 00:32:31,620 It basically determines the number of points 801 00:32:31,620 --> 00:32:33,120 in your constellation. 802 00:32:33,400 --> 00:32:34,680 But we don't know what they are, 803 00:32:34,740 --> 00:32:36,240 and there's a really easy technique 804 00:32:36,240 --> 00:32:37,960 that you can use to figure out 805 00:32:37,960 --> 00:32:41,260 what the order of your phase shift keying actually is. 806 00:32:41,380 --> 00:32:42,500 And I'll show you what that is. 807 00:32:42,700 --> 00:32:43,920 But the first thing is, 808 00:32:43,920 --> 00:32:47,140 we need to clean up our user interface a little bit. 809 00:32:47,300 --> 00:32:51,000 So I'm going to add a notebook. 810 00:32:54,120 --> 00:32:56,180 Can you do, Tim, 811 00:32:56,660 --> 00:32:59,060 can you do notebooks or equivalent in QT? 812 00:33:01,540 --> 00:33:02,060 What? 813 00:33:03,660 --> 00:33:04,620 All right, okay. 814 00:33:04,940 --> 00:33:10,680 So I'm just going to give these things some names. 815 00:33:11,860 --> 00:33:13,360 First one we're going to call it cap, 816 00:33:13,360 --> 00:33:14,600 and the next one we're going to call it BB, 817 00:33:14,740 --> 00:33:16,340 and the next one we're going to call it power. 818 00:33:18,560 --> 00:33:20,080 And then down here, 819 00:33:20,540 --> 00:33:22,020 you can put the notebook. 820 00:33:22,200 --> 00:33:23,740 So I'm going to call it MB0, 821 00:33:25,620 --> 00:33:27,760 and call the notebook NB. 822 00:33:28,920 --> 00:33:34,020 And then this one we're going to put in NB1. 823 00:33:35,740 --> 00:33:38,740 And then we're going to use another FFT, 824 00:33:39,540 --> 00:33:42,460 and we're going to put that in NB2. 825 00:33:42,460 --> 00:33:46,540 Now there's a really neat trick you can do with PSK, 826 00:33:46,680 --> 00:33:51,060 which is multiply the signal by itself a certain number of times. 827 00:33:51,140 --> 00:33:54,500 So basically you raise each sample to a power, 828 00:33:55,240 --> 00:33:59,860 and when you get nice peaks popping up out of your FFT, 829 00:34:00,000 --> 00:34:02,240 you've identified the order of the modulation. 830 00:34:02,680 --> 00:34:04,020 So you can square it, 831 00:34:04,080 --> 00:34:05,680 and if you get peaks, it's BPSK. 832 00:34:05,780 --> 00:34:08,100 If you raise it to the power of 4, 833 00:34:08,140 --> 00:34:09,840 and you get peaks after an FFT, 834 00:34:10,020 --> 00:34:12,440 it's given to you. 835 00:34:12,440 --> 00:34:12,680 So it's BPSK. 836 00:34:12,880 --> 00:34:14,380 If you do 8, then it's... 837 00:34:14,880 --> 00:34:15,840 Right, easy. 838 00:34:17,280 --> 00:34:19,420 So if you have GRBAS installed, 839 00:34:19,760 --> 00:34:22,420 there's a block there called the power block. 840 00:34:23,900 --> 00:34:25,460 And if you don't have that, 841 00:34:25,620 --> 00:34:27,200 then you can cheat, 842 00:34:27,300 --> 00:34:30,040 and you can basically just do... 843 00:34:34,360 --> 00:34:35,260 do this. 844 00:34:38,000 --> 00:34:38,480 Right? 845 00:34:38,720 --> 00:34:41,420 So you'll end up having the same signal going to each of these ports, 846 00:34:41,420 --> 00:34:42,760 if you want to raise it to the power of 4. 847 00:34:44,720 --> 00:34:45,820 But we're not going to do that, 848 00:34:45,880 --> 00:34:47,180 because we don't want to restart the flow graph. 849 00:34:47,360 --> 00:34:50,800 This one, you can actually change it at runtime. 850 00:34:51,040 --> 00:34:52,240 So I'm going to add a slider now, 851 00:34:52,340 --> 00:34:58,540 so that we can change the power of the exponent. 852 00:34:59,200 --> 00:35:00,740 So it's going to be 1 by default. 853 00:35:00,860 --> 00:35:03,260 We're going to go from 1 to, say, 8. 854 00:35:10,240 --> 00:35:11,120 And then... 855 00:35:11,120 --> 00:35:11,840 Why is that complaining? 856 00:35:12,200 --> 00:35:13,200 Oh, it's blacklisted. 857 00:35:13,260 --> 00:35:13,880 Of course it is. 858 00:35:19,940 --> 00:35:22,420 So now we just basically take that off our original signal, 859 00:35:22,600 --> 00:35:24,300 put it into an FFT like that, 860 00:35:24,440 --> 00:35:25,680 and then run. 861 00:35:27,360 --> 00:35:28,840 Now, because we've got the config there, 862 00:35:28,920 --> 00:35:31,880 hopefully it remembered our channel selection from last time, 863 00:35:31,920 --> 00:35:32,360 which it has. 864 00:35:32,520 --> 00:35:33,140 There you go. 865 00:35:34,240 --> 00:35:35,460 Baseband is there. 866 00:35:35,960 --> 00:35:37,240 And then we go to the power. 867 00:35:37,400 --> 00:35:38,520 Now, we've raised it to 1, 868 00:35:38,600 --> 00:35:39,860 so we should get exactly the same signal. 869 00:35:40,020 --> 00:35:41,980 But if we do it to the power of 2, 870 00:35:43,140 --> 00:35:43,840 it's disappeared. 871 00:35:44,360 --> 00:35:47,560 Can anybody tell me why it's disappeared off the current chart? 872 00:35:50,220 --> 00:35:51,680 Think about the values. 873 00:35:51,760 --> 00:35:52,780 I'm taking the samples, 874 00:35:52,840 --> 00:35:54,040 and I'm raising them to a power. 875 00:35:54,180 --> 00:35:54,980 What kind of... 876 00:35:54,980 --> 00:35:55,600 Pardon? 877 00:35:56,440 --> 00:35:56,840 Scale. 878 00:35:56,880 --> 00:35:57,440 Scale, yeah. 879 00:35:58,300 --> 00:36:00,100 Small number gets way smaller than spread. 880 00:36:00,240 --> 00:36:00,600 That's right. 881 00:36:00,660 --> 00:36:02,400 Small number, we've raised it to a power. 882 00:36:02,400 --> 00:36:03,260 It's going to get much smaller. 883 00:36:03,480 --> 00:36:05,160 So, luckily, it's still going to be there, 884 00:36:05,200 --> 00:36:05,800 so we auto-scale, 885 00:36:05,960 --> 00:36:06,760 and it's there, 886 00:36:06,840 --> 00:36:08,320 and we average it. 887 00:36:08,520 --> 00:36:11,420 You can see that it pretty much has the same sort of shape. 888 00:36:12,120 --> 00:36:13,320 We're not seeing any peaks, 889 00:36:13,840 --> 00:36:15,780 so it's probably not BPSK. 890 00:36:16,660 --> 00:36:18,400 Now, let's raise it to the power of 4. 891 00:36:21,620 --> 00:36:23,600 We're not going to check for 3 PSK. 892 00:36:25,180 --> 00:36:26,480 So, we're going to go to 4, 893 00:36:27,680 --> 00:36:28,900 and turn average off, 894 00:36:29,080 --> 00:36:30,600 make it skip along, 895 00:36:30,600 --> 00:36:31,620 auto-scale. 896 00:36:31,900 --> 00:36:32,560 What do you know? 897 00:36:32,600 --> 00:36:32,940 Look at that. 898 00:36:35,320 --> 00:36:37,660 We've got some nice peaks there. 899 00:36:37,940 --> 00:36:42,440 Now, because our signal here is actually quite narrow band, 900 00:36:42,640 --> 00:36:44,880 narrower than the channel we've decimated to, 901 00:36:45,040 --> 00:36:46,460 I can drag this slider 902 00:36:46,460 --> 00:36:50,980 that's actually changing the low pass filter there, 903 00:36:51,140 --> 00:36:52,140 and watch what happens. 904 00:36:53,220 --> 00:36:54,700 I can narrow that in 905 00:36:54,700 --> 00:36:57,500 to cut out all the noise around our signal of interest, 906 00:36:57,740 --> 00:36:59,540 and it's just going to be left with that. 907 00:36:59,540 --> 00:37:01,020 So, now if we go to the power, 908 00:37:01,140 --> 00:37:02,460 it's also cut it off here. 909 00:37:02,540 --> 00:37:03,640 We've got some nice peaks. 910 00:37:04,040 --> 00:37:06,300 Now, with PSK, 911 00:37:06,380 --> 00:37:08,120 you get these characteristic peaks 912 00:37:08,120 --> 00:37:10,920 where you get one large one in the center, 913 00:37:11,540 --> 00:37:12,540 and that's really neat 914 00:37:12,540 --> 00:37:14,760 because it's almost like it's recreating the carrier 915 00:37:15,360 --> 00:37:18,680 that is suppressed normally in phase shift keying. 916 00:37:18,840 --> 00:37:20,400 And what's cool about this 917 00:37:20,400 --> 00:37:24,120 is that you can actually look carefully, 918 00:37:26,720 --> 00:37:28,920 and you see how it's off zero? 919 00:37:29,820 --> 00:37:31,940 That's because when I did my channel selection 920 00:37:31,940 --> 00:37:32,920 and my frequency translation, 921 00:37:33,260 --> 00:37:35,380 I didn't hit the center frequency 922 00:37:35,380 --> 00:37:37,340 of this particular signal right on. 923 00:37:37,380 --> 00:37:37,960 It's slightly off. 924 00:37:38,160 --> 00:37:40,480 So, you can use this as a carrier 925 00:37:40,480 --> 00:37:42,180 to track your signal 926 00:37:42,180 --> 00:37:45,180 and then mix it exactly back down to base band. 927 00:37:45,580 --> 00:37:48,660 So, that's doing some very fine frequency correction. 928 00:37:48,940 --> 00:37:49,820 It's a nice little technique. 929 00:37:50,080 --> 00:37:51,560 We don't really have to worry about that now 930 00:37:51,560 --> 00:37:54,340 because we're going to use a costus loop letter 931 00:37:54,340 --> 00:37:55,260 to take care of this. 932 00:37:55,500 --> 00:37:58,100 But what's important is that these two peaks 933 00:37:58,100 --> 00:37:59,520 on the side of all social networks 934 00:37:59,540 --> 00:37:59,780 are going to tone up. 935 00:38:00,040 --> 00:38:02,720 So, these three together show you that it's QPSK. 936 00:38:04,280 --> 00:38:06,180 And what's also interesting is that 937 00:38:07,540 --> 00:38:08,840 although we're slightly off, 938 00:38:09,100 --> 00:38:11,080 we can correct for this manually, say, 939 00:38:11,240 --> 00:38:12,640 if we have a look here, 940 00:38:12,740 --> 00:38:15,320 we're at about, what's that, 800. 941 00:38:16,240 --> 00:38:18,620 So, if we get rid of that. 942 00:38:19,580 --> 00:38:20,440 Oh, wrong way. 943 00:38:22,900 --> 00:38:23,920 Center it up a little bit. 944 00:38:24,280 --> 00:38:26,620 And actually, if you look carefully, 945 00:38:26,760 --> 00:38:28,480 it's moving around a little bit as well. 946 00:38:28,480 --> 00:38:31,060 So, you can test that by turning on peak hold. 947 00:38:31,700 --> 00:38:35,940 And if you end up scraping out a bit of peak hold there, 948 00:38:36,040 --> 00:38:38,240 it means that actually you've got clock drift. 949 00:38:38,460 --> 00:38:39,800 It could be your receiver. 950 00:38:39,960 --> 00:38:41,340 It could be the LNB. 951 00:38:41,740 --> 00:38:42,920 It could be the satellite. 952 00:38:43,040 --> 00:38:45,120 Or it could be the original transmitter on the ground. 953 00:38:45,260 --> 00:38:48,440 All these things can contribute to this frequency change. 954 00:38:49,140 --> 00:38:51,300 And it's important when you design a receiver 955 00:38:51,300 --> 00:38:53,640 to be able to handle this sort of clock drift. 956 00:38:53,820 --> 00:38:55,120 And I'll show you how to do that in a minute. 957 00:38:55,160 --> 00:38:56,980 But you can see that it's actually drifting quite a bit there. 958 00:38:57,620 --> 00:39:00,400 Well, depends upon what you define as quite a bit. 959 00:39:01,020 --> 00:39:02,120 But it is drifting. 960 00:39:02,860 --> 00:39:05,400 Now, let's just assume that's around about center there at zero. 961 00:39:05,520 --> 00:39:06,540 You can mix that down. 962 00:39:06,720 --> 00:39:08,360 You've got these peaks out here. 963 00:39:08,480 --> 00:39:11,460 Can anybody tell me what would determine 964 00:39:11,980 --> 00:39:14,820 how far away these peaks are from DC? 965 00:39:15,640 --> 00:39:16,600 Any guesses? 966 00:39:17,860 --> 00:39:22,560 Border rate, yeah. 967 00:39:22,740 --> 00:39:24,060 So, with PSK, it's really nice 968 00:39:24,060 --> 00:39:26,900 because you can actually figure out 969 00:39:26,980 --> 00:39:28,980 what the border rate of your signal is. 970 00:39:29,180 --> 00:39:30,740 When you don't know anything about our signal, 971 00:39:30,760 --> 00:39:31,900 remember, we just saw something interesting. 972 00:39:32,200 --> 00:39:33,680 We now know that it's QPSK, 973 00:39:33,740 --> 00:39:35,640 and we now know how to actually figure out 974 00:39:35,640 --> 00:39:38,580 the rate at which symbols are being transmitted in our stream. 975 00:39:39,100 --> 00:39:42,100 So, that's one way, and it works nicely with PSK. 976 00:39:42,240 --> 00:39:43,120 I'm going to show you another way 977 00:39:43,120 --> 00:39:46,380 that can be used to extract the border rate. 978 00:39:47,620 --> 00:39:48,760 And we're going to make a new tab. 979 00:39:57,440 --> 00:39:58,820 I think it should work for that, too. 980 00:39:59,000 --> 00:40:00,960 I've not actually tried, but I think it should. 981 00:40:02,220 --> 00:40:02,780 You know what I mean? 982 00:40:02,820 --> 00:40:04,000 It's easy to simulate that in good and great. 983 00:40:05,740 --> 00:40:06,960 So, I'm going to make a new tab. 984 00:40:07,000 --> 00:40:08,040 I'm going to call it Board. 985 00:40:08,600 --> 00:40:11,520 And then what I'm going to do is 986 00:40:11,900 --> 00:40:16,300 I'm going to do what is essentially 987 00:40:16,300 --> 00:40:19,180 very simple cyclostationary analysis. 988 00:40:19,900 --> 00:40:22,060 So, what I'm going to do is I'm going to take the signal 989 00:40:22,620 --> 00:40:25,060 and multiply it by a delayed version of itself. 990 00:40:25,060 --> 00:40:27,480 So, I'm going to get a delay block. 991 00:40:29,760 --> 00:40:31,340 I'm going to set the delay to 1. 992 00:40:32,740 --> 00:40:34,000 And then I'm going to get, 993 00:40:34,100 --> 00:40:35,920 because we're in the complex domain, 994 00:40:36,220 --> 00:40:41,420 you can get the complex conjugate multiply block. 995 00:40:42,160 --> 00:40:43,260 Oops, wrong one. 996 00:40:45,980 --> 00:40:46,660 Like this. 997 00:40:47,240 --> 00:40:49,280 And then hook that up, 998 00:40:49,280 --> 00:40:51,100 hook that up to the original stream. 999 00:40:53,420 --> 00:40:55,040 And then we're going to take an F50, 1000 00:40:55,060 --> 00:40:55,700 an FFT of this. 1001 00:41:00,080 --> 00:41:01,980 But we don't want a complex FFT. 1002 00:41:02,120 --> 00:41:05,760 We want just an FFT of the magnitude of the output. 1003 00:41:05,940 --> 00:41:07,520 So, we're going to go complex to magnitude. 1004 00:41:07,900 --> 00:41:09,620 We're going to discard the phase information 1005 00:41:09,620 --> 00:41:11,020 from our complex stream. 1006 00:41:11,100 --> 00:41:12,960 Just look at the bins. 1007 00:41:13,340 --> 00:41:14,260 Take an FFT. 1008 00:41:16,060 --> 00:41:17,580 And see what pops up. 1009 00:41:23,920 --> 00:41:31,880 So, I've got that on the wrong tab there, 1010 00:41:31,960 --> 00:41:32,980 but I'll correct that in a minute. 1011 00:41:33,400 --> 00:41:36,080 We bring our low pass filter in again. 1012 00:41:36,760 --> 00:41:39,740 We've got our nice channelized signal there. 1013 00:41:40,760 --> 00:41:41,940 But notice here, 1014 00:41:42,720 --> 00:41:46,100 we're multiplying the signal by one sample delayed version of itself 1015 00:41:46,100 --> 00:41:47,560 and then taking the FFT of that. 1016 00:41:47,560 --> 00:41:48,420 You can see the magnitude. 1017 00:41:48,860 --> 00:41:51,800 And this is the nice effect of actually uncovering 1018 00:41:51,800 --> 00:41:53,680 the periodicity of the symbols 1019 00:41:53,680 --> 00:41:57,120 in your original captured stream. 1020 00:41:57,440 --> 00:41:58,640 And once you take the FFT, 1021 00:41:58,820 --> 00:42:02,020 you're basically looking at these strong frequency components 1022 00:42:02,020 --> 00:42:02,820 that'll pop out 1023 00:42:02,820 --> 00:42:05,880 when you have some sort of periodic timing in your signal. 1024 00:42:06,060 --> 00:42:06,940 And in this case, 1025 00:42:07,100 --> 00:42:08,480 you look for the first peak. 1026 00:42:08,820 --> 00:42:09,440 And you, 1027 00:42:09,600 --> 00:42:11,480 if we put the mouse cursor there, 1028 00:42:11,700 --> 00:42:15,220 it's actually at 963333 kilohertz. 1029 00:42:15,360 --> 00:42:16,060 9.3. 1030 00:42:16,120 --> 00:42:17,000 So, 9.6. 1031 00:42:17,560 --> 00:42:17,680 So, actually, 1032 00:42:17,680 --> 00:42:18,440 what do you know? 1033 00:42:18,740 --> 00:42:19,540 What board rate? 1034 00:42:19,600 --> 00:42:20,700 What common board rate is it? 1035 00:42:21,600 --> 00:42:22,000 9600. 1036 00:42:22,300 --> 00:42:22,900 Board rate. 1037 00:42:22,960 --> 00:42:24,560 Like the old modems in the old days. 1038 00:42:24,880 --> 00:42:25,280 So, 1039 00:42:25,960 --> 00:42:26,920 that's kind of neat. 1040 00:42:27,040 --> 00:42:28,600 You can get that information out pretty quickly. 1041 00:42:28,980 --> 00:42:29,380 Now, 1042 00:42:29,500 --> 00:42:30,980 we can take that a step further. 1043 00:42:32,100 --> 00:42:32,500 And, 1044 00:42:32,580 --> 00:42:34,540 and this is where some, 1045 00:42:34,540 --> 00:42:37,380 a little bit more Gnu Radio trickery comes in. 1046 00:42:38,020 --> 00:42:38,700 Let's say, 1047 00:42:38,720 --> 00:42:41,720 we don't just want to be able to put it into an FFT 1048 00:42:41,720 --> 00:42:42,900 and have to read off a graph 1049 00:42:42,900 --> 00:42:44,440 and manually look for the first peak. 1050 00:42:45,180 --> 00:42:47,360 We want Gnu Radio to do all that for us. 1051 00:42:47,560 --> 00:42:49,140 And you can actually do that with some blocks. 1052 00:42:49,480 --> 00:42:50,980 And what I want to emphasize is that 1053 00:42:50,980 --> 00:42:53,840 you can do these sorts of constructions within Gnu Radio, 1054 00:42:53,960 --> 00:42:54,340 and they're all, 1055 00:42:54,460 --> 00:42:54,980 as you can see, 1056 00:42:55,060 --> 00:42:56,680 pretty simple mathematical operations. 1057 00:42:57,120 --> 00:42:58,540 But I want to emphasize that 1058 00:42:59,040 --> 00:43:00,640 in this particular setup, 1059 00:43:00,760 --> 00:43:03,680 we're looking at a streaming continuous flow 1060 00:43:03,680 --> 00:43:05,180 of this particular channel. 1061 00:43:05,460 --> 00:43:06,940 In other communication systems, 1062 00:43:07,240 --> 00:43:08,760 you're going to have bursts of data. 1063 00:43:09,000 --> 00:43:10,160 And those bursts of data, 1064 00:43:10,880 --> 00:43:14,000 you might need to analyze as discrete sets of samples 1065 00:43:14,000 --> 00:43:15,460 instead of in a continuous fashion. 1066 00:43:15,900 --> 00:43:16,340 So, 1067 00:43:16,340 --> 00:43:18,060 for that, 1068 00:43:18,240 --> 00:43:19,640 I recommend that you 1069 00:43:20,680 --> 00:43:23,180 might consider using something like Boardline. 1070 00:43:23,960 --> 00:43:25,080 It's getting, 1071 00:43:25,180 --> 00:43:26,320 growing pretty popular now. 1072 00:43:27,400 --> 00:43:28,900 I've been using it for years, 1073 00:43:28,980 --> 00:43:30,520 and Eric Olson, 1074 00:43:30,580 --> 00:43:31,080 who's the author, 1075 00:43:31,240 --> 00:43:32,480 keeps adding more features 1076 00:43:32,480 --> 00:43:35,440 and increasing the FFT process size. 1077 00:43:35,600 --> 00:43:37,900 And it's even featured on documentaries on TV 1078 00:43:37,900 --> 00:43:39,160 and things like that. 1079 00:43:39,200 --> 00:43:40,020 It's getting interesting, 1080 00:43:40,180 --> 00:43:41,800 making interesting appearances. 1081 00:43:42,140 --> 00:43:46,100 But it's jam-packed with really lots of advanced tools 1082 00:43:46,100 --> 00:43:49,920 that make it really an indispensable tool 1083 00:43:49,920 --> 00:43:50,580 that you can use. 1084 00:43:50,680 --> 00:43:52,740 And I might also add that 1085 00:43:58,160 --> 00:43:58,880 in gRBAS, 1086 00:43:58,920 --> 00:44:00,640 there's a block called the Boardline sink. 1087 00:44:00,940 --> 00:44:03,760 So, like the QT sink and the WX sink, 1088 00:44:03,880 --> 00:44:05,640 you can drop one of these blocks in, 1089 00:44:05,680 --> 00:44:06,440 hook it up to your flow graph. 1090 00:44:06,500 --> 00:44:07,380 When you run the flow graph, 1091 00:44:07,760 --> 00:44:08,900 it'll run Boardline 1092 00:44:08,900 --> 00:44:11,440 and actually feed the samples into it live 1093 00:44:11,440 --> 00:44:13,280 if you want to do something cool in Boardline. 1094 00:44:14,100 --> 00:44:15,420 So, if you want to check that out. 1095 00:44:15,960 --> 00:44:18,480 This here is actually another capture 1096 00:44:18,480 --> 00:44:20,360 I did off another transponder on that satellite. 1097 00:44:20,580 --> 00:44:22,020 And what's interesting about this capture 1098 00:44:22,020 --> 00:44:25,180 is that instead of being those continuous streams 1099 00:44:25,180 --> 00:44:26,720 like you saw... 1100 00:44:28,780 --> 00:44:32,700 What are the damn meta keys on the Mac 1101 00:44:32,700 --> 00:44:33,360 for doing this? 1102 00:44:34,120 --> 00:44:34,980 Why doesn't it work? 1103 00:44:38,180 --> 00:44:39,240 Oh no, it's just slow. 1104 00:44:39,420 --> 00:44:39,880 There you go. 1105 00:44:40,260 --> 00:44:41,340 That's because... 1106 00:44:47,640 --> 00:44:49,420 Where is my scroll control? 1107 00:44:55,240 --> 00:44:56,060 Okay, there we go. 1108 00:44:56,860 --> 00:44:58,580 So, here you've actually got 1109 00:44:58,580 --> 00:44:59,880 a bunch of different channels 1110 00:44:59,880 --> 00:45:01,340 allocated on this transponder, 1111 00:45:01,460 --> 00:45:04,480 but you have bursts of data 1112 00:45:04,480 --> 00:45:05,580 coming up from the ground 1113 00:45:05,580 --> 00:45:07,260 and then being relayed by the satellite. 1114 00:45:07,500 --> 00:45:08,940 I mean, I'm just theorizing this. 1115 00:45:09,000 --> 00:45:09,800 I don't know for certain. 1116 00:45:10,020 --> 00:45:11,400 But what's interesting is that 1117 00:45:11,400 --> 00:45:12,860 these are all individual bursts, 1118 00:45:13,120 --> 00:45:14,080 individual packets, 1119 00:45:14,080 --> 00:45:16,320 and they're in different channels. 1120 00:45:16,580 --> 00:45:17,700 And you'll also notice 1121 00:45:17,700 --> 00:45:19,620 that they're of different color intensity. 1122 00:45:19,720 --> 00:45:21,180 So, obviously, they're different amplitudes. 1123 00:45:21,260 --> 00:45:22,220 So, you might surmise 1124 00:45:22,220 --> 00:45:23,840 that actually they're distributed 1125 00:45:23,840 --> 00:45:25,800 around a wide geographical area. 1126 00:45:26,060 --> 00:45:28,360 They might be sort of offset pointing. 1127 00:45:28,600 --> 00:45:29,620 They might have larger distances. 1128 00:45:29,940 --> 00:45:31,380 So, you get different amounts of attenuation. 1129 00:45:31,960 --> 00:45:33,840 And so, those packets are coming through 1130 00:45:33,840 --> 00:45:36,320 and it's some sort of potentially TDMA system, 1131 00:45:36,580 --> 00:45:37,940 Time Division Multiplexing, 1132 00:45:37,940 --> 00:45:39,060 for multiple users. 1133 00:45:39,420 --> 00:45:41,360 And also, you'll note that 1134 00:45:41,360 --> 00:45:43,280 you have these regular blocks 1135 00:45:43,280 --> 00:45:43,980 that occur... 1136 00:45:44,080 --> 00:45:44,980 at the beginning of a packet. 1137 00:45:45,160 --> 00:45:46,040 So, this is some sort of 1138 00:45:47,140 --> 00:45:48,020 synchronization signal 1139 00:45:48,020 --> 00:45:50,060 so that the receiver can lock onto these 1140 00:45:50,060 --> 00:45:51,080 particular signals 1141 00:45:51,600 --> 00:45:52,940 that might be coming from different areas 1142 00:45:52,940 --> 00:45:53,740 because they're all going to have 1143 00:45:53,740 --> 00:45:55,220 a slightly different frequency offset. 1144 00:45:55,520 --> 00:45:57,840 So, if you just, in this instance, 1145 00:45:57,980 --> 00:45:58,580 have a tone, 1146 00:45:58,780 --> 00:46:00,800 the receiver knows what tone to expect. 1147 00:46:01,120 --> 00:46:02,940 It can lock to it quickly with a PLL 1148 00:46:02,940 --> 00:46:04,100 and then have a good chance 1149 00:46:04,100 --> 00:46:05,360 of decoding the rest of the packet. 1150 00:46:06,020 --> 00:46:07,480 Now, because they're bursts, 1151 00:46:07,720 --> 00:46:09,820 having that kind of continuous analysis 1152 00:46:09,820 --> 00:46:11,400 and it doesn't really work. 1153 00:46:11,660 --> 00:46:12,640 So, in this case, 1154 00:46:12,640 --> 00:46:15,140 you'd probably use Boardline, for example. 1155 00:46:15,280 --> 00:46:17,900 You can select a packet, like so, 1156 00:46:18,940 --> 00:46:19,980 and then right-click 1157 00:46:19,980 --> 00:46:22,480 and you can actually go Save Selection As. 1158 00:46:23,060 --> 00:46:24,280 So, that'll actually allow you 1159 00:46:24,280 --> 00:46:25,220 to pull that selection out. 1160 00:46:25,400 --> 00:46:27,400 You can import those raw samples 1161 00:46:27,400 --> 00:46:28,700 into something like Octiv, 1162 00:46:28,880 --> 00:46:31,300 which is the open-source equivalent of Matlab, 1163 00:46:31,460 --> 00:46:34,040 or, like we'll hopefully have time 1164 00:46:34,040 --> 00:46:34,840 to do a little bit later on, 1165 00:46:34,880 --> 00:46:37,200 use NumPy and Matplotlib 1166 00:46:37,200 --> 00:46:39,480 and there are some really nice 1167 00:46:39,480 --> 00:46:41,420 DSP filtering functions in there. 1168 00:46:41,420 --> 00:46:44,060 And you can actually then do the same process 1169 00:46:44,060 --> 00:46:46,140 each step as we've been doing in GNU Radio. 1170 00:46:46,220 --> 00:46:47,760 So, channel selection, filtering, 1171 00:46:48,740 --> 00:46:51,260 and then multiplying all the samples by themselves 1172 00:46:51,260 --> 00:46:53,040 or raising to a power and so on, 1173 00:46:53,060 --> 00:46:53,940 and then plotting it out 1174 00:46:53,940 --> 00:46:54,960 and just getting these static graphs. 1175 00:46:55,260 --> 00:46:56,380 So, I just want to emphasize 1176 00:46:56,380 --> 00:46:57,280 that you can do all this 1177 00:46:57,280 --> 00:46:59,000 on a burst basis as well. 1178 00:46:59,100 --> 00:47:01,340 I won't go through it this time, 1179 00:47:01,440 --> 00:47:03,000 but just keep that in mind 1180 00:47:03,000 --> 00:47:05,060 if you want to do analysis like this later on. 1181 00:47:06,020 --> 00:47:08,240 So, we got up to this stage, 1182 00:47:08,300 --> 00:47:11,120 but the target is to get, actually, 1183 00:47:11,420 --> 00:47:12,940 a number appearing on the screen 1184 00:47:12,940 --> 00:47:14,660 telling us what the baud rate is. 1185 00:47:14,780 --> 00:47:16,200 How do you go about doing that? 1186 00:47:16,520 --> 00:47:17,580 So, let's have a quick look at that. 1187 00:47:20,720 --> 00:47:22,760 I'm going to be a little bit lazy 1188 00:47:22,760 --> 00:47:23,900 and just copy some of the stuff 1189 00:47:23,900 --> 00:47:24,680 that I had before. 1190 00:47:27,100 --> 00:47:29,120 In the interest of time, let's see. 1191 00:47:29,960 --> 00:47:31,720 Where does this crazy thing start? 1192 00:47:35,900 --> 00:47:36,340 Right. 1193 00:47:38,060 --> 00:47:39,700 So, what's happening here is that 1194 00:47:39,700 --> 00:47:40,820 you'll notice we have our 1195 00:47:41,960 --> 00:47:44,940 construction here during the cyclostation analysis. 1196 00:47:45,320 --> 00:47:46,380 You've got the delay, 1197 00:47:46,520 --> 00:47:47,160 multiply conjugate, 1198 00:47:47,420 --> 00:47:48,020 complex to mag, 1199 00:47:48,100 --> 00:47:48,780 and the FFT sink. 1200 00:47:48,860 --> 00:47:49,440 We did that already. 1201 00:47:49,980 --> 00:47:51,640 But you'll notice that there's this additional line 1202 00:47:51,640 --> 00:47:54,280 coming down from the output of magnitude. 1203 00:47:56,040 --> 00:47:58,700 This is going into the stream-to-vector block. 1204 00:47:59,100 --> 00:48:03,300 What we want to do is we want to do an FFT. 1205 00:48:03,900 --> 00:48:06,080 So, remember, when we put this block down, 1206 00:48:06,140 --> 00:48:08,260 it has an FFT module inside it already 1207 00:48:08,260 --> 00:48:09,440 that's going to do the FFT, 1208 00:48:09,580 --> 00:48:10,680 but now we're breaking it out. 1209 00:48:10,680 --> 00:48:12,000 We're breaking out the raw components. 1210 00:48:12,140 --> 00:48:13,880 So, we're going to do an FFT manually here 1211 00:48:13,880 --> 00:48:15,340 that this is already doing. 1212 00:48:15,740 --> 00:48:17,180 So, when we did that, 1213 00:48:17,220 --> 00:48:19,300 remember we saw that nice graph 1214 00:48:19,300 --> 00:48:21,020 with that big peak at 9600. 1215 00:48:22,540 --> 00:48:23,580 We do the FFT. 1216 00:48:24,520 --> 00:48:26,180 Because this is accepting vectors, 1217 00:48:26,300 --> 00:48:27,580 we need to go stream-to-vector 1218 00:48:27,580 --> 00:48:28,540 and then vector-to-stream. 1219 00:48:29,380 --> 00:48:31,820 But because we have a FFT 1220 00:48:31,820 --> 00:48:35,360 of a real floating-point sample stream, 1221 00:48:36,420 --> 00:48:37,800 you get symmetry. 1222 00:48:37,920 --> 00:48:39,060 You get a symmetrical spectrum 1223 00:48:39,580 --> 00:48:40,280 when you do that 1224 00:48:40,680 --> 00:48:41,960 because it's real and sort of complex. 1225 00:48:42,140 --> 00:48:43,880 It's just the nature of the transform. 1226 00:48:44,160 --> 00:48:45,560 So, actually, what we want to do then 1227 00:48:45,560 --> 00:48:47,160 is we want to throw out half the information 1228 00:48:47,160 --> 00:48:49,840 because it's just symmetrical duplicate 1229 00:48:49,840 --> 00:48:50,960 of the first half of it. 1230 00:48:51,280 --> 00:48:52,300 And to do that, 1231 00:48:52,340 --> 00:48:55,320 you can use this keep m in n block. 1232 00:48:55,700 --> 00:48:58,820 So, we had a transform size of 4K, 1233 00:48:58,940 --> 00:49:00,520 and what we're saying is 1234 00:49:00,520 --> 00:49:02,220 we want to keep 2,000 of those 1235 00:49:02,220 --> 00:49:03,720 out of the 4,000. 1236 00:49:03,800 --> 00:49:06,020 So, we basically throw out 1237 00:49:06,020 --> 00:49:07,720 the second 2,000 samples. 1238 00:49:08,800 --> 00:49:10,660 And then once we've got those two, 1239 00:49:10,680 --> 00:49:11,360 2,000 samples, 1240 00:49:11,420 --> 00:49:12,760 which now represent that spectrum 1241 00:49:12,760 --> 00:49:14,880 that we saw on the GUI before, 1242 00:49:15,100 --> 00:49:16,160 we go stream-to-vector, 1243 00:49:16,220 --> 00:49:17,100 turn it back into a vector, 1244 00:49:17,920 --> 00:49:18,800 get the magnitude 1245 00:49:18,800 --> 00:49:20,120 because we're just interested 1246 00:49:20,120 --> 00:49:21,480 in the strength of all those bins. 1247 00:49:22,160 --> 00:49:23,660 We go back to vector-to-stream. 1248 00:49:24,000 --> 00:49:25,040 And this is where it gets 1249 00:49:25,040 --> 00:49:25,800 a little bit interesting 1250 00:49:26,800 --> 00:49:28,000 because if you... 1251 00:49:28,000 --> 00:49:29,480 I'll run the flow graph again 1252 00:49:29,480 --> 00:49:30,100 so you can see. 1253 00:49:33,920 --> 00:49:35,880 If you look at the FFT, 1254 00:49:41,120 --> 00:49:43,400 then it's a little bit difficult to see. 1255 00:49:43,460 --> 00:49:44,420 Maybe you'll be able to tell. 1256 00:49:45,320 --> 00:49:50,060 But we said find the first highest peak. 1257 00:49:50,420 --> 00:49:52,340 It looks like this one, right? 1258 00:49:53,180 --> 00:49:54,640 If you were to search through 1259 00:49:54,640 --> 00:49:56,360 the magnitudes of all of these bins 1260 00:49:56,360 --> 00:49:57,660 in this FFT transform, 1261 00:49:58,160 --> 00:49:59,840 is that going to be the largest peak 1262 00:49:59,840 --> 00:50:00,300 that it finds? 1263 00:50:02,580 --> 00:50:03,440 Look over here. 1264 00:50:04,000 --> 00:50:07,120 You get this very rapid increase toward DC. 1265 00:50:07,440 --> 00:50:08,120 So actually, 1266 00:50:08,240 --> 00:50:10,480 there are some very low-frequency components 1267 00:50:10,480 --> 00:50:12,160 in the signal that are very, very strong, 1268 00:50:12,700 --> 00:50:13,720 or even up to DC. 1269 00:50:13,960 --> 00:50:15,760 And so if you were to try and find 1270 00:50:15,760 --> 00:50:18,500 the bin that has the maximum value in it, 1271 00:50:18,560 --> 00:50:19,900 you're going to end up finding something down there, 1272 00:50:19,960 --> 00:50:21,280 which is not what we want. 1273 00:50:22,360 --> 00:50:24,440 So a little workaround for that. 1274 00:50:25,200 --> 00:50:26,620 I'm hoping this will sort of get you 1275 00:50:26,620 --> 00:50:28,600 in the mindset of doing interesting 1276 00:50:28,600 --> 00:50:29,880 hackery with GNU Radio. 1277 00:50:30,220 --> 00:50:31,880 The idea is that up to this point, 1278 00:50:31,940 --> 00:50:33,240 all we've been doing is 1279 00:50:33,440 --> 00:50:35,800 getting that FFT information. 1280 00:50:36,160 --> 00:50:37,920 We've been cutting out the second half of the FFT. 1281 00:50:38,100 --> 00:50:39,220 We've got that bit of information, 1282 00:50:39,400 --> 00:50:41,500 and we just want to find the bin 1283 00:50:41,500 --> 00:50:42,840 that has the most energy in it. 1284 00:50:43,320 --> 00:50:45,500 But we want to ignore those bins 1285 00:50:45,500 --> 00:50:46,760 down the front near DC, 1286 00:50:46,900 --> 00:50:48,060 because that's not going to give us 1287 00:50:48,060 --> 00:50:49,000 the information that we want. 1288 00:50:49,100 --> 00:50:50,400 We want to look for peaks further out. 1289 00:50:50,740 --> 00:50:52,260 So what I'm going to do now 1290 00:50:52,260 --> 00:50:53,740 is I'm going to get this vector source, 1291 00:50:56,680 --> 00:50:58,080 and I'm going to multiply 1292 00:50:58,080 --> 00:51:01,140 every 2,000 points, 1293 00:51:01,260 --> 00:51:02,240 which is one transform, 1294 00:51:02,240 --> 00:51:03,800 by this vector. 1295 00:51:04,020 --> 00:51:06,720 So the first 10 elements there are 0, 1296 00:51:07,440 --> 00:51:09,060 and then the remaining elements, 1297 00:51:09,340 --> 00:51:13,040 so FFT size 4k divided by 2 is 2k minus 10, 1298 00:51:13,200 --> 00:51:14,680 are all going to be 1. 1299 00:51:14,840 --> 00:51:16,600 So effectively you're nulling out 1300 00:51:17,160 --> 00:51:18,520 the first 10 bins, 1301 00:51:18,660 --> 00:51:19,860 so you ignore them completely. 1302 00:51:20,980 --> 00:51:22,760 And then you multiply that 1303 00:51:22,760 --> 00:51:25,660 by your incoming stream here. 1304 00:51:25,820 --> 00:51:27,240 You turn that back into a vector, 1305 00:51:27,360 --> 00:51:28,740 and then you use argmax. 1306 00:51:29,040 --> 00:51:31,700 And what argmax does is it goes through, 1307 00:51:31,700 --> 00:51:34,820 and it finds which index into your incoming vector 1308 00:51:34,820 --> 00:51:36,260 has the highest amplitude. 1309 00:51:36,660 --> 00:51:37,620 So you're going to go through 1310 00:51:37,620 --> 00:51:38,860 each of those FFT bins, 1311 00:51:39,060 --> 00:51:40,340 and you're going to find the one 1312 00:51:40,340 --> 00:51:41,400 with the highest energy, 1313 00:51:41,520 --> 00:51:42,780 which is the one that we're interested in. 1314 00:51:43,260 --> 00:51:44,320 That's going to come out here, 1315 00:51:44,840 --> 00:51:45,240 maxvec, 1316 00:51:45,420 --> 00:51:48,080 turn it into a short to float, 1317 00:51:48,260 --> 00:51:49,620 put it into a number sink, 1318 00:51:50,140 --> 00:51:51,240 and in the number sink, 1319 00:51:52,060 --> 00:51:53,960 it would ordinarily just give us 1320 00:51:53,960 --> 00:51:54,880 the index of the bin, 1321 00:51:54,980 --> 00:51:55,780 which is kind of useless. 1322 00:51:56,220 --> 00:51:57,440 We want to know what that is 1323 00:51:57,440 --> 00:51:59,060 in the board rate 1324 00:51:59,060 --> 00:52:00,600 in terms of our system. 1325 00:52:01,160 --> 00:52:02,120 So actually, 1326 00:52:02,280 --> 00:52:03,580 you need to apply a factor, 1327 00:52:04,820 --> 00:52:07,160 and that's going to multiply that index 1328 00:52:07,740 --> 00:52:10,040 by this magic number to give us a board rate. 1329 00:52:10,180 --> 00:52:12,520 And that's the BB rate, 1330 00:52:12,600 --> 00:52:13,180 baseband rate, 1331 00:52:13,300 --> 00:52:14,780 divided by the FFT size. 1332 00:52:14,920 --> 00:52:15,820 Because if you think about 1333 00:52:15,820 --> 00:52:16,860 what the transform does, 1334 00:52:17,800 --> 00:52:19,320 it's normalized ordinarily, 1335 00:52:19,440 --> 00:52:21,540 but it's 4,000 samples 1336 00:52:21,540 --> 00:52:25,220 over 50 kilohertz worth of sampling rate. 1337 00:52:25,460 --> 00:52:28,080 So you basically un-normalize it 1338 00:52:28,080 --> 00:52:29,760 to get your system rate. 1339 00:52:29,760 --> 00:52:31,740 And so once you do that, 1340 00:52:32,740 --> 00:52:34,180 it's just a very basic formula. 1341 00:52:35,240 --> 00:52:36,160 Once you do that, 1342 00:52:36,160 --> 00:52:36,760 let's run this. 1343 00:52:43,020 --> 00:52:43,420 Then, 1344 00:52:45,640 --> 00:52:46,280 where is it? 1345 00:52:48,920 --> 00:52:50,940 That's our FFT as you saw before. 1346 00:52:53,080 --> 00:52:54,420 Then you get your number sink, 1347 00:52:54,500 --> 00:52:56,660 and it's finding the peak, 1348 00:52:57,120 --> 00:52:58,240 multiplying it by that factor, 1349 00:52:58,360 --> 00:52:59,740 and then you get your board rate. 1350 00:52:59,740 --> 00:53:01,480 Notice that it's not quite 9,600. 1351 00:53:02,120 --> 00:53:05,620 That's because you have quantization steps now 1352 00:53:05,620 --> 00:53:06,580 for the bins. 1353 00:53:06,680 --> 00:53:08,720 If you divide 50k by 2k, 1354 00:53:08,820 --> 00:53:10,320 you're only going to be going up in steps. 1355 00:53:10,780 --> 00:53:11,660 But generally speaking, 1356 00:53:11,820 --> 00:53:12,280 in practice, 1357 00:53:12,400 --> 00:53:13,240 if you look at these things 1358 00:53:13,240 --> 00:53:14,260 and it looks very close 1359 00:53:14,260 --> 00:53:15,960 to a standard kind of number, 1360 00:53:16,140 --> 00:53:17,080 it's probably going to be 1361 00:53:17,080 --> 00:53:17,960 that standard kind of number. 1362 00:53:18,920 --> 00:53:19,760 And that way, 1363 00:53:19,820 --> 00:53:21,660 you know what the symbol rate is. 1364 00:53:21,760 --> 00:53:23,200 So that's that step down. 1365 00:53:24,340 --> 00:53:25,320 The next step is, 1366 00:53:25,380 --> 00:53:26,560 we want to actually start 1367 00:53:27,160 --> 00:53:28,060 demodulating this thing. 1368 00:53:28,060 --> 00:53:30,440 So what we're going to do 1369 00:53:30,440 --> 00:53:31,720 is we're going to throw in 1370 00:53:33,000 --> 00:53:34,500 the steps in GNU Radio 1371 00:53:34,500 --> 00:53:35,380 that you would normally use 1372 00:53:35,380 --> 00:53:38,080 to decode one of these signals. 1373 00:53:38,420 --> 00:53:39,620 So what I'm going to do, 1374 00:53:39,620 --> 00:53:40,820 over here, 1375 00:53:40,940 --> 00:53:41,420 is 1376 00:53:53,860 --> 00:53:54,820 put some 1377 00:53:57,640 --> 00:53:58,300 blocks down. 1378 00:53:58,420 --> 00:54:00,100 So we know now that the board rate 1379 00:54:00,100 --> 00:54:02,320 is 9,600. 1380 00:54:04,680 --> 00:54:06,480 So I'm going to make a variable called board, 1381 00:54:06,660 --> 00:54:07,940 put in 9,600, 1382 00:54:08,060 --> 00:54:09,460 because we know that about our system now. 1383 00:54:10,560 --> 00:54:12,340 And I'm also going to 1384 00:54:13,460 --> 00:54:14,980 be able to calculate this 1385 00:54:16,500 --> 00:54:17,380 new variable. 1386 00:54:17,920 --> 00:54:19,000 I'm going to call it 1387 00:54:19,900 --> 00:54:21,280 samples per symbol. 1388 00:54:23,040 --> 00:54:23,920 So that's... 1389 00:54:23,920 --> 00:54:24,220 What's that? 1390 00:54:24,820 --> 00:54:27,220 Samples per symbol. 1391 00:54:27,680 --> 00:54:29,040 Now, who can tell me 1392 00:54:29,500 --> 00:54:30,480 what this is going to be? 1393 00:54:30,580 --> 00:54:31,500 How are we going to calculate 1394 00:54:31,500 --> 00:54:32,400 samples per symbol? 1395 00:54:32,520 --> 00:54:33,380 If we know the board rate, 1396 00:54:34,540 --> 00:54:35,180 which is? 1397 00:54:36,400 --> 00:54:37,360 9,600, yep. 1398 00:54:37,480 --> 00:54:39,340 And what's our sample rate 1399 00:54:39,340 --> 00:54:40,820 at this baseband level now? 1400 00:54:44,400 --> 00:54:44,880 What's that? 1401 00:54:45,820 --> 00:54:46,440 Yeah, BBR. 1402 00:54:46,660 --> 00:54:47,520 And what's that value? 1403 00:54:48,340 --> 00:54:48,880 50K, right. 1404 00:54:48,960 --> 00:54:50,740 So how many samples then 1405 00:54:50,740 --> 00:54:52,620 do we have per one board? 1406 00:54:55,120 --> 00:54:55,920 Huh, anyone? 1407 00:54:59,420 --> 00:54:59,860 Yep. 1408 00:55:00,860 --> 00:55:01,300 Yep. 1409 00:55:02,680 --> 00:55:03,120 Okay. 1410 00:55:04,360 --> 00:55:05,600 Now, we got five. 1411 00:55:07,100 --> 00:55:08,960 Does anybody see that 1412 00:55:08,960 --> 00:55:09,940 there's a problem with that number? 1413 00:55:15,440 --> 00:55:16,620 It got rounded down. 1414 00:55:17,340 --> 00:55:18,840 Is that a good thing or a bad thing? 1415 00:55:19,980 --> 00:55:20,880 It's a bad thing, 1416 00:55:20,920 --> 00:55:22,480 because the timing has to be exact. 1417 00:55:22,680 --> 00:55:24,520 They don't divide into one another. 1418 00:55:24,820 --> 00:55:26,620 So this is a common problem with Python. 1419 00:55:27,040 --> 00:55:28,160 What's the way to get around it? 1420 00:55:28,200 --> 00:55:28,880 I heard the answer there, 1421 00:55:28,980 --> 00:55:29,740 but maybe from someone 1422 00:55:29,740 --> 00:55:30,460 further back as well. 1423 00:55:33,340 --> 00:55:34,460 Yeah, or you just do 1424 00:55:34,460 --> 00:55:36,260 one dot times out the front. 1425 00:55:36,780 --> 00:55:39,520 And now we got 5.20833, right? 1426 00:55:39,580 --> 00:55:40,580 So this stuff is very important, 1427 00:55:40,680 --> 00:55:41,780 and these little gotchas 1428 00:55:41,780 --> 00:55:44,880 can really break your system. 1429 00:55:46,060 --> 00:55:47,200 So what we're going to do then 1430 00:55:47,200 --> 00:55:48,740 is we're going to take the signal, 1431 00:55:48,780 --> 00:55:52,700 again, from our decimated output, 1432 00:55:53,340 --> 00:55:54,720 and we're going to plug it in 1433 00:55:54,720 --> 00:55:56,480 to the clock recovery block. 1434 00:55:56,860 --> 00:55:57,860 Now, in GNU Radio, 1435 00:55:57,980 --> 00:55:59,260 there's a really nice new block 1436 00:56:00,480 --> 00:56:04,360 called the PolyPhlase clock synchronizer. 1437 00:56:04,480 --> 00:56:05,240 I recommend you use that 1438 00:56:05,240 --> 00:56:06,220 when you're designing a system 1439 00:56:06,220 --> 00:56:07,220 where you know all the parameters. 1440 00:56:07,820 --> 00:56:09,320 But in this case, this is an old one, 1441 00:56:09,440 --> 00:56:11,500 and it works well enough 1442 00:56:11,500 --> 00:56:14,460 for the purposes of this kind of blind analysis. 1443 00:56:15,320 --> 00:56:16,620 So I've dropped that in, 1444 00:56:17,060 --> 00:56:18,980 and it has some parameters there. 1445 00:56:19,180 --> 00:56:20,380 I'll go through it when I run it 1446 00:56:20,380 --> 00:56:21,820 just to give you a visual idea of what they do. 1447 00:56:21,900 --> 00:56:23,900 But basically, this controls how quickly 1448 00:56:23,900 --> 00:56:26,060 and how tight it will try and lock to a signal. 1449 00:56:27,100 --> 00:56:28,980 And, you know, in some systems, 1450 00:56:29,040 --> 00:56:30,280 you want to give it lots of slack. 1451 00:56:30,440 --> 00:56:32,380 In other systems, you want it to be really tight 1452 00:56:32,380 --> 00:56:33,980 because you know that it's not going to deviate 1453 00:56:33,980 --> 00:56:35,120 too much from that. 1454 00:56:35,680 --> 00:56:38,220 And then the next standard step 1455 00:56:38,220 --> 00:56:40,140 is that you can add in this costus loop. 1456 00:56:40,520 --> 00:56:42,020 And what a costus loop does 1457 00:56:42,020 --> 00:56:44,400 is it accounts for some frequency error 1458 00:56:44,400 --> 00:56:47,080 in your original signal. 1459 00:56:47,240 --> 00:56:48,180 So as you saw, 1460 00:56:48,260 --> 00:56:49,520 remember how we had the peak hold 1461 00:56:49,520 --> 00:56:51,600 and it was moving back and forth off DC? 1462 00:56:52,040 --> 00:56:53,880 This thing can then remove that frequency error 1463 00:56:53,900 --> 00:56:54,380 and remove that frequency offset. 1464 00:56:54,760 --> 00:56:56,420 And I'll show you visually 1465 00:56:56,420 --> 00:56:58,000 what that looks like before and after. 1466 00:56:58,380 --> 00:57:01,920 So what we've got now is the costus loop. 1467 00:57:02,200 --> 00:57:03,520 This also has some parameters 1468 00:57:03,520 --> 00:57:05,920 to tell it how quickly to lock to stuff. 1469 00:57:06,980 --> 00:57:08,640 One of them is the loop bandwidth, 1470 00:57:08,880 --> 00:57:09,720 and I'll show you that, 1471 00:57:09,820 --> 00:57:11,420 but we're just missing a slider here. 1472 00:57:11,540 --> 00:57:12,080 Where's that one here? 1473 00:57:16,900 --> 00:57:17,920 And what's that? 1474 00:57:19,260 --> 00:57:21,360 Another little thing you can do is 1475 00:57:21,900 --> 00:57:23,780 often when you're translating 1476 00:57:23,900 --> 00:57:25,040 between normalized frequency 1477 00:57:25,040 --> 00:57:26,620 and the frequency of your app, 1478 00:57:26,820 --> 00:57:28,120 you often end up using 1479 00:57:28,620 --> 00:57:30,000 magical constants like pi. 1480 00:57:30,560 --> 00:57:33,680 You can type in 3.141592 blah blah blah, 1481 00:57:33,760 --> 00:57:35,900 or you can actually just use math.pi 1482 00:57:35,900 --> 00:57:37,720 or numpy.pi. 1483 00:57:37,960 --> 00:57:40,580 But here you can see that it's coming up in red, 1484 00:57:41,720 --> 00:57:45,400 and that's because there's no math module. 1485 00:57:45,620 --> 00:57:51,400 So you need to use the import block like so, 1486 00:57:51,860 --> 00:57:52,920 and then we just go 1487 00:57:55,820 --> 00:57:56,940 import math. 1488 00:57:57,220 --> 00:57:58,940 If only it was that simple in real life. 1489 00:58:00,160 --> 00:58:01,440 Because math is hard. 1490 00:58:02,920 --> 00:58:05,780 So now with this little construction here, 1491 00:58:06,440 --> 00:58:09,000 this should, let's see what happens, 1492 00:58:10,640 --> 00:58:13,820 give us the ability to 1493 00:58:22,380 --> 00:58:23,220 lock on. 1494 00:58:24,020 --> 00:58:25,280 So that's actually 1495 00:58:26,240 --> 00:58:28,600 looking like a dog's breakfast. 1496 00:58:32,560 --> 00:58:33,080 Pardon? 1497 00:58:34,960 --> 00:58:35,480 Yeah. 1498 00:58:36,100 --> 00:58:39,060 So this is not working, 1499 00:58:39,720 --> 00:58:41,620 and there's a very good reason why it's not working. 1500 00:58:42,080 --> 00:58:43,900 I haven't quite figured out what that is yet. 1501 00:58:46,760 --> 00:58:49,100 But really it should look like, 1502 00:58:49,140 --> 00:58:50,600 here's one I prepared earlier, 1503 00:58:54,860 --> 00:58:56,840 oh, it keeps appearing on the wrong display. 1504 00:58:59,980 --> 00:59:01,120 Looks like this. 1505 00:59:05,440 --> 00:59:07,200 So we knew it was qpsk, 1506 00:59:07,320 --> 00:59:08,720 so we knew it was order four, 1507 00:59:08,860 --> 00:59:13,880 and if you actually look in the costus loop, 1508 00:59:14,040 --> 00:59:15,340 it asks you for the order, 1509 00:59:15,420 --> 00:59:16,800 and we know that it's four, 1510 00:59:16,820 --> 00:59:17,460 so we put in four. 1511 00:59:17,820 --> 00:59:18,220 Done. 1512 00:59:19,000 --> 00:59:19,700 Clock recovery. 1513 00:59:22,760 --> 00:59:23,880 Here we came back, 1514 00:59:23,880 --> 00:59:25,000 ah, that's what it was. 1515 00:59:25,100 --> 00:59:27,220 Pardon me, I forgot this important step. 1516 00:59:30,060 --> 00:59:33,780 So some of these blocks can be a little bit finicky. 1517 00:59:34,820 --> 00:59:36,540 One of them is this clock recovery block, 1518 00:59:36,740 --> 00:59:40,620 and ideally it always looks for normalized samples. 1519 00:59:41,600 --> 00:59:43,900 So what that means is in GNU Radio, 1520 00:59:44,020 --> 00:59:46,760 the idea of a normalized sample is a floating point sample between 1521 00:59:52,520 --> 00:59:53,480 negative one, 1522 00:59:53,480 --> 00:59:54,340 and one. 1523 00:59:54,740 --> 00:59:55,920 That's the idea of normalized. 1524 00:59:56,260 --> 00:59:58,980 And the clock recovery block is expecting that. 1525 00:59:59,700 --> 01:00:02,340 This particular block can go into the weeds 1526 01:00:02,340 --> 01:00:04,000 if your amplitudes are too high or too low. 1527 01:00:04,360 --> 01:00:08,360 And one way of making sure that your amplitudes are correct 1528 01:00:08,360 --> 01:00:10,520 is by using an AGC block, 1529 01:00:10,680 --> 01:00:12,040 automatic gain control. 1530 01:00:12,360 --> 01:00:13,200 And if you have a look, 1531 01:00:13,300 --> 01:00:14,800 there are a bunch of different blocks. 1532 01:00:14,940 --> 01:00:15,840 This one's pretty simple. 1533 01:00:17,580 --> 01:00:20,040 And you can see here that you've got the rate, 1534 01:00:20,080 --> 01:00:21,780 so this is how quickly the AGC operates. 1535 01:00:21,780 --> 01:00:24,600 This is like an arbitrary unit. 1536 01:00:25,760 --> 01:00:28,780 The reference is the reference level you want to get to. 1537 01:00:28,780 --> 01:00:29,480 We want to get to one. 1538 01:00:30,160 --> 01:00:32,400 And the current gain that you start with, 1539 01:00:32,580 --> 01:00:35,060 and the maximum gain that it can actually apply to your signal. 1540 01:00:35,200 --> 01:00:38,240 So in that case, it's an arbitrary high number. 1541 01:00:38,980 --> 01:00:39,420 . 1542 01:00:42,260 --> 01:00:44,820 Yeah, so there's another AGC block, AGC2, 1543 01:00:44,960 --> 01:00:46,340 and that has attack and delay values, 1544 01:00:46,560 --> 01:00:48,080 and that does it a slightly different way. 1545 01:00:48,300 --> 01:00:50,100 So here, we've got the AGC. 1546 01:00:50,100 --> 01:00:54,580 Now we're going to connect that up to our original signal. 1547 01:00:55,620 --> 01:00:58,200 So what I'll do now is I'm going to disconnect this one, 1548 01:00:58,260 --> 01:00:59,360 and I'm going to show you each step. 1549 01:00:59,940 --> 01:01:02,380 And sometimes it's nice to do this, 1550 01:01:02,460 --> 01:01:05,140 but because you've designed part of your flow graph already, 1551 01:01:05,660 --> 01:01:07,920 you don't want to end up disabling a million blocks, 1552 01:01:08,120 --> 01:01:09,560 so you can use the null sink. 1553 01:01:09,860 --> 01:01:11,820 Just drop that down, hook it up, 1554 01:01:11,900 --> 01:01:12,900 and then it'll run as normal, 1555 01:01:13,060 --> 01:01:16,300 and then you can hook up your probe essentially to any point. 1556 01:01:16,560 --> 01:01:18,660 So I've hooked it up to the AGC, 1557 01:01:18,660 --> 01:01:21,300 this scope, and you'll see this at the bottom of the screen, 1558 01:01:21,340 --> 01:01:22,380 and hopefully... 1559 01:01:28,500 --> 01:01:32,060 You see how the scale is... 1560 01:01:32,880 --> 01:01:33,680 was changing? 1561 01:01:34,060 --> 01:01:35,840 It was pretty quick. 1562 01:01:40,280 --> 01:01:42,180 That's actually AGC kicking into effect. 1563 01:01:42,280 --> 01:01:43,420 So the original signal's pretty low, 1564 01:01:43,600 --> 01:01:46,260 and then so it amplifies the signal more and more and more 1565 01:01:46,260 --> 01:01:48,400 at the rate of your gain, and then it... 1566 01:01:48,660 --> 01:01:50,440 basically gets roughly to your... 1567 01:01:52,020 --> 01:01:53,720 your... the point that you want. 1568 01:01:53,880 --> 01:01:56,520 So here, it's not looking particularly pretty. 1569 01:01:56,600 --> 01:01:58,440 We're immediately after the AGC, right? 1570 01:01:58,520 --> 01:01:59,600 So we need to do clock recovery, 1571 01:01:59,800 --> 01:02:02,600 and then we need to apply that frequency offset. 1572 01:02:02,900 --> 01:02:04,840 So now let's switch to... 1573 01:02:05,880 --> 01:02:07,540 post-clock recovery... 1574 01:02:08,740 --> 01:02:09,460 like so. 1575 01:02:09,460 --> 01:02:10,300 . 1576 01:02:18,000 --> 01:02:19,800 Now, you'll notice here 1577 01:02:20,560 --> 01:02:22,600 that this constellation plot 1578 01:02:22,600 --> 01:02:24,280 looks different from the previous one. 1579 01:02:24,340 --> 01:02:24,520 How? 1580 01:02:28,500 --> 01:02:29,120 What's that? 1581 01:02:29,760 --> 01:02:31,220 There's nothing in the center, 1582 01:02:31,420 --> 01:02:34,480 and that's good because it means 1583 01:02:34,480 --> 01:02:35,880 that the clock recovery algorithm 1584 01:02:35,880 --> 01:02:37,860 has locked onto your incoming signal, 1585 01:02:37,860 --> 01:02:41,000 and it's sampling at about the right time. 1586 01:02:41,280 --> 01:02:43,320 And when it samples at the right time, 1587 01:02:43,440 --> 01:02:45,120 you expect it to be sampling 1588 01:02:45,120 --> 01:02:46,500 somewhere out where... 1589 01:02:47,600 --> 01:02:49,100 during the midpoint of your sample 1590 01:02:49,100 --> 01:02:50,920 where it'll result in some... 1591 01:02:52,060 --> 01:02:53,800 point that has an amplitude 1592 01:02:53,800 --> 01:02:55,780 out here, outside of... 1593 01:02:55,780 --> 01:02:57,400 outside of the origin, which is good. 1594 01:02:57,500 --> 01:02:58,100 That's what we want. 1595 01:02:58,240 --> 01:02:59,220 So that's a good signal. 1596 01:02:59,320 --> 01:03:00,920 But we don't have a clean constellation 1597 01:03:01,920 --> 01:03:03,980 because if you were to visualize this, 1598 01:03:04,120 --> 01:03:06,100 the constellation itself is actually rotating. 1599 01:03:06,600 --> 01:03:07,120 Right? 1600 01:03:07,120 --> 01:03:09,820 And when you have rotation on this constellation plot, 1601 01:03:09,960 --> 01:03:12,480 that means that you have some additional frequency component 1602 01:03:13,100 --> 01:03:15,520 that's part of your clock-recovered signal. 1603 01:03:15,840 --> 01:03:18,800 So we need to get rid of that additional frequency component 1604 01:03:19,280 --> 01:03:20,880 to get a nice, stable constellation, 1605 01:03:21,340 --> 01:03:24,240 and the costus loop will do that for us. 1606 01:03:24,400 --> 01:03:25,660 So if we get rid of that now, 1607 01:03:26,160 --> 01:03:27,700 we don't need this anymore. 1608 01:03:30,260 --> 01:03:31,080 Hook that up. 1609 01:03:32,020 --> 01:03:34,980 And fingers crossed, this time it'll work. 1610 01:03:35,300 --> 01:03:36,300 Let's see what we got. 1611 01:03:38,020 --> 01:03:39,020 What do you know? There we go. 1612 01:03:40,840 --> 01:03:42,920 Now, the costus loop is now working. 1613 01:03:43,020 --> 01:03:43,700 It's doing its thing. 1614 01:03:43,740 --> 01:03:44,760 It's removing that frequency component, 1615 01:03:45,040 --> 01:03:46,020 and we get these four dots. 1616 01:03:46,400 --> 01:03:48,080 Now, remember that I've added... 1617 01:03:48,080 --> 01:03:49,740 copied these sliders across as well. 1618 01:03:50,100 --> 01:03:52,180 So we've got the gain mu, 1619 01:03:52,340 --> 01:03:54,120 the costus loop bandwidth, and so on. 1620 01:03:55,660 --> 01:03:57,640 You can now play with these at runtime 1621 01:03:57,640 --> 01:03:59,680 to see what effect it has on the constellation. 1622 01:04:00,180 --> 01:04:01,740 So let's say I want to change 1623 01:04:03,640 --> 01:04:04,940 the costus loop bandwidth. 1624 01:04:05,400 --> 01:04:06,640 This is essentially saying 1625 01:04:06,640 --> 01:04:09,400 how tightly it's going to look at the incoming signal 1626 01:04:09,400 --> 01:04:11,560 and how much it can deviate by 1627 01:04:11,560 --> 01:04:13,100 before it'll sort of flip back. 1628 01:04:13,320 --> 01:04:14,660 So if I really open it up, 1629 01:04:15,660 --> 01:04:19,180 then you can see how it's sort of losing sync now, 1630 01:04:19,300 --> 01:04:22,900 and the points aren't as tightly grouped anymore. 1631 01:04:23,440 --> 01:04:25,680 That's because we've opened it up way too high, 1632 01:04:25,860 --> 01:04:27,640 and it's sort of going into the weeds 1633 01:04:27,640 --> 01:04:30,400 and looking beyond where it really should. 1634 01:04:30,600 --> 01:04:32,100 If you have a stable signal, 1635 01:04:32,200 --> 01:04:34,420 then generally you can usually 1636 01:04:34,420 --> 01:04:38,100 put the loop bandwidth down considerably, 1637 01:04:38,420 --> 01:04:40,500 and that means it'll track very, very tightly 1638 01:04:41,460 --> 01:04:43,140 to whatever frequency offset is in there. 1639 01:04:43,260 --> 01:04:43,940 And as you can see, 1640 01:04:43,980 --> 01:04:46,400 it cleans up the constellation quite well. 1641 01:04:47,980 --> 01:04:51,020 So now the other ones are the gain mu. 1642 01:04:51,180 --> 01:04:52,340 I won't go into these too much, 1643 01:04:52,400 --> 01:04:53,440 but they basically control... 1644 01:04:53,440 --> 01:04:54,040 You can do a bit of reading 1645 01:04:54,040 --> 01:04:56,540 how the clock recovery block works 1646 01:04:56,540 --> 01:04:59,140 and how strictly it adheres to the timing 1647 01:04:59,140 --> 01:05:01,600 that it's figuring out from the signal. 1648 01:05:01,680 --> 01:05:03,300 Again, usually you can put these kind of low. 1649 01:05:03,300 --> 01:05:04,480 If you bring these out, 1650 01:05:04,660 --> 01:05:07,680 then again, things start to look messy. 1651 01:05:08,740 --> 01:05:10,240 So we can keep that nice and low as well. 1652 01:05:10,400 --> 01:05:13,660 So we've got a recovered stream now. 1653 01:05:13,800 --> 01:05:15,060 We have our recovered symbols. 1654 01:05:15,340 --> 01:05:16,120 That's really good. 1655 01:05:16,280 --> 01:05:17,220 We know the timing. 1656 01:05:17,300 --> 01:05:18,020 We know it's QPSK. 1657 01:05:18,760 --> 01:05:19,720 At this point, 1658 01:05:20,460 --> 01:05:24,440 you could actually pull out digital ones and zeros, 1659 01:05:24,680 --> 01:05:25,900 because you have a constellation, 1660 01:05:26,180 --> 01:05:29,900 and each of these points are going to map to two bits. 1661 01:05:30,340 --> 01:05:32,500 So this could be 00, 01, 1662 01:05:32,500 --> 01:05:35,980 11, and 10, 1663 01:05:36,220 --> 01:05:37,460 if it's gray-coded. 1664 01:05:37,760 --> 01:05:38,920 So if you look on Wikipedia, 1665 01:05:39,640 --> 01:05:43,400 I think I have a page for that. 1666 01:05:49,860 --> 01:05:51,100 You can see here, 1667 01:05:51,780 --> 01:05:54,780 this is a gray-coded QPSK plot. 1668 01:05:54,980 --> 01:05:56,320 And the gray-coding is important 1669 01:05:56,320 --> 01:05:58,140 because it means that only one bit 1670 01:05:58,140 --> 01:06:01,540 is changing between adjacent constellation points. 1671 01:06:01,540 --> 01:06:04,560 That means if you accidentally get the wrong phase, 1672 01:06:04,840 --> 01:06:07,540 you only end off wrong by one bit 1673 01:06:07,540 --> 01:06:08,620 instead of potentially two. 1674 01:06:09,560 --> 01:06:10,960 So that's important. 1675 01:06:13,080 --> 01:06:15,440 So if you want to learn a bit more about it, 1676 01:06:15,500 --> 01:06:16,680 that's a good place to look. 1677 01:06:17,780 --> 01:06:19,040 Now, the thing is, 1678 01:06:19,140 --> 01:06:20,240 we've got raw bits now, 1679 01:06:20,400 --> 01:06:23,080 and we can actually look at that and visualize it, 1680 01:06:23,120 --> 01:06:24,940 but it's probably not going to give us any information, 1681 01:06:25,700 --> 01:06:27,180 because it's probably scrambled. 1682 01:06:27,660 --> 01:06:29,440 Links are usually whitened, 1683 01:06:29,440 --> 01:06:31,200 so you have some sort of pseudo, 1684 01:06:31,620 --> 01:06:33,380 noise code put on top of it 1685 01:06:33,380 --> 01:06:35,560 to distribute the energy through the spectrum. 1686 01:06:35,780 --> 01:06:36,700 That's pretty standard stuff. 1687 01:06:37,580 --> 01:06:39,880 And there might be forward error correction on there. 1688 01:06:39,980 --> 01:06:40,740 Question in the back. 1689 01:06:51,640 --> 01:06:53,560 Often in these sorts of situations, 1690 01:06:53,740 --> 01:06:55,680 you've just got to go through the permutations. 1691 01:06:57,140 --> 01:06:58,840 And actually, so I'm going to show you 1692 01:06:58,840 --> 01:07:00,780 how to do that in terms of the forward error correction 1693 01:07:00,780 --> 01:07:02,160 actually right now. 1694 01:07:02,440 --> 01:07:04,040 So at this point, 1695 01:07:05,180 --> 01:07:07,820 if we look at our reference design here, 1696 01:07:08,020 --> 01:07:09,780 we have our costus loop. 1697 01:07:10,040 --> 01:07:11,780 It's giving us our symbols out, 1698 01:07:11,880 --> 01:07:13,820 and now we want to actually figure out 1699 01:07:13,820 --> 01:07:17,240 how to get our raw bits out of there. 1700 01:07:17,800 --> 01:07:18,340 So... 1701 01:07:23,760 --> 01:07:25,850 I'll give you a very brief introduction 1702 01:07:26,320 --> 01:07:28,140 to convolutional codes. 1703 01:07:29,120 --> 01:07:29,660 So... 1704 01:07:32,820 --> 01:07:34,320 So there are different classes 1705 01:07:34,320 --> 01:07:35,660 of forward error correction out there. 1706 01:07:35,820 --> 01:07:38,280 And one is called convolutional coding. 1707 01:07:38,520 --> 01:07:39,880 And this has been used a lot. 1708 01:07:40,000 --> 01:07:42,040 And for space applications, 1709 01:07:42,300 --> 01:07:43,840 one of the most famous instances 1710 01:07:43,840 --> 01:07:45,500 that is sort of referenced everywhere 1711 01:07:45,500 --> 01:07:46,760 and actually turns up here 1712 01:07:46,760 --> 01:07:49,460 is the NASA Voyager space probe. 1713 01:07:49,720 --> 01:07:51,520 And the way convolutional code works 1714 01:07:51,520 --> 01:07:55,540 is that it's essentially a shift register. 1715 01:07:55,880 --> 01:07:58,980 You have your individual incoming bits 1716 01:07:58,980 --> 01:08:00,600 going into the shift register. 1717 01:08:00,780 --> 01:08:03,160 And once every cycle through your register, 1718 01:08:03,320 --> 01:08:05,860 you have these taps that come off, 1719 01:08:07,640 --> 01:08:09,760 and you evaluate them, 1720 01:08:09,840 --> 01:08:11,840 and then you get your bits... 1721 01:08:15,100 --> 01:08:16,320 It's gone. I was about to sneeze. 1722 01:08:17,760 --> 01:08:20,580 You get your resulting bits coming out. 1723 01:08:21,500 --> 01:08:23,680 And you can have different sorts of codes. 1724 01:08:23,780 --> 01:08:25,820 You can have systematic codes 1725 01:08:25,820 --> 01:08:26,740 and non-systematic codes. 1726 01:08:26,960 --> 01:08:30,620 But what this does is given one input bit 1727 01:08:30,780 --> 01:08:33,700 it'll produce, say, two or three bits output. 1728 01:08:34,100 --> 01:08:36,320 And those additional bits will give you 1729 01:08:36,320 --> 01:08:39,060 a special sort of redundancy in your stream. 1730 01:08:39,500 --> 01:08:42,080 And at the receiver side for convolutional codes, 1731 01:08:42,300 --> 01:08:45,900 you can use a decoder called a Viterbi decoder 1732 01:08:45,900 --> 01:08:47,020 using the Viterbi algorithm. 1733 01:08:47,420 --> 01:08:50,520 And it basically creates... 1734 01:08:51,100 --> 01:08:52,280 I won't go into the details, 1735 01:08:52,360 --> 01:08:54,340 but this sort of trellis, 1736 01:08:54,900 --> 01:08:56,820 depending on what those taps were 1737 01:08:56,820 --> 01:08:57,540 for your shift register. 1738 01:08:57,760 --> 01:09:00,600 And as your bits come into your trellis, 1739 01:09:01,400 --> 01:09:03,100 depending on how your code is designed, 1740 01:09:03,320 --> 01:09:04,660 it will actually go through 1741 01:09:04,660 --> 01:09:06,380 and figure out the most likely path 1742 01:09:06,380 --> 01:09:07,740 through the trellis 1743 01:09:07,740 --> 01:09:10,240 of your original data bits 1744 01:09:10,240 --> 01:09:12,380 that resulted in the bits that were sent over the air. 1745 01:09:12,780 --> 01:09:14,260 And why this is really cool is that 1746 01:09:14,600 --> 01:09:16,640 if you end up having an incorrect bit 1747 01:09:16,640 --> 01:09:17,840 somewhere in here, 1748 01:09:18,660 --> 01:09:19,860 then it will see, 1749 01:09:19,920 --> 01:09:23,120 oh, it was probably not the most likely path 1750 01:09:23,120 --> 01:09:24,440 because it was a bad bit. 1751 01:09:24,560 --> 01:09:25,640 And there's actually another path 1752 01:09:25,640 --> 01:09:27,720 that you can go through that will give you 1753 01:09:27,720 --> 01:09:29,420 a higher, what's called a higher metric 1754 01:09:29,420 --> 01:09:30,620 through your path. 1755 01:09:30,820 --> 01:09:32,220 And it tries to optimize that. 1756 01:09:32,260 --> 01:09:33,500 It tries them all in parallel, 1757 01:09:33,760 --> 01:09:35,880 which is why they're very slow in general purpose PCs. 1758 01:09:35,960 --> 01:09:37,680 But if you do it on an FPGA, 1759 01:09:37,840 --> 01:09:39,140 they're blindingly fast because you can 1760 01:09:39,140 --> 01:09:40,560 compute all the paths in parallel. 1761 01:09:41,060 --> 01:09:42,880 But it tries to find the most likely path. 1762 01:09:43,320 --> 01:09:45,000 And then that is actually, 1763 01:09:45,100 --> 01:09:47,320 they will be the bits that were hopefully 1764 01:09:47,320 --> 01:09:49,000 transmitted initially over the air. 1765 01:09:49,200 --> 01:09:51,900 So then you remove those additional redundant bits 1766 01:09:51,900 --> 01:09:53,340 and you get your original code back. 1767 01:09:54,260 --> 01:09:56,400 And the length of that path 1768 01:09:56,400 --> 01:09:58,180 is known as the constraint length. 1769 01:09:58,720 --> 01:09:59,960 And the constraint length 1770 01:09:59,960 --> 01:10:01,360 is the length of the shift register. 1771 01:10:01,600 --> 01:10:03,640 So it all sort of comes together quite nicely. 1772 01:10:03,660 --> 01:10:05,140 This transmitter side is very simple. 1773 01:10:05,300 --> 01:10:06,700 The Viterbi algorithm is, 1774 01:10:07,310 --> 01:10:08,920 it takes a little bit more 1775 01:10:08,920 --> 01:10:10,260 to get your head around how it works. 1776 01:10:10,320 --> 01:10:11,160 But it's really cool. 1777 01:10:11,900 --> 01:10:13,220 Even though it's really cool, 1778 01:10:13,320 --> 01:10:14,620 it's actually been surpassed now 1779 01:10:14,620 --> 01:10:16,180 by much more modern codes. 1780 01:10:16,580 --> 01:10:18,500 There are turbo codes that are used, 1781 01:10:18,600 --> 01:10:21,280 for example, in LTE and now in satellite links. 1782 01:10:23,340 --> 01:10:24,840 There are other sorts of classes of code 1783 01:10:24,840 --> 01:10:27,320 that are much more efficient than this. 1784 01:10:27,620 --> 01:10:28,200 But this thing, 1785 01:10:28,340 --> 01:10:30,960 these things are actually on space probes 1786 01:10:30,960 --> 01:10:33,940 that have flown outside the solar system 1787 01:10:33,940 --> 01:10:35,540 and are really suitable 1788 01:10:35,540 --> 01:10:37,380 for these sorts of deep space links as well. 1789 01:10:37,740 --> 01:10:38,700 So if you do some research, 1790 01:10:38,800 --> 01:10:39,880 you can see that satellite links 1791 01:10:39,880 --> 01:10:42,440 tend to use this sort of convolutional code. 1792 01:10:43,140 --> 01:10:44,620 You can guess that they're probably 1793 01:10:44,620 --> 01:10:46,180 going to use Voyager because it's standard. 1794 01:10:46,580 --> 01:10:48,120 Everybody's pretty much implemented it. 1795 01:10:48,220 --> 01:10:49,740 It's a highly optimal configuration 1796 01:10:49,740 --> 01:10:51,440 of this convolutional code. 1797 01:10:53,340 --> 01:10:53,900 And it's actually running that 1798 01:10:53,900 --> 01:10:55,820 as the decoder. 1799 01:10:55,980 --> 01:10:58,340 Now the thing is that 1800 01:10:59,340 --> 01:11:01,260 GNU Radio actually already has 1801 01:11:01,260 --> 01:11:03,300 a block 1802 01:11:03,300 --> 01:11:04,120 to do 1803 01:11:06,460 --> 01:11:07,600 that particular 1804 01:11:20,140 --> 01:11:22,880 It has all the letters in it. 1805 01:11:23,340 --> 01:11:23,820 There we go. 1806 01:11:24,640 --> 01:11:25,120 CCSDS. 1807 01:11:26,500 --> 01:11:28,160 And this is a space standard. 1808 01:11:28,360 --> 01:11:30,300 This will do the encoding and decoding 1809 01:11:30,300 --> 01:11:30,900 of this stream. 1810 01:11:33,580 --> 01:11:35,360 But it's not as simple as that, 1811 01:11:35,420 --> 01:11:35,860 unfortunately. 1812 01:11:37,300 --> 01:11:38,640 If you're going to just start doing 1813 01:11:38,640 --> 01:11:40,140 error correction stuff in GNU Radio, 1814 01:11:40,700 --> 01:11:42,200 probably stay away from this one. 1815 01:11:42,720 --> 01:11:44,700 There's a relatively new module 1816 01:11:44,700 --> 01:11:46,120 in GNU Radio called grfeq. 1817 01:11:46,320 --> 01:11:47,280 It's in the tree. 1818 01:11:47,620 --> 01:11:50,780 And it supports a much 1819 01:11:50,780 --> 01:11:53,080 wider variety of encoders 1820 01:11:53,340 --> 01:11:54,660 and it's blindingly fast. 1821 01:11:54,800 --> 01:11:55,520 It's really, really neat. 1822 01:11:55,760 --> 01:11:56,840 So you can do that there as well. 1823 01:11:56,920 --> 01:11:58,920 But I'm going to use this one for a particular reason. 1824 01:12:01,000 --> 01:12:02,600 The complication here is that 1825 01:12:02,600 --> 01:12:05,380 we have a PSK signal 1826 01:12:05,380 --> 01:12:06,160 being transmitted. 1827 01:12:06,920 --> 01:12:09,180 We have a receiver that is now 1828 01:12:09,180 --> 01:12:10,840 locked onto it. We've recovered the symbols. 1829 01:12:11,280 --> 01:12:12,980 And we end up with that constellation. 1830 01:12:13,400 --> 01:12:14,780 So if I run it again, 1831 01:12:14,900 --> 01:12:15,460 you'll see 1832 01:12:17,580 --> 01:12:18,620 what I mean here. 1833 01:12:21,540 --> 01:12:22,380 There's our constellation. 1834 01:12:24,520 --> 01:12:25,720 So if you look here at the bottom, 1835 01:12:25,760 --> 01:12:27,600 you can see our constellation. 1836 01:12:29,800 --> 01:12:30,980 This is all well and good. 1837 01:12:31,200 --> 01:12:32,040 And I can say, 1838 01:12:32,100 --> 01:12:35,700 this is going to be 00, 01, 11, 10. 1839 01:12:36,060 --> 01:12:36,500 Fine. 1840 01:12:36,680 --> 01:12:38,100 We can decode, get the bits out. 1841 01:12:38,620 --> 01:12:39,280 Bob's your uncle. 1842 01:12:39,640 --> 01:12:42,860 The problem is that our receiver 1843 01:12:42,860 --> 01:12:44,840 might not be synchronized 1844 01:12:44,840 --> 01:12:46,220 to our transmitter. 1845 01:12:46,440 --> 01:12:48,320 So you know how this is all quadrature, 1846 01:12:48,960 --> 01:12:50,880 we've got our I and our Q. 1847 01:12:51,400 --> 01:12:52,500 It's quite possible 1848 01:12:52,500 --> 01:12:54,100 that our transmitter and receiver 1849 01:12:54,100 --> 01:12:55,840 happen to just have their oscillators 1850 01:12:55,840 --> 01:12:57,940 come on at a time where the I and Q 1851 01:12:57,940 --> 01:12:59,080 were actually swapped. 1852 01:13:00,380 --> 01:13:01,720 Or the whole thing 1853 01:13:02,440 --> 01:13:03,720 might be rotated. 1854 01:13:03,960 --> 01:13:05,920 Basically, you have 1855 01:13:06,560 --> 01:13:07,780 the problem where 1856 01:13:07,780 --> 01:13:09,920 you don't know how your 1857 01:13:10,620 --> 01:13:11,800 receiver is aligned 1858 01:13:12,340 --> 01:13:14,100 with this transmitter that might be 1859 01:13:14,100 --> 01:13:15,080 on the other side of the world. 1860 01:13:16,000 --> 01:13:18,440 And what that means is that you can actually end up 1861 01:13:18,620 --> 01:13:19,140 having this constellation, 1862 01:13:19,480 --> 01:13:20,520 relative to your transmitter, 1863 01:13:20,700 --> 01:13:22,440 rotated 90 degrees. 1864 01:13:22,840 --> 01:13:24,540 Or it might be conjugated, 1865 01:13:24,600 --> 01:13:25,680 which means that the entire thing 1866 01:13:25,680 --> 01:13:28,220 is flipped through the complex plane. 1867 01:13:28,780 --> 01:13:30,660 And you don't know any of this stuff, 1868 01:13:30,920 --> 01:13:32,580 but you need to account for it. 1869 01:13:32,780 --> 01:13:34,920 So your receiver has to go through 1870 01:13:34,920 --> 01:13:37,080 and try all of these different permutations 1871 01:13:37,080 --> 01:13:39,860 of conjugation, rotation, inversion, 1872 01:13:40,920 --> 01:13:41,840 shifting bits, 1873 01:13:42,060 --> 01:13:43,240 because you don't know how 1874 01:13:43,240 --> 01:13:44,780 the state machine of the decoder 1875 01:13:44,780 --> 01:13:46,160 on your receiver side 1876 01:13:48,620 --> 01:13:49,120 is relative to the state 1877 01:13:49,120 --> 01:13:50,660 of the transmitter. 1878 01:13:51,400 --> 01:13:53,400 So you need to be able to synchronize to it. 1879 01:13:53,580 --> 01:13:54,840 And in modern communication systems, 1880 01:13:54,900 --> 01:13:56,760 often what's done is you know, 1881 01:13:56,760 --> 01:13:58,100 for example, what the... 1882 01:13:58,620 --> 01:13:59,780 There's a preamble, right? 1883 01:13:59,880 --> 01:14:01,460 So there's a fixed code that's documented, 1884 01:14:01,660 --> 01:14:04,580 that's transmitted by the transmitter. 1885 01:14:05,400 --> 01:14:07,100 And when it gets to your receiver, 1886 01:14:07,600 --> 01:14:09,480 then you can try to correlate 1887 01:14:09,940 --> 01:14:11,120 against that code. 1888 01:14:11,380 --> 01:14:13,460 You can try correlating against the code 1889 01:14:13,460 --> 01:14:15,920 as it is in like a zero phase shift, 1890 01:14:16,140 --> 01:14:18,020 a 90 degree phase shift, 1891 01:14:18,620 --> 01:14:19,340 a conjugated constellation, 1892 01:14:20,320 --> 01:14:22,040 a conjugated 90 degree phase shift 1893 01:14:22,040 --> 01:14:22,420 and constellation. 1894 01:14:22,780 --> 01:14:24,060 You can precompute these, 1895 01:14:24,420 --> 01:14:25,840 correlate against them all simultaneously. 1896 01:14:26,320 --> 01:14:27,920 And as soon as you get a correlation peak 1897 01:14:27,920 --> 01:14:28,620 on one of them, you know, 1898 01:14:28,700 --> 01:14:30,120 aha, that's what it is. 1899 01:14:30,160 --> 01:14:31,240 I'm going to rotate, I'm going to conjugate, 1900 01:14:31,380 --> 01:14:31,880 I'm going to invert, 1901 01:14:32,100 --> 01:14:33,400 and then we've logged onto the stream. 1902 01:14:34,140 --> 01:14:35,840 But in this case, we don't know 1903 01:14:35,840 --> 01:14:36,840 what the preamble is, right? 1904 01:14:36,920 --> 01:14:38,020 Because we're coming at this blind. 1905 01:14:38,020 --> 01:14:39,840 We don't have a clue what it is. 1906 01:14:39,980 --> 01:14:41,640 But what we can do is we can exploit 1907 01:14:42,040 --> 01:14:43,540 part of the Viterbi algorithm. 1908 01:14:44,120 --> 01:14:46,240 And remember how when I showed you that trellis, 1909 01:14:46,320 --> 01:14:47,780 it tries to draw a path through 1910 01:14:47,780 --> 01:14:48,740 and determine the metric. 1911 01:14:48,880 --> 01:14:51,280 So it tries to give a score to all of the paths 1912 01:14:51,280 --> 01:14:52,760 to see which one was the most likely. 1913 01:14:53,160 --> 01:14:54,800 And then it picks the most likely one 1914 01:14:54,800 --> 01:14:57,240 and derives your raw data bits from that. 1915 01:14:57,420 --> 01:14:58,320 What we're going to do, 1916 01:14:59,280 --> 01:15:00,160 what you can do, 1917 01:15:00,280 --> 01:15:01,740 is that you can modify 1918 01:15:02,320 --> 01:15:02,680 the 1919 01:15:03,720 --> 01:15:04,140 the 1920 01:15:04,140 --> 01:15:04,320 the 1921 01:15:07,580 --> 01:15:08,000 CCSDS 1922 01:15:09,060 --> 01:15:09,480 decoder. 1923 01:15:11,640 --> 01:15:12,720 And so I've 1924 01:15:12,720 --> 01:15:14,340 modified it in this version of Green Radio 1925 01:15:14,340 --> 01:15:16,300 so that not only does it give you the 1926 01:15:16,300 --> 01:15:18,700 output bits, but it also gives you 1927 01:15:18,700 --> 01:15:19,460 the path metric. 1928 01:15:19,920 --> 01:15:22,180 And the path metric is essentially a score 1929 01:15:22,760 --> 01:15:24,420 telling you how 1930 01:15:24,420 --> 01:15:26,120 well the decoder is actually doing. 1931 01:15:26,720 --> 01:15:28,460 So that if you get, in this case, 1932 01:15:28,480 --> 01:15:29,540 once you do a bit of 1933 01:15:30,800 --> 01:15:31,740 fidgeting with the numbers, 1934 01:15:32,680 --> 01:15:33,500 a path metric of zero, 1935 01:15:34,140 --> 01:15:36,160 that's actually the best number that you can get. 1936 01:15:36,360 --> 01:15:38,520 That means that the soft bits 1937 01:15:38,520 --> 01:15:40,340 that you're getting coming in from your constellation 1938 01:15:40,340 --> 01:15:42,500 map perfectly through a valid 1939 01:15:42,500 --> 01:15:44,580 path through your trellis. So that's good. 1940 01:15:45,000 --> 01:15:46,040 As soon as you get 1941 01:15:46,680 --> 01:15:48,820 incorrect bits that don't 1942 01:15:48,820 --> 01:15:50,540 fit nicely with your trellis, so they 1943 01:15:50,540 --> 01:15:52,660 don't give you a path that's valid for your 1944 01:15:53,180 --> 01:15:54,680 code, then your metric 1945 01:15:54,680 --> 01:15:56,480 actually goes up. And that's bad. 1946 01:15:56,980 --> 01:15:58,620 So if you get a metric that's really 1947 01:15:58,620 --> 01:16:00,660 noisy and high, it means that you probably 1948 01:16:00,660 --> 01:16:02,640 haven't locked on and synchronized to your signal. 1949 01:16:02,680 --> 01:16:04,840 But if you try these different rotations 1950 01:16:04,840 --> 01:16:06,660 and constellations, and then you wait 1951 01:16:06,660 --> 01:16:08,520 for the path metric to go back to zero, 1952 01:16:08,600 --> 01:16:10,480 really close to it, then you probably do 1953 01:16:10,480 --> 01:16:12,120 have a lock. And so 1954 01:16:12,680 --> 01:16:14,580 what I've done is I've actually condensed 1955 01:16:14,580 --> 01:16:15,520 that into this 1956 01:16:17,660 --> 01:16:18,180 auto 1957 01:16:18,920 --> 01:16:20,120 fec block here. 1958 01:16:20,420 --> 01:16:22,680 So it takes in the raw stream coming from 1959 01:16:22,680 --> 01:16:24,820 the constellation, and then it outputs 1960 01:16:24,820 --> 01:16:26,080 the byte stream, but internally 1961 01:16:26,600 --> 01:16:28,400 it's actually applying 1962 01:16:28,400 --> 01:16:30,300 rotations and conjugations 1963 01:16:30,300 --> 01:16:32,580 and inversions to your constellation, 1964 01:16:32,680 --> 01:16:34,480 and trying all the different combinations 1965 01:16:34,480 --> 01:16:36,460 until the path metric 1966 01:16:36,460 --> 01:16:37,520 goes to zero. 1967 01:16:39,540 --> 01:16:40,640 Fundamentally you can break this 1968 01:16:40,640 --> 01:16:42,440 out. If you were to break it out, then 1969 01:16:42,440 --> 01:16:44,260 really what you'd get is something like this. 1970 01:16:54,560 --> 01:16:56,020 So this is more a stripped down version, 1971 01:16:56,220 --> 01:16:58,520 but the first step is the conjugation, 1972 01:16:58,940 --> 01:17:00,340 and the next step is the 1973 01:17:00,340 --> 01:17:02,640 phase rotation, so here you just multiply it 1974 01:17:02,680 --> 01:17:03,960 by zero, 1975 01:17:04,220 --> 01:17:04,700 or 1976 01:17:06,660 --> 01:17:07,960 I'll show you the expression here, 1977 01:17:08,040 --> 01:17:10,520 actually. Oh, it's not there. 1978 01:17:11,460 --> 01:17:12,500 But you can multiply 1979 01:17:12,500 --> 01:17:12,920 it by 1980 01:17:14,880 --> 01:17:16,360 various numbers that will actually 1981 01:17:16,360 --> 01:17:18,260 rotate your constellation, and then 1982 01:17:18,960 --> 01:17:20,680 if you're using this particular 1983 01:17:20,680 --> 01:17:22,560 convolutional code, you might need to 1984 01:17:22,560 --> 01:17:24,180 delay by one sample, because 1985 01:17:24,180 --> 01:17:25,600 you might be misaligned. 1986 01:17:26,000 --> 01:17:28,480 And then you can do that delay. And each of these 1987 01:17:28,480 --> 01:17:30,460 blocks are controlled by a state machine 1988 01:17:30,460 --> 01:17:32,660 that'll conjugate, and then 1989 01:17:32,680 --> 01:17:34,220 not conjugate, and then rotate phase, 1990 01:17:34,460 --> 01:17:36,600 conjugate, not conjugate, rotate 1991 01:17:36,600 --> 01:17:38,380 phase again, conjugate, not conjugate, 1992 01:17:38,540 --> 01:17:40,600 delay, reset everything, try 1993 01:17:40,600 --> 01:17:42,600 everything again, and you keep going through this long 1994 01:17:42,600 --> 01:17:44,700 process until you find 1995 01:17:44,700 --> 01:17:46,080 the right steps. 1996 01:17:46,640 --> 01:17:47,600 And that's 1997 01:17:48,360 --> 01:17:50,540 what that auto 1998 01:17:50,540 --> 01:17:51,840 effect block actually does. 1999 01:17:53,140 --> 01:17:53,620 So, 2000 01:17:55,560 --> 01:17:56,420 restore that, 2001 01:17:57,580 --> 01:17:58,060 and 2002 01:17:59,280 --> 01:18:00,620 what I'm gonna do now is I'm gonna 2003 01:18:00,620 --> 01:18:02,580 run it, and I would like you to page 2004 01:18:02,680 --> 01:18:04,560 attention, if you can, to the 2005 01:18:05,060 --> 01:18:06,720 I'll bring the console over so that 2006 01:18:06,720 --> 01:18:08,600 you can read 2007 01:18:08,600 --> 01:18:08,980 it properly. 2008 01:18:13,100 --> 01:18:14,540 I don't know where 2009 01:18:15,720 --> 01:18:16,620 GRC is running. 2010 01:18:27,960 --> 01:18:28,800 Which terminal 2011 01:18:28,800 --> 01:18:29,120 is it? 2012 01:18:31,680 --> 01:18:32,660 Here we go. Got it. 2013 01:18:35,560 --> 01:18:36,440 And then 2014 01:18:36,440 --> 01:18:38,060 magic incantation. 2015 01:18:42,120 --> 01:18:42,680 Okay. 2016 01:18:44,180 --> 01:18:44,740 So... 2017 01:18:47,840 --> 01:18:48,420 I'm gonna 2018 01:18:48,420 --> 01:18:48,920 run this. 2019 01:18:49,440 --> 01:18:50,680 I want you to observe 2020 01:18:50,680 --> 01:18:51,620 what's printed out. 2021 01:18:53,040 --> 01:18:54,520 So, auto effect starting 2022 01:18:54,520 --> 01:18:56,160 up here, and you can see here, 2023 01:18:56,340 --> 01:18:58,560 it's beginning the search. It applied 2024 01:18:58,560 --> 01:19:00,620 a rotation that 2025 01:19:00,620 --> 01:19:02,500 didn't work because our bit error 2026 01:19:02,680 --> 01:19:04,540 rate was still really high. It's the metric coming out of the 2027 01:19:04,540 --> 01:19:06,600 Viterbi decoder. Applies a rotation, still really 2028 01:19:06,600 --> 01:19:08,760 high. Applies a rotation and a conjugation 2029 01:19:08,760 --> 01:19:10,480 and a delay in the Viterbi samples. 2030 01:19:10,700 --> 01:19:12,520 Still no lock. Applies 2031 01:19:12,520 --> 01:19:14,220 a rotation. Still no good. 2032 01:19:15,200 --> 01:19:16,400 Rotation, conjugation, no good. 2033 01:19:16,600 --> 01:19:18,620 Rotation again. So it basically does 2034 01:19:18,620 --> 01:19:20,800 all of these permutations, and you can see that it's 2035 01:19:20,800 --> 01:19:22,480 testing each one of them, 2036 01:19:22,600 --> 01:19:24,620 waiting for the path metric to come out. 2037 01:19:24,700 --> 01:19:26,560 It's still too high. And then 2038 01:19:26,560 --> 01:19:28,620 what do you know? We step 2039 01:19:28,620 --> 01:19:30,460 through here, we apply the rotation, 2040 01:19:30,660 --> 01:19:32,440 and we had no conjugation. 2041 01:19:32,680 --> 01:19:34,600 In this particular instance. And we locked. 2042 01:19:34,840 --> 01:19:36,680 So our path metric now 2043 01:19:36,680 --> 01:19:38,580 is really 2044 01:19:38,580 --> 01:19:39,920 low. And 2045 01:19:40,510 --> 01:19:42,140 you can actually then see this. 2046 01:19:42,820 --> 01:19:44,620 I'll run it again, but this 2047 01:19:44,620 --> 01:19:46,620 time we can actually watch the graph 2048 01:19:46,620 --> 01:19:48,660 of the path metric, which is just coming 2049 01:19:48,660 --> 01:19:49,300 out of this port. 2050 01:19:56,160 --> 01:19:58,600 So this is a graph 2051 01:19:58,600 --> 01:20:00,680 of the path metric 2052 01:20:00,680 --> 01:20:02,620 coming out of the Viterbi decoder. 2053 01:20:02,680 --> 01:20:04,700 So this is 0. We want it to be 2054 01:20:04,700 --> 01:20:06,480 down at 0. But as you can see, 2055 01:20:06,560 --> 01:20:08,220 it's sort of in the 4-5,000 range. 2056 01:20:08,740 --> 01:20:10,260 So this is pretty noisy. 2057 01:20:10,300 --> 01:20:12,520 It's really high. It's above our magic 2058 01:20:12,520 --> 01:20:14,560 threshold. It hasn't found anything yet. 2059 01:20:14,760 --> 01:20:16,460 And as it steps through and rotates 2060 01:20:16,460 --> 01:20:18,560 and delays and inverts and so on. Look at that. 2061 01:20:18,560 --> 01:20:18,900 Do you see that? 2062 01:20:20,380 --> 01:20:22,760 That's now got a lock. And you can see 2063 01:20:22,760 --> 01:20:24,240 that there are these little humps here. 2064 01:20:24,680 --> 01:20:26,740 And remember how constellation wasn't 2065 01:20:26,740 --> 01:20:27,560 particularly clean? 2066 01:20:28,940 --> 01:20:30,380 You can see here at the bottom, 2067 01:20:30,520 --> 01:20:31,680 it's not a particularly 2068 01:20:33,680 --> 01:20:34,480 tight-looking 2069 01:20:34,480 --> 01:20:36,680 constellation there. 2070 01:20:37,680 --> 01:20:38,620 Inevitably, you're going to have 2071 01:20:38,620 --> 01:20:40,100 constellation points that 2072 01:20:40,660 --> 01:20:42,660 veer off and end up in the wrong 2073 01:20:42,660 --> 01:20:44,420 quadrant. And that will give you the wrong bits. 2074 01:20:44,500 --> 01:20:46,360 You'll get bit errors. And so 2075 01:20:46,360 --> 01:20:48,780 as you go through the Viterbi 2076 01:20:48,780 --> 01:20:50,640 decoder's path, you'll end up getting 2077 01:20:51,060 --> 01:20:52,600 some bits that are wrong and it'll figure 2078 01:20:52,600 --> 01:20:54,500 that out and then output something that's a little bit higher. 2079 01:20:54,780 --> 01:20:56,000 But this is still low enough 2080 01:20:56,500 --> 01:20:58,420 so that it'll give you the correct output bits. 2081 01:20:58,480 --> 01:20:59,060 Question here. 2082 01:20:59,300 --> 01:21:02,040 So if someone's trying to mess with what was 2083 01:21:02,680 --> 01:21:04,540 receiving the signal, is it possible to 2084 01:21:04,540 --> 01:21:06,520 randomize it or make the shifts 2085 01:21:06,520 --> 01:21:08,260 occur at various points so 2086 01:21:08,260 --> 01:21:10,740 if you're using a standardized process like this 2087 01:21:10,740 --> 01:21:11,340 they'll never converge? 2088 01:21:12,160 --> 01:21:14,340 It's possible. The question was if you were 2089 01:21:14,340 --> 01:21:16,280 essentially a man in the middle and you wanted to 2090 01:21:17,020 --> 01:21:18,600 corrupt this link, whether 2091 01:21:18,600 --> 01:21:20,580 you could get 2092 01:21:20,580 --> 01:21:22,540 in there and actually insert bad bits. 2093 01:21:23,200 --> 01:21:24,380 No, not man in the middle. 2094 01:21:24,560 --> 01:21:26,640 The people who are actually 2095 01:21:26,640 --> 01:21:28,340 sending the signals, they want to be 2096 01:21:28,340 --> 01:21:30,580 people other than the intended receiver 2097 01:21:30,580 --> 01:21:32,400 to be able to convert 2098 01:21:32,680 --> 01:21:33,960 the message to a locked state 2099 01:21:33,960 --> 01:21:36,400 if they could mess with the constellations 2100 01:21:36,400 --> 01:21:38,420 and the preambles so that 2101 01:21:39,520 --> 01:21:40,780 your system would never 2102 01:21:40,780 --> 01:21:41,700 have a confidence lock. 2103 01:21:42,420 --> 01:21:44,400 It's possible. It just depends upon 2104 01:21:44,400 --> 01:21:46,540 how you do it. In this case, remember we're coming up blind 2105 01:21:46,540 --> 01:21:48,240 so we have no a priori knowledge about 2106 01:21:48,240 --> 01:21:50,640 what we're looking for. Usually you wouldn't do it 2107 01:21:50,640 --> 01:21:52,520 this way. Usually you would look for that 2108 01:21:52,520 --> 01:21:54,760 known sequence. So this is a bit 2109 01:21:54,760 --> 01:21:56,080 of a hacky way of doing it. 2110 01:21:56,240 --> 01:21:57,880 But it kind of works. 2111 01:21:58,140 --> 01:22:00,720 As you can see here, it's actually running 2112 01:22:00,720 --> 01:22:02,360 and it's locked and it's doing its thing. 2113 01:22:05,700 --> 01:22:06,100 And 2114 01:22:07,240 --> 01:22:08,740 we're now outputting 2115 01:22:08,740 --> 01:22:09,240 these raw 2116 01:22:11,240 --> 01:22:12,780 bits coming out of the decoder 2117 01:22:12,780 --> 01:22:13,720 to a file. 2118 01:22:14,460 --> 01:22:16,180 So the next step is 2119 01:22:16,180 --> 01:22:18,540 we've got the raw bits, we need to visualize that file 2120 01:22:18,540 --> 01:22:20,420 to see whether there's 2121 01:22:20,420 --> 01:22:21,960 some sort of structure to it. 2122 01:22:22,160 --> 01:22:24,320 And that will be the next step. So what I'm going to do 2123 01:22:24,820 --> 01:22:25,220 is 2124 01:22:27,280 --> 01:22:28,560 I might just run that 2125 01:22:28,560 --> 01:22:28,800 again. 2126 01:22:32,680 --> 01:22:34,080 Just so you can get a sense of the 2127 01:22:34,680 --> 01:22:36,640 final app as we were putting 2128 01:22:36,640 --> 01:22:38,420 it together. So we've got a constellation plot. 2129 01:22:38,740 --> 01:22:40,720 We've selected our channel just as a review. 2130 01:22:40,920 --> 01:22:41,940 We've got our channel there. 2131 01:22:43,400 --> 01:22:44,460 Let's tighten up 2132 01:22:44,460 --> 01:22:46,540 the bandwidth. You remember how I used the config 2133 01:22:46,540 --> 01:22:48,740 variable block? Really, I should 2134 01:22:48,740 --> 01:22:50,640 be using one for the bandwidth as well 2135 01:22:50,640 --> 01:22:52,260 so it remembers it whenever I boot it 2136 01:22:52,260 --> 01:22:53,900 up again instead of having to 2137 01:22:54,680 --> 01:22:55,700 adjust that manually. 2138 01:22:57,400 --> 01:22:58,700 We're not using the power. 2139 01:22:58,920 --> 01:23:00,480 We know what the board rate is here. 2140 01:23:00,640 --> 01:23:02,640 We've got the peak. We've got the 2141 01:23:02,680 --> 01:23:03,660 coming out as 96 hundred board. 2142 01:23:04,760 --> 01:23:06,360 And then our path metric is 2143 01:23:06,360 --> 01:23:08,240 as you can see, very low there. 2144 01:23:08,500 --> 01:23:10,520 So I'm just going to let that run for a minute and it's going to 2145 01:23:10,520 --> 01:23:12,460 go to a file. And then I'm going to run some 2146 01:23:12,460 --> 01:23:14,320 Python code to actually read the file in 2147 01:23:14,320 --> 01:23:16,600 and plot it using matplotlib 2148 01:23:16,600 --> 01:23:18,140 so that we can see if there's any structure 2149 01:23:18,540 --> 01:23:20,120 and then take the next step in the process. 2150 01:23:20,740 --> 01:23:22,620 So I'm going to shut that down now 2151 01:23:22,620 --> 01:23:24,320 and I'm going to switch 2152 01:23:24,320 --> 01:23:25,660 to the terminal 2153 01:23:27,040 --> 01:23:28,140 and new tab 2154 01:23:28,800 --> 01:23:29,480 and be 2155 01:23:30,820 --> 01:23:31,220 Python 2156 01:23:32,680 --> 01:23:33,460 and I'm going to 2157 01:23:35,560 --> 01:23:36,520 open my 2158 01:23:36,520 --> 01:23:37,080 secret 2159 01:23:38,400 --> 01:23:39,500 source here 2160 01:23:43,220 --> 01:23:44,940 If I can find it 2161 01:23:46,880 --> 01:23:48,000 Okay, so 2162 01:23:50,000 --> 01:23:50,560 Alright 2163 01:23:54,860 --> 01:23:56,420 Now, you can do this in 2164 01:23:56,420 --> 01:23:57,340 all sorts of different ways 2165 01:23:58,520 --> 01:23:59,080 I 2166 01:24:01,620 --> 01:24:02,560 have a little 2167 01:24:05,140 --> 01:24:05,860 program here 2168 01:24:05,860 --> 01:24:06,680 that I might just 2169 01:24:07,780 --> 01:24:08,420 where is it 2170 01:24:27,500 --> 01:24:28,980 I'm just going to show you quickly here 2171 01:24:28,980 --> 01:24:30,740 so you get a sense of what's going on 2172 01:24:31,400 --> 01:24:32,620 This is now running under 2173 01:24:32,680 --> 01:24:33,100 Wine again 2174 01:24:33,100 --> 01:24:34,800 This is some software that 2175 01:24:36,220 --> 01:24:38,140 crashes under Mono really quickly 2176 01:24:41,340 --> 01:24:43,880 I need to put on my GitHub 2177 01:24:43,880 --> 01:24:45,660 but it's just 2178 01:24:45,660 --> 01:24:48,220 I wrote it to do some simple manipulations on files 2179 01:24:48,220 --> 01:24:49,040 so I'm going to import 2180 01:24:50,820 --> 01:24:51,820 this satellite 2181 01:24:52,550 --> 01:24:53,920 text file that we made 2182 01:24:53,920 --> 01:24:54,760 It's basically 2183 01:24:55,380 --> 01:24:56,520 if you have a look here 2184 01:24:56,520 --> 01:24:57,680 this is what it looks like 2185 01:25:00,460 --> 01:25:02,060 It's just the raw bits out of the 2186 01:25:02,680 --> 01:25:03,160 Turbi decoder 2187 01:25:03,620 --> 01:25:06,520 Now, we would expect that since it's outputting bits all the time 2188 01:25:06,520 --> 01:25:08,780 for the first portion it's just going to be corrupt data 2189 01:25:08,780 --> 01:25:09,760 because it hasn't locked on yet 2190 01:25:09,760 --> 01:25:12,260 and then eventually we're going to get a locked stream after that 2191 01:25:12,260 --> 01:25:14,440 So, if we 2192 01:25:14,440 --> 01:25:15,900 go here, we've imported that file 2193 01:25:15,900 --> 01:25:17,500 Let's see what it looks like 2194 01:25:22,400 --> 01:25:24,460 I'm just going to pick an arbitrary width 2195 01:25:25,580 --> 01:25:26,540 It looks like 2196 01:25:26,540 --> 01:25:28,300 noise, not very helpful, right? 2197 01:25:28,560 --> 01:25:29,940 So there's something going on here 2198 01:25:29,940 --> 01:25:31,360 The first part of it obviously we ignore 2199 01:25:32,680 --> 01:25:33,400 It's going to be a scrambler 2200 01:25:33,400 --> 01:25:35,660 because remember as I said in communication systems 2201 01:25:35,660 --> 01:25:37,780 you want to distribute the energy of your bits 2202 01:25:37,780 --> 01:25:39,760 over the bandwidth that you're transmitting in 2203 01:25:39,760 --> 01:25:41,460 You want to whiten the signal 2204 01:25:41,460 --> 01:25:44,220 and to do that you use some sort of 2205 01:25:44,220 --> 01:25:46,160 pseudo-random code, some pseudo-noise 2206 01:25:46,160 --> 01:25:47,600 to spread the energy out 2207 01:25:47,600 --> 01:25:49,800 and you can use these things called scramblers 2208 01:25:49,800 --> 01:25:52,720 and I recommend that you 2209 01:25:52,720 --> 01:25:53,780 read a little bit about them 2210 01:25:54,440 --> 01:25:56,720 There's another good Wikipedia article on scrambler 2211 01:25:56,720 --> 01:25:58,740 You're going to have two types of scramblers 2212 01:25:58,740 --> 01:26:01,060 One is the additive scrambler 2213 01:26:01,060 --> 01:26:02,660 and the multiplicative scrambler 2214 01:26:02,680 --> 01:26:04,660 There's an important distinction between the two 2215 01:26:04,660 --> 01:26:06,700 One is self-synchronizing 2216 01:26:06,700 --> 01:26:08,100 and the other one is synchronous 2217 01:26:08,740 --> 01:26:11,020 So one of them you need to look at 2218 01:26:11,020 --> 01:26:12,180 for like a special preamble 2219 01:26:12,180 --> 01:26:13,520 and then reset your scrambler 2220 01:26:13,520 --> 01:26:14,980 so it can follow along 2221 01:26:14,980 --> 01:26:17,180 The other one doesn't need that, you can just do it 2222 01:26:17,180 --> 01:26:19,700 Luckily in this case it is 2223 01:26:20,580 --> 01:26:22,500 the multiplicative one that we're using 2224 01:26:22,500 --> 01:26:24,440 otherwise we might be a bit 2225 01:26:25,340 --> 01:26:26,000 out of luck 2226 01:26:26,000 --> 01:26:27,720 So there's not much going on there 2227 01:26:29,300 --> 01:26:30,760 Now, if you do a bit of research 2228 01:26:30,760 --> 01:26:32,420 you can find that a very common scrambler 2229 01:26:32,680 --> 01:26:34,680 is the IESS308 2230 01:26:35,820 --> 01:26:36,260 scrambler 2231 01:26:36,260 --> 01:26:37,340 So we're going to run that 2232 01:26:39,520 --> 01:26:40,700 and if you 2233 01:26:40,700 --> 01:26:42,680 actually look at the source code for this scrambler 2234 01:26:43,320 --> 01:26:43,900 I've got 2235 01:26:43,900 --> 01:26:45,280 a Python implementation 2236 01:26:46,820 --> 01:26:48,360 This is the C sharp implementation 2237 01:26:49,580 --> 01:26:51,020 It's really quite simple 2238 01:26:51,020 --> 01:26:52,760 It's just you have some taps 2239 01:26:52,760 --> 01:26:53,960 coming off some shift registers 2240 01:26:53,960 --> 01:26:55,260 I think there's a latch in there 2241 01:26:55,260 --> 01:26:57,980 and then it just calculates what the next bit is 2242 01:26:57,980 --> 01:27:00,700 So it's really not that complex 2243 01:27:00,700 --> 01:27:02,660 But the idea is that you give it 2244 01:27:02,680 --> 01:27:04,660 a bit, it puts it into the shift register 2245 01:27:04,660 --> 01:27:06,380 and then calculates 2246 01:27:06,380 --> 01:27:08,320 some tap values and then returns 2247 01:27:08,320 --> 01:27:09,500 a bit from that 2248 01:27:11,000 --> 01:27:12,100 Was there a question? 2249 01:27:14,640 --> 01:27:16,240 Yeah, so GnuReady has 2250 01:27:16,740 --> 01:27:18,060 scrambling and descrambling blocks 2251 01:27:18,540 --> 01:27:19,420 I believe 2252 01:27:19,420 --> 01:27:22,300 the reason why I had to go down this route is because 2253 01:27:22,300 --> 01:27:23,320 they're generalized ones 2254 01:27:23,320 --> 01:27:26,640 and this one had some extra flip-flops 2255 01:27:26,640 --> 01:27:28,400 in the circuitry, like I actually found a reference page 2256 01:27:28,400 --> 01:27:29,980 that had it mapped down in commentary logic 2257 01:27:30,660 --> 01:27:32,580 and I don't think you could realize it 2258 01:27:32,680 --> 01:27:33,260 with the GnuReady one 2259 01:27:33,260 --> 01:27:34,980 GnuReady is nice because it has both the additive 2260 01:27:34,980 --> 01:27:36,260 and the multiplicative scrambler 2261 01:27:36,260 --> 01:27:37,000 Was there another point? 2262 01:27:41,620 --> 01:27:42,680 So that was 2263 01:27:42,680 --> 01:27:45,280 on the assumption that 2264 01:27:45,280 --> 01:27:46,860 the first try was with Voyager 2265 01:27:47,420 --> 01:27:48,560 So I figured, oh 2266 01:27:48,560 --> 01:27:50,380 it's probably going to be Voyager, so try that 2267 01:27:50,380 --> 01:27:51,780 And actually that's a good point 2268 01:27:51,780 --> 01:27:53,800 I got lucky with Voyager 2269 01:27:53,800 --> 01:27:56,220 and that CC SDS block 2270 01:27:56,220 --> 01:27:57,700 is hard-coded to Voyager 2271 01:27:57,700 --> 01:28:00,300 but actually if you use the new GFX stuff 2272 01:28:00,300 --> 01:28:01,440 and you look at 2273 01:28:05,500 --> 01:28:05,900 the 2274 01:28:06,540 --> 01:28:06,940 so 2275 01:28:08,060 --> 01:28:09,400 this is the encoded definition 2276 01:28:10,820 --> 01:28:11,960 using the new paradigm 2277 01:28:11,960 --> 01:28:14,240 and there's the convolutional code one 2278 01:28:14,240 --> 01:28:15,500 which is the more generalized one 2279 01:28:16,080 --> 01:28:18,480 so this one, this convolutional coder 2280 01:28:18,480 --> 01:28:20,220 is actually set up for the Voyager 2281 01:28:20,220 --> 01:28:22,800 code, these are the polynomials used to set the taps 2282 01:28:22,800 --> 01:28:23,880 on the shift ridges for the 2283 01:28:24,840 --> 01:28:25,240 convolutional 2284 01:28:25,940 --> 01:28:28,660 but you can configure these any way 2285 01:28:28,660 --> 01:28:30,660 you like, if you had some other ones that you wanted 2286 01:28:30,660 --> 01:28:32,560 to try, you would create that kind of state machine 2287 01:28:32,680 --> 01:28:34,240 and go through and try them 2288 01:28:34,240 --> 01:28:35,100 as well 2289 01:28:35,100 --> 01:28:36,700 and then 2290 01:28:38,520 --> 01:28:39,460 you would go 2291 01:28:41,600 --> 01:28:42,900 there's another block 2292 01:28:42,900 --> 01:28:44,360 that you would use with these ones 2293 01:28:44,360 --> 01:28:45,680 to set it up 2294 01:28:45,680 --> 01:28:47,120 so as an example 2295 01:28:47,760 --> 01:28:49,380 what that looks like 2296 01:28:49,380 --> 01:28:50,600 is like this 2297 01:28:51,240 --> 01:28:52,560 you go down the bottom here 2298 01:28:52,560 --> 01:28:56,200 you have this FEC extended decoder 2299 01:28:56,200 --> 01:28:58,200 and then you have the decoder definition 2300 01:28:58,200 --> 01:29:00,060 so here I've actually defined again 2301 01:29:00,500 --> 01:29:02,060 the settings for 2302 01:29:03,160 --> 01:29:04,660 Voyager, but in this case 2303 01:29:04,660 --> 01:29:05,720 I've just reversed the taps 2304 01:29:06,800 --> 01:29:07,720 and then 2305 01:29:07,720 --> 01:29:09,580 you use this 2306 01:29:12,320 --> 01:29:13,840 decoder object and you pass in 2307 01:29:13,840 --> 01:29:15,400 the ID of the definition 2308 01:29:15,400 --> 01:29:17,560 and then you can set the puncture pattern 2309 01:29:17,560 --> 01:29:18,900 for punctured codes 2310 01:29:18,900 --> 01:29:20,540 and then it just does the rest 2311 01:29:20,540 --> 01:29:23,860 so you could conceivably do something where it tries different 2312 01:29:23,860 --> 01:29:25,900 decoder definitions if you're trying to iterate through 2313 01:29:25,900 --> 01:29:26,840 possible combinations 2314 01:29:28,380 --> 01:29:30,360 and then one other thing to mention here 2315 01:29:30,360 --> 01:29:31,140 also is that 2316 01:29:32,680 --> 01:29:34,240 the code that we were looking at is known as 2317 01:29:34,240 --> 01:29:35,280 the mother code 2318 01:29:36,320 --> 01:29:37,560 and it uses 2319 01:29:37,560 --> 01:29:39,940 the half rate code 2320 01:29:39,940 --> 01:29:42,320 which means that for every bit that you put in 2321 01:29:42,320 --> 01:29:43,800 it'll generate two bits 2322 01:29:43,800 --> 01:29:46,640 but there's this cool notion 2323 01:29:46,640 --> 01:29:48,320 of what's called puncturing 2324 01:29:48,320 --> 01:29:49,040 the code 2325 01:29:49,040 --> 01:29:51,580 so if you don't want to have a half rate code 2326 01:29:51,580 --> 01:29:53,800 let's say you want a three quarter rate code 2327 01:29:53,800 --> 01:29:55,640 so you give it three bits and it gives you four 2328 01:29:55,640 --> 01:29:56,600 that way 2329 01:29:57,560 --> 01:29:59,320 instead of having two for every one 2330 01:29:59,320 --> 01:30:01,800 which is a lot of information that you're wasting on 2331 01:30:02,680 --> 01:30:04,940 if your link doesn't support that kind of bandwidth 2332 01:30:04,940 --> 01:30:07,320 you might opt for a three quarter rate code 2333 01:30:07,320 --> 01:30:08,420 so if you think about it 2334 01:30:08,420 --> 01:30:09,500 for every three you get four 2335 01:30:09,500 --> 01:30:12,220 or you might give it seven and then you get eight 2336 01:30:12,860 --> 01:30:14,640 and that way you can actually change 2337 01:30:14,640 --> 01:30:16,180 the code rate which is really nice 2338 01:30:16,180 --> 01:30:18,800 but it means that when you're running your 2339 01:30:18,800 --> 01:30:19,640 automatic 2340 01:30:20,360 --> 01:30:21,880 forward error correction synchronizing 2341 01:30:21,880 --> 01:30:24,800 you actually have to try all of those different puncturing matrices 2342 01:30:24,800 --> 01:30:25,440 as well 2343 01:30:25,440 --> 01:30:27,980 because maybe the transmitter's not using a half rate code 2344 01:30:27,980 --> 01:30:29,320 maybe it's using a three quarter rate code 2345 01:30:29,320 --> 01:30:32,580 and so what AutoEffect does is it actually goes through 2346 01:30:32,680 --> 01:30:35,760 and it tries all of these standard puncturing matrices as well 2347 01:30:35,760 --> 01:30:37,120 I got lucky in that case 2348 01:30:37,120 --> 01:30:38,540 because they were using a half rate code 2349 01:30:38,540 --> 01:30:40,260 but you might be using something else 2350 01:30:40,260 --> 01:30:42,420 so it's just something to keep in mind there 2351 01:30:43,100 --> 01:30:43,940 and again 2352 01:30:43,940 --> 01:30:46,020 there's a good Wikipedia 2353 01:30:47,740 --> 01:30:48,600 article on that 2354 01:30:48,600 --> 01:30:49,460 if you have a look 2355 01:30:52,060 --> 01:30:52,500 here 2356 01:30:52,500 --> 01:30:54,160 a little bit further down 2357 01:30:57,320 --> 01:30:58,740 you actually have a good write up 2358 01:30:58,740 --> 01:30:59,620 on puncturing 2359 01:30:59,620 --> 01:31:02,560 using the NASA standard k equals seven 2360 01:31:02,680 --> 01:31:03,420 convolutional code 2361 01:31:03,420 --> 01:31:04,820 so what this is saying here is 2362 01:31:04,820 --> 01:31:05,980 the mother code is half rate 2363 01:31:05,980 --> 01:31:09,480 and you give it a bit and you get two out 2364 01:31:09,480 --> 01:31:11,460 if you have the two third rate code 2365 01:31:11,460 --> 01:31:14,200 then you will give it the four bits 2366 01:31:14,200 --> 01:31:15,980 you don't transmit this one 2367 01:31:17,340 --> 01:31:18,280 and then you get 2368 01:31:18,280 --> 01:31:19,680 you basically give it two 2369 01:31:19,680 --> 01:31:21,000 and then you get these three coming out 2370 01:31:21,700 --> 01:31:24,160 you might have a three quarter rate code 2371 01:31:24,560 --> 01:31:26,560 so you have three bits 2372 01:31:26,560 --> 01:31:27,100 coming in 2373 01:31:27,780 --> 01:31:29,540 you generate the normal 2374 01:31:29,980 --> 01:31:32,380 two for one but then you don't send this one 2375 01:31:32,680 --> 01:31:33,140 you don't send that one 2376 01:31:33,720 --> 01:31:35,600 and the receiver will know that 2377 01:31:35,600 --> 01:31:37,120 you're using one of these puncturing codes 2378 01:31:37,120 --> 01:31:39,520 so every time it gets around through its bitstream 2379 01:31:40,060 --> 01:31:41,020 to a point where it says 2380 01:31:41,020 --> 01:31:42,140 this is where it's been punctured 2381 01:31:42,140 --> 01:31:44,800 it inserts a zero which is like an erasure mark 2382 01:31:45,300 --> 01:31:48,180 and the convolutional decoder will know 2383 01:31:48,180 --> 01:31:49,420 when it's looking at the path metric 2384 01:31:49,420 --> 01:31:50,680 I'm just going to ignore that 2385 01:31:50,680 --> 01:31:51,780 because it was actually erased 2386 01:31:51,780 --> 01:31:53,480 and it will still do its thing 2387 01:31:53,480 --> 01:31:54,280 it's a really nice property 2388 01:31:54,280 --> 01:31:55,600 I won't go into the details 2389 01:31:55,600 --> 01:31:58,560 but if you're interested you should definitely read more about it 2390 01:32:02,680 --> 01:32:03,640 about communications for example 2391 01:32:03,640 --> 01:32:05,940 in intel sat systems and digital video broadcasting 2392 01:32:05,940 --> 01:32:06,920 what do you know 2393 01:32:08,920 --> 01:32:10,500 okay so we were looking 2394 01:32:10,500 --> 01:32:12,500 at the raw output 2395 01:32:14,500 --> 01:32:15,280 which is 2396 01:32:17,540 --> 01:32:18,060 here 2397 01:32:18,620 --> 01:32:20,540 so now remember we applied 2398 01:32:20,540 --> 01:32:21,760 that common descrambler 2399 01:32:21,760 --> 01:32:23,780 so let's see what that looks like 2400 01:32:28,760 --> 01:32:30,120 we had noise at the beginning 2401 01:32:30,120 --> 01:32:31,820 because remember we weren't locked to the signal 2402 01:32:32,680 --> 01:32:33,440 so let's see what we have after that 2403 01:32:34,280 --> 01:32:35,980 looks like we've got some structure there 2404 01:32:36,580 --> 01:32:38,560 but still it doesn't look quite right 2405 01:32:38,560 --> 01:32:39,860 can anybody tell me why 2406 01:32:47,640 --> 01:32:48,820 exactly right yes 2407 01:32:48,820 --> 01:32:51,060 so the response was 2408 01:32:51,060 --> 01:32:53,180 we've got long strings of zeros in some places 2409 01:32:53,180 --> 01:32:55,320 and long strings of ones in other places 2410 01:32:55,320 --> 01:32:56,620 and when you see that 2411 01:32:57,100 --> 01:32:58,500 you know that you're onto something 2412 01:32:58,500 --> 01:32:59,360 you're almost there 2413 01:32:59,360 --> 01:33:02,660 but it's quite likely that your original 2414 01:33:02,680 --> 01:33:03,740 data was also 2415 01:33:04,680 --> 01:33:05,720 differentially encoded 2416 01:33:05,720 --> 01:33:07,280 and the idea there is that 2417 01:33:07,860 --> 01:33:10,800 you don't actually encode the raw data bits 2418 01:33:10,800 --> 01:33:12,940 you encode the differences 2419 01:33:12,940 --> 01:33:15,400 between subsequent data bits 2420 01:33:15,400 --> 01:33:16,640 and that's really good 2421 01:33:16,640 --> 01:33:18,280 because it means that you do not end up 2422 01:33:18,280 --> 01:33:19,940 with long strings of ones and zeros 2423 01:33:20,540 --> 01:33:22,720 in common in communication systems 2424 01:33:22,720 --> 01:33:24,000 you want as many 2425 01:33:24,680 --> 01:33:26,560 differences in your data between one and zero 2426 01:33:26,560 --> 01:33:27,960 as many differences in the clock 2427 01:33:28,640 --> 01:33:30,200 essentially sorry in the data 2428 01:33:30,200 --> 01:33:31,940 so that with all those different transitions 2429 01:33:33,000 --> 01:33:34,540 not particularly in this system 2430 01:33:34,540 --> 01:33:35,060 but in other ones 2431 01:33:35,060 --> 01:33:36,860 if they're doing clock recovery 2432 01:33:36,860 --> 01:33:38,920 the more transitions you have 2433 01:33:38,920 --> 01:33:40,980 the better your receiver can lock to the signal 2434 01:33:40,980 --> 01:33:41,840 and recover the clock 2435 01:33:41,840 --> 01:33:43,780 if you have a long string of zero 2436 01:33:43,780 --> 01:33:44,880 or a long string of one 2437 01:33:44,880 --> 01:33:47,300 there's no changing edges there 2438 01:33:47,300 --> 01:33:49,180 so your receiver has nothing to lock onto 2439 01:33:49,180 --> 01:33:51,340 because it wants to see the differences in the signal 2440 01:33:51,340 --> 01:33:53,100 so exactly right 2441 01:33:53,100 --> 01:33:55,700 so the next step then is to 2442 01:33:57,000 --> 01:33:57,940 crash the program 2443 01:34:01,040 --> 01:34:01,520 unbelievable 2444 01:34:10,540 --> 01:34:11,740 all right 2445 01:34:12,680 --> 01:34:13,640 what happened there 2446 01:34:14,800 --> 01:34:16,520 did it not import 2447 01:34:22,540 --> 01:34:23,180 how weird 2448 01:34:37,840 --> 01:34:49,880 Okay. Do we still have a valid file? Oh. Oh, you know why? Okay. Not to worry. This has 2449 01:34:51,480 --> 01:34:55,900 bitten me before. I'm just going to run this again to regenerate the data. The problem 2450 01:34:55,900 --> 01:35:06,380 is that I'm lazy, simply put. And you'll notice that you can have blocks. I basically 2451 01:35:06,380 --> 01:35:11,980 got in the terrible habit of writing C++ blocks and not writing GRC XML definitions for them. 2452 01:35:12,300 --> 01:35:19,840 And instead, I put together this thing called the any block. And what the any block lets 2453 01:35:19,840 --> 01:35:25,880 you do is just put in arbitrary Python. So this is actually the Python code to generate 2454 01:35:27,680 --> 01:35:34,260 the print char block from GRBaz. And I'm just supplying arguments there. I don't need 2455 01:35:34,260 --> 01:35:39,620 to worry about making the XML for it. And then that's really easy. It just works. And 2456 01:35:39,620 --> 01:35:46,040 you don't have to do the extra effort. The problem is that GRC evaluates all the Python 2457 01:35:46,040 --> 01:35:51,600 that it can in every single block, both when you boot it up and when you switch back in 2458 01:35:51,600 --> 01:35:55,620 between flow graphs and change other blocks and stuff. It needs to reevaluate everything. 2459 01:35:56,440 --> 01:36:02,020 And you notice that this is purple, which means that it's text. But even if, as I said 2460 01:36:02,020 --> 01:36:05,920 before, even though it's purple and it's text, it will still evaluate it, which means 2461 01:36:05,920 --> 01:36:11,140 that it will create a temporary instance of this block, which also means that it will 2462 01:36:11,140 --> 01:36:15,820 create this file. And if there was a file already there, it's just going to reset it 2463 01:36:15,820 --> 01:36:25,860 and the contents will disappear. That's why it became zero. So that's the problem. And 2464 01:36:26,980 --> 01:36:28,400 that's me being lazy. 2465 01:36:28,660 --> 01:36:32,260 So all right, we've probably got enough information now. Let's try that one more time. We've got 2466 01:36:32,260 --> 01:36:36,160 our data there. Good. Let's run the program one more time. 2467 01:36:41,880 --> 01:36:49,840 Import. Satellite. Data. Descramble. Differentially decode. View data. 2468 01:36:56,840 --> 01:37:01,900 Unlocked region. Locked region. And you can see now it looks like legit data. You've 2469 01:37:01,900 --> 01:37:06,080 got black. This is idle time in the channel. Nothing's being transmitted. And then you 2470 01:37:06,080 --> 01:37:10,680 have these bursts that show up. And these bursts appear to occur at random points in 2471 01:37:10,680 --> 01:37:15,280 time. So it's some sort of shared link maybe. Not a shared link, but it's some sort of medium 2472 01:37:15,280 --> 01:37:20,060 where there's some maybe telemetry system on the ground. It gets some information queued 2473 01:37:20,060 --> 01:37:23,600 up and then it sends it out as a burst. And if you look carefully, for example, here, 2474 01:37:23,820 --> 01:37:24,980 you can see that... 2475 01:37:25,880 --> 01:37:30,860 The bit pattern looks pretty common. So there's a good chance there's some sort of common 2476 01:37:31,380 --> 01:37:36,680 preamble, common synchronization information in that portion of the file. And actually, 2477 01:37:36,720 --> 01:37:42,300 we won't do it now. But if you have a look at the steps after that, this should all look 2478 01:37:42,300 --> 01:37:45,340 pretty familiar now. We selected the channel. We did the... 2479 01:37:50,160 --> 01:37:55,500 We did the PSK ordering. We did all this stuff. 2480 01:37:55,500 --> 01:38:01,060 Descrambling, differential decoding, forward error correction, Bayer shift keying, board 2481 01:38:01,060 --> 01:38:09,040 rate. All this good stuff. Descrambled it. Got our packets there. And then look for 2482 01:38:09,040 --> 01:38:13,000 the preamble. And then you actually get a packet out like this. And you get the nice 2483 01:38:13,000 --> 01:38:16,660 since and sin at the top. And then you get start of header and start of text, end of 2484 01:38:16,660 --> 01:38:21,780 text in these packets that go through. And then you can pull those out and get these 2485 01:38:22,620 --> 01:38:25,340 packets coming out. And that has BCD and... 2486 01:38:25,340 --> 01:38:25,480 And then you can pull those out and get these packets coming out. And that has BCD and... 2487 01:38:26,580 --> 01:38:30,700 And then you can pull those out and get these packets coming out. And that has BCD and... 2488 01:38:30,700 --> 01:38:33,920 And then you can graph it and you get these pretty lines out. I have no idea what it 2489 01:38:33,920 --> 01:38:36,740 was in the end because I was only recording for two minutes. I'm sure if you recorded 2490 01:38:36,740 --> 01:38:40,080 over a long period of time, you could correlate it with human activity somehow and figure 2491 01:38:40,080 --> 01:38:47,700 out what was going on there. But, yeah, that's kind of the idea. And so, you know, this 2492 01:38:47,700 --> 01:38:53,400 is a Windows program, but I'll just show you how you can do this nicely in... 2493 01:38:55,060 --> 01:38:56,020 In Python. 2494 01:39:00,680 --> 01:39:07,080 So, two hands. And... 2495 01:39:08,940 --> 01:39:14,020 Where is it? Okay. So we're going to go... I'm not going to look at that screen. So tell 2496 01:39:14,020 --> 01:39:22,760 me if I stopped something out. Important map plot lib, Python as plot. Good. And then import... 2497 01:39:22,760 --> 01:39:23,380 I'm sorry. 2498 01:39:24,500 --> 01:39:34,560 So what we're going to do is we're going to open the file, we're reading, and then we're 2499 01:39:34,560 --> 01:39:41,180 going to read that line and check that we've got something. 2500 01:39:41,180 --> 01:39:51,460 And now what we're going to do is we're going to turn the ASCII ones and zeros into 2501 01:39:59,360 --> 01:40:01,040 bytes of zero and one. 2502 01:40:03,580 --> 01:40:04,800 What did I do? 2503 01:40:05,100 --> 01:40:05,380 Oh. 2504 01:40:06,440 --> 01:40:06,920 Okay. 2505 01:40:09,840 --> 01:40:10,800 And then... 2506 01:40:10,800 --> 01:40:19,240 And then we want to find some good value, nine, so we're going to say, what is it, height 2507 01:40:19,240 --> 01:40:29,520 equals nine, two, six, and S2, S2, one, two, four times height. 2508 01:40:34,140 --> 01:40:34,580 Right. 2509 01:40:34,660 --> 01:40:37,500 The reason why we're doing this is we're going to turn it into an image and we want it to 2510 01:40:37,500 --> 01:40:39,140 have nice dimensions. 2511 01:40:39,880 --> 01:40:44,740 So we do do that. 2512 01:40:46,160 --> 01:40:50,580 And then what we do is we want to actually see what it looks like. 2513 01:40:52,400 --> 01:40:53,060 Okay. 2514 01:40:54,080 --> 01:40:54,740 Okay. 2515 01:40:55,680 --> 01:40:56,340 Okay. 2516 01:40:57,740 --> 01:40:58,400 Okay. 2517 01:41:11,360 --> 01:41:15,400 So we had, again, all... 2518 01:41:15,400 --> 01:41:16,600 It's all scrambled, right? 2519 01:41:17,000 --> 01:41:18,020 Nothing to see there. 2520 01:41:20,360 --> 01:41:25,740 Now, you can then get the scrambler happening. 2521 01:41:26,020 --> 01:41:30,900 I did a simple port to Python again. 2522 01:41:31,060 --> 01:41:31,900 Really, really simple. 2523 01:41:32,100 --> 01:41:36,300 It's just a class state machine essentially with the shift registers and just call next 2524 01:41:36,300 --> 01:41:36,680 on it. 2525 01:41:37,840 --> 01:41:38,400 Okay. 2526 01:41:39,120 --> 01:41:39,620 So... 2527 01:41:42,080 --> 01:41:43,320 Did we import that? 2528 01:41:43,400 --> 01:41:43,520 Yes. 2529 01:41:44,620 --> 01:41:46,500 And then we create the scrambler. 2530 01:41:46,560 --> 01:41:47,940 We wanted to tell it to descramble. 2531 01:41:48,340 --> 01:41:53,800 And then we map that across all of the values again. 2532 01:41:54,000 --> 01:41:54,760 Takes a second. 2533 01:41:55,600 --> 01:41:58,820 And then let's see what that looks like. 2534 01:41:59,100 --> 01:41:59,860 I just... 2535 01:41:59,860 --> 01:42:04,260 I really like matplotlib because it makes things really easy. 2536 01:42:05,100 --> 01:42:05,600 Okay. 2537 01:42:05,720 --> 01:42:06,220 Okay. 2538 01:42:07,360 --> 01:42:07,860 Okay. 2539 01:42:07,860 --> 01:42:07,920 Okay. 2540 01:42:08,400 --> 01:42:15,580 So, now you can see we have that structure again, except the colors aren't particularly 2541 01:42:15,580 --> 01:42:16,200 nice for it. 2542 01:42:17,300 --> 01:42:22,400 And then the last step is to do that differential decoding. 2543 01:42:23,160 --> 01:42:25,480 And so this is a little bit tricky. 2544 01:42:25,560 --> 01:42:28,840 By the way, if anybody's got any suggestions how to do this better than I'm open to it. 2545 01:42:28,940 --> 01:42:35,100 But what I'm gonna do here is I'm going to use zip function to create two copies of the 2546 01:42:35,100 --> 01:42:35,700 array. 2547 01:42:35,700 --> 01:42:42,520 but they end up in tuples where one array is offset by one sample so you 2548 01:42:42,520 --> 01:42:45,640 basically get these combinations so I'm going to zip it up and if you have a 2549 01:42:45,640 --> 01:42:50,760 look at what that looks like it looks like that so it's just basically the 2550 01:42:50,760 --> 01:42:54,960 pairs now where the second pair is the same stream but delayed by one we need 2551 01:42:54,960 --> 01:43:04,420 to add an empty one on the end because we'll be off by one for our image and 2552 01:43:04,420 --> 01:43:10,400 then we're going to do the differential decoding and that's just going to be in 2553 01:43:10,400 --> 01:43:14,080 that line there so what we're doing there is we're taking the second value 2554 01:43:14,680 --> 01:43:18,160 in one of these tuples and subtracting it from the first value so it's 2555 01:43:18,160 --> 01:43:23,140 basically the next sample minus the previous sample mod 2 for the entire 2556 01:43:23,720 --> 01:43:26,960 stream and then let's see what that looks like 2557 01:43:35,300 --> 01:43:41,900 and then voila we've got our packets out and then this is nice because now we can 2558 01:43:41,900 --> 01:43:48,260 actually zoom in and you know see see what these individual headers might look 2559 01:43:48,260 --> 01:43:53,700 like and you can start playing around with it from there so that's just an 2560 01:43:53,700 --> 01:43:59,760 example of doing some sort of simple visual analysis in in Python okay so 2561 01:43:59,760 --> 01:44:04,040 thanks for braving with me we're almost at the end of the session hopefully 2562 01:44:04,040 --> 01:44:04,300 that's 2563 01:44:04,420 --> 01:44:08,860 given you an idea of how you can go about doing blind analysis the last two 2564 01:44:08,860 --> 01:44:15,800 very quick demos I'd like to show you with those HF radar things so this also 2565 01:44:15,800 --> 01:44:20,920 includes audio I'll just very quickly show you how that works for these sorts 2566 01:44:20,920 --> 01:44:24,300 of things apart from looking at visually it's also really nice to be able to hear 2567 01:44:24,300 --> 01:44:30,520 what's going on because that can give you a hint so I'm going to run this and 2568 01:44:37,700 --> 01:44:47,700 I know I know for a fact that in this particular capture this was on HF so I 2569 01:44:47,700 --> 01:44:55,160 think it was 17.9 megahertz this here is digital radio mondial it's a 10 2570 01:44:55,160 --> 01:45:00,460 kilohertz OFDM carrier that's transmitting digital music and here is 2571 01:45:00,460 --> 01:45:05,720 going to pop up a chirp a radar chirp that's being sent over the air over 2572 01:45:05,720 --> 01:45:09,260 long some long distance but this chirps really interesting because it actually 2573 01:45:09,260 --> 01:45:12,680 changes the chirp rate while they're transmitting so they do a really quick 2574 01:45:12,680 --> 01:45:16,260 one and they keep slowing it down go slower and slower and slower and with 2575 01:45:16,260 --> 01:45:21,200 radar as you change the chirp rate it actually changes the resolution with 2576 01:45:21,200 --> 01:45:25,820 which you can resolve targets but also affects the distance over which you can 2577 01:45:25,820 --> 01:45:29,220 do it and it's it's basically trade-off in here they're going through the 2578 01:45:29,220 --> 01:45:30,060 spectrum so they can 2579 01:45:30,060 --> 01:45:34,980 get high resolution close in and low resolution but further away and what I 2580 01:45:34,980 --> 01:45:39,380 wanted to show you here was this fast autocorrelation block this was originally 2581 01:45:39,380 --> 01:45:44,440 written by this very mysterious guy called Frank of radio Roush fame he did 2582 01:45:44,440 --> 01:45:51,660 some amazing stuff with ADS-B and p25 and and Motorola stuff and CDMA 2583 01:45:51,660 --> 01:45:55,940 before you and I even knew about software-defined radio and and he is a 2584 01:45:55,940 --> 01:45:59,920 complete enigma but amazing talent guy I took his code and and sort of 2585 01:46:00,060 --> 01:46:04,580 spruce it up a bit for the new rotio and what the faster correlation does is it 2586 01:46:04,580 --> 01:46:08,280 actually looks for periodic structure within your signal 2587 01:46:08,580 --> 01:46:13,740 so unlike when we were talking about discovering the board right so that's 2588 01:46:13,740 --> 01:46:18,960 actually the purity see of the symbols themselves this is looking for larger 2589 01:46:18,960 --> 01:46:22,560 scale priority components to your signal so for example 2590 01:46:22,560 --> 01:46:30,040 let's say you have on this case a chirp but the more obvious one is GPS and 3G CDMA 2591 01:46:30,060 --> 01:46:35,340 mobile telephones. If you consider they're both CDMA systems and a receiver has to lock 2592 01:46:35,340 --> 01:46:39,760 on to the CDMA channel, so it has to look for a particular code in there and part of 2593 01:46:39,760 --> 01:46:44,640 the code, one of the channels there is the common pilot channel, I think, which contains 2594 01:46:44,640 --> 01:46:52,000 broadcast information and that is sent out on 3G at 10 millisecond intervals. So, there's 2595 01:46:52,000 --> 01:46:55,740 going to be some mysterious stuff in your signal. You've got no idea what's going on 2596 01:46:55,740 --> 01:47:01,340 in there. It's CDMA, it's all coded, it's all, you know, spread and everything. Same 2597 01:47:01,340 --> 01:47:06,160 for GPS. But you can hook this fast autocorrelation block up to it and you'll get a strong peak 2598 01:47:06,520 --> 01:47:10,440 at 10 milliseconds because it's finding that there's something repeating in there with 2599 01:47:10,440 --> 01:47:16,760 a 10 millisecond interval. With GPS, the course acquisition code has a 1 millisecond peak 2600 01:47:16,760 --> 01:47:24,960 because they have a chip rate of, the chip length is 1023 and their cyclic rate is 1.023 2601 01:47:24,960 --> 01:47:25,480 megahertz. 2602 01:47:26,260 --> 01:47:31,400 So, here we actually have this radar chirp that comes up and so I want to show you what 2603 01:47:31,400 --> 01:47:48,940 that looks like and what it sounds like as well. So, you can hear the chirps and the 2604 01:47:48,940 --> 01:47:53,620 rate at which it's chirping, it's basically sweeping a tone across the spectrum, is changing 2605 01:47:53,620 --> 01:47:54,100 the rate. 2606 01:47:54,100 --> 01:47:58,840 And it's running through here and again, you look at the first big peak and you can see 2607 01:47:58,840 --> 01:48:03,820 that every time it changes, the peak moves along because the chirp rate is slowing down. 2608 01:48:04,040 --> 01:48:15,460 You can hear that. And then again. So, now it's out here. 2609 01:48:29,820 --> 01:48:37,660 And that's it. So, I'll quickly show you what's going on here and also what I might 2610 01:48:37,660 --> 01:48:52,040 do actually is to finish up, throw a waterfall in there because it looks pretty here and NB2. 2611 01:48:54,100 --> 01:48:57,620 And so, before I run that, I just want to show you here, 2612 01:48:57,720 --> 01:49:00,960 this is essentially, it's really easy to do a fast-order correlation. 2613 01:49:01,880 --> 01:49:03,300 We have our channel selection here. 2614 01:49:03,680 --> 01:49:06,260 You do an FFT, you take the magnitude, 2615 01:49:06,700 --> 01:49:07,860 you do an FFT again, 2616 01:49:09,660 --> 01:49:12,100 and you take the magnitude of that as well, 2617 01:49:12,600 --> 01:49:14,160 and that will give you that plot. 2618 01:49:14,780 --> 01:49:15,480 That's all it is. 2619 01:49:15,560 --> 01:49:18,260 So that fast-order correlation block, all it does is that, 2620 01:49:18,440 --> 01:49:19,580 and then you get your plot out. 2621 01:49:19,660 --> 01:49:20,500 Really simple. 2622 01:49:20,840 --> 01:49:22,960 It relies on the special theorem. 2623 01:49:22,960 --> 01:49:24,520 You can read about it more online. 2624 01:49:24,960 --> 01:49:29,260 I think you pronounced it the Weiner-Kirchner theorem. 2625 01:49:29,540 --> 01:49:33,020 But it's a really simple and effective way of doing the transform. 2626 01:49:33,300 --> 01:49:37,300 And again, like before, we have this fancy plotting business 2627 01:49:37,300 --> 01:49:40,180 so that you get your number sink out, finds the first big peak. 2628 01:49:40,340 --> 01:49:41,780 And so when you run the thing, 2629 01:49:42,560 --> 01:49:45,040 you actually have that number sink telling you 2630 01:49:45,040 --> 01:49:47,920 what the period of the chirp actually is. 2631 01:49:48,320 --> 01:49:49,960 So if we wait one more time, 2632 01:49:50,600 --> 01:49:51,680 hopefully we can... 2633 01:49:58,460 --> 01:49:59,620 Where did I put that waterfall? 2634 01:50:01,380 --> 01:50:02,800 Ah, snap, I did it again. 2635 01:50:03,340 --> 01:50:04,460 Hang on, where's the waterfall? 2636 01:50:04,600 --> 01:50:05,020 Here, right? 2637 01:50:05,200 --> 01:50:05,640 Yeah. 2638 01:50:06,360 --> 01:50:07,420 Same old mistake. 2639 01:50:11,200 --> 01:50:12,200 Right, let's run that. 2640 01:50:20,500 --> 01:50:21,640 There we go. 2641 01:50:23,680 --> 01:50:24,360 Very good. 2642 01:50:25,820 --> 01:50:26,260 Waterfall. 2643 01:50:26,700 --> 01:50:27,140 Good. 2644 01:50:32,860 --> 01:50:33,760 Give it a second. 2645 01:50:42,760 --> 01:50:44,060 So just as a lead-up, 2646 01:50:44,940 --> 01:50:46,980 in 30 seconds when this is done... 2647 01:50:46,980 --> 01:50:47,020 Oh. 2648 01:50:47,920 --> 01:50:48,360 Oh. 2649 01:50:51,920 --> 01:50:52,360 So, 2650 01:50:52,960 --> 01:50:55,880 the chirp rate is too fast for this slow waterfall 2651 01:50:55,880 --> 01:50:57,560 to actually show you, but when we slow down, 2652 01:50:57,720 --> 01:50:59,660 you can see this peak is moving across, 2653 01:51:00,040 --> 01:51:01,600 it's doing that thing, and then it's telling you 2654 01:51:01,600 --> 01:51:02,760 what the period of the chirp is. 2655 01:51:03,040 --> 01:51:04,380 And then from that, you can calculate 2656 01:51:04,380 --> 01:51:07,000 what kind of range resolution you can get 2657 01:51:07,000 --> 01:51:07,860 on your radar signal. 2658 01:51:09,000 --> 01:51:09,360 But... 2659 01:51:12,960 --> 01:51:15,860 Yeah, this could be some over-the-horizon radar. 2660 01:51:16,580 --> 01:51:16,940 Yeah. 2661 01:51:17,360 --> 01:51:17,720 Yeah. 2662 01:51:22,580 --> 01:51:22,940 Yeah. 2663 01:51:22,940 --> 01:51:27,920 So if you look there, you can kind of see this pattern there, 2664 01:51:28,000 --> 01:51:30,620 this diagonal line, and that's your chirp, 2665 01:51:30,660 --> 01:51:34,080 that's your tone moving across the frequency band. 2666 01:51:34,920 --> 01:51:36,980 And you can see these all over the place, 2667 01:51:37,120 --> 01:51:39,440 all sorts of nation-states doing weird things. 2668 01:51:39,620 --> 01:51:40,660 So I'll just finish very quickly. 2669 01:51:41,480 --> 01:51:45,060 That same capture has DRM, Digital Radio Mondial, 2670 01:51:45,100 --> 01:51:52,400 that same business, 2671 01:51:53,220 --> 01:51:55,320 and what's interesting about this one is that 2672 01:51:55,920 --> 01:51:57,660 you can see there's that peak there. 2673 01:51:57,860 --> 01:52:01,740 That peak corresponds to the unguarded symbol time 2674 01:52:01,740 --> 01:52:02,800 of an OFDM frame. 2675 01:52:02,980 --> 01:52:05,500 So if you want to figure out what OFDM timing is used here, 2676 01:52:05,600 --> 01:52:08,120 same process, same technique, you can read that off. 2677 01:52:08,560 --> 01:52:10,140 And this, if you invert this, 2678 01:52:10,200 --> 01:52:13,840 this is the sub-carrier spacing within the OFDM frame. 2679 01:52:14,620 --> 01:52:16,720 Once you do the cyclostation analysis 2680 01:52:16,720 --> 01:52:18,500 and use that as your delay, 2681 01:52:19,300 --> 01:52:21,260 then you run that again with the... 2682 01:52:21,260 --> 01:52:22,780 So you're running this on the delayed, 2683 01:52:22,940 --> 01:52:25,120 version of itself, and you get this peak here, 2684 01:52:25,260 --> 01:52:28,600 and that's telling you the full OFDM symbol length. 2685 01:52:29,260 --> 01:52:33,440 And with that, you can start to look at the OFDM sub-carriers 2686 01:52:33,440 --> 01:52:34,180 within your signal. 2687 01:52:34,820 --> 01:52:42,140 And what we're actually hearing now is this sonified, 2688 01:52:42,340 --> 01:52:44,220 and you can see we've got that peak again, 2689 01:52:44,840 --> 01:52:46,740 and it's kind of difficult to hear 2690 01:52:46,740 --> 01:52:48,980 because we're actually listening to an FFT, 2691 01:52:50,780 --> 01:52:52,780 but there is actually a tone, 2692 01:52:52,940 --> 01:52:55,440 a tune in there, a very slight, subtle tone 2693 01:52:55,440 --> 01:52:57,880 that maps to this strong peak 2694 01:52:57,880 --> 01:53:01,240 that represents the cyclic nature of the DRM signal. 2695 01:53:01,380 --> 01:53:03,560 So within DRM, there's probably some synchronization code 2696 01:53:03,560 --> 01:53:06,200 that gets repeated every so often, 2697 01:53:06,340 --> 01:53:07,880 making up the frame, 2698 01:53:08,120 --> 01:53:11,000 and that's why we get that response in the domain 2699 01:53:11,000 --> 01:53:13,040 because we need to have the receiver synchronized to it. 2700 01:53:13,120 --> 01:53:13,360 Question? 2701 01:53:13,640 --> 01:53:18,860 If you haven't seen Contact, 2702 01:53:19,060 --> 01:53:21,200 it's a really great film, one of my favorites. 2703 01:53:21,880 --> 01:53:22,700 And then... 2704 01:53:23,200 --> 01:53:24,920 Promise, last thing, very quickly, 2705 01:53:25,060 --> 01:53:26,420 back to the satellite thing. 2706 01:53:26,600 --> 01:53:28,100 Remember how I was telling you that there's telemetry? 2707 01:53:29,100 --> 01:53:30,900 The satellite will send down telemetry 2708 01:53:30,900 --> 01:53:32,240 to let you know that it's okay. 2709 01:53:33,300 --> 01:53:36,160 This is the telemetry here. 2710 01:53:36,320 --> 01:53:38,760 We've got lots of things modulated onto this carrier. 2711 01:53:38,980 --> 01:53:40,420 It's actually using phase modulation, 2712 01:53:40,640 --> 01:53:41,560 we can tell from the research. 2713 01:53:42,840 --> 01:53:45,260 This now is the channel-selected thing, 2714 01:53:45,300 --> 01:53:46,780 and you can see how this is slightly off-center. 2715 01:53:47,200 --> 01:53:48,640 I'm using a PLL here 2716 01:53:49,800 --> 01:53:51,300 to lock onto that signal, 2717 01:53:51,480 --> 01:53:52,920 bring it back down to back-center, 2718 01:53:52,920 --> 01:53:53,300 baseband, 2719 01:53:53,880 --> 01:53:55,020 and then we can... 2720 01:53:59,660 --> 01:54:00,960 Can you hear that B thing? 2721 01:54:03,120 --> 01:54:04,140 That's the satellite saying, 2722 01:54:04,300 --> 01:54:04,700 oh, I'm here. 2723 01:54:06,740 --> 01:54:09,300 And that's the telemetry coming down from the satellite. 2724 01:54:11,160 --> 01:54:12,420 So you can visualize that 2725 01:54:12,420 --> 01:54:15,440 and try to access and figure out the telemetries. 2726 01:54:15,520 --> 01:54:17,200 Anyway, thanks for bearing with me. 2727 01:54:17,260 --> 01:54:18,240 Hope you've learned something, 2728 01:54:18,380 --> 01:54:19,980 and I'll wrap up there. 2729 01:54:20,660 --> 01:54:21,840 I've gone over time a little bit, 2730 01:54:21,860 --> 01:54:22,300 so I'll be outside. 2731 01:54:22,920 --> 01:54:23,900 Thanks for watching. 2732 01:54:23,900 --> 01:54:24,020 Please subscribe to my channel.