1 00:00:00,420 --> 00:00:06,740 So one of the things that we did after Defcon was we went through and cut up all the talks that were given at NixVegas. 2 00:00:06,740 --> 00:00:13,440 And this one has the audio missing for the first five or so minutes, so just bear with me while I narrate over it a little bit. 3 00:00:13,580 --> 00:00:16,480 But this is reproduce this build, how we built the Nix badge. 4 00:00:17,880 --> 00:00:21,240 And because this is Nix, we can just provide repos up front. 5 00:00:21,260 --> 00:00:24,140 So NixVegas slash badge, that's the firmware for the badge. 6 00:00:24,140 --> 00:00:26,180 It uses the ESP32 SDK. 7 00:00:26,180 --> 00:00:31,040 And NixVegas slash PCB is the reproducible hardware pipeline that we built for the badge. 8 00:00:31,080 --> 00:00:44,540 And that uses KiCad as the CAD software with a mix of plugins that are actually packaged reproducibly so they can spit out the correct Gerber file that JLCPCB needs in a bill of materials. 9 00:00:44,540 --> 00:00:52,260 And it's called a centroid file that basically is everything that JLCPCB needs to fabricate the PCB. 10 00:00:52,260 --> 00:00:57,320 And having a reproducible PCB pipeline is actually really useful. 11 00:00:57,400 --> 00:01:10,300 As it turns out, you can run the electrical rules checks and the design rules checks in your build pipeline to make sure you're always getting the exact same PCB every time you upload it. 12 00:01:10,840 --> 00:01:24,060 And also, it's very useful if you're repeatedly uploading things to test JLCPCB's preview feature so you can make sure that your board that you're previewing is the one that you built and ultimately the one you're going to get printed. 13 00:01:25,080 --> 00:01:28,680 Speaking of getting things printed, so this is what JLCPCB ships you. 14 00:01:28,680 --> 00:01:31,140 This was kind of after our prototyping phase. 15 00:01:31,840 --> 00:01:46,180 They kind of are notorious for shipping you a lot of cardboard, a lot of red bubble wrap, and each one of those red bubble wrap things has like, I think, six PCBs in it. 16 00:01:46,220 --> 00:01:55,180 We had to go through every one and pull it out, pop the mouse bytes off, which are basically these little snaps that secure the board frame in. 17 00:01:55,660 --> 00:02:02,580 We had a couple prototype badges that we passed around for people to take a peek at. 18 00:02:04,440 --> 00:02:17,140 And yeah, so we had all these things arrive and Tristan and I basically spent the better part of five or six hours the Tuesday before DefCon soldering all those things. 19 00:02:17,140 --> 00:02:18,400 So this is the first one that worked. 20 00:02:18,400 --> 00:02:26,540 We plugged it into USB and flashed the firmware on it and, you know, thankfully all the LEDs lit up. 21 00:02:27,540 --> 00:02:31,860 And from what it seems like, most of the badges were pretty much like this. 22 00:02:32,680 --> 00:02:36,680 Maybe like a couple defects here and there, but most of them just came up. 23 00:02:36,720 --> 00:02:40,680 They're actually pretty consistent, which was good. 24 00:02:42,640 --> 00:02:57,380 Another interesting thing about the programming process is that the ESP32 uses the clear-to-send pin of the serial line as a reset line. 25 00:02:57,920 --> 00:03:05,680 And that's really useful because regardless of what state the badge is in, you don't actually need to hold down any reset buttons or any bootloader buttons to get into the bootloader. 26 00:03:05,680 --> 00:03:13,500 So you just plug it in and immediately bootload it and it will reset and basically get going. 27 00:03:13,500 --> 00:03:18,720 So yeah, here you can see I'm kind of going over the KiCad PCB just at a very high level. 28 00:03:19,440 --> 00:03:23,260 So this is the PCB editor as opposed to the schematic editor. 29 00:03:23,560 --> 00:03:30,020 There's normally a schematic editor and you define the basically electrical schematic there. 30 00:03:30,020 --> 00:03:38,140 And then you basically tell KiCad that I want all those components on a physical PCB and it will copy all of them there. 31 00:03:39,020 --> 00:03:52,040 And then you get to spend hours and hours arranging them and routing them and putting silkscreen on and doing solder mask knockouts and all sorts of good stuff. 32 00:03:52,420 --> 00:03:55,280 You can see that there are zones drawn. 33 00:03:55,280 --> 00:03:59,420 Those are those red outlines around each lambda. 34 00:03:59,420 --> 00:04:06,120 Basically what those are for are those are different copper fill kind of designations. 35 00:04:06,380 --> 00:04:12,720 So you can tell KiCad to fill different parts of the PCB differently. 36 00:04:12,720 --> 00:04:24,920 So that's what creates the board's kind of like light versus dark lambda effect as opposed to, you know, something that's printed on it because it's a blue it's a blue PCB. 37 00:04:24,920 --> 00:04:31,720 So because the NixOS logo is just different shades of blue, you can kind of do darker or lighter blue. 38 00:04:32,560 --> 00:04:35,900 So that's, yeah, you can see I'm turning on the silkscreen layer there. 39 00:04:35,920 --> 00:04:40,340 That kind of made the negative space between all the lambdas. 40 00:04:41,120 --> 00:04:46,840 And yeah, by the way, this was made with the new NixOS logo that the marketing team just created. 41 00:04:46,880 --> 00:04:49,220 So the board cuts are all from that. 42 00:04:50,180 --> 00:05:04,900 And yeah, so you can just import, actually, board cuts from an SVG directly into KiCad and then give it a scale factor and it will basically just resize that SVG and that will be your board. 43 00:05:05,260 --> 00:05:11,160 So there's a tool called SVG to Shenzhen that lets you do this for kind of complicated outlines. 44 00:05:11,160 --> 00:05:12,960 I actually didn't even have to use that here. 45 00:05:12,960 --> 00:05:16,560 I mostly use SVG to Shenzhen for that actually. 46 00:05:16,720 --> 00:05:22,860 That is our artwork which was live traced in Inkscape. 47 00:05:22,860 --> 00:05:34,040 And then, yeah, I did use SVG to Shenzhen to basically create a custom footprint with the solder mask knockout for our art. 48 00:05:34,720 --> 00:05:38,880 Anyway, that's kind of this first part of voiceover. 49 00:05:38,880 --> 00:05:43,020 Audio is going to return in a few seconds. 50 00:05:43,020 --> 00:05:44,820 Yeah, enjoy. 51 00:05:50,480 --> 00:05:51,900 It's a little bit counterintuitive. 52 00:05:51,900 --> 00:05:55,620 It's a solder mask knockout layer because it's assumed that there's mask. 53 00:05:55,900 --> 00:05:58,560 The solder mask is basically the blue color. 54 00:05:58,560 --> 00:06:02,880 It's the thing that effectively a coating that goes over the copper so you don't short the copper. 55 00:06:03,160 --> 00:06:08,040 But if you have a solder mask layer, that means that that part of the solder mask is actually removed. 56 00:06:08,420 --> 00:06:11,280 Now, if you remove the solder mask, you expose copper. 57 00:06:11,280 --> 00:06:13,720 So then you have to go and actually add two things. 58 00:06:13,720 --> 00:06:22,620 So if I hide the mask layer, you see there's all that still all this basically, which is actually copper knockout. 59 00:06:22,620 --> 00:06:30,120 So all of these outlines have the copper removed so you can see through to the PCB. 60 00:06:31,320 --> 00:06:36,000 And FR4, it's the type of material that these PCBs are made of. 61 00:06:36,000 --> 00:06:39,820 It's kind of like a fiberglass style material is slightly translucent. 62 00:06:39,820 --> 00:06:46,120 So we cranked up this LED basically to maximum and you can see the kind of RGB effect on the back. 63 00:06:46,780 --> 00:06:49,980 So that's SVG to Shenzhen and KiCad. 64 00:06:49,980 --> 00:07:05,500 What I will note is that there's a nasty Ruby script that we had to write in the repository to convert the SVG to Shenzhen output to an actual copper knockout because it creates a solder mask knockout but not a copper knockout. 65 00:07:05,500 --> 00:07:07,640 And Q and KiCad are different formats. 66 00:07:08,100 --> 00:07:17,800 And there's a lot of manual copy paste of KiCad files that that part is not really that reproducible honestly, just because the tooling is annoying. 67 00:07:18,300 --> 00:07:32,040 So how this all kind of comes together is if I go to the PCB repository, we basically have a Nix package that is actually a couple things. 68 00:07:32,040 --> 00:07:45,980 There's the KiCad text injector, which is if you look on the back of these badges, actually the store path that the badge was rendered to in the Gerber files is actually printed on the back. 69 00:07:46,140 --> 00:07:49,800 So KiCad text injector is a Rust package. 70 00:07:49,800 --> 00:07:54,020 It's actually not upstream to Nix packages, although that's something that I plan to do. 71 00:07:54,980 --> 00:08:01,320 It's just a really simple Rust package that replaces the placeholders in KiCad with environment variables. 72 00:08:01,600 --> 00:08:03,680 So that's how we got the store path on that. 73 00:08:04,140 --> 00:08:09,880 And then there's this other project called JLCFCTSRE. 74 00:08:09,880 --> 00:08:11,860 It's a reverse engineering project. 75 00:08:12,180 --> 00:08:16,920 So the fab that we used is JLCPCB. 76 00:08:16,920 --> 00:08:20,160 So they're a Chinese fab based in Shenzhen. 77 00:08:20,160 --> 00:08:27,100 And one of the things that we looked into doing was using basically using JLC's like colored silkscreen. 78 00:08:27,100 --> 00:08:34,840 And JLC has kind of a strange thing where their colored silkscreen is a proprietary like encrypted format. 79 00:08:34,840 --> 00:08:37,200 But someone's gone and reverse engineered it. 80 00:08:37,200 --> 00:08:44,140 It seemingly like only exists to like vendor lock UN basically because it's just encrypting an SVG basically. 81 00:08:44,240 --> 00:08:48,120 There's interestingly no tooling that really supports this. 82 00:08:48,180 --> 00:08:56,600 So we were looking into like originally making these white using like doing a white PCB and then actually printing the NixOS colors on it. 83 00:08:56,600 --> 00:09:01,840 But seeing there's no tooling from KiCad that actually works with JLCPCB. 84 00:09:02,960 --> 00:09:07,240 We ended up using the copper and stuff. 85 00:09:07,240 --> 00:09:09,340 And honestly, that was it was cheaper. 86 00:09:09,340 --> 00:09:11,100 It turned out better, I think. 87 00:09:11,320 --> 00:09:15,020 Although I'd still like to see a white version with color silkscreen. 88 00:09:17,100 --> 00:09:20,140 So those are just some support packages that we made. 89 00:09:20,300 --> 00:09:22,440 Then our default.nix. 90 00:09:25,300 --> 00:09:28,860 So this is where we actually start locking down KiCad libraries. 91 00:09:28,860 --> 00:09:34,620 So we have the JLCPCB KiCad library from GitHub that we locked the exact version. 92 00:09:35,120 --> 00:09:41,160 So if you want to, you know, reproduce this hardware, then you can you can literally reproduce the build basically. 93 00:09:42,000 --> 00:09:54,220 There's also this fabrication toolkit for KiCad, which is a collection of Python scripts that are kind of annoying to use, that correctly export the Gerbers and get them into a format that JLCPCB can read. 94 00:09:55,580 --> 00:10:02,500 So I've got a derivation that basically takes those two things together and creates KiCad's third party directory, which is all of the plugins. 95 00:10:02,720 --> 00:10:09,900 And it's this kind of nasty JQ script basically that adds a bunch of JSON in the sandbox to KiCad's plugins directory. 96 00:10:10,180 --> 00:10:11,940 But all this is in the packages. 97 00:10:13,240 --> 00:10:18,320 And then yeah, the actual build, we define all the layers that we want to render. 98 00:10:18,560 --> 00:10:31,300 We actually do a couple renderings, including like a 3D render and then a render of the Gerber, so you can open that in the Gerber editor, and then a actual fab copy, which uses fabrication toolkits. 99 00:10:31,360 --> 00:10:40,860 And so we run KiCad Text Injector to basically inject the environment variables which are relevant, which are mostly just the store path. 100 00:10:41,160 --> 00:10:48,580 And then the build phase basically exports the Gerbers, exports the drill, so you can render or load those into a Gerber viewer. 101 00:10:49,160 --> 00:11:07,380 And then the check phase runs the ERC and DRC, so you can get assurance that your electrical rules aren't being violated and your design rules aren't being violated, although that wasn't 100% assurance if you define the electrical rules wrong, such as swapping a 3v3 and ground. 102 00:11:07,560 --> 00:11:17,580 It will just make sure that you're not connecting 3v3 to ground, but if you're going through a component then you're still going to violate, or you're not going to violate ERC, but it's also just not going to work. 103 00:11:19,140 --> 00:11:25,200 So then we also, the post check, once we know that the check phase is good, we render it to another output. 104 00:11:25,200 --> 00:11:28,780 So this is using a feature of Nix called split output derivations. 105 00:11:28,860 --> 00:11:33,400 So you can actually define in Nix derivations this outputs variable. 106 00:11:33,720 --> 00:11:51,080 So we have out, which is the Gerbers, and then check, which is basically the ERC and DRC reports, and then fab and render, fab being the JLC output, and then render being just 3D renders if you want to look at the badge in a photo viewer or something. 107 00:11:51,560 --> 00:11:59,220 So then the renders are all using KiCad's render ray tracer, using the KiCad CLI, and that was pretty easy. 108 00:11:59,420 --> 00:12:05,020 Then the install phase, just moving all the things to their outpats. 109 00:12:06,580 --> 00:12:27,860 So if you go and build this, actually, well, one thing of note is that because we have so many polygons in the copper layer, the design rule check actually takes quite a long time to run. 110 00:12:29,980 --> 00:12:46,080 So because I think if you do this sort of PCB art, you hit pathological cases with KiCad, where it will basically try to compare every single polygon in your copper layer against every single other polygon, and so it effectively becomes like an N-squared, 111 00:12:46,080 --> 00:12:50,200 and you just end up taking a lot of time, but it eventually finishes. 112 00:12:50,400 --> 00:12:54,020 So it'll at least get partially through the build. 113 00:12:55,120 --> 00:13:02,470 And while it's doing that, let's talk firmware. 114 00:13:15,820 --> 00:13:22,760 So basically, I got started on the firmware and got a couple demos working of the various hardware features. 115 00:13:23,940 --> 00:13:28,360 And then Tristan has been working pretty hard on it pretty recently. 116 00:13:29,960 --> 00:13:34,200 So the firmware is in the NixVegas slash badge repo. 117 00:13:37,840 --> 00:13:44,020 And if I do a NixFlake show, effectively, there's 118 00:13:49,520 --> 00:13:53,620 just one output, there's default, and it's the same as the output called NixBadge. 119 00:13:54,300 --> 00:13:59,060 And the result that it produces by, say, NixBuild, 120 00:14:03,040 --> 00:14:06,720 this dot caret star actually produces all the outputs. 121 00:14:06,780 --> 00:14:14,220 You don't have to do that, it'll just build the firmware by default, but if you want to do dot caret star, it will give you a flasher script too. 122 00:14:17,220 --> 00:14:25,860 Alternatively, if you want to develop on it, you can basically just NixDevelop, and it will automatically set the ESP IDF framework up for you. 123 00:14:25,860 --> 00:14:31,480 There's actually a Nix packaged version of ESP's IDF. 124 00:14:31,540 --> 00:14:35,540 I think it's the IoT development framework is what that's called. 125 00:14:36,400 --> 00:14:38,720 Oh boy , keypad's freezing. 126 00:14:41,320 --> 00:14:42,680 Come on . 127 00:14:45,270 --> 00:14:48,190 It's probably doing the design rule check right now. 128 00:15:03,140 --> 00:15:04,760 Oh, there it goes. 129 00:15:19,860 --> 00:15:22,780 I think I'm going to just kill that. 130 00:15:43,860 --> 00:15:45,280 Oh, there we go. 131 00:15:46,060 --> 00:15:47,120 Come on. 132 00:15:54,980 --> 00:15:59,300 This laptop is not a powerful laptop for doing any sort of CAD work. 133 00:16:03,640 --> 00:16:05,360 Now, during my talk? 134 00:16:13,810 --> 00:16:16,270 That is true, they could probably build it pretty quickly. 135 00:16:24,720 --> 00:16:25,960 All right. 136 00:16:25,960 --> 00:16:27,700 Well, my laptop reboots. 137 00:16:27,700 --> 00:16:29,960 Any questions? 138 00:16:39,740 --> 00:16:44,600 So, probably manually routing all the traces was really frustrating. 139 00:16:47,020 --> 00:16:52,660 The auto-router had a lot of hard time with the shape of the badge. 140 00:16:52,660 --> 00:16:59,620 It frequently just could not route anything at all, and I had to just manually draw a bunch of traces. 141 00:17:00,020 --> 00:17:04,380 Changing the layout of a bunch of traces and having to re-route them was also pretty frustrating. 142 00:17:13,610 --> 00:17:16,050 I'm going to unlock my data sets and get in here. 143 00:18:12,290 --> 00:18:14,570 All right, now let's start playing with the firmware. 144 00:18:19,410 --> 00:18:23,370 So, to actually start playing with the firmware, there's a USB port on the badge. 145 00:18:23,370 --> 00:18:24,970 Just plug your USB-C in. 146 00:18:26,110 --> 00:18:27,670 And run Nix Develop. 147 00:18:40,120 --> 00:18:49,960 And part of the Nix Develop, or the build, it will actually patch the ESP IDF, because there's a plugin that we use that requires patches to it. 148 00:18:50,020 --> 00:18:51,600 So, it will just do that for you. 149 00:18:52,500 --> 00:18:56,320 But it takes a second, because it has to copy the entire ESP IDF. 150 00:18:57,220 --> 00:18:58,240 All right, there we go. 151 00:18:59,500 --> 00:19:06,320 But it drops you directly in source, and your friend is going to be... and this is in the readme, so if you check out the readme... 152 00:19:09,620 --> 00:19:16,680 The hardware feature is also, loudly, kind of the known issue about the SD card and how to build it. 153 00:19:16,700 --> 00:19:22,340 But yeah, for develop, your friend is idf.py, which is conveniently in your path. 154 00:19:29,750 --> 00:19:36,820 So, if I copy this, it will build it. 155 00:19:40,300 --> 00:19:43,460 And mostly, it shouldn't have to rebuild too much. 156 00:19:48,750 --> 00:19:50,030 Yeah, there we go. 157 00:19:51,210 --> 00:19:53,170 I kind of just built it. 158 00:19:54,870 --> 00:20:02,130 And ESP IDF has a monitor command that lets you basically break into a serial monitor that's very similar to something like screen. 159 00:20:02,790 --> 00:20:10,200 So, it's going to flash it, and then it will start monitoring. 160 00:20:10,920 --> 00:20:18,820 And so, yeah, by default, the badges come up in a configuration that's kind of the most battery saving configuration, so it just lights up the LEDs, basically. 161 00:20:19,120 --> 00:20:27,580 The ESP32, which is a RISC-V core, actually supports a bunch of things that we're not necessarily using. 162 00:20:28,640 --> 00:20:30,800 And by default, we don't use the Wi-Fi. 163 00:20:30,800 --> 00:20:40,560 But if we turn, if we unplug it, and if you hold the button down at boot, and plug it back in, 164 00:20:45,000 --> 00:20:47,800 run the monitor again, 165 00:20:52,430 --> 00:20:54,170 oh , it switches the port. 166 00:20:54,170 --> 00:20:54,770 Okay. 167 00:21:01,280 --> 00:21:03,620 All right, let's try this again. 168 00:21:04,300 --> 00:21:05,760 That's still ACN0. 169 00:21:05,880 --> 00:21:07,380 I'm just going to go monitor. 170 00:21:11,440 --> 00:21:15,220 And I'm going to hold the button down and hit reset. 171 00:21:21,380 --> 00:21:22,520 Oh, until it's fully up. 172 00:21:22,520 --> 00:21:23,000 Okay. 173 00:21:27,950 --> 00:21:29,150 All right, there we go. 174 00:21:29,210 --> 00:21:31,330 So, this actually started up Wi-Fi. 175 00:21:32,750 --> 00:21:42,810 And what these badges are doing when Wi-Fi is started up, basically, is they use ESP's mesh light library to basically automatically create a mesh topology. 176 00:21:42,870 --> 00:21:48,450 So, it spawns a Wi-Fi network, and it tries to connect to other badges' Wi-Fi networks. 177 00:21:49,070 --> 00:21:52,830 And let me try to connect to it. 178 00:22:00,120 --> 00:22:03,240 Is that an NVS config option? 179 00:22:19,830 --> 00:22:21,490 It is not working. 180 00:22:32,480 --> 00:22:33,560 Oh, what's that? 181 00:22:36,460 --> 00:22:37,460 You hold the button. 182 00:22:37,460 --> 00:22:39,660 So, if you hold boot, that puts it to the boot loader. 183 00:22:43,900 --> 00:22:44,480 Okay. 184 00:22:44,480 --> 00:22:48,220 I think, yeah, the issue, basically, is that the USB also resets it. 185 00:22:48,220 --> 00:22:50,200 So, I just have to hold the button until it comes up. 186 00:22:52,040 --> 00:22:54,520 If I want to just show the console. 187 00:23:10,280 --> 00:23:12,120 I think it's whatever the latest is. 188 00:23:13,100 --> 00:23:18,660 So, we can, yeah, probably we're going to probably not going to be able to do this demo live, at least. 189 00:23:19,860 --> 00:23:20,760 But, yeah. 190 00:23:22,840 --> 00:23:23,460 Oh, really? 191 00:23:23,460 --> 00:23:25,080 Do I have the old version? 192 00:23:25,120 --> 00:23:26,360 That's entirely possible. 193 00:23:26,360 --> 00:23:27,640 Can I try your badge? 194 00:23:27,960 --> 00:23:28,720 No. 195 00:23:30,640 --> 00:23:40,840 Well, we'll come around and, yeah, if you guys are curious about doing binary substitution over this, it basically connects to our Wi-Fi network and talks to our servers. 196 00:23:41,720 --> 00:23:49,220 It's not that fast, and because the SD card is not working, it's, you know, especially slow because the ESP32 has to Wi-Fi schedule a lot. 197 00:23:49,480 --> 00:23:51,060 But the firmware is open source. 198 00:23:51,060 --> 00:23:52,320 Y'all can hack on it. 199 00:23:52,360 --> 00:23:59,240 We're definitely willing to help you all get going with it, especially if it's your first foray into Nix and you want to hack the badge. 200 00:23:59,340 --> 00:24:00,280 I mean, yeah. 201 00:24:00,720 --> 00:24:04,900 You guys, you guys have the tools, so. 202 00:24:05,040 --> 00:24:06,280 Any more questions? 203 00:24:18,440 --> 00:24:29,080 So, yeah, the getting KiCad plugins to work in the Nix sandbox, basically it was reconstructing the entire KiCad, like, plugins directory every build. 204 00:24:29,120 --> 00:24:33,780 Which, I mean, it's useful if you want to get the same output every time because it was very reliable. 205 00:24:33,780 --> 00:24:48,800 I think I had, like, probably, like, 15 different uploads to JLCPCB that were all, like, slightly different because they have... So, JLCPCB has a great, like, Gerber file viewer, and I wanted to make sure that, like, when I uploaded it, it was kind of what I expected. 206 00:24:48,800 --> 00:24:53,800 So, I'd do something and then, like, I'd make a little change and then I'd just upload the same zip. 207 00:24:53,800 --> 00:24:56,160 But getting it there, it was just a lot of scripting. 208 00:24:56,200 --> 00:24:59,640 But that actually gave me a pretty good iteration process with JLC. 209 00:24:59,640 --> 00:25:07,300 Because, I mean, I knew it was going to produce the correct thing every time and that it was going to change in just the way I intended. 210 00:25:07,300 --> 00:25:10,960 So, it actually gave me pretty fine-grained control of that process. 211 00:25:11,140 --> 00:25:15,720 JLC still had trouble with the orientation of some of the components. 212 00:25:16,000 --> 00:25:22,280 So, I think that's kind of a classic one, like, the diode was, like, flipped around or something despite the footprint being correct. 213 00:25:22,280 --> 00:25:26,860 And there's always a couple things with JLC that you have to mess with manually. 214 00:25:27,040 --> 00:25:30,420 But, I mean, at least Nix made some of the stuff work pretty well. 215 00:25:31,480 --> 00:25:32,840 Any more questions? 216 00:25:34,740 --> 00:25:37,960 And to the question of will you guys get a badge, we've got a bunch. 217 00:25:37,960 --> 00:25:38,960 So, probably. 218 00:25:43,600 --> 00:25:45,360 That's more of a Tristan question. 219 00:25:45,860 --> 00:25:47,680 What parts did we use Zik for? 220 00:25:53,800 --> 00:25:54,980 So, GPIO. 221 00:25:54,980 --> 00:25:55,660 Yeah, that's right. 222 00:25:55,660 --> 00:26:01,820 So, we used it to do some GPIO initialization and also we're still using the ASN1 stuff. 223 00:26:02,240 --> 00:26:11,160 So, yeah, the mesh communication... Zik has a great ASN1 library and it's a memory-safe ASN1 parser, which is super cool. 224 00:26:11,160 --> 00:26:15,720 So, we were playing with it on the mesh communication side of things. 225 00:26:15,780 --> 00:26:22,420 Of course, ESP-IDF still has a bunch of that framework that's written in C. 226 00:26:22,420 --> 00:26:29,040 I'm aware that there's a safe Rust version that's, like, a community-supported version of the ESP. 227 00:26:29,040 --> 00:26:34,300 It's, like, a kind of a Rust version of the ESP-IDF that's more, like, community-driven, basically. 228 00:26:34,300 --> 00:26:36,480 Although it doesn't support all the things, like, Wi-Fi. 229 00:26:36,480 --> 00:26:49,600 It still has to probably use unsafe to connect to some of that stuff, especially considering that the Wi-Fi chipset on the ESP32 is, like, locked down and has vendor blobs everywhere, basically, and Expressive ships you, basically, .a files to link into your project. 230 00:26:50,500 --> 00:26:56,640 But, yeah, I mean, it was pretty easy to link ZIG with it. 231 00:26:56,640 --> 00:27:04,160 It was, like, just some CMake file modifications, pretty much, and integration with ESP's, like, existing build system. 232 00:27:04,160 --> 00:27:05,960 So, actually, that wasn't that bad. 233 00:27:06,380 --> 00:27:17,980 I think the main issues that we had with it were, like, calling convention issues, like, where we would accidentally use the wrong calling convention for something, and then we'd just corrupt some memory, and it would cause problems, like, down the line. 234 00:27:17,980 --> 00:27:28,100 But once we were, like, once we had, like, the translation layer between C and ZIG, like, working, it was pretty easy to write ZIG that would, you know, just work. 235 00:27:28,100 --> 00:27:31,840 Unless we, well, unless we exhausted the stack, then things would get corrupted as well. 236 00:27:32,220 --> 00:27:34,740 So, obviously, not perfect. 237 00:27:35,500 --> 00:27:36,780 Yeah, any other questions? 238 00:27:43,300 --> 00:27:44,560 Any what issues? 239 00:27:47,320 --> 00:27:49,240 Feature size, like, what? 240 00:27:59,530 --> 00:28:00,750 Oh, I see. 241 00:28:00,750 --> 00:28:01,210 Okay. 242 00:28:01,210 --> 00:28:04,750 So, I copied the design rule. 243 00:28:05,390 --> 00:28:17,210 Basically, all the design rules, they're pretty well documented for JLCPCB, and someone actually implemented a KiCad rule set that basically automatically does the design rule checks for you. 244 00:28:17,290 --> 00:28:21,370 Those were, like, a little bit hard to dig up, but once I found them, it was all fine. 245 00:28:21,410 --> 00:28:26,450 And JLCPCB is also pretty good at running, like, design rule checks for you after the fact, too. 246 00:28:26,450 --> 00:28:34,190 So, like, you have a couple layers of, I guess, like, safety with the design rules on JLCPCB. 247 00:28:34,190 --> 00:28:39,650 So, I didn't really have any feature size issues because KiCad caught them first. 248 00:28:39,650 --> 00:28:44,970 It was mostly just, like, mistakes that I made, like, the 3.3 volt and ground swap on the SD card. 249 00:28:44,970 --> 00:28:53,090 What we really wanted to do with that is we really wanted to actually cache packages to the SD card, but, I mean, that'll just be in a future hardware revision of the badge, so. 250 00:28:54,090 --> 00:29:01,890 Or if people are enterprising enough to, you know, exacto things and bodge wire it, that also works, too. 251 00:29:01,890 --> 00:29:03,710 The hardware hacking village is down the corner. 252 00:29:03,970 --> 00:29:09,630 I was, like, 95% sure I'd have to say that because I'd make some mistake that would warrant it, and here we are, so. 253 00:29:10,410 --> 00:29:11,090 But, yeah. 254 00:29:11,850 --> 00:29:12,910 Any other questions? 255 00:29:20,750 --> 00:29:21,890 Oh, yeah. 256 00:29:22,530 --> 00:29:41,170 So, also, when you're getting PCBs fabbed with JLCPCB, and they have a lot of polygons in the copper layer, or solder, probably most of the copper layer, JLCPCB will kind of choke when you upload them and act like it's not going to render any of the, you know, 257 00:29:41,170 --> 00:29:42,750 any of the art that you added. 258 00:29:42,830 --> 00:29:48,110 But in, like, a half hour, the preview will magically appear and they'll be able to fab the boards. 259 00:29:48,110 --> 00:29:50,150 So, none of this was documented. 260 00:29:50,170 --> 00:29:55,130 It was just all stuff that we figured out just through trial and error. 261 00:29:56,430 --> 00:30:03,190 And, obviously, I mean, you know, you can reproduce this build, but sometimes you can't reproduce JLCPCB errors, so. 262 00:30:04,170 --> 00:30:05,510 All right, anything else? 263 00:30:06,670 --> 00:30:07,690 All right. 264 00:30:08,770 --> 00:30:10,430 Well, that's all I got. 265 00:30:11,230 --> 00:30:13,530 It's, that's our last talk for the day. 266 00:30:13,530 --> 00:30:15,390 We're going to go into the unconference. 267 00:30:15,390 --> 00:30:19,950 So, the unconference is an idea that we borrowed from Scale, actually. 268 00:30:19,950 --> 00:30:28,130 It is just the mess around with hardware in front of you, talk to people, chill out, maybe do some lightning talks, too. 269 00:30:28,410 --> 00:30:34,030 So, if you want to do lightning talks, come to me or Tristan and let us know. 270 00:30:34,430 --> 00:30:37,550 And, Firefox is messed up. 271 00:30:38,270 --> 00:30:40,770 And, yeah, we can get you slotted in. 272 00:30:41,350 --> 00:30:45,450 Lightning talks are, like, five to ten minutes, basically, if you want to go over. 273 00:30:46,190 --> 00:30:48,790 I mean, I'm not going to complain, so. 274 00:30:49,250 --> 00:30:50,490 But, yeah, thank you, guys. 275 00:30:58,400 --> 00:31:02,340 So, the badge actually generically acts as a router. 276 00:31:02,620 --> 00:31:04,760 So, I'm actually connected to it right now. 277 00:31:04,760 --> 00:31:08,040 We pushed some firmware that fixes some stuff. 278 00:31:08,120 --> 00:31:11,940 Also includes the default credentials for the Nix Vegas Wi-Fi network. 279 00:31:12,340 --> 00:31:14,380 So, I was able to actually get push over the badge. 280 00:31:14,380 --> 00:31:16,140 But, let's substitute over the badge. 281 00:31:16,140 --> 00:31:16,880 How does that work? 282 00:31:16,880 --> 00:31:18,980 Well, it's in the readme. 283 00:31:20,780 --> 00:31:37,820 So, if you connect to the badge, so, these badges, if you hold the reset button at the boot, or rather, not the reset button, the button at boot, and hit the reset button, they come up as this Nix badge and then, effectively, the last few digits of the MAC address. 284 00:31:38,100 --> 00:31:41,000 And so, you connect to that, gives you an IP address over DHCP. 285 00:31:42,500 --> 00:31:46,060 So, you can generically, like, ping over this. 286 00:31:46,260 --> 00:31:47,460 It's kind of slow. 287 00:31:47,780 --> 00:31:53,740 But if you want to use it as a substitutor, let's pick... I already have hello. 288 00:31:53,840 --> 00:31:54,820 Give me a package . 289 00:31:54,820 --> 00:31:56,480 Something that's small, ideally. 290 00:31:57,320 --> 00:31:57,880 Links? 291 00:31:57,880 --> 00:31:59,200 All right, let's go links. 292 00:32:01,600 --> 00:32:04,720 So , you pick port 1008 on the badge. 293 00:32:04,980 --> 00:32:14,620 It's a TCP port that we're kind of trying to think of as, this is, like, kind of a link local Nix cache port, basically. 294 00:32:14,680 --> 00:32:19,940 It's actually a free port in the IANA registry, which is interesting, because it's less than 1024. 295 00:32:19,940 --> 00:32:23,420 It was previously only used by Solaris, actually, for UDP. 296 00:32:23,420 --> 00:32:25,140 So, there's nothing registered to this port. 297 00:32:25,140 --> 00:32:27,820 So, it could be one that Nix uses if you registered it. 298 00:32:28,060 --> 00:32:31,500 But it will then go and download. 299 00:32:32,080 --> 00:32:33,500 And if you have the... 300 00:32:33,500 --> 00:32:44,500 If you have the ESP console open, you'll see that it's basically chunking the response from cache.nixos.lv, because it's connected to our network. 301 00:32:44,500 --> 00:32:46,640 So, it's actually substituting over this network. 302 00:32:47,320 --> 00:32:49,380 And it will take a while. 303 00:32:51,200 --> 00:32:52,780 It's not fast. 304 00:32:53,060 --> 00:33:00,460 The ESP IDF HTTP server is... I don't think we're using it right, first of all. 305 00:33:00,460 --> 00:33:04,080 And second of all... Oh, there... Well, actually, that didn't work earlier. 306 00:33:04,080 --> 00:33:04,240 All right. 307 00:33:04,240 --> 00:33:05,860 Let's try Cowsay. 308 00:33:09,880 --> 00:33:12,260 Let's see what Cowsay's dependencies are. 309 00:33:26,510 --> 00:33:28,090 Is the badge even still up? 310 00:33:28,330 --> 00:33:29,390 Yeah, it's still up. 311 00:33:32,390 --> 00:33:33,590 Oh, there we go. 312 00:33:36,920 --> 00:33:37,680 Oh, there we go. 313 00:33:37,680 --> 00:33:38,600 We got Cowsay. 314 00:33:48,270 --> 00:33:50,190 And we got Cowsay over the badge. 315 00:33:50,310 --> 00:33:53,710 Now, there's not an SD card, so it doesn't actually cache anything. 316 00:33:54,570 --> 00:33:56,650 But you can do that if you want. 317 00:33:56,650 --> 00:33:57,630 It's a nice party trick. 318 00:33:58,670 --> 00:33:59,770 And yeah, that's it. 319 00:33:59,770 --> 00:34:01,670 That's all documented in the README, by the way. 320 00:34:02,270 --> 00:34:04,190 So, this comes up as... 321 00:34:05,130 --> 00:34:05,950 Yeah, here we go. 322 00:34:05,950 --> 00:34:07,170 So, you just hold the button, we'll boot it. 323 00:34:07,170 --> 00:34:09,850 And yeah, you connect to the Wi-Fi network, basically. 324 00:34:10,250 --> 00:34:13,250 And just set the last octet to one. 325 00:34:14,110 --> 00:34:15,550 It can be a router, too. 326 00:34:15,550 --> 00:34:18,090 The password, by the way, it's all 1234578. 327 00:34:18,090 --> 00:34:23,570 Apparently, in the default ESP mesh configuration, you can't, like, change this for some reason. 328 00:34:23,830 --> 00:34:26,790 But it's there in case you want to mess with it. 329 00:34:27,390 --> 00:34:28,090 And that's it. 330 00:34:28,090 --> 00:34:29,190 Which button? 331 00:34:29,430 --> 00:34:34,450 So, the button is the one that's actually labeled button in the top right of the badge. 332 00:34:34,470 --> 00:34:36,990 So, it is the button. 333 00:34:38,350 --> 00:34:40,750 But yeah, have fun.