1 00:00:00,000 --> 00:00:05,540 Hello, everyone. Thanks for being here and thanks to Wireless Village for having me. 2 00:00:05,780 --> 00:00:16,780 Woo! My name is Eric Reuter. I'm not sure how to introduce myself to this crowd. My work is 3 00:00:16,780 --> 00:00:22,780 not in anything that I'm going to talk about today. I teach and consult in acoustics and 4 00:00:22,780 --> 00:00:27,320 noise control. But my education is electrical engineering and I've been a lifelong 5 00:00:27,320 --> 00:00:36,880 electronics nut and train nut. And so I look for ways occasionally to bridge those gaps, 6 00:00:37,000 --> 00:00:44,820 although it's rare that those opportunities work out. But with the advent of consumer SDR 7 00:00:45,300 --> 00:00:51,860 devices in the last five years or so, I've been inspired to look at some of the wireless 8 00:00:51,860 --> 00:00:57,300 protocols that the railroads use. And my interest in this isn't to, you know, look at the 9 00:00:57,320 --> 00:01:02,400 tracks. But it's really to try to find ways to exploit them or break them. It's really to figure 10 00:01:02,400 --> 00:01:06,680 out where the trains are so I can go and take pictures of them and things of that nature. I'm 11 00:01:06,680 --> 00:01:15,800 part of a subculture of people who likes to chase trains around in photograph them. This photograph 12 00:01:15,800 --> 00:01:27,300 was taken in Apex, a few miles north of here a couple years ago. I'm a ham AB-1XO. And I'm a ham 13 00:01:27,320 --> 00:01:32,360 And then I'm on Twitter, but I've only ever tweeted four 14 00:01:32,360 --> 00:01:36,200 times and two of them were in the last 48 hours. So I will send 15 00:01:36,200 --> 00:01:38,840 out some of the material from this after. I'm going to release 16 00:01:38,840 --> 00:01:43,140 some code as well. So if you want to find that stuff, you can 17 00:01:43,140 --> 00:01:48,800 follow me and I hope I won't disappoint you. So when I put 18 00:01:48,800 --> 00:01:51,520 this together and I wrote the abstract, I had planned to sort 19 00:01:51,520 --> 00:01:55,540 of break this into three parts. First, looking at a survey of 20 00:01:55,540 --> 00:01:59,060 all the different wireless systems that railroads use in the 21 00:01:59,060 --> 00:02:03,420 United States. And then look at two specific protocols that I've 22 00:02:03,420 --> 00:02:06,220 spent a lot of time reverse engineering for no particular 23 00:02:06,220 --> 00:02:11,400 reason except to use them as learning tools for learning 24 00:02:11,400 --> 00:02:18,360 about SDR and radio and Python and RFID and things. So I 25 00:02:18,360 --> 00:02:21,220 decided, though, to spend the time on those two things and not 26 00:02:21,220 --> 00:02:24,880 spend much time on the other protocols. But just very quickly 27 00:02:25,540 --> 00:02:31,660 these are kind of the major uses of RF that the railroads use. 28 00:02:31,920 --> 00:02:35,920 There's voice communications. These have been around forever. 29 00:02:36,140 --> 00:02:39,180 They got narrow-banded a few years ago, but they're all still 30 00:02:39,180 --> 00:02:44,340 in the same block of frequencies. PTC and ATCS are 31 00:02:44,340 --> 00:02:50,100 both traffic control protocols. PTC has had a lot of press 32 00:02:50,100 --> 00:02:55,520 lately. Distributed power, DP, is the most common type of 33 00:02:55,540 --> 00:02:58,820 remote control protocol for locomotives. And then the two 34 00:02:58,820 --> 00:03:03,120 that I want to talk to you about today are the end of train, head 35 00:03:03,120 --> 00:03:07,760 of train telemetry system, the EOT system, and the automatic 36 00:03:07,760 --> 00:03:11,780 equipment identification system, AEI. So I'm going to jump right 37 00:03:11,780 --> 00:03:18,280 into the EOT system first. To really understand the purpose of 38 00:03:18,280 --> 00:03:22,580 the EOT, I'm going to spend a few slides on mechanical stuff, 39 00:03:22,660 --> 00:03:25,520 and that's the braking systems for railroads. So I'm going to 40 00:03:25,540 --> 00:03:25,780 talk a little bit about the braking systems for railroads. 41 00:03:26,960 --> 00:03:31,360 So if you have a locomotive or a set of locomotives and then a 42 00:03:31,360 --> 00:03:38,020 string of cars, you have to have brakes on the individual cars 43 00:03:38,360 --> 00:03:41,580 or you'll never stop the train. They would easily overwhelm the 44 00:03:41,580 --> 00:03:46,180 locomotive. So in the early days, this was accomplished by 45 00:03:46,180 --> 00:03:49,660 having people run down the top of the train and turn wheels, 46 00:03:50,220 --> 00:03:52,860 which is very dangerous and inefficient. You really had to 47 00:03:52,860 --> 00:03:54,460 plan ahead if you wanted to stop the train. 48 00:03:56,560 --> 00:04:06,660 And that went on until the late 1800s. And just around 1869 or so, 49 00:04:06,740 --> 00:04:10,920 George Westinghouse, when he was 22, came up with and patented the 50 00:04:10,920 --> 00:04:14,100 first railroad air brake system, which is very similar to what's 51 00:04:14,100 --> 00:04:18,260 still used. And the important thing to understand about the way 52 00:04:18,260 --> 00:04:23,000 these brakes work is that they're intended to be fail-safe, which 53 00:04:23,000 --> 00:04:24,740 is to, which is to say that the 54 00:04:25,680 --> 00:04:30,540 brake cylinders on the cars are actuated by air that's stored on 55 00:04:30,540 --> 00:04:34,520 each car. And so to apply the brakes, you actually reduce the 56 00:04:34,520 --> 00:04:38,420 pressure that you send to the cars from the engine. And that's 57 00:04:38,420 --> 00:04:41,380 important in the context of the device that we're going to look 58 00:04:41,380 --> 00:04:44,700 at here. This is how it goes together. You have in the engine 59 00:04:44,700 --> 00:04:48,840 the red stuff there, a compressor, a reservoir for air. 60 00:04:48,980 --> 00:04:52,380 It's fairly high pressure. And then there's a pipe that runs 61 00:04:52,380 --> 00:04:53,640 the whole length of the train. 62 00:04:54,380 --> 00:04:54,900 And 63 00:04:55,540 --> 00:05:01,800 carries the air to each car, which has a special valve called a 64 00:05:01,800 --> 00:05:08,100 triple valve, a reservoir, and then the brake cylinder and brake 65 00:05:08,100 --> 00:05:14,280 shoe. And then that applies to the wheel. So there are three basic 66 00:05:14,280 --> 00:05:18,720 conditions that are important in the context of this discussion. The 67 00:05:18,720 --> 00:05:21,720 kind of steady state condition is when the brakes are off, the 68 00:05:21,720 --> 00:05:25,520 release condition. And during that time, there's a bit of a 69 00:05:25,540 --> 00:05:28,620 slowdown. So you have about 90 PSI of air being supplied by the 70 00:05:28,620 --> 00:05:34,200 engine to the cars. That charges up the reservoirs on the cars. So 71 00:05:34,200 --> 00:05:37,540 they're always being charged, sort of topped off. And then if 72 00:05:37,540 --> 00:05:39,720 you want to slow down the train, you do what's called a service 73 00:05:39,720 --> 00:05:43,140 application, which means that you reduce, gradually reduce the 74 00:05:43,140 --> 00:05:48,000 pressure from the engine. The pressure in the reservoir on the 75 00:05:48,000 --> 00:05:51,540 car becomes higher than that in the brake pipe. And some of that 76 00:05:51,540 --> 00:05:54,300 then moves the valve and bleeds off and applies the brakes. 77 00:05:55,800 --> 00:06:00,000 The other condition is called an emergency application. That's when 78 00:06:00,000 --> 00:06:03,660 there's a car stuck in the tracks or something and you need to stop the 79 00:06:03,660 --> 00:06:08,500 train right now. And to do that, you vent the brake line to the 80 00:06:08,500 --> 00:06:12,380 atmosphere. You dump the air. So instead of reducing it slowly, you 81 00:06:12,380 --> 00:06:16,660 reduce it to zero immediately. And that applies to brakes very 82 00:06:16,660 --> 00:06:23,260 quickly. The propagation rates essentially are limited by the speed 83 00:06:23,260 --> 00:06:25,520 of sound. So the service application is a little bit more 84 00:06:25,540 --> 00:06:28,300 complicated. A service application propagations about 6 to 700 feet 85 00:06:28,300 --> 00:06:32,360 per second. And then an emergency application gets up to about 900 feet 86 00:06:32,360 --> 00:06:37,220 per second. But a train can be miles long. So it takes a few seconds, 87 00:06:37,300 --> 00:06:40,920 even in an emergency application, to get air all the way to the back 88 00:06:40,920 --> 00:06:44,200 of the train, which means that the brakes are on at the front but not 89 00:06:44,200 --> 00:06:48,200 at the back. And the momentum of those cars are still pushing until 90 00:06:48,200 --> 00:06:55,140 that propagates to the back. So it's important for the engineer to know 91 00:06:55,580 --> 00:07:00,220 what the pressure is at the back of the train for several reasons. When 92 00:07:00,220 --> 00:07:03,780 you start moving, you need to know when the brakes are off. You need to 93 00:07:03,780 --> 00:07:07,580 know that the brake pipe is intact, that it hasn't pulled apart. And then 94 00:07:07,580 --> 00:07:11,200 if you're actually moving in the knuckle coupler brakes, you want to know 95 00:07:11,200 --> 00:07:14,620 that the train hasn't pulled apart. So it's important to monitor that 96 00:07:15,280 --> 00:07:19,300 pressure at the back of the train. And for the first 110 years or so, 97 00:07:19,360 --> 00:07:22,920 that was done by a human in a caboose. This is one of the principal 98 00:07:22,920 --> 00:07:25,520 functions of the caboose, was to monitor the brake pressure. 99 00:07:25,540 --> 00:07:30,820 And then in about 1980, the caboose was no longer required by the FRA, 100 00:07:31,380 --> 00:07:37,700 and they were quickly replaced by these EOT devices, which is in the photo 101 00:07:37,700 --> 00:07:41,880 there. So the EOT hangs on a coupler on the back, connects to the brake 102 00:07:41,880 --> 00:07:47,820 line, monitors the pressure, and radios the pressure back to the engine. 103 00:07:49,860 --> 00:07:55,400 So the system is a two-part, two-way system, full duplex system. So 104 00:07:55,400 --> 00:08:01,480 the EOT sends telemetry data forward, and the engine has a couple of 105 00:08:01,480 --> 00:08:05,580 commands that it can send back. And I'll get to that in just a second. 106 00:08:06,040 --> 00:08:09,080 But it is full duplex, so if you want to hear both of them, you have to 107 00:08:09,080 --> 00:08:17,720 monitor both frequencies. So some functions. The first one I've talked 108 00:08:17,720 --> 00:08:22,660 about. It also provides a flashing red light on the back of the train, 109 00:08:22,720 --> 00:08:25,380 which is required for night operations by the FRA. And then it's a 110 00:08:25,400 --> 00:08:25,960 Industrial tod, in other words, the engine that is flashing the brake 111 00:08:25,960 --> 00:08:31,280 line. These are sometimes called FREDs, for flashing rear-end device. And 112 00:08:31,280 --> 00:08:38,720 in that case, the HOTs called Wilma. And then the last function there is 113 00:08:38,720 --> 00:08:43,320 that, in an emergency stop situation, the HOT, the head-end unit which sits 114 00:08:43,320 --> 00:08:48,340 in the engine, can tell the EOT to dump the air. And that effectively dumps 115 00:08:48,340 --> 00:08:51,580 the air from both ends of the train at once, and applies to brakes much more 116 00:08:51,580 --> 00:08:51,920 quickly. 117 00:08:55,400 --> 00:09:04,160 a security concern that we'll talk about here. Specifications, this is the frequency pair I 118 00:09:04,160 --> 00:09:08,560 mentioned earlier. The RF power of the OT is two watts. The antenna is in a terrible 119 00:09:08,560 --> 00:09:16,240 position. It's blocked by the bulkhead end of a railcar. So the reception is actually much 120 00:09:16,240 --> 00:09:25,140 better any place but the engine. So it's easy to monitor these things. The modulation is 121 00:09:25,400 --> 00:09:34,420 continuous phase fast frequency shift keying, also called minimum shift keying. And the mark and 122 00:09:34,420 --> 00:09:41,340 space frequencies, it's a 1200 baud signal, mark and space frequencies are 1200 and 1800 hertz. 123 00:09:41,870 --> 00:09:54,780 And the way that MSK or FFSK works is that you have one cycle of your, each symbol is either one 124 00:09:54,780 --> 00:10:02,120 cycle of the lower frequency or one and a half cycles of the higher frequency. And the benefit to 125 00:10:02,120 --> 00:10:06,440 this is that the phase is continuous every time you get to a zero crossing you don't have a 126 00:10:07,880 --> 00:10:15,840 discontinuity. So it doesn't create a lot of harmonic noise. You can use a very narrow 127 00:10:15,840 --> 00:10:21,220 transmission channel. For this to work you have to have either a marker space frequency 128 00:10:21,220 --> 00:10:24,760 that equals the baud rate. And so what I've plotted here is six thresholds. And if you have a few Werner 129 00:10:24,780 --> 00:10:35,220 is a 0101 sequence and you can see that you have for the ones a full cycle of 1200 hertz 130 00:10:35,220 --> 00:10:41,240 and for the zeros one and a half cycles of 1800 hertz the phase is arbitrary it's dependent on 131 00:10:41,240 --> 00:10:47,360 the previous symbol so if you look at every other sine wave or every other one the phase is opposite 132 00:10:47,940 --> 00:10:50,180 so it's it's the frequency that matters not the phase 133 00:10:53,700 --> 00:10:59,820 so frequency shift keying or fast frequency shift keying of this type is a type of af afsk audio 134 00:10:59,820 --> 00:11:05,540 frequency shift keying which means that it's a sort of two-part modulation demodulation process 135 00:11:06,660 --> 00:11:12,380 so to modulate it essentially you take a bit stream and you generate audio and that audio 136 00:11:12,380 --> 00:11:17,860 may never be heard or see the light of day but it it becomes an audio signal and then you can 137 00:11:17,860 --> 00:11:19,700 transmit that through an audio channel 138 00:11:19,700 --> 00:11:26,440 or a channel that's in that's designed for voice communication so in the early days of data modems 139 00:11:26,440 --> 00:11:32,780 that that was the type of transmitter that was available so you see a lot of this in older 140 00:11:32,780 --> 00:11:37,960 protocols like this and then on the other end you do the opposite you can demodulate the audio 141 00:11:37,960 --> 00:11:43,340 and then and then demodulate the bit stream and i'll show you that processing your new radio 142 00:11:47,060 --> 00:11:48,840 all right so um this 143 00:11:49,700 --> 00:11:56,760 uh these telemetry packets have been used for a long time by rail fans people like trains to um 144 00:11:57,440 --> 00:12:02,100 uh to tell when a train is coming you know if you're out waiting for a train that you want to 145 00:12:02,100 --> 00:12:08,680 see you start to hear these chirps telemetry chirps um that's how you know there's a train 146 00:12:08,680 --> 00:12:13,920 approaching but i always wondered what they were actually saying and so that was sort of the um 147 00:12:14,760 --> 00:12:18,340 the uh motivation for this project and 148 00:12:19,700 --> 00:12:25,420 uh there is a windows software called soft eot that does this but it's not open source and i 149 00:12:25,420 --> 00:12:32,420 really wanted to dig into it and understand it so the first clue i got was this figure from a patent 150 00:12:32,420 --> 00:12:36,600 the patent was from some you know proposed improvement or something 151 00:12:36,600 --> 00:12:40,800 they probably didn't go anywhere but they had this figure in there that has the packet format 152 00:12:41,520 --> 00:12:46,560 so they have up at the top the bit sync and the frame sync and then what's in the actual packet 153 00:12:47,200 --> 00:12:48,060 and so 154 00:12:48,060 --> 00:12:56,320 so starting with this i was able to do some additional research and come up with what i think 155 00:12:56,760 --> 00:13:04,220 is the packet contents for a modern eot this has evolved a bit over the last 40 years 156 00:13:04,880 --> 00:13:10,720 as the technology has gotten better the important things here though are the unit id 157 00:13:11,620 --> 00:13:16,240 and the pressure and then there are some other flags for things like battery condition 158 00:13:16,240 --> 00:13:22,700 condition, whether the rear end light is flashing. A lot of these units now are powered by a 159 00:13:22,700 --> 00:13:27,260 turbine that bleeds some air off of the brake line to charge the batteries to keep them 160 00:13:27,260 --> 00:13:35,160 running indefinitely. And so these fields are all clear. You can, if you know where 161 00:13:35,160 --> 00:13:42,860 to look inside the packet, you can get the data. They are validated, though, by a set 162 00:13:42,860 --> 00:13:49,420 of 18 check bits using BCH error correction. And I'll explain a bit about that in a moment. 163 00:13:49,760 --> 00:13:57,800 But here's a first attempt at decoding this. I just recorded an audio sample off of a scanner 164 00:13:57,800 --> 00:14:06,380 or one of my HTs or something. And this is Audacity, which everyone who works in SDRs 165 00:14:06,380 --> 00:14:12,840 has seen in many demonstrations. Since this is 1200 baud, if you, if you're 166 00:14:12,840 --> 00:14:18,640 recording at 48 kilohertz sampling rate, every symbol is 40 cycles, or 40 samples. 167 00:14:19,220 --> 00:14:24,500 So if you get lost kind of going through this, looking for whether it's one cycle or one 168 00:14:24,500 --> 00:14:28,180 and a half, you can just measure 40 samples and kind of figure out where you are. 169 00:14:28,340 --> 00:14:34,000 So I put a comment track down at the bottom there, or two actually, and went through the 170 00:14:34,000 --> 00:14:41,320 whole thing and just typed 0101 and then correlated that to what I knew those fields were. 171 00:14:44,160 --> 00:14:49,660 I knew the unit ID for this unit. The unit IDs are all printed on the side of the BOT, 172 00:14:49,700 --> 00:14:55,360 so if you can see it, you can get the unit ID from there. And I discovered that it was 173 00:14:55,360 --> 00:15:02,660 all of the multi-bit fields are little Indians, so you have to reverse them to, before you 174 00:15:02,660 --> 00:15:10,160 convert them to decimal. But this is unit 10603, and the pressure was 66. 175 00:15:13,260 --> 00:15:19,580 All right, the BCH code. If you just want to know what the data, you know, contains, 176 00:15:19,980 --> 00:15:23,060 then you can just look at these fields. If you want to actually validate the packet, 177 00:15:23,260 --> 00:15:31,760 you need the BCH code. So BCH code is a type of CRC, forward error correction. How to 178 00:15:31,760 --> 00:15:36,380 actually calculate the generator polynomials is another lecture that I'm not qualified 179 00:15:36,380 --> 00:15:41,680 to give, but I'll give you an example of how to calculate the check bits if you know the 180 00:15:41,680 --> 00:15:42,820 generator polynomials. 181 00:15:42,840 --> 00:15:50,080 And this is similar to any CRC calculation. So this example is the simplest one that you 182 00:15:50,080 --> 00:15:56,460 can use, the 7-4 code. And what that means is that there are seven bits in a code word, 183 00:15:57,480 --> 00:16:01,940 and four of those are actual information, and the other three are the checksum. 184 00:16:05,940 --> 00:16:10,240 And typically, you would take the information in the checksum and concatenate them to come 185 00:16:10,240 --> 00:16:12,200 up with a check word, or a code word. 186 00:16:12,840 --> 00:16:19,500 So here's an example of calculating that. The first step is to take the order of the 187 00:16:19,500 --> 00:16:27,160 generator polynomial, which is third order. The generator polynomial is 1011 in binary 188 00:16:27,160 --> 00:16:33,160 form. And then you pad your information with the same number of zeros as the order of the 189 00:16:33,160 --> 00:16:39,020 polynomial, which ends up being the number of bits in the polynomial minus one. And then 190 00:16:39,020 --> 00:16:42,660 you just mod that. So we don't care what the quotient is, we just care about the remainder, 191 00:16:42,820 --> 00:16:50,980 and the remainder is the check bits. So in this case we take 011 192 00:16:50,980 --> 00:16:55,500 because we know it's 3 bits and concatenate that with 1010 and 193 00:16:55,500 --> 00:17:02,100 that's our code word. So there are 127 possible 7 bit binary 194 00:17:02,100 --> 00:17:07,440 numbers but only 16 of them are valid, valid code words. And 195 00:17:07,440 --> 00:17:12,100 you'll notice here that any code word, any valid code word if you 196 00:17:12,100 --> 00:17:16,700 rotate it, that's also a valid code word. So that's the sort of 197 00:17:16,700 --> 00:17:21,220 cyclic nature of this. I've done a sort of linear list of valid 198 00:17:21,220 --> 00:17:24,900 code words and not valid code words which is a gross over 199 00:17:24,900 --> 00:17:27,320 simplification because what you're really after is the 200 00:17:27,320 --> 00:17:30,260 Hamming distance which is the number of bits that you would 201 00:17:30,260 --> 00:17:33,380 have to change in an invalid code word to get to a valid code 202 00:17:33,380 --> 00:17:38,900 word. And for that, for this code it's very small. You can 203 00:17:38,900 --> 00:17:41,760 only correct one error in this code because the Hamming 204 00:17:41,760 --> 00:17:42,080 distance is very small. You can only correct one error in this 205 00:17:42,100 --> 00:17:47,540 code because the Hamming distance is like 3 or a minimum of 3. But 206 00:17:47,540 --> 00:17:52,960 in the BCH code for the EOT packets we have a lot more check 207 00:17:52,960 --> 00:17:57,460 bits. So we can correct a lot more errors. However, there are 208 00:17:57,460 --> 00:17:59,960 two ways to validate a packet. One is to actually do the error 209 00:17:59,960 --> 00:18:04,340 correction and the other one is to just recalculate what you 210 00:18:04,340 --> 00:18:06,780 know the check bits should be and make sure they're the same. 211 00:18:07,680 --> 00:18:11,540 So in a non-critical application like this one certainly is, 212 00:18:11,540 --> 00:18:15,880 that's a much easier way to do it. So you basically just, you 213 00:18:15,880 --> 00:18:18,940 know, use your generator polynomial, mod it with the data 214 00:18:18,940 --> 00:18:22,120 and see if the bits that you received are the same as the 215 00:18:22,120 --> 00:18:25,140 bits you calculated. At least that's what I assumed would be 216 00:18:25,140 --> 00:18:30,920 the case. It turns out it's not quite the case for this. So the 217 00:18:30,920 --> 00:18:36,200 BCH code in the EOT packet is a 6345 type. So there are 45 bits 218 00:18:36,200 --> 00:18:41,520 of information and then 18 bits of check bits. And then the 219 00:18:41,540 --> 00:18:43,480 BCH code in the EOT packet is a 6445 type. And this took, this 220 00:18:43,480 --> 00:18:48,580 probably took the longest time of any of this to figure out. They 221 00:18:48,580 --> 00:18:52,920 actually first reversed the order of the whole data block. 222 00:18:53,720 --> 00:18:59,960 And then they calculate the, then they calculate the check 223 00:18:59,960 --> 00:19:03,940 bits here, the BCH check bits. And then for some reason they 224 00:19:03,940 --> 00:19:09,820 XOR that with a 18-bit string. I think there's probably some 225 00:19:09,820 --> 00:19:11,520 technical reason for that. I don't have a lot of information 226 00:19:11,540 --> 00:19:13,540 about that. But in the sense it's a security reason. But 227 00:19:13,540 --> 00:19:15,760 because obviously you could just, if you know the right 228 00:19:15,760 --> 00:19:18,020 answer, you could just XOR it with what you have and get the 229 00:19:18,020 --> 00:19:22,400 key. So I don't think it's a security thing. And maybe one of 230 00:19:22,400 --> 00:19:25,540 you have some, an idea about why they do that. But anyway, then 231 00:19:25,540 --> 00:19:28,220 you take the encrypted, I hesitate to use that word, but 232 00:19:28,220 --> 00:19:31,060 encrypted check bits and concatenate those with the 233 00:19:31,060 --> 00:19:34,400 original packet, not the reversed packet. So this took a 234 00:19:34,400 --> 00:19:37,920 lot of futzing around to figure out. But once I got it, I could 235 00:19:37,920 --> 00:19:41,420 reliably re, recreate the check bits and compare them to the 236 00:19:41,420 --> 00:19:41,520 BCH code. And so that's kind of what I'm trying to do here. 237 00:19:41,540 --> 00:19:46,700 Validate my packets. All right. So the decoder that I put 238 00:19:46,700 --> 00:19:52,780 together is in two parts. The first part is GNU radio. And in 239 00:19:52,780 --> 00:19:57,160 GNU radio, I'm going to take the IQ data from the SDR and 240 00:19:57,980 --> 00:20:01,500 demodulate it to audio. And then take the audio and demodulate 241 00:20:01,500 --> 00:20:05,060 that to a bit stream and then send that to a ZMQ socket. And 242 00:20:05,060 --> 00:20:09,060 then in a separate Python script, which could be local 243 00:20:09,060 --> 00:20:11,520 host or anywhere. I'm going to take the audio and demodulate 244 00:20:11,520 --> 00:20:15,120 it to audio. And then I'm going to grab that ZMQ pub sub socket 245 00:20:15,820 --> 00:20:21,820 and parse out the data fields, compute the checksum and 246 00:20:21,820 --> 00:20:27,760 validate the packet. So here's the whole flowchart. It's very 247 00:20:27,760 --> 00:20:31,920 simple. I've tried to keep everything very simple here. I'm 248 00:20:31,920 --> 00:20:34,040 going to zoom in on this, but that's the whole thing. So 249 00:20:34,040 --> 00:20:37,980 basically, RF stuff on the top and audio stuff on the bottom. 250 00:20:38,940 --> 00:20:41,500 So the upper right, upper left corner is where I'm going to 251 00:20:41,500 --> 00:20:47,760 have the OSMO COM source there. Low pass filter. Drops it to 4 252 00:20:47,760 --> 00:20:52,380 kilohertz bandwidth, which is still more than we need. A 253 00:20:52,380 --> 00:20:56,340 squelch, which I actually haven't been using. And I'll 254 00:20:57,040 --> 00:21:01,200 explain why in a moment. And then moving over, I have a 255 00:21:02,880 --> 00:21:07,660 resampler to get it down to 48 kilohertz audio. And that's way 256 00:21:07,660 --> 00:21:10,920 more than we need for this application. But I wanted this to 257 00:21:10,920 --> 00:21:17,220 also be able to read a WAV file. So I just did everything at 48k so 258 00:21:17,220 --> 00:21:20,560 I can read a WAV file in for testing. And actually, if you 259 00:21:21,220 --> 00:21:26,980 feed a source, an audio source from the laptop microphone into 260 00:21:26,980 --> 00:21:30,260 this and just put a radio next to it, it will decode the packets. 261 00:21:30,720 --> 00:21:36,140 It's a pretty slow data rate. Pretty robust format. Audio sync 262 00:21:36,140 --> 00:21:40,580 if you want to hear it. And then the line that goes back across is 263 00:21:40,920 --> 00:21:45,840 audio at this point. Then I go into a frequency translating FIR 264 00:21:45,840 --> 00:21:51,820 filter. And what I'm doing here is shifting the center to a point 265 00:21:51,820 --> 00:21:56,860 that's halfway between the mark and space frequencies. So the zero 266 00:21:56,860 --> 00:22:01,380 point now, the zero hertz point, used to be 1500 hertz. And what 267 00:22:01,380 --> 00:22:06,500 that does is it makes the space frequency positive and the mark 268 00:22:06,500 --> 00:22:10,900 frequency negative. And so the complex output that that 269 00:22:10,920 --> 00:22:17,160 creates goes into the quadrature demod block. And in simple terms, 270 00:22:17,200 --> 00:22:20,460 the quadrature demod output is proportional to the frequency of 271 00:22:20,460 --> 00:22:24,820 the input. Or the instantaneous frequency of the input. So if 272 00:22:24,820 --> 00:22:27,680 you shift the input such that you have positive and negative 273 00:22:27,680 --> 00:22:32,280 frequencies relative to that midpoint, it's very easy for the 274 00:22:32,280 --> 00:22:36,860 quadrature demod block to figure out whether it's a mark or a 275 00:22:36,860 --> 00:22:40,900 space, essentially with two samples. I'm using four, but I 276 00:22:40,920 --> 00:22:45,920 think even that's more than we need. The mark frequency is the 277 00:22:46,600 --> 00:22:49,860 lower frequency. So I have to invert the logic, which is why I'm 278 00:22:49,860 --> 00:22:56,100 multiplying by negative one. And then I'm resampling that down. 279 00:22:56,240 --> 00:23:00,420 Oh, smoothing it. Resampling it down to four cycles per symbol 280 00:23:00,420 --> 00:23:05,840 instead of 40. So just dividing by 10. And then clock recovery, 281 00:23:06,180 --> 00:23:10,900 binary slicer, and then the CMQ pub socket. And, or rather, 282 00:23:10,920 --> 00:23:14,720 pub sync. The output of the binary slicer is bytes. So 283 00:23:14,720 --> 00:23:17,600 there's a byte that represents each bit. So it effectively 284 00:23:17,600 --> 00:23:24,900 increases the data rate by 8. And the bytes are like 0x00 and 285 00:23:24,900 --> 00:23:29,000 0x01. So they're not ASCII 0 and 1. They're actual, you know, 286 00:23:29,600 --> 00:23:36,840 hex 0 and 1. Just to quickly show you the steps in this 287 00:23:36,840 --> 00:23:40,780 graphically, this is just that same 0101 test signal that I 288 00:23:40,920 --> 00:23:45,140 showed you earlier in green. And then the output of the 289 00:23:47,080 --> 00:23:50,620 quadrature demod block is blue. So you can see when the 290 00:23:50,620 --> 00:23:57,080 frequency is 1200, it goes down. The kind of sinusoidal signal 291 00:23:57,080 --> 00:24:01,420 goes down. And when it's 1800, it goes up. And then the binary 292 00:24:01,420 --> 00:24:06,800 data, that's after the slicing. And the logic's been inverted. 293 00:24:07,100 --> 00:24:10,800 So it's very clean. And it seems to be pretty 294 00:24:10,920 --> 00:24:15,960 reliable. I don't think you'll be able to read this, but this is 295 00:24:15,960 --> 00:24:20,740 up on GitHub. This is the routine that essentially connects to the 296 00:24:20,740 --> 00:24:24,800 socket. And what's coming in is arbitrary chunks of ones and 297 00:24:24,800 --> 00:24:30,460 zeros. So it might be one byte. It might be 20 bytes. If we have 298 00:24:30,460 --> 00:24:32,980 time, I can kind of show you that, what's coming through. So 299 00:24:32,980 --> 00:24:37,620 what I'm doing is I'm putting each of the new blocks that 300 00:24:37,620 --> 00:24:40,900 comes in that I read, one byte at a time into a single block. 301 00:24:40,900 --> 00:24:44,260 Into a deck that has a finite length that's more than I need, 302 00:24:44,360 --> 00:24:49,100 more than the packet length. And then every time I put a byte in, 303 00:24:49,140 --> 00:24:52,120 I take the whole thing, put it in a buffer, and see if my 304 00:24:52,120 --> 00:24:56,500 frame sync sequence is at the top of the buffer. And if it is, 305 00:24:56,500 --> 00:25:00,300 I know that it might have a packet. And so I go then into a 306 00:25:02,340 --> 00:25:06,640 class that parses out the data and does all the acrobatics to 307 00:25:06,640 --> 00:25:10,360 figure out the checksum. And if the checksum checks out, it sets 308 00:25:10,360 --> 00:25:10,880 a flag. And then I can go back and see what's going on. And I 309 00:25:10,880 --> 00:25:15,800 get a flag. And then the main function prints it, calls another 310 00:25:15,800 --> 00:25:18,200 function to print it to the screen, which I'll show you. This 311 00:25:18,200 --> 00:25:20,640 will be easier to see if it's in front of you. But that's the 312 00:25:20,640 --> 00:25:22,800 process. There may be a more efficient way to handle that, 313 00:25:22,880 --> 00:25:28,220 but I'm not very good at Python. So this is, but it 314 00:25:28,220 --> 00:25:31,100 works. It seems to work reliably. All right. So here's 315 00:25:31,100 --> 00:25:40,000 a field test. And I'm going to just, sorry. I just wanted to 316 00:25:40,000 --> 00:25:43,120 have audio for this. It's not important, but it makes it more 317 00:25:43,120 --> 00:25:57,240 dramatic. So there are two packets arriving. There's no 318 00:25:57,240 --> 00:26:00,060 reason to be this close to the train. You could be a mile away. 319 00:26:00,300 --> 00:26:03,800 In fact, I was testing this this morning in my hotel room on the 320 00:26:03,800 --> 00:26:06,560 other side of the strip, and I was getting packets from a train 321 00:26:06,560 --> 00:26:09,980 going by, no problem, inside the building. So it's, it's, you 322 00:26:09,980 --> 00:26:11,620 know, it's a lot easier. But you can receive these things pretty 323 00:26:11,620 --> 00:26:20,300 far away. All right. So I want to do a live demo. I have loaded 324 00:26:20,300 --> 00:26:28,900 up here on my HackRF audio files that are packets, and this 325 00:26:28,900 --> 00:26:32,680 is going to transmit them. I'm using one of the hand bands, the 326 00:26:32,680 --> 00:26:37,460 47 centimeter hand band, so that we don't transmit on the actual 327 00:26:37,460 --> 00:26:39,960 railroad frequencies. And I'm going to put that in here, and I'm 328 00:26:39,960 --> 00:26:45,260 and ID and all that to keep this legal. So really there are just 329 00:26:45,260 --> 00:26:48,960 two parts of this. I'm going to hit play on the flow graph here 330 00:26:49,740 --> 00:26:54,900 and then I'm going to run once it gets settled here, I'm going 331 00:26:54,900 --> 00:27:03,260 to go over here and run this. PyEOT.py. I wrote all this 332 00:27:03,260 --> 00:27:08,840 stuff in Python 3 because it's 2018 but of course GNU radio is 333 00:27:08,840 --> 00:27:11,840 still Python 2 so you kind of have to run them separately at 334 00:27:11,840 --> 00:27:15,820 the moment. But hopefully in the future that will kind of get 335 00:27:15,820 --> 00:27:20,200 integrated. And I'm just going to play, I'm just going to loop 336 00:27:20,200 --> 00:27:28,840 here a kind of demo sequence that has a number of packets in 337 00:27:28,840 --> 00:27:35,920 it. And I have my HT on here so you can hear the chirps. And 338 00:27:37,620 --> 00:27:38,820 we're not getting all the packets. So I'm just going to 339 00:27:38,820 --> 00:27:41,560 get rid of the packets. This is a noisy environment. Oh there we 340 00:27:41,560 --> 00:27:45,540 go. I put an attenuator on this and I probably shouldn't have 341 00:27:45,540 --> 00:27:48,180 but you can see there are three different packets that are kind 342 00:27:48,180 --> 00:27:53,700 of flowing in there. And what I've just picked some interesting 343 00:27:54,300 --> 00:27:57,000 fields to display. This isn't all of them but I have the ID 344 00:27:57,480 --> 00:28:01,060 and the pressure and whether the train's moving, whether the 345 00:28:01,060 --> 00:28:04,560 marker light's on, that sort of thing. One of the things about, 346 00:28:04,720 --> 00:28:08,800 another thing about, I'm going to stop this. Hold on. I'm going 347 00:28:08,800 --> 00:28:13,560 to stop this. The other thing that, detail that might be helpful 348 00:28:13,560 --> 00:28:17,560 in this is that railroad cars, the couplers all have slack in 349 00:28:17,560 --> 00:28:20,760 them. They're in gear boxes so when the engine starts moving, 350 00:28:20,940 --> 00:28:23,780 the first car starts moving and then the second car starts 351 00:28:23,780 --> 00:28:26,500 moving. And then you'd never be able to start a two mile train 352 00:28:26,500 --> 00:28:30,120 if it were all rigid. So this helps the engineer, this motion 353 00:28:30,120 --> 00:28:32,760 marker helps the engineer know when the back of the train has 354 00:28:32,760 --> 00:28:37,280 actually started moving. And some of the more advanced DOTs use 355 00:28:37,280 --> 00:28:38,780 discretionary data to actually see if the train's moving. And I'm 356 00:28:43,840 --> 00:28:56,700 going to go back to PowerPoint here. So security. I haven't 357 00:28:56,700 --> 00:29:01,880 talked much about the HOT part of this. The standard has two 358 00:29:01,880 --> 00:29:05,740 commands for the HOT. One is a status request. The EOT 359 00:29:05,740 --> 00:29:08,760 broadcasts its, its, its, its, its, its, its, its, its, its, 360 00:29:08,780 --> 00:29:11,040 its, its, its, its, data every minute, give or take 10 361 00:29:11,040 --> 00:29:13,980 seconds. But if the HOT hasn't heard from it for a while, it 362 00:29:13,980 --> 00:29:17,840 can request status. The other command is that emergency 363 00:29:17,840 --> 00:29:22,600 braking command. The, there, the security that's built into 364 00:29:22,600 --> 00:29:29,280 this is sort of to prevent a rogue HOT from initiating an 365 00:29:29,280 --> 00:29:33,340 emergency stop for an EOT. And so there's an arming sequence 366 00:29:33,340 --> 00:29:36,460 where you press a button on the EOT and then you press a button 367 00:29:36,460 --> 00:29:38,760 on the HOT and then, and then, and then, and then, and then, and 368 00:29:38,780 --> 00:29:42,160 then it acknowledges and then that HOT is allowed to send the 369 00:29:42,160 --> 00:29:46,880 emergency signal. The problem though is that, um, there's no 370 00:29:46,880 --> 00:29:50,680 way for the EOT to know if that actually came from the HOT. So 371 00:29:50,680 --> 00:29:53,840 40 years ago, that wasn't really a big concern, but now 372 00:29:53,840 --> 00:29:57,080 it is. And this is something this is not, I didn't discover 373 00:29:57,080 --> 00:30:01,440 this. This is known about in the industry for years. Um, this is 374 00:30:01,440 --> 00:30:05,880 a paper from 2005 from the, uh, Joint Rail Conference in, um, 375 00:30:06,000 --> 00:30:08,760 Pueblo where Paul and Steven Craven came forward and, um, 376 00:30:08,780 --> 00:30:15,940 who I assume to be related, wrote about the vulnerability of spoofing this signal and 377 00:30:16,900 --> 00:30:22,100 provided some recommendations for a key exchange. As far as I know, that's never been done. 378 00:30:22,520 --> 00:30:30,880 So the code that I'm putting up on GitHub does not deal with the HOT at all. It decodes 379 00:30:30,880 --> 00:30:35,180 the EOT, and that's it. It doesn't generate packets for either, and it doesn't even decode 380 00:30:35,180 --> 00:30:40,200 the HOT. It's not especially interesting to look at the HOT. It rarely broadcasts, and the 381 00:30:40,200 --> 00:30:45,760 chances of catching that emergency packet are very small, and for that reason, a replay attack 382 00:30:45,760 --> 00:30:54,360 isn't really a big concern because it's such a rare event. All right, so the other protocol 383 00:30:54,360 --> 00:31:01,600 that I want to talk about, and we're right at 430, so that's good. I'm halfway there. Give me just a 384 00:31:01,600 --> 00:31:01,900 second here. 385 00:31:05,740 --> 00:31:13,760 This is the automatic equipment identification system, AEI system, and this is an RFID system 386 00:31:13,760 --> 00:31:21,720 that's used for identifying equipment as it passes a reader, essentially. So back in the 60s, 387 00:31:21,720 --> 00:31:29,580 the rail industry started looking for a way to do automatic equipment identification, and what 388 00:31:29,580 --> 00:31:34,940 they came up with initially was one of the first barcodes. This is a system called 389 00:31:35,340 --> 00:31:44,180 CarTrack. Oh, I'm sorry. Let me put this, make it big here so you can see it. Come on. All right. 390 00:31:46,720 --> 00:31:51,460 All right, CarTrack, which is a barcode, a colored barcode that went on the side of the cars, 391 00:31:53,720 --> 00:31:59,180 and they worked really well until they got dirty, and then they didn't work at all. So the whole 392 00:31:59,180 --> 00:32:04,680 thing, the whole mess was abandoned in 1977, and then through the 80s, they tried to come up with 393 00:32:04,680 --> 00:32:05,160 another way to do it. And so they did. And so they did. And so they did. And so they did. And so 394 00:32:05,180 --> 00:32:15,880 to do this and set it on RFID. So by 1994, 1991 the mandate went out and by 1994 every railcar 395 00:32:15,880 --> 00:32:28,220 engine in the U.S. had an AEI tag on it. This is an actual AEI tag here. So it's a RFID tag. Some 396 00:32:28,220 --> 00:32:33,620 of these slides I made for a less technical crowd so I'll go through them quickly but 397 00:32:33,620 --> 00:32:39,980 essentially in any RFID system you have a reader and a tag and the tag is usually a passive 398 00:32:39,980 --> 00:32:44,800 device. Sometimes they're battery assisted but essentially the idea is that the reader sends out 399 00:32:44,800 --> 00:32:52,560 RF power and that powers the tag which then spits back some data. And there are a couple of 400 00:32:52,560 --> 00:32:57,200 different, broadly a couple of different types of RFID. The lower frequency ones where 401 00:32:57,200 --> 00:33:02,940 antennas would be impractical, they're very long, are inductively coupled. So most of the access 402 00:33:03,620 --> 00:33:08,360 systems, door access systems and things of that nature you have a coil in the tag and you have a 403 00:33:08,360 --> 00:33:14,740 coil in the reader and you get them close together and they couple like a transformer. At higher 404 00:33:14,740 --> 00:33:21,180 frequencies it's practical to have antennas that are, you know, reasonable relative to the size of 405 00:33:21,180 --> 00:33:27,280 a reader. And so you can do some long range stuff where you actually send the power out pretty 406 00:33:27,280 --> 00:33:32,380 far and get it back. So a common application is tolling, for example. You know, high speed tolling. 407 00:33:34,200 --> 00:33:41,080 The system that we're going to look at is in the 900 megahertz ISM band. And what else do I have 408 00:33:41,080 --> 00:33:50,900 here? Yeah, long range, et cetera. There are two standards that apply to AEI. One is this ISO 409 00:33:51,700 --> 00:33:58,340 10374, which is an old, you know, antiquated by any other standard than outside of the real 410 00:33:58,340 --> 00:34:03,600 industry, error interface protocol. The error interface protocol, essentially, is a system that 411 00:34:03,620 --> 00:34:12,080 actually defines the exchange, the way the data is exchanged and the format of the ID, the data that 412 00:34:12,080 --> 00:34:18,400 comes back. In this case it's 128 bits. And so then whatever your application is, you decide what 413 00:34:18,400 --> 00:34:27,540 those 128 bits mean. And so the AARS 918, AARS, the Association of American Railroads, S918 414 00:34:27,540 --> 00:34:33,600 protocol or standard then defines what those 128 bits mean and where they're coming from. And 415 00:34:33,620 --> 00:34:41,280 the tag should go on the car and things of that nature. I think that's been replaced now by S9203 416 00:34:41,680 --> 00:34:49,520 and then by S6009, but I don't have copies of these, so I don't know for sure. S918 is pretty 417 00:34:49,520 --> 00:34:57,040 old, but nothing's changed, you know, in this. Here are the fields that the tag contains. There's 418 00:34:57,040 --> 00:35:03,540 the type of equipment, whether it's an engine or a car or there are others, trailers, you know, some of 419 00:35:03,620 --> 00:35:12,260 the special types of equipment. The reporting mark, which is a four-letter identifier that tells 420 00:35:12,260 --> 00:35:22,460 you who owns it. So if it's UP it would just be UP, Union Pacific. If it's a company that isn't an 421 00:35:22,460 --> 00:35:29,240 actual railroad but, so up to four letters, isn't an actual railroad but leases equipment, then it 422 00:35:29,240 --> 00:35:33,600 would be, there would be an X at the end, so like GATX is not a unit that gets the right sort of 423 00:35:33,620 --> 00:35:39,720 a common carrier but they own equipment so there are reporting marks assigned to anyone who owns 424 00:35:39,720 --> 00:35:46,780 rail cars and then you have the uh which side you're looking at there's two tags in each car 425 00:35:47,340 --> 00:35:52,080 and that's related to the end that has the handbrake looking from the end that has the 426 00:35:52,080 --> 00:35:58,400 handbrake uh the length of the vehicle the car engine uh how many axles it has what type of 427 00:35:58,400 --> 00:36:03,380 bearings it has they're all roller bearings now but but back in the early 90s there were still 428 00:36:03,380 --> 00:36:08,540 some friction bearings and then there are a number of additional equipment dependence parameters 429 00:36:08,540 --> 00:36:14,440 like engines have slightly different data than cars and then there are actually some 430 00:36:14,440 --> 00:36:19,520 there's provisions in there for active tags that would tell you things like how much fuel was left 431 00:36:19,520 --> 00:36:25,920 in the engine or things like that as far as i know those don't exist but they are in the standard 432 00:36:28,620 --> 00:36:33,240 so the the performance depends on uh basically 433 00:36:33,240 --> 00:36:33,360 the the the the performance depends on uh basically the but the the the the the performance 434 00:36:33,380 --> 00:36:41,760 two things. The effective radiative power of the reader and the speed of the train. So you get 435 00:36:41,760 --> 00:36:51,820 more ERP by narrowing the polar pattern of the antenna but then you have less time to read as the 436 00:36:51,820 --> 00:36:59,640 train goes by within that window. Now typically I'm seeing dozens of tag reads for each tag as it 437 00:36:59,640 --> 00:37:08,200 goes by. So it's pretty fast. The maximum I was able to get was about 20 feet for a 70 mile an hour 438 00:37:08,200 --> 00:37:18,580 Amtrak train. And that was at 32 watts ERP. Using a 2 watt radio but a very high gain antenna. The 439 00:37:18,580 --> 00:37:26,560 ERP calculation is an example. If you have a 2 watt transmitter and a 9 dBi antenna, it's 2 watts 440 00:37:26,560 --> 00:37:29,620 times 10 to the 9 over 10. So you end up with a very high gain antenna. So you end up with a 441 00:37:29,620 --> 00:37:30,900 very high gain antenna. So you end up with a very high gain antenna. So you end up with about 16 watts 442 00:37:30,900 --> 00:37:41,080 ERP. So if you go up to 11 dBi antenna or 12 dBi antenna you'll double that again. There are a 443 00:37:41,080 --> 00:37:48,060 couple different readers on the market. And to be clear I'm not doing this in GNU radio. That's 444 00:37:48,060 --> 00:37:55,860 possible. But it exceeds my skill level. So I went for a commercial reader on eBay essentially. So 445 00:37:55,860 --> 00:37:59,600 there are two types you can get. One is kind of low power. One is low power in the middle. And the 446 00:37:59,620 --> 00:38:04,580 watt and the other is a high power two watts and the one watt is a part 15 device which means anyone 447 00:38:04,580 --> 00:38:10,480 can use it without a license but for a railroad application you have to be very close to the 448 00:38:10,480 --> 00:38:15,220 train and it's unlikely that you could get that close and not be trespassing so the low power 449 00:38:15,220 --> 00:38:22,500 option is kind of off the table the high power reader you can run at two watts and attach any 450 00:38:22,500 --> 00:38:27,820 antenna you want and for a commercial application you would get a part 90 license from the FCC which 451 00:38:27,820 --> 00:38:34,920 is a site specific license I did my experiments using my amateur radio license privileges so 452 00:38:37,020 --> 00:38:45,700 amateurs can operate up to 1500 Watson in the 900 Hertz band I operated too so not a big deal and I 453 00:38:45,700 --> 00:38:54,300 found that I could ID by toggling the radio using Morse code and toggling the radio in the device to 454 00:38:54,300 --> 00:38:57,700 keep it all legal so the 455 00:38:57,820 --> 00:39:03,820 the one that I bought on eBay was a seer at ID 50 100 seer it was a really great company and then 456 00:39:03,820 --> 00:39:10,880 3m bought them and scuttled the whole thing but this product was it's about this big and it was 457 00:39:10,880 --> 00:39:17,980 designed for tolling and like parking garage access applications it happens to support ISO 458 00:39:17,980 --> 00:39:24,280 103 74 although you have to find somebody who can install that key for you I found a former 459 00:39:24,280 --> 00:39:26,320 seer an employee who was able to do it and 460 00:39:28,100 --> 00:39:31,960 set up an application using that key right away and you can use it it has a built in antenna or you can use 461 00:39:31,960 --> 00:39:41,400 an external antenna I used to 90 by Yagi for my experiments because it's less obvious than this big 462 00:39:41,400 --> 00:39:52,280 panel thing and it's a pretty robust device it runs Linux internally and you can upload over TCP 463 00:39:52,860 --> 00:39:57,800 Python or JavaScript scripts and it has internal storage and it allows you to keep up to date data to 464 00:39:57,800 --> 00:40:00,460 so you can have it do logging on its own. 465 00:40:00,600 --> 00:40:01,740 All it needs is power. 466 00:40:01,960 --> 00:40:04,060 It has GPIO lines. 467 00:40:04,220 --> 00:40:05,260 It has a serial port. 468 00:40:05,500 --> 00:40:07,320 Most of the communication is over Ethernet. 469 00:40:07,560 --> 00:40:08,820 So it's a really cool device. 470 00:40:09,300 --> 00:40:12,640 I've never seen another one on eBay since I bought this one, 471 00:40:12,760 --> 00:40:15,980 so you may have trouble finding one. 472 00:40:16,440 --> 00:40:22,580 But what I got out of it is 128 bits. 473 00:40:22,800 --> 00:40:24,800 So then I took the AAR standard, 474 00:40:25,000 --> 00:40:27,440 which I easily found in a Google search, 475 00:40:27,800 --> 00:40:32,640 and took those fields and wrote Python to parse them out 476 00:40:32,640 --> 00:40:34,780 so I could make it readable. 477 00:40:36,100 --> 00:40:39,100 So this was actually the first test, 478 00:40:41,140 --> 00:40:42,780 which went unusually well, 479 00:40:44,800 --> 00:40:47,500 of that software that does the parsing. 480 00:40:49,840 --> 00:40:52,600 So this is Amtrak, about 70 miles an hour, 481 00:40:53,460 --> 00:40:56,960 and you can see the tag data populating as the cars go by. 482 00:40:57,080 --> 00:40:57,700 Oh, thank you. 483 00:41:01,600 --> 00:41:02,820 That's very kind. Thanks. 484 00:41:03,640 --> 00:41:05,280 So the fields going across, 485 00:41:05,380 --> 00:41:08,780 we have a timestamp down to millisecond, 486 00:41:09,420 --> 00:41:14,360 and then Amtrak, the car number or engine number, 487 00:41:14,500 --> 00:41:16,460 whether it's a car or an engine or locomotive, 488 00:41:16,560 --> 00:41:18,880 and then what side we're looking at. 489 00:41:19,060 --> 00:41:22,260 So you can tell which way the train's going from the side 490 00:41:22,260 --> 00:41:24,460 because the engine's either facing left or right. 491 00:41:24,980 --> 00:41:27,520 And then the length of each car, 492 00:41:27,800 --> 00:41:29,020 how many axles it has, et cetera. 493 00:41:30,320 --> 00:41:31,280 So I wanted to, 494 00:41:31,400 --> 00:41:34,480 I mentioned earlier that my work is in noise control, 495 00:41:34,780 --> 00:41:37,040 and I do rail noise occasionally. 496 00:41:37,760 --> 00:41:43,200 So the pretense that I used to get information on this, 497 00:41:43,220 --> 00:41:44,400 to do this project, 498 00:41:44,520 --> 00:41:46,580 was that I wanted to try to correlate noise data 499 00:41:46,580 --> 00:41:51,020 with AEI tag, you know, the equipment that creates the noise, 500 00:41:51,140 --> 00:41:53,400 and then it turned out to be a viable research project, 501 00:41:53,500 --> 00:41:54,320 so I went ahead and did it. 502 00:41:54,900 --> 00:41:57,680 So I wanted to do logging long term, 503 00:41:57,800 --> 00:42:01,420 so I found some, I found a property owner who was cool with it, 504 00:42:01,440 --> 00:42:04,740 that was very close to the tracks, but not on the railroad property. 505 00:42:05,600 --> 00:42:08,140 And to do this, you really want to do triggering, 506 00:42:08,240 --> 00:42:13,940 because you don't want to just spew 32 watts of square wave all the time, 507 00:42:14,440 --> 00:42:17,260 in any environment, especially in the ISM band. 508 00:42:17,680 --> 00:42:21,120 So the railroads do this with wheel flange detectors. 509 00:42:22,040 --> 00:42:24,820 I couldn't do that, obviously, I couldn't touch the track, 510 00:42:25,040 --> 00:42:26,180 so I used ground vibration. 511 00:42:27,080 --> 00:42:27,780 This is a, 512 00:42:27,780 --> 00:42:29,180 this is a seismic geophone. 513 00:42:29,840 --> 00:42:31,400 Geophone's like a microphone that you bury, 514 00:42:31,520 --> 00:42:33,940 and it outputs essentially audio, 515 00:42:34,220 --> 00:42:36,320 but there's nothing above a couple hundred hertz. 516 00:42:36,580 --> 00:42:40,040 And we use these for measuring propagation of vibration 517 00:42:40,040 --> 00:42:40,900 through the ground. 518 00:42:41,560 --> 00:42:44,260 But I put this one as close as I could get it to the tracks, 519 00:42:44,480 --> 00:42:47,220 and I wanted to make sure that the ground wave 520 00:42:47,220 --> 00:42:50,080 that precedes the train would arrive soon enough 521 00:42:50,080 --> 00:42:52,740 to get the radio turned on to get the first tag. 522 00:42:52,960 --> 00:42:55,100 So this was a, this is a wave file down here, 523 00:42:55,940 --> 00:42:57,580 and essentially I have about 524 00:42:57,580 --> 00:42:59,860 one second of warning at 70 miles an hour, 525 00:43:00,020 --> 00:43:01,080 which is plenty of time. 526 00:43:03,160 --> 00:43:05,300 So that was the kind of proof of concept. 527 00:43:05,580 --> 00:43:08,460 This is a little circuit I built to do the actual triggering. 528 00:43:08,660 --> 00:43:10,400 So it's just a dual op amp. 529 00:43:10,640 --> 00:43:12,860 On the left side's a differential amplifier, 530 00:43:13,200 --> 00:43:14,320 the output of the thing's differential. 531 00:43:15,220 --> 00:43:17,920 About 70, what was it specifically, 532 00:43:18,100 --> 00:43:20,180 73 dB of gain, which is arbitrary. 533 00:43:21,380 --> 00:43:23,160 This side is just a comparator, 534 00:43:23,300 --> 00:43:27,040 and then I have a threshold control that's, 535 00:43:27,040 --> 00:43:28,580 it's the other side of the comparator. 536 00:43:28,860 --> 00:43:32,000 So you basically set this up with an LED 537 00:43:32,560 --> 00:43:35,040 and just turn up the threshold until it stopped blinking 538 00:43:35,040 --> 00:43:36,200 under normal conditions, 539 00:43:36,460 --> 00:43:40,420 and then when the train goes by, it'll trigger. 540 00:43:40,700 --> 00:43:43,760 So this goes into a GPIO line on the reader, 541 00:43:43,940 --> 00:43:46,920 and I have a Python script running on the reader 542 00:43:46,920 --> 00:43:49,900 that looks at that and then toggles the power of the radio, 543 00:43:50,040 --> 00:43:53,540 either puts it from standby into active mode and vice versa. 544 00:43:53,760 --> 00:43:55,580 So here's a video of that. 545 00:43:57,200 --> 00:44:00,320 The little circuit's down in the left corner there. 546 00:44:01,160 --> 00:44:02,780 I don't know if this is playing, whoops. 547 00:44:04,320 --> 00:44:05,900 I really want to play this, let's see. 548 00:44:07,380 --> 00:44:08,660 I guess it is playing, okay. 549 00:44:09,060 --> 00:44:11,300 So the circuit's down in the left corner there, 550 00:44:11,380 --> 00:44:12,600 you'll see the lights start to blink. 551 00:44:19,820 --> 00:44:21,740 And then the top terminal window, 552 00:44:21,900 --> 00:44:22,740 which you probably can't read, 553 00:44:22,800 --> 00:44:24,560 says that it went into active mode, 554 00:44:25,040 --> 00:44:26,520 and then it's reading the tags. 555 00:44:27,080 --> 00:44:31,180 And then after the ground vibration drops below 556 00:44:31,180 --> 00:44:32,760 the threshold on the comparator, 557 00:44:32,920 --> 00:44:36,500 the script drops it back into passive mode. 558 00:44:37,560 --> 00:44:39,540 And if it goes into active mode, 559 00:44:40,090 --> 00:44:41,680 when a truck goes by, it doesn't really matter, 560 00:44:41,820 --> 00:44:42,840 you're not gonna lose any data, 561 00:44:42,960 --> 00:44:45,840 or cause a significant amount of RF pollution. 562 00:44:46,620 --> 00:44:47,880 So that worked pretty well, 563 00:44:48,020 --> 00:44:53,020 so I put this box out there with the reader in the box. 564 00:44:53,300 --> 00:44:54,320 Sorry, you can't see that. 565 00:44:54,700 --> 00:44:56,200 With the reader in the box, 566 00:44:57,040 --> 00:44:58,400 and then I have an ethernet hub, 567 00:44:58,760 --> 00:45:02,040 and a cellular modem, and a Raspberry Pi, 568 00:45:02,940 --> 00:45:04,540 and a sound level meter. 569 00:45:06,940 --> 00:45:09,820 And essentially, this is about 30 miles from my office, 570 00:45:09,880 --> 00:45:12,560 so I could, I just had the Raspberry Pi 571 00:45:12,560 --> 00:45:14,880 do a reverse tunnel out to a digital ocean droplet, 572 00:45:15,060 --> 00:45:17,580 and then I could get to it from there, 573 00:45:18,160 --> 00:45:20,500 and experiment with it remotely. 574 00:45:20,740 --> 00:45:24,640 It also, it's also the remote control of the radio, 575 00:45:24,760 --> 00:45:26,880 which is important for the amateur, 576 00:45:26,880 --> 00:45:27,280 amateur privileges. 577 00:45:28,080 --> 00:45:31,300 And the reader's just logging all of the data, 578 00:45:31,420 --> 00:45:32,900 so I logged for about five weeks. 579 00:45:34,320 --> 00:45:37,240 This is the Yagi, it's on an old shed, 580 00:45:37,460 --> 00:45:39,520 about 15 feet from the rail. 581 00:45:41,320 --> 00:45:44,260 And then there's also a microphone on a stand, 582 00:45:44,540 --> 00:45:46,880 that's logging the sound level meters, 583 00:45:46,900 --> 00:45:48,120 logging the data from that. 584 00:45:48,340 --> 00:45:50,580 So this is what comes out of the reader, 585 00:45:50,860 --> 00:45:54,700 raw tag data, so we have 128-bit tag IDs, 586 00:45:55,420 --> 00:45:56,000 and then, 587 00:45:56,880 --> 00:45:59,500 I can translate into something like this, 588 00:45:59,580 --> 00:46:00,680 so this is a single train, 589 00:46:01,540 --> 00:46:03,700 and you see a locomotive at the top, 590 00:46:04,200 --> 00:46:05,180 and then all the stats, 591 00:46:05,440 --> 00:46:08,000 and then, the EOT actually has its own AEI tag. 592 00:46:08,320 --> 00:46:10,840 So, at the bottom, you see the EOT tag, 593 00:46:11,860 --> 00:46:13,480 that's one of the possible devices, 594 00:46:13,760 --> 00:46:16,940 so we have locomotive, car car car car car, EOT. 595 00:46:18,280 --> 00:46:20,280 And since I know the length of the train, 596 00:46:20,780 --> 00:46:22,900 and I know the time stamp, 597 00:46:23,120 --> 00:46:24,800 so I can actually calculate the speed, also. 598 00:46:25,600 --> 00:46:26,600 So, I've got the, 599 00:46:26,880 --> 00:46:33,580 of the train, the speed and then in most cases can surmise the direction from the direction 600 00:46:33,580 --> 00:46:42,760 the engine is pointing. Then I can take that and turn it into a list of trains. So this 601 00:46:42,760 --> 00:46:48,720 is a list of trains where I have a time stamp and then the number of engines plus the number 602 00:46:48,720 --> 00:46:55,020 of cars, which direction it was going, how long it was, how many axles and how fast it 603 00:46:55,020 --> 00:47:00,940 was going. You see only a few of them have EOTs. The EOT only has a tag on one side. So if 604 00:47:00,940 --> 00:47:06,420 it's going the other way, you won't catch it. The railroads have readers on both sides of the 605 00:47:06,420 --> 00:47:11,020 track. So they can, for redundancy, but they can also catch if there's a missing tag or 606 00:47:11,020 --> 00:47:17,520 whatever. So I didn't catch all the EOTs. But you'll see there's one train in here that's like 607 00:47:17,520 --> 00:47:23,600 8,000 feet long. So that's a very long train. And this is in New England. We don't get a lot 608 00:47:23,600 --> 00:47:25,000 of 8,000 foot trains. So. 609 00:47:25,020 --> 00:47:31,600 That was an exception. All right. So here's an automatic correlation of sound data down on the 610 00:47:31,600 --> 00:47:39,160 bottom. So these are one minute LEQs or one minute average levels. And then each blue dot is a 611 00:47:39,160 --> 00:47:46,540 train from the AEI data. So you see they line up very well. Every time there's a spike in sound 612 00:47:46,540 --> 00:47:53,120 pressure level, there's a train. And we can do some interesting things like look at eastbound 613 00:47:53,120 --> 00:47:55,000 Amtrak trains versus westbound trains. And we can do some interesting things like look at the 614 00:47:55,020 --> 00:47:58,260 You can see the westbound ones are much louder. 615 00:47:58,460 --> 00:48:01,860 And that's because there are trees over here and not over here from the microphone position. 616 00:48:02,640 --> 00:48:08,040 And you can look at anomalies like that one at the end of the red trace is lower than the others. 617 00:48:08,220 --> 00:48:11,460 There was a slow order or something, so it was going slower than usual. 618 00:48:12,060 --> 00:48:14,220 So a lot of interesting data from this. 619 00:48:14,480 --> 00:48:24,380 And my conclusion was that this is pretty useful for noise surveys when you need to know what the equipment is. 620 00:48:24,380 --> 00:48:31,140 You know, instead of having an intern with a clipboard writing down everything, you can log the stuff automatically. 621 00:48:31,500 --> 00:48:36,920 But the problem is that it uses a lot of power, which is, you know, you can overcome that. 622 00:48:37,080 --> 00:48:38,700 But also you need a site license. 623 00:48:39,420 --> 00:48:41,040 It's not a license for the thing. 624 00:48:41,160 --> 00:48:43,480 It's a license for the thing at the place it's going to go. 625 00:48:43,540 --> 00:48:46,060 So for a short-term project, it doesn't make any sense. 626 00:48:47,180 --> 00:48:48,360 But it does work. 627 00:48:48,640 --> 00:48:54,360 So it was an interesting, turned into an interesting research project. 628 00:48:54,380 --> 00:48:57,520 That started as just, you know, trying to see if I could do it. 629 00:48:59,420 --> 00:48:59,940 Security. 630 00:49:02,280 --> 00:49:05,740 There's nothing on these tags that isn't also painted on the side of the car. 631 00:49:06,320 --> 00:49:08,960 You know, the number and the owner and all that stuff. 632 00:49:09,300 --> 00:49:16,940 So you could conceivably do this with machine vision or an observer or videotaping it and writing stuff down. 633 00:49:18,260 --> 00:49:22,240 So I don't really think that there's any meaningful security concern with this. 634 00:49:24,740 --> 00:49:28,780 There's no indication of the type or presence of the load in the car. 635 00:49:29,060 --> 00:49:32,640 So we don't know if anything's in it at all or what it might be. 636 00:49:33,420 --> 00:49:39,060 But there is a sensitivity in the industry to private readers, which I think is just kind of a knee-jerk reaction. 637 00:49:39,920 --> 00:49:48,120 And a lot of that really flamed up about five years ago when this company called Clipper Data bought 30 readers 638 00:49:48,120 --> 00:49:53,260 and rented people's backyards along rail lines with Internet connections. 639 00:49:53,400 --> 00:49:54,360 And they were going to aggregate. 640 00:49:54,380 --> 00:50:00,080 They were going to aggregate the data and sell it back to the shippers or something, some sort of commodities thing. 641 00:50:00,860 --> 00:50:03,820 And BNSF found a couple of the readers and flipped out. 642 00:50:04,560 --> 00:50:13,220 And the end of the story was that Clipper Data had only applied for an FCC license or been granted an FCC license for one of the 30, 643 00:50:14,080 --> 00:50:15,620 which I think was just a misunderstanding. 644 00:50:16,400 --> 00:50:20,100 But they got fined a quarter million dollars by the FCC for the other 29. 645 00:50:20,780 --> 00:50:23,980 So the whole project got put to rest. 646 00:50:24,460 --> 00:50:27,600 But this is actually what got me thinking that maybe I could do this. 647 00:50:28,080 --> 00:50:35,940 Because I always assumed it was kind of a proprietary thing that the railroads had locked down. 648 00:50:36,160 --> 00:50:39,400 But there are actually very few things like that I've learned in the last three years. 649 00:50:43,000 --> 00:50:50,100 And then finally, if you're going to try this, make sure you have a license of some sort, 650 00:50:50,180 --> 00:50:54,300 whether it's a commercial license for this application or an amateur. 651 00:50:54,380 --> 00:50:56,100 Make sure you have an amateur license with privileges. 652 00:50:56,260 --> 00:50:59,080 Actually, any amateur license has privileges in this band. 653 00:50:59,580 --> 00:51:01,520 And make sure you're not on railroad property. 654 00:51:01,800 --> 00:51:04,740 That's really important for any of the stuff I'm showing you today. 655 00:51:05,320 --> 00:51:08,100 Railroads do not like trespassers, and they will prosecute. 656 00:51:09,460 --> 00:51:12,180 So I'm not an attorney, certainly. 657 00:51:13,380 --> 00:51:14,960 Do any of this at your own risk. 658 00:51:15,020 --> 00:51:20,160 But I recommend those as a starting point or starting points for any kind of experimentation. 659 00:51:22,660 --> 00:51:23,860 And that's about it. 660 00:51:23,860 --> 00:51:24,780 Here are some resources. 661 00:51:25,160 --> 00:51:31,260 The PyEOT software that I demoed is up on GitHub. 662 00:51:32,960 --> 00:51:39,440 And I've listed here a couple of Windows applications that do railroad telemetry decoding. 663 00:51:39,600 --> 00:51:45,040 One is SoftEOT, which I mentioned earlier, which takes in an audio signal. 664 00:51:45,260 --> 00:51:50,060 So you have to have a radio external to the computer and decodes EOTs. 665 00:51:50,160 --> 00:51:52,860 The other one that's interesting is ATCS Monitor. 666 00:51:53,160 --> 00:51:53,700 ATCS. 667 00:51:53,760 --> 00:51:53,840 ATCS. 668 00:51:53,860 --> 00:51:55,180 It's one of those traffic control systems. 669 00:51:55,460 --> 00:52:03,120 And things like signals and switches and other devices spit out data with their status. 670 00:52:03,300 --> 00:52:07,040 And they're also controlled with RF link. 671 00:52:07,260 --> 00:52:10,520 And there are people all over the place that monitor these things. 672 00:52:10,640 --> 00:52:12,560 And the data get aggregated. 673 00:52:12,600 --> 00:52:14,980 It's sort of like the ADS-B stuff for planes. 674 00:52:15,720 --> 00:52:23,740 And you can use ATCS Monitor to look at a panel. 675 00:52:23,740 --> 00:52:33,220 For example, in Las Vegas, you can look at 100 miles north of here and see this aspect of every signal, whether it's red or green, and which blocks of track are occupied. 676 00:52:33,580 --> 00:52:35,160 So it makes it very easy to find trains. 677 00:52:35,360 --> 00:52:39,480 But we don't have this in New England, so I've never really done much work with it. 678 00:52:39,540 --> 00:52:40,140 But it's pretty cool. 679 00:52:41,340 --> 00:52:48,660 And then if you want to read more about BCH code, Wikipedia page is a good starting point. 680 00:52:48,780 --> 00:52:52,540 There are also a couple of good articles that you'll find right at the top of a Google search. 681 00:52:53,100 --> 00:52:54,220 It's pretty interesting stuff. 682 00:52:55,380 --> 00:52:56,420 And that's all I've got. 683 00:52:56,560 --> 00:52:58,060 So thanks for your kind attention. 684 00:52:58,240 --> 00:52:58,800 I appreciate it. 685 00:53:07,780 --> 00:53:10,660 I think there's a couple minutes if there are any questions. 686 00:53:10,760 --> 00:53:10,940 Yeah. 687 00:53:29,000 --> 00:53:35,020 Yeah, so the question is, I think, if you stand behind an existing reader, can you read the tag data? 688 00:53:35,500 --> 00:53:37,120 And the answer is, I'm not sure. 689 00:53:37,300 --> 00:53:39,020 I tried that in my office a little bit. 690 00:53:39,280 --> 00:53:43,200 But there aren't any readers that I have access to that are out there. 691 00:53:43,380 --> 00:53:44,780 So I would have to set up one. 692 00:53:44,980 --> 00:53:47,080 And I just haven't done that exercise. 693 00:53:47,420 --> 00:53:52,520 But it is something that I've played around with a little bit because that obviously is a much less intrusive thing. 694 00:53:52,520 --> 00:53:53,340 But it is a much less intrusive way to do this. 695 00:53:55,180 --> 00:53:55,700 Yeah. 696 00:54:05,620 --> 00:54:08,380 Crossing signals generally use track circuits. 697 00:54:08,680 --> 00:54:11,740 So essentially the train shunts the rails. 698 00:54:12,160 --> 00:54:18,060 And then there's the fancy ones use like TDR to figure out the distance and the velocity of the train. 699 00:54:18,260 --> 00:54:20,140 So a faster train, the gates will go down sooner. 700 00:54:20,140 --> 00:54:25,800 As far as I know, that stuff doesn't have a wireless component to it. 701 00:54:26,560 --> 00:54:29,700 If it's anything, it would be that ATCS data. 702 00:54:29,900 --> 00:54:31,280 But I haven't really dug into that. 703 00:54:31,820 --> 00:54:32,280 Yeah. 704 00:54:39,600 --> 00:54:40,520 Oh, yeah. 705 00:54:40,600 --> 00:54:41,860 That's an important point. 706 00:54:42,040 --> 00:54:45,520 So this is really only the EOT stuff is only freight. 707 00:54:47,120 --> 00:54:50,120 So passenger trains have electrical connections. 708 00:54:50,140 --> 00:54:51,700 All the way through so they don't need it. 709 00:54:52,400 --> 00:54:58,560 As far as light rail, that would be really specific to the if there's no interchange service with other railroads, 710 00:54:58,720 --> 00:55:04,840 then there's no requirement to comply with the AEI tagging, for example. 711 00:55:05,080 --> 00:55:09,860 I know that some of the light rail systems have their own RFID systems for tracking. 712 00:55:10,100 --> 00:55:11,980 Whether they're compatible, I don't know. 713 00:55:12,500 --> 00:55:13,940 I haven't played with that. 714 00:55:16,540 --> 00:55:17,140 All right. 715 00:55:17,180 --> 00:55:18,000 Well, oh, yeah. 716 00:55:22,140 --> 00:55:24,120 Oh, I would be happy to. 717 00:55:24,540 --> 00:55:27,180 You'd need a reader for it to make any sense. 718 00:55:27,380 --> 00:55:29,440 So it's a little, there's a higher barrier to entry. 719 00:55:29,500 --> 00:55:32,060 But, yeah, I can put that up there, too. 720 00:55:34,200 --> 00:55:34,600 Great. 721 00:55:34,680 --> 00:55:35,280 Well, thanks very much. 722 00:55:36,680 --> 00:55:37,080 . 723 00:55:38,100 --> 00:55:38,500 . 724 00:55:38,500 --> 00:55:38,860 . 725 00:55:38,860 --> 00:55:39,180 . 726 00:55:39,180 --> 00:55:39,420 . 727 00:55:39,420 --> 00:55:39,940 . 728 00:55:39,940 --> 00:55:40,600 . 729 00:55:40,600 --> 00:55:41,280 .