1 00:00:00,000 --> 00:00:04,160 So, a show of hands, who here has suffered a scrum meeting? 2 00:00:05,900 --> 00:00:07,520 Be honest, there's no shame in it? 3 00:00:08,340 --> 00:00:09,440 A scrum meeting. 4 00:00:10,180 --> 00:00:14,100 Okay, so in a scrum meeting you're supposed to say what you did the day before, 5 00:00:14,560 --> 00:00:15,980 and what you're doing that day, 6 00:00:16,600 --> 00:00:20,040 and then you're supposed to wait for another hour as, like, round robin goes around, 7 00:00:20,340 --> 00:00:22,960 and then you've wasted the first hour of your day and you've got nothing done. 8 00:00:24,740 --> 00:00:28,340 And I had the misfortune of doing these every morning. 9 00:00:29,160 --> 00:00:33,520 First thing, every day of the work week for several months. 10 00:00:33,720 --> 00:00:36,700 And it really, really took a toll on my soul. 11 00:00:38,880 --> 00:00:42,220 Because, you know, when you're talking about doing work instead of doing the work, 12 00:00:42,280 --> 00:00:43,680 it gets really frustrating, right? 13 00:00:44,300 --> 00:00:49,220 So I decided that I didn't want to do that anymore, and so I stopped doing that, 14 00:00:49,280 --> 00:00:52,100 and instead I made this, and I hope that you like it. 15 00:00:52,580 --> 00:00:58,000 This is a clone of the Casio 3208 watch module called the Goodwatch. 16 00:00:59,120 --> 00:01:01,560 It's completely open source and open hardware. 17 00:01:01,800 --> 00:01:03,660 Everything is available on GitHub. 18 00:01:05,400 --> 00:01:09,000 It's a replacement board that fits within the original Casio watch. 19 00:01:09,240 --> 00:01:12,100 So you can have, like, a watch that's good to wear, 20 00:01:12,240 --> 00:01:15,820 that has, like, the right metals and materials and all that stuff, 21 00:01:15,980 --> 00:01:18,000 is comfortable, has years of battery life. 22 00:01:18,100 --> 00:01:19,300 So we're not talking a smartwatch here. 23 00:01:21,440 --> 00:01:24,620 And at the same time, there's room for additional features. 24 00:01:24,800 --> 00:01:26,500 So not only is this programmed in C, 25 00:01:26,500 --> 00:01:28,680 and you can have a reverse Polish notation calculator 26 00:01:29,180 --> 00:01:31,880 instead of the algebraic one that it came with, 27 00:01:32,020 --> 00:01:34,720 but you can also do really crazy stuff, like a disassembler for it. 28 00:01:34,820 --> 00:01:35,760 Or you can add extra hardware. 29 00:01:35,960 --> 00:01:40,200 So this includes a 70 centimeter amateur radio. 30 00:01:41,140 --> 00:01:44,320 The next revision runs from 300 megahertz to 1 gigahertz 31 00:01:45,600 --> 00:01:48,840 using the watch band itself as a random wire antenna. 32 00:01:49,200 --> 00:01:52,160 So you can receive radio signals and you can transmit them, 33 00:01:52,240 --> 00:01:56,060 and you can use it to help reverse engineer other devices 34 00:01:57,420 --> 00:02:00,180 without having to bring out a full software-defined radio, 35 00:02:00,340 --> 00:02:02,160 without having to pull out your laptop, 36 00:02:02,420 --> 00:02:09,440 and without having to run the expensive, power-hungry and heavy tools. 37 00:02:10,220 --> 00:02:11,980 Because as you're wandering around here, 38 00:02:12,080 --> 00:02:15,180 if you have a laptop bag and you've got your radios 39 00:02:15,180 --> 00:02:17,860 and you've got your antennas, the weight of all of that can add up. 40 00:02:18,100 --> 00:02:22,380 So wouldn't it be nice to just have your entire toolkit on your wrist 41 00:02:22,380 --> 00:02:25,400 whenever you might need it in a way that you can forget about it 42 00:02:25,400 --> 00:02:26,520 the rest of the time? 43 00:02:29,120 --> 00:02:34,380 So I'm not the first to make a replacement board for a wristwatch, 44 00:02:34,620 --> 00:02:36,380 and I'm not the first to play with this radio chip. 45 00:02:36,640 --> 00:02:42,100 So as far as background goes, there's this thing called the Pluto watch, 46 00:02:42,340 --> 00:02:45,440 which is a replacement for the Casio F91W. 47 00:02:46,240 --> 00:02:51,560 This watch is famous because there was a moral panic 48 00:02:51,560 --> 00:02:54,160 over them being used in improvised explosive devices, 49 00:02:54,160 --> 00:02:57,580 where the alarm ringer would set off an explosion, 50 00:02:58,900 --> 00:03:05,440 prompting even TSA warnings about giving extra attention 51 00:03:05,440 --> 00:03:07,620 to people wearing the Casio F91. 52 00:03:08,200 --> 00:03:14,080 The Pluto watch also uses an MSP430 related to the one that I'm using, 53 00:03:14,220 --> 00:03:16,720 but they add a MEMS compass to it. 54 00:03:16,820 --> 00:03:20,480 So in addition to running your own code on the watch, 55 00:03:20,560 --> 00:03:24,100 you can also tell which way is north just by swinging your wrist around. 56 00:03:26,840 --> 00:03:30,460 About 10 years ago, TI came out with the Chronos development kit, 57 00:03:31,520 --> 00:03:33,760 which uses the same CPU that I use. 58 00:03:34,520 --> 00:03:36,340 The Chronos had a number of problems with it, though. 59 00:03:36,660 --> 00:03:39,460 It's really heavy, and it's really bulky. 60 00:03:39,780 --> 00:03:43,180 So you've got a fixed watch band that's uncomfortable. 61 00:03:43,420 --> 00:03:46,040 In the summer, your wrist will fill up with sweat. 62 00:03:47,480 --> 00:03:50,660 And it doesn't have a full keypad, 63 00:03:50,840 --> 00:03:53,840 so you need to go through awkward menu rings 64 00:03:54,160 --> 00:03:55,360 in order to reach anything that you like. 65 00:03:56,980 --> 00:03:59,160 There's also the Faraday RF kit, 66 00:03:59,780 --> 00:04:02,900 which again uses the ChipCon 430 chip that I'm using. 67 00:04:03,440 --> 00:04:06,320 They add a power amplifier for the 900 megahertz band. 68 00:04:06,740 --> 00:04:08,880 So you can just buy one of these things 69 00:04:08,880 --> 00:04:10,380 and have a half watt transceiver 70 00:04:11,060 --> 00:04:12,800 that's compatible with the wristwatch. 71 00:04:14,480 --> 00:04:17,080 Their firmware and their hardware are also open source, 72 00:04:17,320 --> 00:04:20,680 although little to no code is shared between them and my watch. 73 00:04:21,500 --> 00:04:23,560 And then, of course, a few years back, 74 00:04:23,560 --> 00:04:26,560 at TorCon, Michael Osmond and I did a lecture 75 00:04:26,560 --> 00:04:27,960 called Real Men Carry Pink Pagers. 76 00:04:29,300 --> 00:04:31,300 It's me on the left and Mike on the right. 77 00:04:31,560 --> 00:04:35,280 And we reverse engineered these pink children's text messaging toys 78 00:04:35,280 --> 00:04:37,700 in order to make a spectrum analyzer, 79 00:04:37,840 --> 00:04:41,220 a garage door opener, a reflexive jammer for APCO P25. 80 00:04:44,000 --> 00:04:47,180 The radio in these things is not a software-defined radio. 81 00:04:47,440 --> 00:04:49,820 It's not very good for reverse engineering a signal. 82 00:04:49,980 --> 00:04:52,140 But after you understand what that signal is, 83 00:04:52,140 --> 00:04:54,620 it's an excellent radio for talking to it 84 00:04:55,010 --> 00:04:57,840 or for making a receiver or a transmitter. 85 00:05:00,560 --> 00:05:02,460 And then there's the RF cat 86 00:05:03,140 --> 00:05:05,140 running on the Yardstick One hardware. 87 00:05:07,540 --> 00:05:11,300 This is by Atlas and Michael Osmond and those folks. 88 00:05:11,580 --> 00:05:13,340 This is a nice little tool that allowed you 89 00:05:13,340 --> 00:05:17,880 to write your radio definitions in Python on your own workstation 90 00:05:18,820 --> 00:05:21,500 while receiving from the real antenna with the real radio. 91 00:05:22,140 --> 00:05:25,660 The register settings for the RF cat are compatible with my watch. 92 00:05:25,820 --> 00:05:29,220 So you can prototype a receiver in Python 93 00:05:29,220 --> 00:05:31,960 on the hardware that's easy to prototype for 94 00:05:31,960 --> 00:05:35,360 and then move that definition to run inside of the watch 95 00:05:35,360 --> 00:05:39,040 as a radio application that you can keep with you at all times. 96 00:05:42,020 --> 00:05:47,060 So when you have an existing watch and you want to replace it, 97 00:05:47,160 --> 00:05:50,560 you first need to understand what goes where and why. 98 00:05:50,560 --> 00:05:54,780 So the Goodwatch 10 left out the radio 99 00:05:55,460 --> 00:06:00,460 and was my prototype to figure out that the LCD layout was correct, 100 00:06:00,680 --> 00:06:02,920 that the keypad layout was correct. 101 00:06:03,580 --> 00:06:06,680 I began by using a micrometer, a vernier caliper, 102 00:06:06,760 --> 00:06:10,420 to measure all of the dimensions of the PCB. 103 00:06:10,740 --> 00:06:13,920 So first I needed to know how wide it is, how tall it is, 104 00:06:13,980 --> 00:06:14,980 where the screw holes are. 105 00:06:17,200 --> 00:06:19,080 And I drew all this out on paper 106 00:06:19,080 --> 00:06:21,060 and then recreated it in the CAD software. 107 00:06:21,260 --> 00:06:23,880 And I did this for the front of the board, for the back of the board. 108 00:06:24,140 --> 00:06:26,680 And then I made my own board that matched those dimensions. 109 00:06:27,120 --> 00:06:30,140 So every keypad pin has to be in the same place. 110 00:06:30,260 --> 00:06:31,980 Every LCD pin has to be in the same place. 111 00:06:34,980 --> 00:06:39,060 Into this board I placed the ChipCon 430 F6137. 112 00:06:39,280 --> 00:06:41,080 This is the CPU of my device. 113 00:06:41,700 --> 00:06:46,580 You can also use the 6147, which is a related chip that's more modern. 114 00:06:47,200 --> 00:06:49,060 But each of these has 32 kilobytes. 115 00:06:49,080 --> 00:06:49,520 It has 4 kilobytes of flash. 116 00:06:50,120 --> 00:06:51,820 It has 4 kilobytes of SRAM. 117 00:06:52,100 --> 00:06:55,840 It has a built-in LCD driver and a built-in radio 118 00:06:55,840 --> 00:06:59,140 and a bootloader ROM that allows you to flash it over a serial port. 119 00:06:59,800 --> 00:07:02,200 And all of this comes for free inside of the chip 120 00:07:02,200 --> 00:07:05,720 so that I could build the entire watch around a single chip 121 00:07:05,720 --> 00:07:07,140 and a couple of support components. 122 00:07:09,140 --> 00:07:11,940 It's important to keep it to as few devices as possible 123 00:07:11,940 --> 00:07:15,740 because the chip packaging takes a lot of surface area on the board 124 00:07:15,740 --> 00:07:17,960 and also a lot of vertical height. 125 00:07:17,960 --> 00:07:20,620 So I wanted to have room for another chip 126 00:07:20,620 --> 00:07:24,240 to have a separate radio and CPU. 127 00:07:24,520 --> 00:07:25,860 They really had to be the same device. 128 00:07:26,080 --> 00:07:30,140 And similarly, I don't have room for an external LCD controller. 129 00:07:30,580 --> 00:07:34,720 So I had to find a part that contained both the CPU and the LCD controller 130 00:07:34,720 --> 00:07:38,160 and the radio in a single component in order to fit everything. 131 00:07:40,420 --> 00:07:43,860 And that got me a watch with a working display, 132 00:07:44,080 --> 00:07:45,660 with working keypad inputs. 133 00:07:46,160 --> 00:07:47,940 I initially bootstrapped it 134 00:07:47,960 --> 00:07:51,400 by building a watch that has these little blue fly wires coming out of it 135 00:07:51,400 --> 00:07:52,640 for reflashing. 136 00:07:53,100 --> 00:07:55,960 This also allows me to read back the de-message log from the watch. 137 00:07:56,400 --> 00:07:58,880 And I use this for all of my software development 138 00:07:58,880 --> 00:08:01,780 so that as I'm developing the code, 139 00:08:01,940 --> 00:08:03,960 I'm doing it on a tethered watch 140 00:08:05,000 --> 00:08:07,420 where temporarily I have no power concerns 141 00:08:07,420 --> 00:08:08,840 and where I get full logging. 142 00:08:11,520 --> 00:08:15,700 On the left is my recreation of the board, 143 00:08:15,920 --> 00:08:17,460 the Goodwatch 10. 144 00:08:17,960 --> 00:08:22,300 On the right is the original board from Casio. 145 00:08:22,480 --> 00:08:25,540 And you can see that even though the components are in different places, 146 00:08:25,820 --> 00:08:27,720 all of the pads are in identical locations. 147 00:08:29,040 --> 00:08:32,760 Because I'm less concerned about the cost of the individual PCB, 148 00:08:33,140 --> 00:08:37,540 I was able to do silver coating to prevent oxidization. 149 00:08:37,680 --> 00:08:42,160 You'll note that the copper has sort of dimmed down over the years in the original. 150 00:08:42,700 --> 00:08:44,900 And instead of an epoxy blob, 151 00:08:44,900 --> 00:08:47,660 I use a QFN chip. 152 00:08:49,820 --> 00:08:51,640 I drafted this in KiCad, 153 00:08:53,220 --> 00:08:57,180 so there are no licensing requirements to be able to edit the PCB 154 00:08:57,180 --> 00:08:58,500 or to manufacture your own. 155 00:08:58,660 --> 00:09:00,760 You can grab the files from the website, 156 00:09:01,020 --> 00:09:02,260 send it off to China, 157 00:09:02,340 --> 00:09:04,380 and receive your own package of 200 boards. 158 00:09:05,080 --> 00:09:08,720 They cost under a dollar apiece if you're doing a quantity above 100. 159 00:09:10,880 --> 00:09:13,020 But having the board is only part of it. 160 00:09:13,080 --> 00:09:14,880 You also need to know which pins do what. 161 00:09:14,900 --> 00:09:23,860 So the black bar here that is blocking some of the pins on the far west of the LCD, 162 00:09:24,840 --> 00:09:27,380 those pins are called commons. 163 00:09:27,700 --> 00:09:31,160 And a common is connected to very many segment pins. 164 00:09:31,780 --> 00:09:34,960 And you can think of this as like a row and column for a driver. 165 00:09:35,060 --> 00:09:37,240 And you have very few rows and very many columns. 166 00:09:37,580 --> 00:09:42,800 And then they're wired up to fit the individual pixels of the LCD display. 167 00:09:43,340 --> 00:09:44,880 So these are the common pins. 168 00:09:44,900 --> 00:09:45,400 These are the commons. 169 00:09:45,440 --> 00:09:46,520 And these are the segments. 170 00:09:48,720 --> 00:09:51,540 And I recovered these by using sticky tape. 171 00:09:51,960 --> 00:09:54,020 Or the little sticky notes, right? 172 00:09:54,060 --> 00:09:56,160 You take a razor blade and you chop off the end of it. 173 00:09:56,440 --> 00:09:59,560 And then by sticking this onto the PCB, 174 00:09:59,860 --> 00:10:04,360 you can selectively introduce a failure in a single pin of the LCD. 175 00:10:04,940 --> 00:10:09,740 I had to do this because I don't quite have enough LCD pins on my chip 176 00:10:09,740 --> 00:10:14,460 to drive all of the pins of the physical LCD hardware. 177 00:10:14,460 --> 00:10:18,460 So I needed to find which pins I could block off 178 00:10:18,460 --> 00:10:21,340 while keeping every digit of the display legible. 179 00:10:22,680 --> 00:10:24,420 To figure out which pin does what, 180 00:10:24,620 --> 00:10:27,500 you just introduce failure in a whole bunch of them at a time. 181 00:10:27,680 --> 00:10:31,300 So with the black bar there covering the far west pin, 182 00:10:31,540 --> 00:10:38,100 I now know that a quarter of the LCD pixels will refuse to light. 183 00:10:38,360 --> 00:10:40,500 And if I move that just one over, 184 00:10:40,700 --> 00:10:42,800 then a different quarter fail to light up. 185 00:10:42,800 --> 00:10:44,440 And a little bit further, 186 00:10:44,580 --> 00:10:46,460 a different quarter fail to light up. 187 00:10:47,820 --> 00:10:48,720 And so on. 188 00:10:50,580 --> 00:10:55,100 And whenever you cover up a pin that knocks out a quarter of the pixels, 189 00:10:56,020 --> 00:10:57,620 you're covering a common pin. 190 00:10:57,860 --> 00:11:02,900 And whenever you cover a pin that knocks out one, two, three, or four of the pixels, 191 00:11:03,100 --> 00:11:05,100 then you're covering up a segment pin. 192 00:11:05,800 --> 00:11:08,460 And this is how you figure out how to wire it to the chip. 193 00:11:08,980 --> 00:11:12,520 You don't actually care about which pixel is connected to which pair yet. 194 00:11:12,800 --> 00:11:15,180 Because you can figure out the rest of that by software. 195 00:11:15,440 --> 00:11:18,800 So instead of running through and tapping each and every one of these 196 00:11:18,800 --> 00:11:22,160 and measuring which pixels go out at which time, 197 00:11:22,820 --> 00:11:23,880 which would take forever, 198 00:11:24,580 --> 00:11:26,920 instead I just wired it up in software, 199 00:11:27,440 --> 00:11:28,900 lit up all of the pixels, 200 00:11:29,060 --> 00:11:31,160 and then selectively turned them dim. 201 00:11:31,720 --> 00:11:33,900 And then for each dim one, 202 00:11:34,080 --> 00:11:35,640 I was able to come up with its address, 203 00:11:35,840 --> 00:11:38,120 which is which common meets which segment. 204 00:11:39,560 --> 00:11:42,180 And that way I was able to write the LCD driver, 205 00:11:42,180 --> 00:11:44,820 after my hardware prototypes arrived, 206 00:11:45,040 --> 00:11:46,600 so that they didn't block each other. 207 00:11:48,100 --> 00:11:49,480 As far as the software went, 208 00:11:50,600 --> 00:11:53,120 MSP430 chips are well supported by GCC, 209 00:11:53,340 --> 00:11:58,080 and a complete development toolchain is available inside of most standard Linux distributions. 210 00:11:58,660 --> 00:12:01,100 So in Debian, you can build this firmware, 211 00:12:01,340 --> 00:12:03,100 either in stable or in testing, 212 00:12:03,200 --> 00:12:05,920 just by installing the compiler and building it. 213 00:12:05,980 --> 00:12:09,020 You don't need any external packages or external package sources. 214 00:12:14,640 --> 00:12:17,980 And then the actual programming happens through a serial port. 215 00:12:18,220 --> 00:12:22,000 So these little test probes that are connected to the sides, 216 00:12:22,200 --> 00:12:27,340 those are connected to the pins that allow me to force the chip into its bootloader mode. 217 00:12:27,780 --> 00:12:31,240 And then the bootloader appears as a serial port with documented commands. 218 00:12:31,400 --> 00:12:34,500 And a Python script can check the model number, 219 00:12:34,780 --> 00:12:37,660 erase flash, load in the programming, reboot. 220 00:12:38,120 --> 00:12:40,960 It can also dump a copy of RAM, 221 00:12:40,960 --> 00:12:42,100 so that I can do core boots, 222 00:12:42,340 --> 00:12:44,260 I can do core dumps from a running watch, 223 00:12:44,500 --> 00:12:47,780 in order to load a real RAM image into my debugger, 224 00:12:47,800 --> 00:12:49,600 to see what particular variables were. 225 00:12:51,280 --> 00:12:54,600 Or, I can dump the dmessage log. 226 00:12:54,840 --> 00:12:55,880 So when I run printf, 227 00:12:56,720 --> 00:13:00,820 there's no room on the LCD to cover the full kernel log. 228 00:13:01,260 --> 00:13:03,760 So instead, printf just writes to a memory buffer, 229 00:13:03,960 --> 00:13:06,040 and by dumping that memory buffer out, 230 00:13:06,160 --> 00:13:08,500 I can use printf debugging to see what went wrong. 231 00:13:10,960 --> 00:13:14,240 And then the ads are implemented by rows and columns again. 232 00:13:14,460 --> 00:13:15,900 And whenever you push a button, 233 00:13:15,920 --> 00:13:17,480 it connects that row to that column. 234 00:13:17,700 --> 00:13:20,300 So if we push the upper left button, 235 00:13:20,380 --> 00:13:21,000 which is a seven, 236 00:13:21,180 --> 00:13:23,220 that will connect pin two dot two 237 00:13:23,840 --> 00:13:25,400 to pin two dot three. 238 00:13:25,800 --> 00:13:28,320 And the two will be bridged and there will be a circuit between them. 239 00:13:28,580 --> 00:13:31,160 So what we do is we set all of the rows 240 00:13:31,940 --> 00:13:33,620 to be input pins 241 00:13:33,620 --> 00:13:35,700 and all of the commons to be output pins. 242 00:13:36,120 --> 00:13:39,300 And the inputs we pull lightly low, 243 00:13:39,420 --> 00:13:40,940 and the outputs we pull slightly low. 244 00:13:40,960 --> 00:13:46,640 strongly high. And when they connect, the inputs will jump high and that tells us which 245 00:13:46,640 --> 00:13:53,640 column touched which row by then cycling all of the other pins off. And again, we implement 246 00:13:53,640 --> 00:14:05,420 this as a table in which the high nibble of each byte is the scan code and the low nibble 247 00:14:05,420 --> 00:14:09,940 of each byte is the actual ASCII character. So that the driver can return the ASCII character 248 00:14:09,940 --> 00:14:15,620 of the key that's being pressed rather than the scan code. So that your source code can 249 00:14:15,620 --> 00:14:23,060 remain readable. Power management matters a lot if you're building something that has to run 250 00:14:23,060 --> 00:14:30,480 on a 1.6 millimeter thin coin cell battery for years. If I have to replace the battery every 251 00:14:30,480 --> 00:14:34,880 day or if I have to recharge the watch every day, it will become too much trouble and I'll stop 252 00:14:34,880 --> 00:14:39,920 wearing the watch and then I won't really have a wearable. So, I'm going to show you a 253 00:14:39,940 --> 00:14:47,240 few examples. The main CPU has a variable clock rate. And CMOS chips, when they're digital, 254 00:14:48,260 --> 00:14:55,320 they waste just a little bit of energy when the transistors flip. So, if you have a gate, when 255 00:14:55,320 --> 00:15:00,680 that gate transitions, then a little bit of energy is lost and after the transition and before 256 00:15:00,680 --> 00:15:06,220 the transition, it's almost perfectly static. It leaks very, very little energy. So, the power 257 00:15:06,220 --> 00:15:09,920 consumption is almost linear with the clock speed. And also, the power consumption is almost 258 00:15:09,940 --> 00:15:13,820 zero. So, a watch doesn't really have to do that much when it's idling. It only needs to display 259 00:15:13,820 --> 00:15:21,880 the time. So, I can run the entire CPU at 32 kilohertz until momentarily I need more speed and 260 00:15:21,880 --> 00:15:27,560 then I'm able to jump it up to 1 megahertz. And then my idle CPU draw can be as small as 5 261 00:15:27,560 --> 00:15:37,180 microamps. I implemented a reverse polish notation calculator. So, like the old Hewlett-Packard 262 00:15:37,180 --> 00:15:39,920 calculators, whenever you enter a number, it pushes it on a number. And then you have a number that 263 00:15:39,940 --> 00:15:43,680 is written to the stack. Whenever you hit an operator, it pops the last two values off the 264 00:15:43,680 --> 00:15:49,780 stack and pushes the result. This allows the calculator to be written quickly and with very 265 00:15:49,780 --> 00:15:57,060 small source code. New functions can be added. There is a timer. Each of these applications is 266 00:15:57,060 --> 00:16:02,180 written as, like, a small little module of C code, so that you can fork any application to add 267 00:16:02,180 --> 00:16:09,060 new pieces to it. There are bugs, though. Because when you implement something like this, the 268 00:16:09,060 --> 00:16:13,560 the documentation says it's supposed to work a certain way. And then you actually get it 269 00:16:13,560 --> 00:16:18,960 running and faults occur. You might have forgotten to check for an error message or there could 270 00:16:18,960 --> 00:16:24,060 be a mistake in the documentation. You need a way to debug this so that you can work out 271 00:16:24,060 --> 00:16:29,900 all of these kinks and then have a stable platform. So one of the applications that 272 00:16:29,900 --> 00:16:34,900 I wrote was a hex editor. And the hex editor allows me to view all of the CPU's memory. 273 00:16:34,900 --> 00:16:44,080 And it shows, I have room for eight hexadecimal nibbles on the screen. So the left four digits 274 00:16:44,080 --> 00:16:50,600 are the address and the right four are the value. I had two of the prototypes of this watch 275 00:16:50,600 --> 00:16:57,100 and I was in Budapest and I had no tools with which to work on them. Except for what I could 276 00:16:57,100 --> 00:17:04,520 borrow from a friendly hacker space. So the watch on the left is keeping accurate time 277 00:17:04,900 --> 00:17:11,000 and the watch on the right is losing an entire minute every day. And I needed to figure out 278 00:17:11,000 --> 00:17:21,560 why. So I used the hex editor to check the error flags of the real time clock value. And they all 279 00:17:21,560 --> 00:17:25,440 looked good. And then I checked the crystal and I was able to find that the low frequency 280 00:17:25,440 --> 00:17:31,240 crystal had faulted and that when the low frequency crystal faults on this chip, it defaults 281 00:17:31,240 --> 00:17:34,880 to a software backup. And the software backup was wasting a ton of time. So I was able to 282 00:17:37,600 --> 00:17:46,200 debug this without opening the case or any of that just by using the hex editor. As long as you 283 00:17:46,200 --> 00:17:50,740 have a hex editor, you might as well add a disassembler. So you can disassemble the firmware 284 00:17:50,740 --> 00:17:56,620 of the watch on the watch itself and then reverse engineer it with pen and paper. It has a 285 00:17:56,620 --> 00:18:02,680 power on self test. So every time I've been able to identify a faulting condition, I add a check 286 00:18:02,680 --> 00:18:04,860 for that to a routine that runs through and check the clock. And then I can do the test. And that's 287 00:18:04,860 --> 00:18:09,260 all of them at start up and all of them if you press the number 7. This allows me to recognize 288 00:18:09,260 --> 00:18:14,480 things like clock faults or things like leaving the radio on that can sabotage the power 289 00:18:14,480 --> 00:18:19,840 consumption. Because if a minor bug were to leave anything powered up that oughtn't be, that 290 00:18:19,840 --> 00:18:29,020 could wipe the battery out in a day or two and the watch will die. Then we need a radio. Because 291 00:18:29,020 --> 00:18:33,400 there's no point in having a fancy watch with a disassembler if it doesn't also give you like a 292 00:18:33,400 --> 00:18:34,840 really cool tool on the side. So I'm going to show you how to do that. I'm going to show you a 293 00:18:34,840 --> 00:18:42,360 little bit of the other side. To add a radio to the non radio version, I needed to add a crystal. 294 00:18:43,340 --> 00:18:49,840 It's a 26 megahertz crystal that provides the timing needed for the phase lock loops and the 295 00:18:49,840 --> 00:18:55,820 other analog pieces of the radio. And I also needed a filter chain. Without the filter chain, 296 00:18:56,040 --> 00:19:01,300 when you transmit, you would also transmit on harmonic frequencies because the digital chip can 297 00:19:01,300 --> 00:19:04,820 produce a square wave but not very well a sine wave. So I have a digital chip. I'm going to do an 298 00:19:06,340 --> 00:19:14,740 So, the original radio models are restricted to the band between 430 and 435 megahertz 299 00:19:14,740 --> 00:19:16,120 because of a band pass filter. 300 00:19:16,540 --> 00:19:23,100 The upcoming version extends this to support the full range of the chip by using a low 301 00:19:23,100 --> 00:19:26,020 pass filter above the 900 megahertz band. 302 00:19:26,580 --> 00:19:30,140 So you will transmit harmonics if you transmit in the lower frequencies. 303 00:19:30,960 --> 00:19:32,900 This causes no trouble for reception. 304 00:19:34,480 --> 00:19:35,780 I needed an antenna. 305 00:19:36,240 --> 00:19:40,980 So this little green wire here in the back actually connects the watch band as a random 306 00:19:40,980 --> 00:19:41,620 wire antenna. 307 00:19:42,740 --> 00:19:46,440 So that the watch band is the antenna for all reception and transmission. 308 00:19:47,780 --> 00:19:51,800 This is not a very good antenna, but it is more than good enough. 309 00:19:52,100 --> 00:19:57,260 In tests we were able to transmit Morse code across four city blocks in West Philadelphia. 310 00:19:58,820 --> 00:19:59,400 Received indoors. 311 00:20:02,700 --> 00:20:06,000 Now, radio software also has to be carefully considered. 312 00:20:06,320 --> 00:20:12,880 If you're building your first watch from my design, you'll get the digital parts working 313 00:20:12,880 --> 00:20:14,980 before you have the radio properly wired up. 314 00:20:15,200 --> 00:20:17,560 So it needs to gracefully downgrade. 315 00:20:18,300 --> 00:20:25,220 When the watch powers up, if it's unable to start that 26 megahertz radio crystal, 316 00:20:25,440 --> 00:20:28,780 if it can't fire that up, it assumes that it's not populated. 317 00:20:28,780 --> 00:20:31,460 And then it disables all radio features. 318 00:20:31,800 --> 00:20:35,680 Or if you need a model that you can wear inside of a skiff, you can just not populate that 319 00:20:35,680 --> 00:20:37,540 component and then you have a non-radio watch. 320 00:20:39,720 --> 00:20:46,040 It was also very important to have a way to quickly prototype radio functions separately 321 00:20:46,040 --> 00:20:46,820 from the GUI. 322 00:20:49,100 --> 00:20:55,240 For those purposes, the watch can be assembled with a built on chip antenna outside of a 323 00:20:55,240 --> 00:20:55,660 wrist watch. 324 00:20:56,320 --> 00:20:56,980 And then. 325 00:20:56,980 --> 00:21:01,780 All of the firmware can be communicated with over a serial port so that you can ask it 326 00:21:01,780 --> 00:21:03,540 to receive packets or transmit packets. 327 00:21:04,240 --> 00:21:10,060 And in this way you can prototype any new protocol entirely in software as a desktop 328 00:21:10,060 --> 00:21:16,600 Python application without having to involve the GUI of the watch. 329 00:21:16,740 --> 00:21:19,920 So you don't need to push the teeny little buttons to try the thing when you're trying 330 00:21:19,920 --> 00:21:21,240 to get it to work for the very first time. 331 00:21:21,820 --> 00:21:23,380 There's also code plugs. 332 00:21:23,520 --> 00:21:26,320 There's a text file that lists all of the frequencies that you might use. 333 00:21:26,980 --> 00:21:34,220 And then you can use this text file to add your own channels or things that you're interested 334 00:21:34,220 --> 00:21:37,540 in to tune between them in the tuner application. 335 00:21:39,120 --> 00:21:41,580 Radio power management also matters a lot. 336 00:21:41,840 --> 00:21:49,520 I told you before that with the radio off, the CPU consumes 5 microamps at 32 kilohertz 337 00:21:49,520 --> 00:21:52,060 and 160 microamps at 1 megahertz. 338 00:21:52,840 --> 00:21:54,040 Just receiving. 339 00:21:54,140 --> 00:21:55,260 Not transmitting. 340 00:21:55,360 --> 00:21:56,960 It takes 15 seconds. 341 00:21:56,960 --> 00:21:58,440 10,000 microamps. 342 00:21:59,800 --> 00:22:04,620 Transmitting can cost up to twice that although for a shorter period of time because you can 343 00:22:04,620 --> 00:22:06,500 shut the radio off after your transmission completes. 344 00:22:06,920 --> 00:22:09,300 This is a ton of power by comparison. 345 00:22:10,260 --> 00:22:15,900 It's for this reason that I can't really write like set it and forget it pager application. 346 00:22:16,700 --> 00:22:22,540 The watch can't be idly listening because idly listening costs a ton of power. 347 00:22:25,600 --> 00:22:30,620 Transmitting is a lot easier because it's only using energy for the time that you push 348 00:22:30,620 --> 00:22:31,060 down the button. 349 00:22:31,220 --> 00:22:36,360 So we have a Morse code mode where you can push the side of the watch as a Morse code 350 00:22:36,360 --> 00:22:40,960 key and then send that to any single sideband receiver within range. 351 00:22:41,180 --> 00:22:48,300 So here we have a Yesu 817 and we had this set up at a bar and then my buddy took the 352 00:22:48,300 --> 00:22:51,880 watch four blocks from the bar and was saying hello in Morse code. 353 00:22:51,880 --> 00:22:53,160 And we accurately received it. 354 00:22:53,860 --> 00:22:55,740 You can also send more complicated packets. 355 00:22:56,020 --> 00:23:06,080 This is GMSK transmission that we use as like a fast data rate packet format for dumping 356 00:23:06,900 --> 00:23:07,960 larger files. 357 00:23:08,280 --> 00:23:14,740 So one of our contributors is working on dumping the D message log over the radio so that in 358 00:23:14,740 --> 00:23:20,200 debugging we can just ask the watch to flush its logs out and then have a desktop nearby 359 00:23:20,200 --> 00:23:21,020 with a receiver. 360 00:23:23,960 --> 00:23:27,800 This can also be used for automated real world power management. 361 00:23:28,220 --> 00:23:34,060 So if I want to record the battery of a watch dying over a long period of time, then I can 362 00:23:34,060 --> 00:23:39,000 put a reduced capacity battery into a watch and set it to transmit its voltage every night 363 00:23:39,000 --> 00:23:42,040 at midnight and get a nice little graph of the voltage falling over time. 364 00:23:44,200 --> 00:23:48,300 Now this is great for talking to like abstract things. 365 00:23:49,040 --> 00:23:50,680 But in addition to abstract things. 366 00:23:50,680 --> 00:23:52,780 You also want to talk to specific things. 367 00:23:53,900 --> 00:23:56,420 So I bought a relay controller. 368 00:23:57,180 --> 00:24:06,640 All of these cheap relay controllers seem to use the same protocol of sending either 369 00:24:06,640 --> 00:24:12,140 a wide burst for a one and a short burst for a zero or the other way around. 370 00:24:12,400 --> 00:24:18,640 I call this the eights and E's code because if you receive it with accurate timing and 371 00:24:18,640 --> 00:24:20,180 you assume that they're a nibble wide. 372 00:24:20,180 --> 00:24:26,400 Then the long ones become E's and the short ones become eights or one-zero-zero. 373 00:24:27,840 --> 00:24:31,000 You can reverse engineer these using universal radio hacker. 374 00:24:31,860 --> 00:24:37,040 Connect it to any SDR and then it takes a recording and allows you to zoom in and out 375 00:24:37,040 --> 00:24:37,460 on the signal. 376 00:24:37,600 --> 00:24:38,620 You can change the thresholds. 377 00:24:38,620 --> 00:24:39,300 You can change the encoding. 378 00:24:40,160 --> 00:24:43,520 You're basically just trying to measure the width of one short bit. 379 00:24:43,840 --> 00:24:46,840 So here I have short bit selected. 380 00:24:47,360 --> 00:24:49,360 And then once you know that width. 381 00:24:49,640 --> 00:24:50,160 Yeah. 382 00:24:50,180 --> 00:24:57,560 you're able to program your own radio transmitter to mimic the signal which you copy out as 383 00:24:57,560 --> 00:25:06,100 a packet in hexadecimal. So the result of that will be this set of register values which 384 00:25:06,100 --> 00:25:10,680 are compatible with the RF cat. So you can take anything that's been reverse engineered 385 00:25:10,680 --> 00:25:16,600 to talk to an RF cat and you can then port it over to the watch. You also need the packets 386 00:25:16,600 --> 00:25:23,600 themselves. So here we have four strings broken apart into eight lines and these are for the A, 387 00:25:23,660 --> 00:25:31,320 B, C and D buttons of the transmitter. And then at the end of it you have a working signal that 388 00:25:31,320 --> 00:25:44,920 you can send. You can also send this between devices. So here I'm transmitting as Morse code 389 00:25:44,920 --> 00:25:46,580 to my hand held radio. And then I can send it to my watch. And then I can send it to my 390 00:25:46,580 --> 00:25:52,420 watch. And then I can send it to the Kenwood D74. Or you can use it for receiving on the reverse 391 00:25:52,420 --> 00:25:58,260 engineering end. So this cute little black radio on the left that's like a bit thicker but almost 392 00:25:58,260 --> 00:26:04,960 as small as my watch. You can buy these online from China and they arrive. And they just call 393 00:26:04,960 --> 00:26:08,340 them walkie talkies. And they don't tell you what frequencies they use and they're not 394 00:26:08,340 --> 00:26:13,140 externally programmable. But it would be really handy to know what frequency it's on because if 395 00:26:13,140 --> 00:26:16,040 no one else is using it, maybe that would be cool for you. Or maybe you want to move it over. 396 00:26:16,580 --> 00:26:22,160 So the watch in the middle is running a frequency counter application that tells me that the 397 00:26:23,380 --> 00:26:29,640 transmitting frequency is 450 megahertz. And the Kenwood on the right has found that it's 398 00:26:29,640 --> 00:26:39,020 actually 450.05 megahertz. This is really close. We're off by 50 kilohertz. And all the time of 399 00:26:39,020 --> 00:26:44,440 trying to guess what the frequency would be, of having to set up a waterfall on a software defined 400 00:26:44,440 --> 00:26:46,560 radio. All of that can be skipped. Just don't. All I can do is just put this one in my pocket. Just 401 00:26:46,560 --> 00:26:54,340 by asking the wristwatch what frequency the transmitter next to it is running. I used 402 00:26:54,340 --> 00:27:00,200 this at B-Sides Knoxville in order to figure out what the frequency of the two-way radios they 403 00:27:00,200 --> 00:27:07,140 were using was. So then I could call the staff on their own radios having reverse engineered 404 00:27:07,140 --> 00:27:12,880 their frequencies without using a desktop or software-defined radio or laptop or anything 405 00:27:12,880 --> 00:27:19,660 heavy. The only tools that I used to reverse engineering this were my watch and my handheld. 406 00:27:20,540 --> 00:27:28,660 You can also hit other items. So like this is a doorbell that I've reverse engineered to be 407 00:27:28,660 --> 00:27:33,420 remote controlled by my wristwatch. And I can be sitting on the couch at home and just reach 408 00:27:33,420 --> 00:27:42,860 over and knock the thing off and it ding-dongs, you know. So many things that can be done 409 00:27:42,880 --> 00:27:52,000 with this platform. Once the basic problems of power management and radio access are solved, and 410 00:27:52,000 --> 00:27:57,400 all of those have been solved in this project. We have clean C source code that is well commented 411 00:27:57,400 --> 00:28:03,360 and well documented. The wiki explains how individual applications were written. The 412 00:28:03,360 --> 00:28:07,960 development environment is simple enough that you can now sit down and write a feature in an 413 00:28:07,960 --> 00:28:12,860 afternoon. Last Friday I implemented a new feature called radio access. It's a feature that 414 00:28:12,880 --> 00:28:18,500 we call the Shabbos mode for this. So you can actually turn off the keypad and the side button 415 00:28:18,840 --> 00:28:22,640 and have no buttons that you might accidentally press that would change even a single transistor 416 00:28:23,360 --> 00:28:31,280 until the recessed button on the side is pressed to exit the mode. You can reverse engineer radio 417 00:28:31,280 --> 00:28:40,460 protocols and port them over. So any on-off keyed 2FSK or 4FSK transmitter or receiver can be 418 00:28:40,460 --> 00:28:42,860 re-implemented on this platform. For example, if you want to use radio access, you can use the 419 00:28:42,880 --> 00:28:51,640 first and quickly prototyped Python and then re-implemented in stand-alone C. Isn't that nifty? 420 00:28:53,160 --> 00:29:03,980 Okay. Code is available on GitHub. The source code is available as well. The third revision of the 421 00:29:03,980 --> 00:29:10,760 watch will be arriving on Monday, which adds additional frequencies for the 900 megahertz band 422 00:29:10,760 --> 00:29:12,420 and the 300 megahertz band. 423 00:29:13,260 --> 00:29:16,300 And have at it. Thank you kindly. 424 00:29:24,440 --> 00:29:29,820 This is Ruger. He's a very good dog. Another round for Ruger, please. 425 00:29:36,280 --> 00:29:42,740 So I'm finished with plenty of time to spare. Do we have any questions? Yes? Did you order the most 426 00:29:42,740 --> 00:29:49,780 BCP already assembled or did you assemble it yourself because when you published the course, I try 427 00:29:49,780 --> 00:29:55,760 to assemble it, but there is like I needed the micro scoping . 428 00:29:56,960 --> 00:29:58,320 Yeah, yeah. 429 00:29:58,480 --> 00:30:04,160 And I still didn't get it, so I've been trying to buy it already. 430 00:30:04,460 --> 00:30:12,620 Ok, so I have no plans to manufacture this. But the license allows it. If Sind Studio or anyone want, 431 00:30:12,720 --> 00:30:18,340 to manufacture this, they have my blessing. I made this as a hobby project because I thought 432 00:30:18,340 --> 00:30:23,460 it would be cool. I really enjoy designing electronics and building them at home, but 433 00:30:23,460 --> 00:30:27,620 I do not enjoy dealing with the hassles of manufacturing. If you want me to do that, 434 00:30:27,660 --> 00:30:36,780 you really have to pay me. For the, so, but no, there are no preassembled boards available 435 00:30:36,780 --> 00:30:43,420 so far. If you can find a student who is good with soldering or has the microscope eyes 436 00:30:43,420 --> 00:30:51,400 and steady hands, you might also try, like, fixing equipment problems. Like, if you have 437 00:30:52,060 --> 00:30:57,920 brighter lights or if you have a better vise or maybe you need, like, more coffee or less 438 00:30:57,920 --> 00:31:05,300 whiskey or those sorts of things. The soldering on this is rather difficult. It is 0201, which 439 00:31:06,780 --> 00:31:12,980 is American, not metric. It's not that bad. But it is 2 mils long and 1 mil wide for some 440 00:31:12,980 --> 00:31:18,140 of the smaller components. You will need very bright lights and steady hands and solder 441 00:31:18,140 --> 00:31:26,620 paste or a flux pen. Do not use lead-free solder. That's a communist conspiracy. All right. 442 00:31:27,260 --> 00:31:36,760 Any other questions? Oh, yes. Sorry. The, the software is a little bit different than 443 00:31:36,780 --> 00:31:41,100 the hardware. For now, you should just be running everything from the get master. The 444 00:31:41,860 --> 00:31:47,320 software is backward compatible with every hardware release. So, it, like, we've not 445 00:31:47,320 --> 00:31:54,640 broken hardware compatibility at all yet. The, the new boards that arrive Monday add a better 446 00:31:55,280 --> 00:32:00,660 ground plane stitching. So the battery ought to work even as it gets lower. So the, the 447 00:32:00,660 --> 00:32:06,720 life will increase. And then the revision after that adds the, the wider radio bands. And 448 00:32:06,720 --> 00:32:12,080 that requires a different set of components. Yes? With your typical usage, what battery 449 00:32:12,080 --> 00:32:17,040 run times do you get? The question is what battery lifetimes do I get with my typical usage? 450 00:32:17,360 --> 00:32:23,520 And the answer is that it varies by what I'm doing and by whether there are any hardware 451 00:32:23,520 --> 00:32:29,200 faults. So, for example, I missoldered the resistor in one of my units. And then whenever I send a 452 00:32:29,200 --> 00:32:34,160 radio transmission, the radio transmission would be really squeaky quiet. And the battery life 453 00:32:34,160 --> 00:32:36,700 would just drop off of a cliff. So, that's, that's, that's, that's, that's, that's the 454 00:32:36,700 --> 00:32:44,640 problem. For units which do not have physical faults, I'm getting battery life on the order of, 455 00:32:44,820 --> 00:32:50,940 like, two or three years, I think. They're, they no longer die from old age. When I have them die, 456 00:32:51,160 --> 00:32:55,480 it's because of a software bug or because I screwed up somewhere. And the software bugs are 457 00:32:55,480 --> 00:33:00,680 becoming fewer and further between. So. Great. Thank you kindly. 458 00:33:06,700 --> 00:33:06,960 Thank you.