1 00:00:00,001 --> 00:00:06,920 Welcome to The Bootloader. I'm Paul Cutler. 2 00:00:06,920 --> 00:00:10,760 And I'm Tod Kurt. We have a special episode for you today with an interview with Justin 3 00:00:10,760 --> 00:00:14,920 Myers, the author of the CircuitPython Library Connection Manager. Before we get to that, 4 00:00:14,920 --> 00:00:18,240 though, Paul and I each have a couple of things to share with you, each not more than a few 5 00:00:18,240 --> 00:00:20,860 minutes long. What's your first one, Paul? 6 00:00:20,860 --> 00:00:25,700 My first one is how to level up at CircuitPython. Professor John Gallaugher of Boston College 7 00:00:25,700 --> 00:00:29,720 recently released two videos I wanted to share, one for how to migrate from using Mu and 8 00:00:29,720 --> 00:00:34,620 CircuitPython to using PyCharm with Teal and a video on using Circup to install and update 9 00:00:34,620 --> 00:00:38,820 CircuitPython libraries. If you're not familiar with Professor Gallaugher, I talked to him 10 00:00:38,820 --> 00:00:43,540 way back in episode 3 of the CircuitPython Show, which I'll link to in the show notes. 11 00:00:43,540 --> 00:00:47,300 He teaches a class called Introduction to Physical Computing, which uses CircuitPython 12 00:00:47,300 --> 00:00:52,300 along with microcontrollers to teach students computing concepts. He has other YouTube playlists 13 00:00:52,300 --> 00:00:55,940 worth checking out on his YouTube channel, especially if you're newer to CircuitPython. 14 00:00:55,940 --> 00:00:57,860 I'll link to those as well. 15 00:00:57,860 --> 00:01:02,100 But back to his new videos. The first one is how to correctly set up PyCharm on MacOS 16 00:01:02,100 --> 00:01:06,440 to use with CircuitPython. Most of this is applicable to Linux, too, and I learned a 17 00:01:06,440 --> 00:01:10,600 few new things. It's a longer video at about half an hour, but the professor walks you 18 00:01:10,600 --> 00:01:14,500 through how to correctly configure PyCharm, and he's using the free community edition 19 00:01:14,500 --> 00:01:19,380 in the video. Next, he covers using the new and updated CircuitPython setboard so you 20 00:01:19,380 --> 00:01:24,340 have code completion for your microcontroller in PyCharm. That might be brand new to a lot 21 00:01:24,340 --> 00:01:28,560 of people and is definitely worth watching. From there, he covers using Teal, an open 22 00:01:28,560 --> 00:01:33,380 source serial program that is way better than using Screen. It's got auto-reconnect as 23 00:01:33,380 --> 00:01:37,540 its killer feature, and I think it's pretty cool that he included Teal as the serial monitor 24 00:01:37,540 --> 00:01:40,120 in Mu is one of its key features. 25 00:01:40,120 --> 00:01:44,700 Next up is a 15-minute video on using CircUp to install CircuitPython libraries. If you've 26 00:01:44,700 --> 00:01:49,620 used CircuitPython, chances are you've downloaded the Adafruit library or the community library 27 00:01:49,620 --> 00:01:53,900 bundle, and then you have to find the right library out of hundreds. But what if you could 28 00:01:53,900 --> 00:01:57,500 easily use the command line? He walks you through how to use CircUp from the command 29 00:01:57,500 --> 00:02:03,020 line, and then for Mac OS users or for Linux users using the ZSH shell, he shows you how 30 00:02:03,020 --> 00:02:07,740 to add tab completion by updating your ZSH configuration file. 31 00:02:07,740 --> 00:02:11,660 CircUp has also been getting some love over the last few months. Shout out to Tim, aka 32 00:02:11,660 --> 00:02:15,400 Foamy Guy in the Adafruit community. He's been doing some refactoring and adding new 33 00:02:15,400 --> 00:02:19,300 features as well. I know I learned a few things, and if you use CircuitPython and you're looking 34 00:02:19,300 --> 00:02:23,020 to level up your CircuitPython workflow, I highly recommend checking out these videos 35 00:02:23,020 --> 00:02:24,020 from Professor Gallaugher. 36 00:02:24,020 --> 00:02:29,580 I love CircUp. It's sort of like, if you've never heard of it, it's sort of like Pip, 37 00:02:29,580 --> 00:02:34,380 the Python package manager, but for CircuitPython. And it hooks into the two big package repositories 38 00:02:34,380 --> 00:02:38,660 that exist for CircuitPython, the Adafruit one and the community one. It's so good, but 39 00:02:38,660 --> 00:02:42,740 it's a little bit hard to set up if you've never done any sort of Python setup before. 40 00:02:42,740 --> 00:02:46,460 So this video is like super handy because I get people asking me all the time, "How 41 00:02:46,460 --> 00:02:48,100 do you install a CircuitPython library?" 42 00:02:48,100 --> 00:02:49,100 Right. 43 00:02:49,100 --> 00:02:53,300 And I'm like, "The answer is just use CircUp." But then the question becomes, "Well, how 44 00:02:53,300 --> 00:02:55,780 do you install CircUp?" 45 00:02:55,780 --> 00:02:59,460 And I think it's really cool that he actually walks you through on how to update your ZSH 46 00:02:59,460 --> 00:03:06,100 shell for the tab autocompletes, because there's hundreds of libraries, and it makes it just 47 00:03:06,100 --> 00:03:08,660 that much easier to find the library you're looking for. 48 00:03:08,660 --> 00:03:13,500 I really want to follow his steps on how to set up that PyCharm IDE, because I don't really 49 00:03:13,500 --> 00:03:17,980 use IDEs in the normal sense. I just use a text editor with code syntax highlighting. 50 00:03:17,980 --> 00:03:21,340 But there's so many people that have been trying to use the VS Code CircuitPython extension, 51 00:03:21,340 --> 00:03:24,620 and it's been sort of perennially broken. 52 00:03:24,620 --> 00:03:31,140 The people are so frustrated using it. And it looks like PyCharm is really well done. 53 00:03:31,140 --> 00:03:34,860 And there's this nice now intro video on how to actually meld it with CircuitPython, which 54 00:03:34,860 --> 00:03:40,460 is a little weird because most of the times when you're editing Python with an IDE, you're 55 00:03:40,460 --> 00:03:44,140 editing the files sort of in a project, say. 56 00:03:44,140 --> 00:03:48,060 And CircuitPython is a little bit different in that the code lives on a device, and you 57 00:03:48,060 --> 00:03:49,060 edit the device. 58 00:03:49,060 --> 00:03:53,500 And so maybe your actual project is in a GitHub repo that lives on your computer somewhere. 59 00:03:53,500 --> 00:03:57,180 So how do you deal with those two separate views of your code? 60 00:03:57,180 --> 00:03:59,140 And I think PyCharm can help you with that. 61 00:03:59,140 --> 00:04:03,260 It can, but you're still writing directly to the microcontroller in the way that it's 62 00:04:03,260 --> 00:04:05,100 set up in this example. 63 00:04:05,100 --> 00:04:08,940 Because I know I use PyCharm, and I did learn a couple of things, but there's still a lot 64 00:04:08,940 --> 00:04:09,940 of copy-paste. 65 00:04:09,940 --> 00:04:10,940 Yeah, yeah. 66 00:04:10,940 --> 00:04:15,140 Because I commit everything to my GitHub repo, so I'm writing locally, saving it there, and 67 00:04:15,140 --> 00:04:19,500 then copying it over to the drive as soon as I hit save, running the code. 68 00:04:19,500 --> 00:04:22,140 Yeah, that's usually how I work as well. 69 00:04:22,140 --> 00:04:25,580 But I see all these people that try to use Mu, because it's easy to use, but Mu's getting 70 00:04:25,580 --> 00:04:26,580 kind of crusty. 71 00:04:26,580 --> 00:04:32,900 And Thonny, I don't know, Thonny just always seems like it breaks my CircuitPython install 72 00:04:32,900 --> 00:04:34,580 whenever I try to use it. 73 00:04:34,580 --> 00:04:35,580 Sure. 74 00:04:35,580 --> 00:04:38,020 Yeah, it's too bad that Mu's getting a little long in the tooth. 75 00:04:38,020 --> 00:04:42,740 It's an open source project, it needs a little love, but it's nice to see other alternatives 76 00:04:42,740 --> 00:04:44,180 out there that are well documented. 77 00:04:44,180 --> 00:04:45,180 Yeah, no doubt. 78 00:04:45,180 --> 00:04:49,940 Yeah, I mean, the cool thing is that because it's all just a text file, you can use anything 79 00:04:49,940 --> 00:04:53,900 that can edit text files to edit your CircuitPython code. 80 00:04:53,900 --> 00:04:57,460 But it'd be nice to have a really good IDE for those people who need IDEs. 81 00:04:57,460 --> 00:04:58,460 What's your first one? 82 00:04:58,460 --> 00:05:04,460 All right, so kind of related, Professor Gallaugher also does a lot of how to program iOS apps 83 00:05:04,460 --> 00:05:06,100 for Apple devices. 84 00:05:06,100 --> 00:05:08,100 And so those are written in Swift. 85 00:05:08,100 --> 00:05:11,500 Swift is a programming language that Apple has been developing for the last 10 years. 86 00:05:11,500 --> 00:05:13,140 They use it on all their platforms. 87 00:05:13,140 --> 00:05:17,500 It's the officially recommended way for writing apps for iPhones, iPads, Apple Watch, things 88 00:05:17,500 --> 00:05:18,500 like that. 89 00:05:18,500 --> 00:05:19,920 And Swift is a really interesting language. 90 00:05:19,920 --> 00:05:26,140 It's heavily influenced by Haskell and Rust, these sort of academic languages that emphasize 91 00:05:26,140 --> 00:05:31,300 type safety and functional programming, where the compiler itself can catch a lot of bugs 92 00:05:31,300 --> 00:05:35,780 as it compiles your code down, which is kind of foreign to how Python and JavaScript work, 93 00:05:35,780 --> 00:05:40,900 where you just kind of run your code and see if it crashes or not. 94 00:05:40,900 --> 00:05:44,940 And so there's this whole academic effort in computer science that we should be able 95 00:05:44,940 --> 00:05:50,540 to make provably correct programs, or programs that we can prove will not crash for certain 96 00:05:50,540 --> 00:05:51,540 classes of crashes. 97 00:05:51,540 --> 00:05:53,940 That's what Haskell and Rust kind of comes from. 98 00:05:53,940 --> 00:05:56,660 That's where Swift came from as well. 99 00:05:56,660 --> 00:05:57,740 And it's a really interesting language. 100 00:05:57,740 --> 00:06:02,500 It looks a little bit like C, but with all these sort of extra neat things on top of 101 00:06:02,500 --> 00:06:03,500 it. 102 00:06:03,500 --> 00:06:07,740 If you look at Chris Lattner, who developed LLVM and the Clang compiler, which you've 103 00:06:07,740 --> 00:06:12,660 probably seen in various places when you've installed things, it's been the sort of revolution 104 00:06:12,660 --> 00:06:15,860 how to compile C-based or C-like languages. 105 00:06:15,860 --> 00:06:19,820 And so you'll see, I think you'll see LLVM and Clang a lot more going forward. 106 00:06:19,820 --> 00:06:25,420 But Swift uses those two things underneath to do its magic as well. 107 00:06:25,420 --> 00:06:29,100 And the reason why I'm bringing all this up is because Apple just released something they 108 00:06:29,100 --> 00:06:34,100 call Embedded Swift, which is a version of Swift that runs on microcontrollers, which 109 00:06:34,100 --> 00:06:35,420 is amazing. 110 00:06:35,420 --> 00:06:42,060 This is a super high-level language, in many ways higher level than Python or JavaScript. 111 00:06:42,060 --> 00:06:47,540 And we can run it on a microcontroller on things that are even some ways smaller than 112 00:06:47,540 --> 00:06:50,060 what CircuitPython type controllers can do. 113 00:06:50,060 --> 00:06:54,380 And not only did they release here's Embedded Swift, but they also released working demos 114 00:06:54,380 --> 00:07:01,620 for the Raspberry Pi Pico, the ESP32C6, the InterF52-840, which is a Beely chip, and the 115 00:07:01,620 --> 00:07:02,700 STM32 chips. 116 00:07:02,700 --> 00:07:07,900 And they've also released a bunch of examples on how to participate in Matter, a Matter 117 00:07:07,900 --> 00:07:14,060 network, which is the new standard for home automation that Apple's HomeKit API does. 118 00:07:14,060 --> 00:07:18,580 And I think Google's Echo platform also does now. 119 00:07:18,580 --> 00:07:25,100 And so there's a, and it's all on GitHub, you can just go to their Swift Matter examples, 120 00:07:25,100 --> 00:07:29,100 see the smart light example that you can run and control. 121 00:07:29,100 --> 00:07:33,140 You can make a controllable smart light with Siri and about 60 lines of Swift code. 122 00:07:33,140 --> 00:07:38,340 And it's all, it has a lot of the same features of real Swift of the type safety, the functional 123 00:07:38,340 --> 00:07:40,380 programming, that kind of stuff. 124 00:07:40,380 --> 00:07:44,480 And it's just sort of amazing that we're getting this super high-level language running on 125 00:07:44,480 --> 00:07:45,740 tiny chips. 126 00:07:45,740 --> 00:07:49,060 And I've not looked at it too much yet, but in the show notes, there'll be some links 127 00:07:49,060 --> 00:07:53,700 to some other articles describing it and links to the GitHub that has some examples. 128 00:07:53,700 --> 00:07:58,220 So you can actually try some of this stuff out on your Pico or ESP32. 129 00:07:58,220 --> 00:08:02,860 I only know Python, and this has me really intrigued, especially the Matter integration, 130 00:08:02,860 --> 00:08:03,860 right? 131 00:08:03,860 --> 00:08:05,060 We don't have that in CircuitPython yet. 132 00:08:05,060 --> 00:08:08,380 I don't think Arduino has Matter integration that I've seen. 133 00:08:08,380 --> 00:08:13,980 So actually being able to write my own smart home apps on microcontrollers would be a really 134 00:08:13,980 --> 00:08:18,180 cool use case and actually has me thinking of learning a second language. 135 00:08:18,180 --> 00:08:25,180 Yeah, it's like, supposedly there's Matter APIs in the latest ESP IDF, the SDK that you 136 00:08:25,180 --> 00:08:28,660 use when you're writing C code for the ESP32 chips. 137 00:08:28,660 --> 00:08:33,420 And I think that's what these Swift Matter examples are using under the hood. 138 00:08:33,420 --> 00:08:37,940 But do you really want to be mucking around with C code when you could use a high-level 139 00:08:37,940 --> 00:08:38,940 language like Swift? 140 00:08:38,940 --> 00:08:39,940 Yeah. 141 00:08:39,940 --> 00:08:44,980 And so, you know, it'd be nice if we get Matter support in CircuitPython someday. 142 00:08:44,980 --> 00:08:45,980 There's no reason why we can't. 143 00:08:45,980 --> 00:08:50,780 And I think Jeffler might actually be working on that really, really early stages. 144 00:08:50,780 --> 00:08:51,780 Nice. 145 00:08:51,780 --> 00:08:52,780 Yeah, yeah. 146 00:08:52,780 --> 00:08:53,780 I would love to see that. 147 00:08:53,780 --> 00:08:55,180 All right, Paul, what's your number two? 148 00:08:55,180 --> 00:08:58,400 My number two is accessibility matters. 149 00:08:58,400 --> 00:09:01,980 When I first started contributing to open source about 20 years ago, one of the first 150 00:09:01,980 --> 00:09:06,740 projects I contributed to was the GNOME project, the Linux desktop environment. 151 00:09:06,740 --> 00:09:10,140 One of the core pieces of GNOME's culture is accessibility, which includes everything 152 00:09:10,140 --> 00:09:14,340 from the Orca screen reader to how we wrote documentation back then. 153 00:09:14,340 --> 00:09:18,420 You know, the worst disability that I have personally is being extremely colorblind, 154 00:09:18,420 --> 00:09:22,820 but that focus on accessibility has always stuck with me, which is why I'm excited to 155 00:09:22,820 --> 00:09:24,740 see a project like this. 156 00:09:24,740 --> 00:09:29,020 The first is the AccessBit from Dr. John Vidler in the UK. 157 00:09:29,020 --> 00:09:33,280 The Micro:bit Educational Foundation commissioned a report on accessibility, which included 158 00:09:33,280 --> 00:09:37,700 a speculative section on how to improve the Micro:bit platform for those with limited or 159 00:09:37,700 --> 00:09:38,700 different mobility. 160 00:09:38,700 --> 00:09:42,580 If you're not familiar with the Micro:bit, it's a microcontroller primarily made for 161 00:09:42,580 --> 00:09:48,580 education, popular in the UK and Australia, that features two buttons, a 5x5 LED grid, 162 00:09:48,580 --> 00:09:50,020 and connections for alligator clips. 163 00:09:50,020 --> 00:09:53,660 It can run MicroPython, CircuitPython, and MakeCode. 164 00:09:53,660 --> 00:09:58,900 The report included a few sketches and possible solutions for potential 3.5 millimeter audio 165 00:09:58,900 --> 00:10:03,260 jacks, which are the industry de facto standard for accessibility, like what are found on 166 00:10:03,260 --> 00:10:06,020 Microsoft's Xbox Adaptive Controller. 167 00:10:06,020 --> 00:10:12,580 Dr. Vidler decided to design a PCB as a minimum viable product to add five adaptive switches. 168 00:10:12,580 --> 00:10:16,780 He walks through various iterations of his design, landing on a final design that includes 169 00:10:16,780 --> 00:10:22,380 an edge connector to connect to the Micro:bit and room for five 3.5 millimeter jacks. 170 00:10:22,380 --> 00:10:26,020 It's pretty cool the thought that he put into the design, from how the add-on board connects 171 00:10:26,020 --> 00:10:30,220 using the 40 pin Micro:bit controller to the curved design of the board. 172 00:10:30,220 --> 00:10:33,920 He had JLCPCB make a handful of boards and sent them off, and they were shown at the 173 00:10:33,920 --> 00:10:36,940 Blockly Summit in Cambridge earlier in June. 174 00:10:36,940 --> 00:10:40,260 Check out the show notes to the link to his blog post detailing the process, including 175 00:10:40,260 --> 00:10:41,260 photos. 176 00:10:41,260 --> 00:10:45,940 The second product is a new Adafruit product, the TRRS Trinkey. 177 00:10:45,940 --> 00:10:50,460 Adafruit's Trinkey line includes a USB-A port to plug it into a host computer, and a small 178 00:10:50,460 --> 00:10:53,940 board maybe the size of a flash drive, so it's pretty small. 179 00:10:53,940 --> 00:11:00,100 The TRRS Trinkey has a SAMD21 chip, has one 3.5 millimeter jack, and can run CircuitPython 180 00:11:00,100 --> 00:11:01,740 or Arduino. 181 00:11:01,740 --> 00:11:07,060 I think it's great that those who might need it have more options for accessibility, especially 182 00:11:07,060 --> 00:11:10,340 using microcontrollers, which they can program to their needs. 183 00:11:10,340 --> 00:11:14,080 I'm excited to see what people can think up using tech like this, especially if it makes 184 00:11:14,080 --> 00:11:15,420 their lives easier. 185 00:11:15,420 --> 00:11:22,340 These are a great sort of combo, because the Adafruit TRRS Trinkey is purely just a USB device. 186 00:11:22,340 --> 00:11:27,580 It looks like a little USB thumb drive almost, it just has a 3.5 millimeter jack on the back. 187 00:11:27,580 --> 00:11:30,340 But the Micro:bit, it has Bluetooth. 188 00:11:30,340 --> 00:11:32,820 It has USB as well, but it has Bluetooth. 189 00:11:32,820 --> 00:11:38,140 And so you can now make a Bluetooth accessible controller with this little add-on board by 190 00:11:38,140 --> 00:11:43,100 just snicking the Micro:bit into it, and then plugging in some of these accessibility controllers 191 00:11:43,100 --> 00:11:47,500 into that, and then pairing it with your phone with a little bit of code, with make code 192 00:11:47,500 --> 00:11:48,500 or something. 193 00:11:48,500 --> 00:11:49,500 That's incredible. 194 00:11:49,500 --> 00:11:52,980 I think there'll be a lot of fun things being created with this. 195 00:11:52,980 --> 00:11:53,980 I agree. 196 00:11:53,980 --> 00:11:54,980 What's your next one? 197 00:11:54,980 --> 00:11:57,180 So my next one is about CAD query. 198 00:11:57,180 --> 00:12:01,340 So I've been on a journey to move to open source tools for my engineering work. 199 00:12:01,340 --> 00:12:08,900 I've mentioned before I've gone from using Eagle to KiCAD. 200 00:12:08,900 --> 00:12:13,480 I use Fusion 360 for my 3D CAD modeling, and it's pretty good, but I'm always irritated 201 00:12:13,480 --> 00:12:18,020 after using it for a lot of different reasons. 202 00:12:18,020 --> 00:12:19,980 What are the open source alternatives? 203 00:12:19,980 --> 00:12:24,820 If you're going for a gooey 3D experience, there's things like Blender, but I like parametric 204 00:12:24,820 --> 00:12:25,820 modeling. 205 00:12:25,820 --> 00:12:29,620 One of the nice things that Fusion 360 does is you can make everything parametric, where 206 00:12:29,620 --> 00:12:36,060 you just define a set of constraints, and then you create solid bodies from those constraints. 207 00:12:36,060 --> 00:12:37,380 Blender's not really that. 208 00:12:37,380 --> 00:12:40,100 Blender's more of like an artist's tool. 209 00:12:40,100 --> 00:12:42,020 It can do a little bit of it. 210 00:12:42,020 --> 00:12:46,940 So for the longest time, there's been this thing called OpenSCAD, which is a textual 211 00:12:46,940 --> 00:12:49,540 3D parametric modeler. 212 00:12:49,540 --> 00:12:52,260 And it's a gooey app where you've got two panes. 213 00:12:52,260 --> 00:12:58,460 One pane is the text of the OpenSCAD language you write to create cubes and pyramids and 214 00:12:58,460 --> 00:13:04,620 cones and ways to combine them in different ways to make your 3D object. 215 00:13:04,620 --> 00:13:07,540 And then on the right is a render of what that thing looks like. 216 00:13:07,540 --> 00:13:13,460 And so from that, you can, and people have done this to great effect, make enclosures 217 00:13:13,460 --> 00:13:16,260 and other 3D things that can be 3D printed. 218 00:13:16,260 --> 00:13:22,460 Like I think all of the Prusa components in the Prusa 3D printers are all actual SCAD 219 00:13:22,460 --> 00:13:26,500 models that somebody has designed as text files. 220 00:13:26,500 --> 00:13:30,740 And so if you need to make the screw holes a little bigger because you're building it 221 00:13:30,740 --> 00:13:35,300 by hand and you're 3D printing the pieces and you only have M5 screws instead of M3 222 00:13:35,300 --> 00:13:39,100 screws, you can maybe just go into the OpenSCAD file and change one little parameter and change 223 00:13:39,100 --> 00:13:41,060 all the screw hole sizes. 224 00:13:41,060 --> 00:13:45,780 But I've always bristled at OpenSCAD because it's got its own special language. 225 00:13:45,780 --> 00:13:47,540 And I've been looking at other things. 226 00:13:47,540 --> 00:13:51,580 And I just discovered recently this thing that's been around for a long time called 227 00:13:51,580 --> 00:13:55,260 CAD Query, which is like OpenSCAD, but it's all in Python. 228 00:13:55,260 --> 00:14:01,740 It uses standard Python syntax, and it is mostly a library that you can then express 229 00:14:01,740 --> 00:14:03,340 via various ways. 230 00:14:03,340 --> 00:14:10,020 You can just run a main.py and have that output a file, but you can also run this thing called 231 00:14:10,020 --> 00:14:13,700 CQ Editor, which is a GUI editor, kind of like the OpenSCAD editor where you have multiple 232 00:14:13,700 --> 00:14:18,100 windows and you can edit text in one and see a render in the other window. 233 00:14:18,100 --> 00:14:22,540 And I've been using that and it's kind of working. 234 00:14:22,540 --> 00:14:25,540 I don't know, even though I've been using CircuitPython for so many years, I'm still 235 00:14:25,540 --> 00:14:26,740 not a very good Python person. 236 00:14:26,740 --> 00:14:29,020 So this is like kind of diving into more Python. 237 00:14:29,020 --> 00:14:34,420 The reason why I discovered this is Luke Wren, who is one of the ASIC designers, sorry, at 238 00:14:34,420 --> 00:14:35,620 Raspberry Pi. 239 00:14:35,620 --> 00:14:40,940 He's one who has helped us do some of the clever PIO things that we've done with the 240 00:14:40,940 --> 00:14:48,340 Raspberry Pi RP2040 chip, like the cool SynthIO and PWM and touch sensors and stuff is all 241 00:14:48,340 --> 00:14:56,180 kind of because, oh, and most especially the HDMI output from a little $4 microcontroller 242 00:14:56,180 --> 00:14:59,340 is because of some of his hints that he's given us. 243 00:14:59,340 --> 00:15:04,820 But he has a GitHub repo of a bunch of CAD query files. 244 00:15:04,820 --> 00:15:09,580 So if you want to see how CAD query things look, what the Python looks like, you can 245 00:15:09,580 --> 00:15:13,940 just go to his repository and go, oh, look, there's a little vacuum adapter and here's 246 00:15:13,940 --> 00:15:17,860 an air duct plate or whatever. 247 00:15:17,860 --> 00:15:21,180 So there's a nice little library of things for you to kind of browse through and see 248 00:15:21,180 --> 00:15:25,220 what CAD query feels like from a language point of view. 249 00:15:25,220 --> 00:15:31,500 But one of the best things about CAD query is that unlike OpenSCAD and unlike the similar 250 00:15:31,500 --> 00:15:37,900 OpenJS CAD, which is the same thing as OpenSCAD in some ways, but with JavaScript, CAD query 251 00:15:37,900 --> 00:15:45,060 outputs step files, which are object files, not STLs, which are like tessellated, triangulated 252 00:15:45,060 --> 00:15:46,460 shapes. 253 00:15:46,460 --> 00:15:50,900 And I was really frustrated that like OpenSCAD doesn't have a step export feature because 254 00:15:50,900 --> 00:15:56,460 if you have a step file, you can now import that into another CAD program like Fusion 255 00:15:56,460 --> 00:15:59,020 360 and then do additional edits on it. 256 00:15:59,020 --> 00:16:01,940 Whereas it's really hard to do edits on meshes. 257 00:16:01,940 --> 00:16:05,460 The STL format is made for just output, for 3D printing. 258 00:16:05,460 --> 00:16:10,340 It's like the bitmap version of your vector file. 259 00:16:10,340 --> 00:16:13,500 And so having a step is really important to me. 260 00:16:13,500 --> 00:16:17,140 And so, yeah, so I'm going to be playing with CAD query over the next whatever months or 261 00:16:17,140 --> 00:16:19,100 so and see if I do anything with it. 262 00:16:19,100 --> 00:16:21,240 I share your excitement for that. 263 00:16:21,240 --> 00:16:23,940 As I mentioned earlier, Python is the only language I know. 264 00:16:23,940 --> 00:16:27,060 So looking through some of those examples, it's started to click for me. 265 00:16:27,060 --> 00:16:30,500 I've tried to use OpenSCAD and never could figure it out. 266 00:16:30,500 --> 00:16:35,140 I can't use FreeCAD because they don't have a colorblind mode and Fusion 360, I've never 267 00:16:35,140 --> 00:16:36,260 really gotten the hang of. 268 00:16:36,260 --> 00:16:41,660 I've had some luck with Onshape, but actually having the ability to actually program it 269 00:16:41,660 --> 00:16:45,220 is and with the examples that they've got, looks really cool. 270 00:16:45,220 --> 00:16:46,460 Thanks, Tod. 271 00:16:46,460 --> 00:16:49,700 And now we have a special guest, Justin Myers. 272 00:16:49,700 --> 00:16:53,860 Back in episode seven for the CircuitPython 9 release show we did, I mentioned Connection 273 00:16:53,860 --> 00:16:56,180 Manager, but kind of guessed how it worked. 274 00:16:56,180 --> 00:17:00,020 Well, I reached out to the author of the new library, Justin Myers, and asked him about 275 00:17:00,020 --> 00:17:01,020 it. 276 00:17:01,020 --> 00:17:02,020 Here's the interview. 277 00:17:02,020 --> 00:17:03,020 Justin, welcome to the show. 278 00:17:03,020 --> 00:17:04,020 Thanks, Paul. 279 00:17:04,020 --> 00:17:05,020 I'm excited to be here. 280 00:17:05,020 --> 00:17:09,020 To be honest, it's my first time I've been on a podcast, so I'm really excited about 281 00:17:09,020 --> 00:17:10,020 it. 282 00:17:10,020 --> 00:17:11,020 It's great that you're here. 283 00:17:11,020 --> 00:17:15,020 What is the new CircuitPython library Connection Manager and what was your inspiration in creating 284 00:17:15,020 --> 00:17:16,020 it? 285 00:17:16,020 --> 00:17:23,540 Yeah, so basically late 2023, I had decided to spend some of my, let's call it extra time 286 00:17:23,540 --> 00:17:27,660 working on CircuitPython and trying to see how I could help project. 287 00:17:27,660 --> 00:17:30,220 I love the open source community. 288 00:17:30,220 --> 00:17:35,380 And as I was kind of watching the threads, I just saw kind of user after user on Discord 289 00:17:35,380 --> 00:17:40,940 having different connection issues, running out of sockets, different things like that, 290 00:17:40,940 --> 00:17:42,940 memories issues and everything. 291 00:17:42,940 --> 00:17:46,100 And I was like, "Hmm, seems strange. 292 00:17:46,100 --> 00:17:47,460 Should be a better way." 293 00:17:47,460 --> 00:17:51,300 And so as I kind of started digging in, saw like each library kind of managed sockets 294 00:17:51,300 --> 00:17:56,420 differently and really think about and look at the differences between like a microcontroller 295 00:17:56,420 --> 00:18:03,700 and CPython running on a PC is like on CPython, you can open sockets all day long, nothing 296 00:18:03,700 --> 00:18:04,860 really happens. 297 00:18:04,860 --> 00:18:08,240 But then once you get to a microcontroller, it's different. 298 00:18:08,240 --> 00:18:12,020 And kind of once I started digging into that, I was like, "Oh, well, you've got the native 299 00:18:12,020 --> 00:18:14,260 Wi-Fi that does it one way. 300 00:18:14,260 --> 00:18:18,460 You've got like the ESP32 SPI that does it one way. 301 00:18:18,460 --> 00:18:22,540 You've got the WISNET 5K that does it a different way." 302 00:18:22,540 --> 00:18:27,060 And just kind of all this boilerplate and different ways to get the SSL connection and 303 00:18:27,060 --> 00:18:28,060 different things. 304 00:18:28,060 --> 00:18:30,500 And I was like, "This is weird. 305 00:18:30,500 --> 00:18:32,220 Like there should be an easier way to do this." 306 00:18:32,220 --> 00:18:35,980 And so it's kind of what started me going down this road of trying to find out like, 307 00:18:35,980 --> 00:18:38,980 "Is there a better way to do this?" 308 00:18:38,980 --> 00:18:40,740 And what was the better way? 309 00:18:40,740 --> 00:18:46,820 So basically kind of the flow went, I asked the comment on the CircuitPython dev channel 310 00:18:46,820 --> 00:18:47,820 and Discord. 311 00:18:47,820 --> 00:18:50,940 I said, "Hey, I've got this idea." 312 00:18:50,940 --> 00:18:57,300 Basically the requests library had this built-in session manager that kind of managed a bunch 313 00:18:57,300 --> 00:18:58,300 of the sockets. 314 00:18:58,300 --> 00:19:02,860 But oftentimes what users would do is they would just re-init that thing and lose all 315 00:19:02,860 --> 00:19:03,860 the sockets. 316 00:19:03,860 --> 00:19:06,100 And so they were still technically open, just sitting there. 317 00:19:06,100 --> 00:19:10,220 And so kind of that first pass was I basically kind of separated some of that out to a separate 318 00:19:10,220 --> 00:19:15,420 class and kind of shared that with the devs. 319 00:19:15,420 --> 00:19:18,340 And they were like, "Nope, let's create a new library. 320 00:19:18,340 --> 00:19:20,500 Like that's not a good way to do it." 321 00:19:20,500 --> 00:19:23,460 Kind of break up dependencies and everything like that. 322 00:19:23,460 --> 00:19:28,820 And kind of from that, there's literally days spent kind of back and forth on like, "What 323 00:19:28,820 --> 00:19:30,900 should we name this?" 324 00:19:30,900 --> 00:19:35,980 And so ConnectionManager was kind of where that was born and basically just started separating 325 00:19:35,980 --> 00:19:41,820 a bunch of the stuff out of what was in the request library and put it into this new one. 326 00:19:41,820 --> 00:19:47,140 And then building handlers that would take in whatever radio object you passed in and 327 00:19:47,140 --> 00:19:51,500 try to determine, "Oh, what's the right SSL method for this one?" 328 00:19:51,500 --> 00:19:56,620 Reducing imports from five or six all the way down to just the one or two that were 329 00:19:56,620 --> 00:19:57,860 needed. 330 00:19:57,860 --> 00:19:59,180 And that's really the key, isn't it? 331 00:19:59,180 --> 00:20:04,140 If you have a PicoW, it was doing it different than an ESP32 S3. 332 00:20:04,140 --> 00:20:09,860 And now for the user, that setup instantiation is almost the same across the different microcontrollers. 333 00:20:09,860 --> 00:20:10,860 Is that right? 334 00:20:10,860 --> 00:20:11,860 Yeah. 335 00:20:11,860 --> 00:20:12,860 And that was kind of the goal, right? 336 00:20:12,860 --> 00:20:18,660 Because if you think through how CircuitPython started and once connection happened, so the 337 00:20:18,660 --> 00:20:25,740 ESP32 Spy was one of the first ones, developers wrote that library and then they kind of mimicked 338 00:20:25,740 --> 00:20:30,120 it a little bit for the Wiznet 5K. 339 00:20:30,120 --> 00:20:38,220 And then when the new ones came out, like ESP32 S2 and S3 and things, and they started 340 00:20:38,220 --> 00:20:42,380 having this onboard wifi, they changed how they did it again. 341 00:20:42,380 --> 00:20:46,740 And with anything that's open source, they're running forward as fast as they can. 342 00:20:46,740 --> 00:20:50,020 And sometimes it's hard to go backwards to go update everything. 343 00:20:50,020 --> 00:20:54,660 There were depreciation flags and comments, not flags in the code. 344 00:20:54,660 --> 00:20:58,940 And all of these places were like, "Oh, we should get rid of this at some point," but 345 00:20:58,940 --> 00:21:01,880 it was still there like years or months later. 346 00:21:01,880 --> 00:21:05,280 And so a lot of it was like trying to trim some of that down. 347 00:21:05,280 --> 00:21:08,820 What was it like to partner with the core developers on Connection Manager? 348 00:21:08,820 --> 00:21:10,300 I really enjoyed it. 349 00:21:10,300 --> 00:21:11,300 It was really interesting. 350 00:21:11,300 --> 00:21:13,220 It's been a really interesting progress for me. 351 00:21:13,220 --> 00:21:18,780 So a lot of my development started in C, 20 plus years ago when I started doing dev. 352 00:21:18,780 --> 00:21:22,260 And a lot of it was for smaller systems. 353 00:21:22,260 --> 00:21:28,080 And it was at a time where you had to do memory management and really think of your code for 354 00:21:28,080 --> 00:21:31,140 what's going to be the fastest and most efficient ways. 355 00:21:31,140 --> 00:21:36,860 And last 20 years, I've switched over to things like Python and things where... 356 00:21:36,860 --> 00:21:39,660 And JavaScript and everything, where a lot of that stuff's just handled for you and you 357 00:21:39,660 --> 00:21:40,920 forget about it. 358 00:21:40,920 --> 00:21:46,300 And so it's actually been really fun because they'll make comments on PRs and they're like, 359 00:21:46,300 --> 00:21:51,900 "Oh yeah, that's a wasteful way to do something," because there's not a lot of space. 360 00:21:51,900 --> 00:21:54,980 So it's really small and trying to think through it. 361 00:21:54,980 --> 00:21:56,140 But they've been great. 362 00:21:56,140 --> 00:21:59,840 There's been times where a handful of them, we've jumped on calls together to work through 363 00:21:59,840 --> 00:22:01,540 some things and figure it out. 364 00:22:01,540 --> 00:22:04,880 They've been great on the comments and asking questions and whatnot. 365 00:22:04,880 --> 00:22:09,920 And so I think the CircuitPython devs, it's a great team to work with. 366 00:22:09,920 --> 00:22:11,480 Well, that's great to hear. 367 00:22:11,480 --> 00:22:13,720 What's next for you and Connection Manager? 368 00:22:13,720 --> 00:22:18,940 Kind of where I've been going next, I've been opening a handful of PRs to make the radios 369 00:22:18,940 --> 00:22:20,640 again more similar. 370 00:22:20,640 --> 00:22:26,600 So for example, they all had different ways to find out what AP am I connected to? 371 00:22:26,600 --> 00:22:28,680 What's my Mac address? 372 00:22:28,680 --> 00:22:30,960 And different methods of returning everything. 373 00:22:30,960 --> 00:22:36,440 So I've been continuously working to try to get the different radios as close to the same 374 00:22:36,440 --> 00:22:37,880 as possible. 375 00:22:37,880 --> 00:22:40,640 And so really for an idea of... 376 00:22:40,640 --> 00:22:45,480 A typical user probably goes out and they buy a microcontroller that's got whatever 377 00:22:45,480 --> 00:22:49,440 Wi-Fi has on it, and they go run with that project and go. 378 00:22:49,440 --> 00:22:54,000 But oftentimes they see a lot of the questions are someone sees a learn guide and they're 379 00:22:54,000 --> 00:22:56,240 like, "Well, I don't have that stuff that's in the learn guide. 380 00:22:56,240 --> 00:22:57,240 I have this." 381 00:22:57,240 --> 00:23:01,520 But then they really struggle to try to figure out how to get it all to work because these 382 00:23:01,520 --> 00:23:03,740 different methods are different. 383 00:23:03,740 --> 00:23:07,960 So it's really been working to get all those core methods the same. 384 00:23:07,960 --> 00:23:14,720 So you can, for the most part, copy paste other than initializing the radio itself. 385 00:23:14,720 --> 00:23:21,600 And the work I'm doing currently now is I'm actually building out some network test code 386 00:23:21,600 --> 00:23:22,680 that we can run. 387 00:23:22,680 --> 00:23:29,480 And so every time a new version of requests comes out or 9.1 for CircuitPython or 9.2 388 00:23:29,480 --> 00:23:35,760 or 10 or whatnot, we can actually run the same test code across the same different microcontrollers 389 00:23:35,760 --> 00:23:39,160 and actually figure out like, "Oh, is SSL still working? 390 00:23:39,160 --> 00:23:42,000 Can I still connect to MQTT? 391 00:23:42,000 --> 00:23:44,000 Can I run a server? 392 00:23:44,000 --> 00:23:45,720 Can I do requests?" 393 00:23:45,720 --> 00:23:52,960 And ideally with a goal of having a kind of similar to CSS is that this like, "Can I use?" 394 00:23:52,960 --> 00:23:56,840 Like so you could go look and be like, "I have this microcontroller. 395 00:23:56,840 --> 00:24:00,320 I'm using this radio and I want to do this. 396 00:24:00,320 --> 00:24:01,320 Can I do that?" 397 00:24:01,320 --> 00:24:03,240 Well, that's great. 398 00:24:03,240 --> 00:24:07,320 It's been fun and exciting to watch you partner with the core devs as you've built this over 399 00:24:07,320 --> 00:24:09,000 the last few months. 400 00:24:09,000 --> 00:24:11,400 Thank you so much for being on the show. 401 00:24:11,400 --> 00:24:12,400 Thank you very much. 402 00:24:12,400 --> 00:24:13,400 I really appreciate it. 403 00:24:13,400 --> 00:24:14,400 And that's our show. 404 00:24:14,400 --> 00:24:15,400 A special thanks to Justin Myers. 405 00:24:15,400 --> 00:24:16,400 If you enjoy listening to the show, tell a friend or write a review. 406 00:24:16,400 --> 00:24:17,400 It really does help. 407 00:24:17,400 --> 00:24:18,400 For detailed show notes and transcripts, visit thebootloader.net. 408 00:24:18,400 --> 00:24:18,400 Until next time, stay positive. 409 00:24:18,400 --> 00:24:28,400 [Music]