Learn Python with Talk Python's 270 hours of courses

#221: Empowering developers by embedding Python Transcript

Recorded on Monday, Jun 24, 2019.

00:00 How do we get kids excited about programming? Make programming tangible with embedded devices.

00:05 Did you know that after kids learned to code with the BBC microbit, 90% of them thought that coding

00:12 was for everyone, and 86% said it made CS topics more interesting? One person doing great work in

00:17 this space is Nina Zakarenko. She's here to tell us all about her projects with CircuitPython.

00:22 This is Talk Python to Me, episode 221, recorded June 24, 2019.

00:28 Welcome to Talk Python to Me, a weekly podcast on Python, the language, the libraries, the

00:46 ecosystem, and the personalities. This is your host, Michael Kennedy. Follow me on Twitter

00:50 where I'm @mkennedy. Keep up with the show and listen to past episodes at talkpython.fm,

00:55 and follow the show on Twitter via at Talk Python.

00:57 Hey, everyone. Before we get to the interview, I want to quickly tell you about a new course

01:02 we just launched. It's our first major Flask course, and it's called Building Data-Driven

01:06 Web Apps in Flask and SQLAlchemy. This one's a deep dive into Flask. We cover things like

01:12 routing models, templates, databases, and migrations, and even deployment and security. And we do

01:17 all of this in the context of building a clone of the pypi.org website. Check it out over

01:23 at training.talkpython.fm. If you're not sure if you want to choose Flask just yet for your

01:28 web app, then give our 100 days of web course a look. We cover many frameworks and programming

01:34 models in 25 four-day projects, so you get a super wide view of what's out there. Then you

01:40 could pick Flask or Django or Pyramid or something else. Thanks for checking it out. Now let's get

01:45 to the interview. Nina, welcome to Talk Python.

01:48 Hi, thanks for having me.

01:49 It's great to have you here. You've been on Python Bytes, but not Talk Python before,

01:53 so I'm really excited to talk about some of the really cool stuff you did at PyCon, at

01:58 some of these other Python conferences, and with hardware and embedded Python and a lot

02:03 of cool stuff you're doing.

02:04 I'm really glad to be here, and we're recording a special episode from Portland for my home office.

02:10 That's right. Yeah, we both live in Portland, so doing it live, it's going to be great.

02:13 So before we get into embedded Python and circuit Python and all these sorts of things, let's just

02:19 start with your story. How did you get into programming in Python?

02:21 It's a little bit of an embarrassing story how I got involved in programming in the first place.

02:26 I was lucky to develop an interest from a young age. So when I was about 11 or 12,

02:33 I found out about the band Hanson. You remember that?

02:37 Yes, yes. I remember Hanson. The boy band, right?

02:39 Yes. And I really didn't like them, and I wanted everyone else to know. And so I figured out HTML

02:47 and figured out how to put up a Geocities site so I could put some stuff on there, some animated GIFs.

02:53 Geocities, people might not even remember Geocities, right? Those were early days. If you just had a

03:00 website, people were impressed. It didn't matter what it was.

03:02 Yeah, it was like free single-page web hosting. And I think it really kind of changed the landscape

03:09 of the internet, right? It made programming, even simple things like HTML, something that was

03:15 accessible to a lot more people.

03:17 For sure. So you had this thing against Hanson.

03:20 Yeah.

03:22 All right. How did that get you to programming?

03:24 There weren't really a ton of good resources out there. There wasn't GitHub where you can just go

03:30 and look at somebody else's source code. And so I just started out by right-click,

03:34 view source, pages that I liked, and figuring out how they did it. And then figuring out how

03:39 HTML was structured and all of that. And that kind of started my curiosity. So I did go a more

03:46 traditional route and went to school for computer science. And I've been in engineering ever since.

03:52 Yeah, that's really awesome. So how'd you get into Python from there? Because Geocities and

03:57 HTML and vSource, that's all just the web brand and stuff.

03:59 There was some period in my life where I called myself a full-stack developer,

04:03 but I was always that half-drawn horse full-stack developer.

04:07 Yeah?

04:07 Yeah, where I just naturally gravitated more towards back-end programming than front-end.

04:13 So I learned Java in school and then I did enterprise Java for a really long time and

04:20 worked on some really boring software.

04:23 Yeah? A lot of forms over data and data entry and all that kind of stuff?

04:27 Yeah.

04:27 You know, financial software. I worked on software for satellite control computers when I worked at HBO.

04:34 And I didn't really kind of lost touch with software being fun, you know, or software kind

04:39 of having creative purposes. I would just go to work and feel drained. I didn't really know much

04:44 about open source or the open source community. And at one of my jobs, I was doing my enterprise Java

04:52 thing. And we had started using Python for a little bit of scripting and for the API. And so I started

05:00 dabbling in that. Had the opportunity to go to PyCon. So my first PyCon was seven years ago.

05:05 And I was just kind of dreading it, you know, I was like, I'm going to be a noob in this thing and

05:11 I'm going to get made fun of, or people are going to call me out and it's just, it's going to be so

05:15 horrible. And then I showed up and I was just overwhelmed with how friendly the community was.

05:22 Yeah. I had the same experience, you know, just when I was getting into Python, I thought,

05:26 you know, it was rough. And you said you came from Java, like I came from C# and

05:30 I was really good at it. And I'm like, I'm going back to being like a true beginner,

05:34 like where I'm just going to make all these stupid mistakes. And, you know, people were super

05:38 supportive and friendly. And I really thought it was a special place, right. And just made me want to

05:43 get into it even more and so on. Yeah. I came back from my first PyCon and I was like,

05:47 how do I do this more? Because people were, you know, they weren't just kind of friendly to me and

05:53 welcoming to me. They were really generous with their time as well. So one of the first sprint

06:00 projects that I worked on as someone that I had met, who is an engineer at Google, you know, instead of

06:04 sprinting on a big, fancy open source project, just sat with me and helped me talk through some of the

06:10 issues I was having with my own code. And I was just, I mean, I was floored, right?

06:14 Yeah. Yeah. Why is this person who's like such a high end developer messing with my stuff, right?

06:18 Yeah. But they were so, you know, happy to do it.

06:20 Yeah. That's awesome. That's definitely kind of epitomizes what the Python community is like and why so

06:25 many people stay, stay and love to work there.

06:27 And I try to pay it forward, you know?

06:29 Absolutely. And I definitely do think you do. And it's worth pointing out that you gave the closing,

06:34 was it the closing keynote?

06:35 It was.

06:36 At PyCon?

06:36 Yeah.

06:36 Yeah. So you were basically, you stressed out the whole PyCon.

06:39 Yes.

06:40 Because at least for me, like we were talking earlier, like it's, it's hard to relax if you're

06:45 giving conference presentations and stuff until they're over. And you know, if you're the last

06:49 one, you've got to just like hold your breath off, PyCon. But it was a great presentation. You

06:53 talked about some really cool ideas about making programming fun again and personal and maybe

07:00 creative and not necessarily just for closing JIRA tickets or whatever, right? So nothing

07:07 wrong with that. Like it's great to do programming as work. And a lot of times it is fun, but a

07:12 lot of us have jobs where it's not exactly the reason we got into programming, right? So it's

07:18 cool to do really useful stuff or really playful stuff, I guess, rather not useful stuff, maybe

07:23 even. And so one of the themes of your talk that I wanted to start off with and discuss with you is

07:29 you said like software doesn't have to be serious. What's the story of that?

07:32 Not a lot of people know this about me, but now they will. When I was in high school, I was just

07:38 totally goth, you know, just had dyed black hair. I had a lot of piercings. And when I graduated

07:46 college, you know, I was like, nobody is going to give me a job if I look like this.

07:50 Yeah. I can't work at IBM. Like where's the formal dress code of this place is not going

07:56 to match with me, right?

07:56 Yeah. Okay.

07:57 I didn't know anything about startups. I didn't even really know anything about

08:01 how to go out and get a job after I got my degree. And so I just kind of toned it down and also got a

08:08 really dry job in the financial sector because they were the first ones to take me out to a nice

08:13 dinner. And I was like, whoa, you know, so I just kind of fell into it without really knowing

08:19 what I was getting myself into. And I just, you know, I didn't have kind of the time or the energy

08:25 really to do a lot of coding on the weekends or do a lot of coding after work. And it wasn't until I

08:31 found areas that I was kind of really passionate about for other reasons, you know, not just

08:37 tutorials or quizzes or whatever that I started spending a lot more time on it and kind of getting

08:43 really interested.

08:45 Right. The stuff you do in the financial place is not a super fun thing to take home and work on,

08:49 right?

08:49 Yeah.

08:49 So you got to find something else. Yeah, that's cool.

08:52 So I showed you, you know, this headdress, this LED kind of headdress that I built with,

08:57 you know, flowers and it's really beautiful. And I worked on that for hours, you know, just...

09:02 For this whole show, everyone, I'm going to basically have to be like the narrator since

09:06 a lot of this stuff has a visual component to it, right? Like it's, oh, you push this

09:10 button or we plug in this device and what does it look like? How big is it? So I guess I'll

09:15 start by describing the headdress. It's like a, I don't know, it's probably like a big circular

09:20 fan type headdress and it's probably fans out about a foot or so. And it's got all these LEDs

09:27 that are going and it's just, it's super cool. And so that you built with Arduino, right?

09:30 That's right. So that does not run Python. I use something called the FastLED library.

09:34 Yeah. And that was just about really just animating LEDs, right? And so there's kind of a,

09:39 it's actually a big thing and it's pretty omnipresent, right? It would definitely stand

09:45 out at a party, but it's not a huge programming thing, right? It's not like super interactive

09:49 in that sense, right?

09:51 It's not interactive, but there is a push button. So there's six or seven patterns that I programmed.

09:56 Okay. Yeah. So yeah, there's some interactivity to it. Okay. Awesome. All right. So you did that

10:00 and you're like, Hey, this is embedded stuff. This is pretty cool. Sort of designing

10:04 things with Python. And that's definitely got to be a lot easier these days, right? There's a lot more

10:10 stuff out there, a lot more little boards and devices you can get, right?

10:14 Yeah. This field is, you know, at least for Python is still very, very new. So all the software,

10:20 all the devices, you know, there's a lot of excitement in that space and things are

10:24 kind of moving pretty quickly.

10:25 For sure. So I guess maybe the, the headdress you described maybe falls under art. There's also

10:31 animations, but like actual graphical animations people could play around with. Have you seen

10:35 this, the programming music with Python, like the Fox dot stuff before?

10:39 No, I haven't.

10:40 Oh my gosh. yeah. Maybe I'll put a link to it. It's just, there's some really cool stuff people

10:45 are doing with like live performance music with Python. And so there's just all these really,

10:50 really great ways that are, you know, very far away from people's jobs.

10:54 Yeah.

10:55 That's you play with code instead of, you know, just take your work home with you,

10:58 which I think that's great.

10:59 There was a conference here in Portland over the weekend called Teardown Hardware Conference.

11:03 And Scott Shawcroft, who is the maintainer of CircuitPython, he did a demo of the Game Boy.

11:10 He kind of hacked a cartridge to run CircuitPython on an original Game Boy. And his demo was all

11:17 playing tones, right? So, you know, depending on what bit was set or wasn't set for a particular

11:23 register that would vary the length of the tone that was played or the pitch. And I just, the whole

11:29 time I was thinking like, I really want you to be a CircuitPython chip tunes, you know, DJ.

11:33 Yeah. Yeah. That's awesome. That sounds like so fun and tune it on the Game Boy. That's pretty

11:38 wild, right? That's not even intended for it. I feel like the Nintendo stuff is pretty locked down.

11:43 Cool. Cool. So, you know, I guess let's start this conversation with like, how do I write code

11:50 in Python and run code? So if I were to go to my Mac and type Python, I'd be running CPython.

11:55 But when I think of embedded programming, often people say, well, you have to use C to do this,

12:02 right? But there's a couple of options. Like you mentioned CircuitPython before that, or sort of

12:06 parallel and started like as a, started that project as well as MicroPython. And then there's probably

12:12 other options that I don't know about. Like maybe you could put Python on an Arduino or

12:16 who knows, something like that. Maybe talk us through the options and like why you would choose

12:20 one or another. Some of the kind of Arduino options, you can just run, you know, straight Python on there.

12:26 And it's just CPython that we all know and love? I believe so. Yeah. But the downside is,

12:30 you know, the devices are a little bit bigger. They're a little bit less lightweight.

12:33 Use more battery, probably. Use more battery. And they're kind of geared towards a more advanced

12:38 audience. Okay. MicroPython. I actually haven't done much work with MicroPython. I don't really

12:45 have any of the devices that run it. So I don't have a micro bit or anything like that. But that was the

12:51 original Python for kind of these, you know, devices and CircuitPython forked from it, maybe about three

13:00 years ago. And it differentiates itself by aiming to be the fork that's focused towards learning.

13:07 So it's not, you know, maybe the fastest or the most optimized, but it's the one that's going to be easiest

13:13 for beginners to pick up on and use. And that's important because it can be super frustrating with some of these

13:18 things. They're, they're, they're kind of glitchy. Like I'd only done mostly web development and server

13:22 side programming and stuff for a long time. And recently we did some mobile development for my

13:28 courses and man, I just felt like, wow, life is a whole lot harder for some people than others. And

13:33 I kind of get that sense, like watching you work through all your devices, like they're really cool.

13:37 And they, they do work with their, they all take like a special little setup or like, it's a little,

13:42 a little tricky to get started, right? Not hard, but like, you know, you got to find the right volume

13:47 and all this one's not connecting and just like that kind of stuff, right?

13:50 Yeah. You know, I mess with mine probably more than most, but the, yeah, the, the goal for these

13:55 CircuitPython devices is that you just, you plug it in and it shows up as a drive. And, if you're

14:01 not, you know, messing with it, like I am, or kind of plugging in a bunch at once, it does work

14:06 relatively well. There are a ton of guides on Adafruit for a lot of things that you might want to do.

14:13 And they're also really good about releasing helpful libraries.

14:16 Okay. Like little Python libraries you can use and stuff.

14:19 Yeah. Like, these LED strips are in Adafruit land. They're called NeoPixels, but they're just

14:25 WS2812, LEDs. So they have libraries for filling all the NeoPixels on a particular device. Like,

14:34 the, CircuitPlayground Express has, you know, the built-in ring. So a lot of kind of helper methods

14:39 for things like that.

14:40 That's really cool.

14:42 This portion of Talk Python to me is brought to you by Ting. Let me tell you about Ting, a new mobile

14:46 service available in the U.S. that's targeted developers and other technically savvy folks.

14:51 First of all, their average customer only pays $23 a month, but they're no discount provider.

14:56 Their service runs over T-Mobile's and Sprint's fast nationwide network.

15:00 If you don't use that much data because you're usually on Wi-Fi, like many of you are, then Ting will save you a ton of cash.

15:06 But don't worry, you can still use as much data as you like for just $10 per gig.

15:10 One mobile feature I use all the time is tethering. And with Ting, you get unlimited tethering at the

15:16 same data rate with your account. $6 a month for a phone line, $10 a gig, $3 a month for text if you

15:21 usually chat over iMessage or WhatsApp. Think about it, no contracts and super clear and fair billing.

15:27 Visit python.ting.com, that's python.ting.com, and check out their savings calculator.

15:34 Enter your usage and see exactly what you'd pay. Use that link and you'll get a $25 credit to try

15:39 them as well. That's python.ting.com or just click the link in the show notes.

15:43 Maybe that's a good place to talk a little bit about some of the devices we might start with.

15:50 We'll dig into the, you got a bunch here we're going to talk to you. They're going to be really

15:53 fun. But you know, everyone who attended PyCon got in CircuitPython Express. Is that what it's called?

15:58 CircuitPlayground Express.

16:00 CircuitPlayground Express.

16:01 Yeah. And maybe that gives people a good idea of just what's possible these days, because how would

16:06 you describe the size of that thing? It's like, I don't know, five centimeters across, two inches,

16:11 something like that, across probably.

16:13 About two inches.

16:14 Yeah. And, you know, maybe describe all the stuff that is on this little tiny,

16:19 super thin device here.

16:21 The cool thing about this, I was showing, Michael, I was showing you some of my other projects,

16:26 like something that I built at a teardown workshop and it involved a lot of soldering.

16:30 Yeah. Hot irons and maybe not connecting the right thing to the right. It's pretty intimidating,

16:35 actually, if you haven't done it before, I think.

16:36 Yeah, it definitely is. And not yesterday. I've gotten, I've gotten a lot better at it,

16:41 but definitely when I was, you know, first starting out, I've gotten, you know, like little burns here

16:45 and there. So you do have to be kind of really careful. You have to think about, you know, polarity of

16:49 things. Am I putting it in the right way? Am I using, am I using the right components? Even

16:54 breadboarding, you know, there's kind of some complication to it. So the thing that I like

16:58 about these Circuit Playground Express devices, it has kind of everything that you need to just get

17:03 started conceptually on one board. So it has both inputs and outputs, right? So inputs being things like

17:11 there's two programmable buttons on here. There's a switch that you can program. There are some sensors

17:17 on here, like there's an accelerometer, there's a temperature sensor, a few other things. And then

17:23 the outputs are the, the ring of LEDs around it.

17:27 And you probably can connect other stuff. Like, could you connect a speaker or something to it?

17:31 So there is a tiny speaker on it.

17:32 That's awesome.

17:33 And then you can use the, there's kind of these inputs and outputs along the sides as well that

17:38 you can connect to, you know, you can hack up a NeoPixel strip or something pretty easily with just

17:44 alligator clips.

17:45 Yeah. So it's like a circle and there's maybe 10, 12 little punched out rings on the outside and you

17:52 can connect stuff and control like lights and stuff with that. Right.

17:54 There's some inputs in here, both analog and digital.

17:57 That's super cool. And that whole thing costs like what? $25. It's not super expensive, right?

18:03 Yeah. I think these are $25, $35.

18:04 Yeah. So if you want to get started, this is probably a good one because it has a bunch of

18:08 built-in sensors, you don't have to like try to attach them and so on. That's a pretty good option.

18:13 Another one that looked interesting, you know, is not really in the realm of what you've been

18:19 working on, but maybe other people would be interested in is there's a Pi Gamer, right?

18:23 So if you're interested in like doing little games with like Pi Game, that's another good

18:27 option. And it's more, but it's like $20 more. It's not like, it's like 49. There's a starter

18:33 kit for $59. Like these things are all really approachable for folks. Right. And I feel like

18:40 these types of devices would be really good for kids or people who are getting into programming

18:46 who are, don't fit the, I don't know, the traditional, just plow through the technical

18:51 bits until like you get there. I feel like so much of traditional programming is taught

18:56 with like extreme delayed gratification, right? Like, okay, you're going to take a course on

19:02 programming and this semester you won't really do anything interesting at all. So you're

19:06 going to work really hard all semester and come up with nothing. Maybe the end of next

19:10 course after this, you'll have something that's cool. And like, really, that's how it goes,

19:15 right? Like, here's how you do a loop. Here's what a variable is. Here's how the memory works.

19:18 Here's a heap and all that. Like you've got to plow through that in order to get to something

19:23 like where it actually is creative and fun on the other side. Whereas like this kind of stuff,

19:28 right? 10 lines of Python, plug in a USB to your computer and you've got cool stuff happening

19:34 already, right? So I feel like it's a much more approachable, like early win, get into program.

19:39 Then once you're really into it, you're like, okay, well, how do I do this looping? Because I want to

19:43 make it cycle or whatever. I think it's, it's a much more natural way to approach learning programming.

19:48 I think so as well. Yeah. I, all the code examples that I used in my keynote, I try to make them be,

19:53 you know, each one just kind of building on the next. There's just something, you know,

19:57 magical about holding something in your hand and having it do something right. That just,

20:01 like you said, that kind of immediate reward, immediate gratification. And I think whatever

20:08 we can do in our industry to get, you know, not just kids, but even just, this is fun for adults,

20:13 right? Yeah. Yeah. Yeah. It's, it's super cool. Just get more people interested. There's tons of

20:18 little projects that you could do with this. I mean, if you're into gardening and you could do IoT,

20:21 like plant monitoring, all kinds of stuff, right? Like it's, it's pretty neat. I love it.

20:26 I'm still a hobbyist. Yeah. I like that. You don't have to be an expert to use a device like this and

20:32 kind of get the basics down and get the concepts down. You know, I'm not an electrical engineer and I

20:37 never will be, but I can still do a lot with something like this. Right. Right. You're not mapping out the

20:42 actual circuit or whatever. Right. But yeah, that's really cool. And it seems like some

20:46 super fun projects that we'll talk about. But before we get into the actual steps of programming,

20:51 let's just maybe talk real quickly about the BBC micro bit, because you quoted some cool stats

20:57 from there at the end of your keynote. I've had a topic on it before on the show. And, you know,

21:03 it's a really cool story where the BBC funded giving a little device, kind of like what we're talking

21:08 about to what grade was it in all the UK? I don't remember.

21:12 Like late elementary school, early middle school, something like fifth, sixth, seventh grade,

21:16 something like this, right? Yeah. Like 11, 12 year olds.

21:18 Yes, exactly. Okay. So yeah, there's some really cool stats. If you want to tell us about that.

21:22 Something I really like about this project that they did is they did kind of an exit survey,

21:26 right? So they surveyed kids kind of before and after. And some of the numbers that came out of this

21:32 were 90% of the kids after they got to use the micro bit thought that coding was for everyone.

21:39 Right. Because a lot of people feel like coding for either super geeky people or super smart people,

21:45 or maybe the intersection of those. I don't know. Like it's, it doesn't feel like, oh yeah,

21:49 everyone can just do this. Right. It feels very like you got to know the magic and there's,

21:54 it's just too hard to get into a lot of times. I feel maybe that's a little bit less these days.

21:59 I mean, when it was like C++ and assembly, it really felt, or Java even, it felt like,

22:03 you know, this is not something you just walk up to and get a job in, or you become proficient in.

22:08 Even kind of when I first got the hardware stuff on my radar, you know, a lot of the projects that

22:13 are coming out, I just, I wasn't really kind of particularly interested in them. Right.

22:18 Yeah.

22:18 It wasn't until I started seeing, you know, projects and builds and guides and tutorials

22:23 that were doing things that matched my interest more, matched my aesthetic that I recognized,

22:29 you know, that it was something that I could try as well.

22:31 Yeah. It's awesome. Like build something you could wear or like make something awesome for Halloween.

22:35 Right. Something like that. That sounds really fun. Yeah. So another stat, 86% of the kids who went

22:42 through it said computer science is a topic that's more interesting to them afterwards.

22:47 Yeah. Yeah. I think so as well. Right. You know, like you said, kind of mixing those things in

22:52 little by little, right. You know, looping control statements, if else, and then seeing it happen.

22:58 Yeah, absolutely. The visual aspect. And then I think also just the learning just enough. Right. And so I

23:03 guess we didn't mention this at the top, but it's worth pointing out that the micro bit ran

23:08 micro Python at the time. Actually, they started out in the historically trying to do some other

23:13 way to program it. I don't know if it was like in C or it was in, they're trying to build their own

23:18 little operating system for it or something, but it wasn't Python and micro Python until it got a

23:24 little ways down the road. They're like, this looks hard. You should use micro Python. And they went for

23:27 it. So that's really good. Yeah. Yeah. And then the last one you said was very near and dear to your

23:33 heart. Yeah. 70% of girls said that they would choose computer science as a subject option after using the

23:39 micro bit. That is super cool. I think it really, really speaks to like the first one, like a lot

23:45 of people find it more interesting or they thought it was for everyone. And of course, girls would feel

23:50 that way as well. Right. Like it's, it's a fun thing to work on. And like a lot of these projects we're

23:54 going to talk about are, you know, super interesting for girls and boys. Right. But definitely, definitely

24:00 interesting. So let's talk a little bit about the overall flow of like, what does it look like to

24:06 program? One of these things, right? Like maybe I go and order the circuit Python express,

24:12 circuit playground, sorry. And, and I get that. And then, well, now I have this thing and it's cool,

24:18 but what do I do? Right. Like, how do I get started? What are the steps? These are Arduino compatible.

24:23 So there is a mode that you can go into where you can just write straight Arduino for this as well.

24:28 Okay. So it's not limited to just circuit Python. So depending on when and where you bought your

24:35 circuit playground express, it might either already have circuit Python loaded up on it,

24:39 which is great. You'll plug it in and you'll see a circuit Python drive. If you don't, it's pretty easy.

24:45 All you need to do is check out the Adafruit website and there's instructions for putting

24:49 this into boot letter mode and you basically just drag and drop a file and then circuit Python's

24:54 available. Okay. Yeah. And if you pick yours up at PyCon, circuit Python's already on there. So

25:00 easy peasy. Yeah. Super easy.

25:02 Once it's available as a drive, you will see either a main.py file or a code.py file. I believe code.py is

25:10 the standard that they're moving towards. The really nice thing about these devices and circuit Python

25:16 in general is with Arduino, you would have to write your code and then there's a compile step and there's

25:24 a step where you'd have to load it onto your device. And sometimes it wouldn't transfer correctly or it

25:29 wouldn't be recognized. And so there's just kind of a lot of waiting and fiddling in the process.

25:35 With circuit Python, all you need to do is if the code.py file is not there, you just, you make it,

25:42 you type your code in, you save it, and then it auto reloads on the device.

25:46 Yeah. That's cool. So basically the programming effect is I just edit this file and then when you

25:53 hit save, it reruns it. Either it's good and it runs or it's going to crash or whatever. And

25:57 we'll talk about debugging them in a little bit, but yeah, you just, it basically just auto refreshes.

26:03 I mean, kind of like Flask or something you're doing web development, you make a change, it detects it

26:06 and it just goes, but it's just on the device, right? So you don't have to like turn it on or start

26:11 Python. You don't have to do any REPL thing. You just, you edit a file like by virtue of powering it,

26:17 it's trying to run that file. And then it just watches for changes, I'd guess, something like that.

26:21 The important thing here though, is you do want to use a known good micro USB cable that has both

26:27 data and charge. A lot of cables don't. And so point of frustration for a lot of folks is they're

26:34 using a cable that's just for charging. The drive isn't being recognized.

26:38 Like that $3 one you got at Target or something, right? It's $3 because it probably doesn't carry

26:43 the data or whatever.

26:43 Right.

26:44 Yeah. Okay. Yeah. So you got to be real careful about that. But other than that,

26:48 like you basically plug in a micro USB thing, then regular USB to your computer and then it's up,

26:53 you have to find, find it as a volume or a drive, right? So you got to go and hunt that down.

26:58 So on Mac, if you have your finder open, you know, it'll just show up there on the left-hand side.

27:03 Yeah. And that's easy. And it's probably similar to Windows Explorer. It probably just shows up as

27:07 another like attached drive or something.

27:09 I believe so. I actually don't use a Windows computer. It's ironic, right?

27:13 Yeah. Don't you work for Microsoft?

27:14 I do. Yeah.

27:15 You work on this code PY file. I guess maybe it's pretty much straightforward. You import some of

27:21 the libraries that maybe CircuitPython provides so that you can program things or maybe something

27:27 from Adafruit. So like the regular standard library doesn't probably have something for talking to

27:33 LEDs.

27:33 Right.

27:34 Right. But this probably has a bunch of stuff like that you're going to work with.

27:36 Some of the libraries are kind of baked in. So on the Circuit Playground Express, there's

27:41 Circuit Playground Express library that makes it really easy to work with the buttons, for example,

27:46 and some of those sensors on the device, you know, the switches and all of that. So for that,

27:51 you just have to import it. Some of the external libraries, like the ones for working with, you know,

27:57 additional NeoPixel strips or some of the things that you can, you know, kind of extend and plug into

28:03 this need to live in a library folder.

28:06 Okay.

28:06 And you can just find those dependencies on CircuitPython.org.

28:10 I see. So if I want to have some sort of external dependency, that's possible?

28:14 Yeah.

28:15 Yeah.

28:15 Do I pip install it? Do I download it and copy over? Like what's the, what's the mechanism? Like I just copy into this libraries folder?

28:23 Yeah. You just copy it into the libraries folder. There's definitely some additional work that can be

28:29 thought of with packaging. You know, there's no good way of pegging a dependency to a version,

28:35 for example, but the project is open source. And they will gladly.

28:40 Exactly. PRs are accepted.

28:41 Yeah. They'll gladly accept your contributions in the space.

28:44 Yeah. I can imagine that they would. Like you said, it's early days, right?

28:47 Yeah.

28:48 So it's, it's wide open. I feel like it's really growing quite a bit. A lot of interest

28:52 is developing here and a lot of, a lot of different angles, like the education space,

28:56 people are makers, all kinds of stuff.

28:58 I think the key here is, you know, it's not just for kids. People look at some of these devices and

29:03 they're like, Oh, this will be fun for my eight year old, you know, but it'll be really fun for you

29:07 too.

29:07 For sure. You can definitely do some, some cool things. You know, one of the things that I find is actually

29:11 a challenge, maybe because I'm good at programming. I don't perceive that as a challenge,

29:15 but just my assessment of like looking at this space, like what is challenging. The programming

29:20 is a little challenging, but I feel like knowing what extra things go with my device. Like what if

29:26 I want, you know, like strips along the wall that light up when it watches me walk by, or, you know,

29:30 it just says, you know, to text me and like, well, Greece welcomes me when I'm home or welcome to our

29:35 house or whatever it says. Right. Like if I wanted to do something like that, like I just look at all

29:39 the stuff I could go shopping for at crowdsource or, on adafruit.com or, and I'm just like,

29:46 there's a bunch of stuff here. I'm not sure it's even compatible with this thing I want to get.

29:50 Like, how do you address those kinds of things?

29:52 So I've gotten, kind of a lot better about figuring out what parts or components I might

29:57 need and how, how things work together. But until that happened, I would just look at guides online

30:03 that had incorporated some aspect of what I wanted to do. And then I would just kind of deconstruct

30:08 that and kind of pick and choose and figure out ways to put those things together. So there's guides

30:14 on Adafruit. There are guides on Instructables. I just met a really cool maker who does a lot of

30:20 wearable stuff for an Arduino based magazine, Sophie Wong. Okay. Yeah. She, she makes really cool.

30:26 She had this led jacket. She does kind of cosplay. So she brought this helmet, like led helmet that

30:33 she made for astronaut costume. That was just amazing and incredible.

30:36 Oh, wow. Yeah. Yeah. I can imagine the cosplay stuff. It's really got a lot of,

30:40 a lot of cool options actually. You should check out her guides. cause her led jacket was powered

30:45 by one of these circuit playground expresses. I rode over here on my motorcycle, right? And I just saw

30:50 yesterday on YouTube, this guy who had built a helmet like from Tron and had these led lights all

30:57 over it. It had this like, sort of one of these type of chips and batteries on the back.

31:03 And you could do some like super cool stuff with that as well. Like have that light up way right

31:07 at night or yeah, it's not really, there's just a lot of cool little projects you could just take on.

31:11 Right. My only piece of advice in that space is you want to build things incrementally. So you might

31:17 have, you know, this kind of crazy idea of, you know, yeah, this grand vision, but it's, you'll have a

31:23 much easier time and you'll end up on a happier path. If you start with something much smaller scale and

31:30 either really understand how all the components work first written and how they work together

31:35 before you take on a really large undertaking. Yeah. Yeah. Even on small things, right? Like

31:40 write one line of code, see it run, write another line of code, see it run, because there's not a

31:46 whole lot of debugging or like high end tools to attach it to analyze it. Right. It's kind of like

31:51 print statements. And, you know, we should also talk about that. you know, if, if I like try to figure

31:57 out what's going on, I do a print statement or something like that, I'll probably be a little

32:00 disappointed on the output at first. Right. If I don't, don't like find a way to connect to it.

32:04 All the code is running on this little device and you won't see any output. Right. It has no screen.

32:10 And it's, as far as it's concerned, it's its own operating system. It doesn't care about your Mac or

32:14 your windows or whatever you connected it to or any, cause it might not be connected to anything.

32:19 Right. If you want to see any debugging output on this, you can either use something like the

32:24 mute editor. So that's an editor that's good, not just for beginners, but for folks who are just

32:31 starting out with hardware. Cause there's just kind of buttons for all these things. There's one button

32:36 that says open serial console and that's where you would go to see your print output. Right. So it just

32:40 listens for the serial output and it just prints out whatever it sees. Right. Which is, so these

32:45 things, when you connect them, they basically appear to your computer, like modems. Is that right?

32:49 As a drive.

32:49 As a drive. Okay. Yeah. So you connect to them and you get the output and whatnot.

32:54 That's cool. I guess another, you know, so we talked about the circuit playground express,

32:58 another one that's a pretty good one and that's self-contained, right? So knowing what I need to

33:02 get for that, I can do a lot of interesting stuff. Just that one little thing in a power core,

33:07 power data cord. There's also a pie gamer, which is kind of cool. A little screen, a couple of buttons

33:11 and a controller.

33:12 There's a pie badge. I have one right here.

33:14 The pie badge is super cool. It's got some buttons and a screen, like two sets of buttons,

33:19 like an AB button and then like the four arrows and a little, a little screen on it. That's,

33:23 those are both really cool. And then, I don't know about this one. You probably can tell us,

33:27 but the pie gamer comes with a starter kit as well with a battery and a speaker and a little box it

33:33 goes into. So, you know, for me, I'm, I'm kind of, I'm at the super early stages of this stuff. So I'm

33:37 like, all right, starter kit. Does it say starter kit? That's good for me. I'm going to try that

33:41 maybe and then see what else I got to get. I believe the pie gamer is going to be in the

33:46 ADA box that's shipping right now. Okay. Yeah. So if you're subscribed, you should get a fun surprise

33:51 in the mail. Oh, how cool. How cool. Yeah. It's some of these things are hard to get ahold of. They

33:55 keep selling out. Yeah. So I guess that's a good sign. Yeah. The, this thing, the pie portal,

34:01 it's been a pretty hot seller. Yeah. So let me describe the pie portal. So the pie portal is this,

34:07 let's say three inch by two inch touchscreen. And it looks basically just like a touchscreen from the

34:12 front. There's almost no other circuitry you can see. And I guess translation, what is that like five

34:17 by seven centimeters? And yeah, it's just a little touchscreen that you can program with CircuitPython,

34:23 right? The cool thing about this one, it also has internet connectivity. Yeah. The internet connectivity

34:28 is missing from the Playground Express, right? Yes. And that would be so, it's like the one thing,

34:34 like a little wifi something. Can you get an adapter to plug into it that works? I don't know. I haven't

34:38 thought that one through. I haven't tried it either. So I guess you got to decide what am I trying to

34:43 build? Does it need internet connectivity? Right. Right. Right. Do you want to do something IOT

34:47 related? Right. Right. If it's IOT, then it probably needs that. This portion of Talk Python to Me is

34:54 brought to you by Rollbar. Got a question for you. Have you been outsourcing your bug discovery to your

34:59 users? Have you been making them send you bug reports? You know, there's two problems with that.

35:04 You can't discover all the bugs this way. And some users don't bother reporting bugs at all.

35:08 They just leave, sometimes forever. The best software teams practice proactive error monitoring.

35:14 They detect all the errors in their production apps and services in real time and debug important errors

35:19 in minutes or hours, sometimes before users even notice. Teams from companies like Twilio,

35:24 Instacart, and CircleCI use Rollbar to do this. With Rollbar, you get a real-time feed of all the errors,

35:31 so you know exactly what's broken in production. And Rollbar automatically collects all the relevant

35:36 data and metadata you need to debug the errors so you don't have to sift through logs. If you aren't

35:41 using Rollbar yet, they have a special offer for you, and it's really awesome. Sign up and install

35:46 Rollbar at talkpython.fm/Rollbar, and Rollbar will send you a $100 gift card to use at the Open

35:53 Collective, where you can donate to any of the 900 plus projects listed under the Open Source Collective

35:59 or to the Women Who Code organization. Get notified of errors in real time and make a difference in open

36:04 source. Visit talkpython.fm/Rollbar today.

36:09 I really like the screens here. I mean, the LEDs are cool and they're fun, but you have a lot of

36:14 flexibility of doing fun stuff. So one of the projects you were showing me earlier before we

36:20 started talking on the recording is the Python 2 death clock. So I talked about, you know, legacy Python

36:26 and how we're finally moving past, right? Past Python 2, I think. But a while ago, someone made something,

36:33 I think it's pythonclock.org or something like this, where it's just the countdown until the end of Python 2.

36:40 Yeah.

36:41 Right? And so you've got this cool little app that you built on one of these. Yeah. And it's,

36:46 man, it is beautiful. Yeah. You want to just tell us about it?

36:48 Yeah. So I wanted to make my own desktop Python 2.7 countdown, you know, so I could just keep an eye

36:54 on it. Yeah. Didn't have to have a browser tab open. Come in the morning, sit down. You're like,

36:59 oh yeah, it's 190 days now. Yeah. 190 days, four hours, 31 minutes. Right on. The fun thing about

37:06 this is I really wanted to kind of use the touchscreen capability here. And so I wanted my Python 2.7

37:12 countdown timer to match my mood. Okay. Right. So there's a kind of a bunch of different themes that

37:18 you can flip through with the left and right side of the touchscreen, you know, light colored

37:23 background, dark colored background, there's different fonts. So, you know, whatever mood

37:27 you're kind of feeling like that day, more modern, more abstract. That's the version of the Python

37:33 2.7 countdown.

37:34 Yeah. That's super cool. So you just touch the screen and it cycles through and it's just constantly

37:38 counting down the time there. Yeah. So tell us about programming that.

37:42 So this is interesting. This is kind of where I bumped into some of the limitations and the quirks

37:50 of a device like this. So there's no real time clock on this. Right. Okay. So you have to go and

37:57 fetch the time from the internet. Because it just doesn't, it's just, it's like Grandhog day for it.

38:01 It doesn't know what time it is. Once you kind of unplug it, you know, unplug it back and it doesn't

38:05 know what time it is. And it can kind of keep track of the time for a little bit, but then eventually

38:10 the clock will start to drift. So you want to fetch the time from the internet. Yeah, just refresh it.

38:14 Okay. Every once in a while. It has Wi-Fi. So it's, it's a big deal. Yeah. The other thing I haven't really

38:18 kind of figured out how to do in the longer term, this works just fine on a home network.

38:23 You provide your SSID and password and just a secret stop UI file, but it doesn't really work

38:29 well with captive portals, you know? So if you're at a conference or something and there's a lot of

38:34 sign-in steps, having quite kind of thought that through soon, you do kind of have to, you know,

38:38 tether your phone or something else. But yeah, all the graphics are kind of lower level. So

38:43 the backgrounds that you see there, they're all, I believe, 16-bit bitmaps.

38:48 Yeah. And you have a video of this that people can look at. So we'll put that in the share notes

38:52 that people can check it out and watch it going and see what it's like. So that'd be cool.

38:56 I'll try to share the repo and then a blog post of kind of explaining all of the, all of the code

39:01 ready by the time.

39:03 Yeah, sure. That would be great. So there's some interesting challenges to programming this,

39:07 right? It's not just like, you know, playing with the terminal or even with like PyGamer or Kivy,

39:12 where you program in some high-end graphics thing like OpenGL or something like that. Like,

39:19 there's not like a graphics card in the traditional sense, right? Like, so even getting text on the

39:25 screen is a little, it requires not hacks, but it requires like funky techniques, right?

39:29 Yeah. You have to port whatever font you want to use into a bitmap font. Yeah. So just kind of a lot

39:34 of downscaling. I don't remember how much room is on this, but it's enough to kind of get you going

39:39 for most basic projects, but you can't, you know, drop a uncompressed video on here or something like

39:44 that. You know, you'll run out of room. Sure, sure. And you have to do interesting optimizations

39:48 potentially. Like if you're going to animate the, say the numbers, right? Maybe you have to like pre

39:53 pre-allocate all the font representations for 0, 1, 2, 3 and things like this, right?

39:59 Yeah. You can kind of optimize by saying, you know, which characters are you going to be using

40:04 in the course of your program? Load those from the font. Yeah. So you have to think about some things

40:09 when you work on these super small devices that maybe we might just overlook, right?

40:13 That's pretty cool. But yeah, it's, it looks great and we'll put the video of it up. It's,

40:17 it's going to be fun. So maybe we could, you have a whole bunch of hardware, big, small screens,

40:24 no screens, lights, no lights hanging around here. Maybe we could just talk through some of

40:28 these devices and some of the cool little projects or things you might be doing with them.

40:31 Yeah. I can kind of start from smallest and work my way up. So this here is a Trinket M0.

40:39 Yeah. So this is maybe a quarter inch by one inch, something like that. So two centimeters by like

40:46 one, maybe. Teeny tiny. Yeah. Very tiny. Kind of, you know, about the size of a, of a U.S. quarter

40:52 and pretty basic as well. And, you know, to be fair, I do have a lot of Adafruit devices here.

40:57 I'm a fan. Yeah. But there are other devices out there that do run Python or, you know,

41:03 MicroPython or even CircuitPython. But I will kind of talk through what I have in front of me and,

41:08 you know, what I use for my projects. So this is kind of nice because it does have a micro USB

41:15 for programming. Yeah. It's really nice that it just plugs into like, Hey, I have a Kindle,

41:19 so I'm just going to grab that or whatever. I just use that cord or I have a certain type of

41:23 Android phone. Maybe it just takes that. So there's just like a, you know, a handful of small

41:27 or a handful of inputs and outputs here and then, you know, mounting holes. So if you're really kind

41:33 of tight for space, this is a good option. That's super small. Yeah. It doesn't have a port,

41:37 you know, that JST port for something like a light poly battery or, you know, different kind of battery

41:43 closures like the CircuitPlayground Express has, right? And that kind of plugs in there.

41:47 So this is a micro USB only. And then this right here is the Gemma.

41:53 Okay. The Gemma is really like a quarter or something like that or so. Yeah.

41:57 This is what was included in the PyCon swag bags last year.

42:01 Right. The 2018 one.

42:02 So this was like the dip your toe in the water of the IoT before the CircuitPlayground one.

42:08 Or programming hardware because this also doesn't have any internet connectivity on it.

42:13 Okay.

42:13 The nice thing about this form factor is it's great for Sobel electronics and wearables, right? Okay.

42:18 So it's got these big pads on the sides that you can use to run conductive thread through or conductive paint, right?

42:26 This thing is super tiny. It's like really about the size of a quarter. It may be thinner

42:30 than a quarter except for it's got his little power thing bumping up there.

42:33 Right.

42:34 You could probably make some really cool Halloween costumes or something for, you know, like a parade.

42:39 Yeah.

42:39 Or if you're giving a talk, right? Like you've been known to have some pretty cool devices that like

42:44 you've like secretly worn into the conference talks when you're giving them, right?

42:49 I used Gemma MZero's for my Python powered earring.

42:52 Yeah. That's awesome.

42:53 That I'm holding right here. I will turn them on. They're bright because,

42:56 you know, they're meant for being worn on like a conference stage so that folks can see me in the back.

43:02 For sure.

43:02 But these are really, really fun.

43:04 So they're like big ring. It's a big ring of LEDs that are animated. And then like an inner little

43:09 light thing as well. And then this little tiny circular board that we just talked about is back

43:13 there with a battery stuck to it. Yeah.

43:15 Doing all the magic to make it actually happen, right?

43:17 I did have to do quite a bit of soldering, you know, to get everything to work here. There's

43:22 three layers of LED rings. So the kind of these, you know, individual neopixel rings.

43:29 And you'll see that each one of these has pads on the back here, a data in, data out,

43:34 a ground and a power.

43:36 And did you have to solder these?

43:37 Yes.

43:38 Okay.

43:38 You can see they're kind of small and unwieldy. So, you know, it was a fun little project,

43:42 but something a little bit more complicated than, you know, a Circuit Playground Express,

43:46 for example.

43:46 It requires actual hardware aspects of like building hardware a little bit, right? Like you've got to

43:53 connect stuff and whatnot rather than just like pure programming to the thing.

43:56 Just some soldering skills. This project was based on a guide by a really cool maker. Her

44:01 name is Becky Stern.

44:02 Okay.

44:03 And so her, her original idea was, you know, having this Gemma with kind of one LED ring. And I wanted

44:10 to have more LEDs, you know, cause always just, I just always want to have more LEDs. So I added

44:16 more in there and then wrote my own custom Python code.

44:19 Yeah. That's really cool. You know, another one that you were showing me that I thought is pretty

44:23 cool was with the Pi badge. So with the Pi badge, I have to describe a little bit. It's,

44:28 it's got a little screen. The screen is maybe one and a half by one inches, maybe a tiny bit larger

44:33 than that. And it's meant, it does have buttons and stuff, but it's meant to be worn as an actual

44:39 badge at a conference, right?

44:40 Yeah.

44:41 Like instead of like just the printed one or whatever.

44:43 Yeah. It's what I'm wearing in my Twitter profile picture.

44:46 Okay. Really cool. And so you've, you obviously have the screen to put like your name.

44:51 Hello, my name is Michael or Nina, whatever you want to put there, but you could also do other

44:56 stuff. And you know, at PyCon, we have this like certain color of badge means I'm willing to be

45:03 in photos or I'm not willing to be in photos. There's a couple of other things you can get like

45:07 sticker, like stickers, little like, cloth ribbons that go under and that indicate a few

45:12 things. But you had this really cool idea of, of taking a Neo pixel lanyard, the actual like

45:20 rope thing that this hangs on and lighting that up based on how you're feeling now or how you want

45:26 interactions right now, rather than blanket. I don't want pictures or blanket. I want to talk

45:31 to people or I don't, but you know, like right now I'm busy, please don't talk to me or our,

45:35 Hey, I'd love to talk to you. Come on over. Right. So tell people about this project. This is cool.

45:39 So the nice thing about this pie badge, it does have, you know, kind of mounting holes,

45:43 but then you can also use them for just a clip. Right. Right. So you can easily wear it around

45:47 your neck. And my coworker, Tommy, I hope I pronounce his last name right. Tommy Falgao. He

45:54 did this really cool build of a Lego badge holder with kind of this Arduino based LED badge lanyard.

46:02 It just looks awesome. I'll send you a link on Twitter for you to share with your listeners.

46:07 And I saw it and, he kind of did some IOT stuff and he wants to make it internet connected,

46:13 but you know, the pie badge is not internet connected. And so I thought, you know, how can I

46:18 make this fun and useful just as a wearable? And I think I would label myself as an expovert,

46:26 you know, at conferences. Yeah. Describe that to us. I think a lot of people who know me casually

46:32 would find it hard to believe that I'm very introverted. And so I do like meeting people.

46:37 I love talking to people, but at some point I need to kind of just, you know, run away and recharge and

46:43 have, have quiet time. Or I, I slowly kind of get crankier and crankier. You know, I've seen you at

46:48 conferences and it's like, there's always a crowd of people talking to you. So it's wonderful, but it also

46:54 is draining, right? Like, I mean, when I go to PyCon by the third day, I literally have lost my voice

47:01 because while I love talking to people, I just, at some point, like my body breaks down and just says,

47:06 no, you're not taking any more of this, right? It's so cool. I love that people want to come

47:11 and chat with me and I never want to be rude or turn someone away. So there's always this conflict of,

47:16 you know, I need to do some self-care, right? Right. Or just, I got to be ready for a meeting

47:21 or presentation in 15 minutes, right? Like I was at the booth at PyCon getting ready to do a live

47:27 presentation. So I was sitting, sitting kind of next to this little, pop-up stage in the expo

47:33 area. And I was like, literally trying to get the demos ready. And someone's like, Oh, Michael, I'd love

47:38 to meet you. Hey, I was going like, Hey, it's really great to meet you, but I really need like five

47:41 minutes because we're, I think we were doing a live Python bytes recording. I'm like, I really have to

47:45 figure out what we're talking about in five minutes. Right. So it was just times like that at

47:49 conferences where it's like, you know, just, you would love to be able to like signal that.

47:53 Yeah. Yeah. So I'm going to use the pie badge for that and a, an led strip. And there are,

47:59 I don't want to say proprietary, they're not proprietary, but there are some kind of data

48:03 out ports on here. They use a three pin 20 millimeter JST clip. So you just kind of have to

48:09 find and buy the right one. Right. It's not like you just plug in micro USB or something, right?

48:13 I have a few here. I, I saw Scott Shawcraft, the circuit Python maintainer. He, you know,

48:20 works with Adafruit. I saw him in Seattle early last week and I was like, please bring me some of this,

48:26 you know, odd looking adapter. So it kind of looks like the, you know, these, we'll talk about powering

48:32 your projects a little bit later. It kind of looks like these LiPoly, you know, JST connectors.

48:36 There's just one more pin. Right. These little white three pin connectors. Yeah. Uh-huh.

48:40 So the battery just has two, you know, red and black, ground and power. This has three,

48:45 cause there is a ground and power and also data. Okay. So you can just plug one of these right into

48:50 the Pi badge. And then I'm going to do a little bit of light soldering and just solder my led strip to

48:56 the end of this, which, which means, you know, I can easily disconnect it. There's not a lot of

49:01 wiring or anything like that. And that's just going to run through a lanyard clip. Yeah. And then this

49:05 connects to the NeoPixels. Yeah. That's going to connect to the NeoPixels. And so I'm going to be able

49:09 to kind of adjust and say, you know, instead of, do I want my photo taken or not? It's like,

49:14 well, maybe if my badge lanyard is red, I can also, you know, update the message on the Pi badge here

49:20 saying like, now's really not a good time to talk. You know, maybe yellow is like only if you really

49:26 need to. And then if my lanyard green come up and chat, I'm happy to. Right. Or it's rainbow colors

49:33 and blinking or just something obvious. And I think that's, yeah, that's super cool. So the

49:37 lanyard basically is like a ring or like a strip of like super bright LEDs. Right. So like not just the

49:45 little badge will light up, like your whole lanyard will like actually have colors and communication.

49:50 That's cool. I'm so grateful for to Tommy for this idea. And he's actually going to be productizing

49:57 his version of the LED lanyard badges so that you'll be able to just go and buy a kit from him.

50:04 Yeah. Cool.

50:05 Yeah. I think so as well. I'll probably be documenting my build on this and trying to,

50:10 I'm so bad about, you know, I like getting in the zone and building these things. And I'm really bad

50:15 about stopping to take pictures and then document. Right. Right. Because along the way,

50:20 you almost got to rebuild it a second time. Yeah. And just document it the second time through.

50:24 But I will share a link with his tweet and his product. I think it's going to make conferences a

50:29 lot more fun. But these are just the same kind of individually addressable LEDs that are on the

50:36 surface of the Circuit Playground Express. They're just kind of in a strip form.

50:40 Yeah. Yeah. This looks super cool.

50:42 And this project is going to involve a little bit of sewing so that I can get my badge clip on there.

50:46 I love it. I would love to see it. I mean, it's going to be a little bit tricky

50:50 just in terms of like getting conferences to offer it as, because it'll cost some money, right?

50:56 Yeah.

50:56 It won't be as cheap as just the paper, but if they could do it, it would be so cool, right?

51:00 Yeah. I would love to see that at some point in the future.

51:02 I mean, they did give them out in the swag bags, the Playground Circuit Expresses.

51:07 Yeah.

51:07 Circuit Playground Express. It could just be, well, it's not in your bag. It is your lanyard.

51:13 Yeah.

51:13 Right. And it has a little screen. So it's not really that big of a stretch, I guess,

51:17 on that regard.

51:18 No. The current iteration, you know, it is a little fragile. So you have to treat it carefully.

51:24 Right. Or, you know, these strips, especially ones that don't have any casing on them, they're pretty

51:29 bendy here. And so if you break, you'll see in between each strip, there's, you know, the powered

51:34 data on the ground. So if this breaks or disconnects, then you lose, you know, you lose connectivity

51:40 to the rest of the strip.

51:41 It's like Christmas lights.

51:42 Yeah.

51:42 Yeah.

51:43 Kind of.

51:44 It's also, you know, I haven't, I've been thinking through some ways of wearing it,

51:48 but I haven't figured out a way to make the length adjustable, you know, without damaging

51:52 the components inside. So.

51:53 So there are some challenges and maybe, and maybe it's not all strip, right? Maybe there's

51:58 just like two parts that light up or something. And then there's like just a gap. I'm sure

52:02 you'll figure it out.

52:03 Yeah, that could work. That's always kind of the fun thing about, you know, the prototype

52:06 or the first build is like, how do all the pieces fit together? You know, despite your

52:11 best intentions, things don't always fit or look or work the way that you expect them to

52:16 or would like them to.

52:17 It's a really cool idea. And it's, it's one of these sort of practical things and it definitely

52:21 fits in with the style of stuff that you're doing. So I think it'd be cool. So I guess,

52:25 you know, we have the bag stuffing volunteers at the conference. Now there'll be the lanyard

52:31 building and programming thing that's the day before, right?

52:34 I bet those volunteers are not too thrilled by that idea.

52:38 No, that's gotta be a lot of work, right?

52:39 Mm-hmm. Yeah.

52:40 Cool. All right. Well, you got a few other things. You want to just quickly maybe tell

52:43 us about those?

52:44 So we talked about the Circuit Playground Express. I think the only thing I haven't shown you

52:48 so far is this.

52:49 So this one you got from this recent conference, you were just at the teardown.

52:53 I built this at a soldering workshop. And so this is a custom board. It's designed by Thomas

53:01 Hudson. He's local to Portland. He works for OMSI. So he does kind of a lot of electrical

53:07 work for them.

53:07 OMSI is a really cool like industrial and science museum here in town.

53:12 I'll share a link to his GitHub here. It's actually on the back of the board.

53:16 Oh, how cool. The GitHub is on the board. I love it. Yeah, yeah, yeah. That's really cool.

53:20 And this comes from, it has a crowd supply on it. And I don't know much about crowd supply,

53:25 although I've just recently seen a few things here. And it seems like there's a ton of this

53:29 kind of stuff available. What is that place? Do you know?

53:32 It's kind of like a Kickstarter, but for hardware projects.

53:34 Yeah, Kickstarter is specifically focused on these types of things. There's some really

53:39 cool stuff there. Okay. So.

53:40 I believe crowd supply sponsored this workshop, which is what allowed us to walk away with these

53:46 boards.

53:46 Sure.

53:47 So we just kind of started out with the boards here and then all of the components, you

53:51 know, I hand soldered on in this workshop, which was pretty fun. But this is based on the

53:56 NRF 52840 reference board.

54:00 So this is something that Thomas designed and it has Bluetooth connectivity on here.

54:06 A couple of LEDs, a couple of buttons.

54:07 A few buttons. And he put a bunch of kind of examples on online on his GitHub as well. So

54:14 this is going to be kind of an interesting reference board. And, you know, it shows you that if you

54:18 have the skills and the knowledge, you can build your own devices that run CircuitPython.

54:23 That's really cool. So there's probably a whole ecosystem instead of tooling around actually

54:28 designing the boards. Like if you want to have a board created, right?

54:32 This is not in my realm yet. It is something I'd like to learn this year.

54:36 It's super cool. It may never be in my realm, but I admire it. I share it's really cool.

54:41 One thing I do want to come back to before we run out of time though, is we talked about the

54:47 serial stuff with print, the mu editor, but there was another tip that you gave about actually getting

54:52 a REPL for the Python running on, on these embedded devices. So, I tell people real quick about that.

55:00 I think mu is a great project. I personally don't use it. I tend to write all my code in VS Code. I

55:07 really like the Python extension day to day. So I'll just have a side by side terminal open there. I'll

55:13 use screen to connect to the serial console.

55:15 And then you can get the print statements there instead of using mu.

55:18 You can see the print statements there. And then if you press, I don't remember if it's control C or

55:22 control D, there's a nice kind of helpful hint when you start your REPL. If you hit one of those

55:28 keyboard combinations in your serial console, you'll just get kicked into a REPL that's running on this

55:34 device.

55:34 Yeah, that's really cool. So you kind of cancel out of it and it just drops you into the REPL a little bit.

55:38 Yeah.

55:38 And you can kind of run stuff to stuff out. The nice thing about the PI portal or the PI badge that has

55:44 the screen on there is your REPL will be displayed on the screen.

55:47 That's super cool. I love it.

55:49 I can show you a little demo of that. But Scott, who I've mentioned a few times, he has one of those

55:54 IBM. I don't remember the model, but you know, those like really clacky old school IBM keyboards.

55:59 Yeah, the mechanical ones. Yeah, they're probably beige.

56:02 It's very, it's the beigest. So he has one of these PI portals just stuck onto a keyboard and you can

56:09 like type in the REPL on this really old school IBM keyboard.

56:12 Wow, that's crazy. It probably just has serial input or something straight into it, whatever the

56:16 keyboard does.

56:17 He brought that whole contraption to PI Cascades.

56:19 Okay. Yeah. How cool. That's awesome. And you also had some advice on how to exit out of screen.

56:26 There's a funny joke. I feel like some of these things are a little tricky. Like,

56:30 so if you want to generate a random string, obviously there's ways to do Python. But another

56:35 way is to put a first year computer science student in front of them and ask them to quit,

56:40 save and exit. Right. I feel like screens a little bit like that. Like there's a series of combinations.

56:45 You got to hit just right and it'll like let you out of it and stuff like that.

56:48 The important thing about screen is you have to press control A, which is kind of the leader key. And

56:53 then to quit, you press K. K for kill.

56:56 Cool. So let's touch on a couple other things really quick. So we talked all about CircuitPython

57:00 and programming in Python and people like Python, but maybe they're using this in an educational context or with younger kids or just people who are not programmers yet. So there's also a thing called Microsoft MakeCode. That's pretty cool. You want to tell people about that?

57:15 The nice thing about MakeCode is there's just this online based emulator. So you don't even have to have access to a device.

57:24 Actually, that's maybe the coolest part of it, right? Is that, yeah, it comes with a Circuit Playground Express emulator. So you can play around a little bit and decide if is this for me? Is this interesting? Then you get the, then you order the $25 little thing.

57:38 It's a kind of a block based editor, you know, like a scratch like editor. So really good for kids, really good for conceptualizing. They've done a lot of really interesting partnerships with Cartoon Network, for example. So there's a lot of, you know, Steven Universe is a really cute cartoon, not just for kids. Personally, I love it. I watch the whole series. And so there's a lot of Steven Universe projects that you can build on MakeCode. And then the code that you generate, it's portable. So if you do have a device, you can run it on there. If you don't, you can run it in the emulator.

58:08 You can also export it as JavaScript. Okay. And in the future, JavaScript, huh? Maybe even Python. Maybe. That'd be awesome. Okay. No commitment there, but maybe. That'd be awesome. Yeah. I do think it's really awesome that it comes with an emulator. Can you get like CircuitPython running on the emulator? Do you know? Like if you don't have a device and all the stuff we talked about, could you make that happen on the emulator that comes with MakeCode? I don't believe so. Okay.

58:38 Maybe someday. But yeah, if it outputs Python, that's kind of good enough. Eventually, if it ever does, right?

58:43 There is a group of interns working in Vancouver for the Microsoft Garage program that are doing some really interesting things with CircuitPython and VS Code.

58:53 That sounds really fun. What is Microsoft Garage?

58:55 It's kind of like a hack space, right?

58:58 Right. Like a maker space type of thing.

59:00 Maker space, yeah.

59:01 Okay.

59:01 So they have access to, you know, electronics and devices and, you know, kind of the stuff that you would find in a typical maker space.

59:09 And they're particularly focusing on the Circuit Playground Express. So I'm really interested in seeing their project.

59:15 Oh, that's super cool. Super cool.

59:17 So I get the sense from sitting here with you with all these cool things like, oh, I got one of these and I tried this here and I got this cable and, oh, have you seen this LED strip? How much fun this is.

59:25 But also how it would be much better to have that experience with other people who have these things. If you want to get into it, it probably makes a lot of sense to go to like meetups or maker spaces or other things like that where people are doing these kinds of things.

59:39 What advice do you have for people to like find other people doing this?

59:42 Yeah. So meetup is a great resource. If I lived in Seattle, I'd be going to Hardware Happy Hour.

59:48 Okay.

59:49 Scott comes with some of his projects that Wearables Maker I was telling you about from Teardown, Sophie Wong. She attends as well. That seems like an incredible community. Just at Teardown for the first time, I went to Control H makerspace here in Portland.

01:00:03 I haven't been to that one.

01:00:05 Just the friendliest group of folks, you know, really nice space. They have cool hardware. You can talk about joining, but, you know, meetup, local makerspaces. I think they're both fantastic avenues for getting in touch with some folks.

01:00:19 Who not only have these devices, but are open and willing to share. The lucky thing is, you know, if you live somewhere remote, you really don't need these resources. The guides online, you know, there are tons of YouTube videos.

01:00:31 Yeah, the YouTube videos. I suspect YouTube is pretty good.

01:00:33 I keep meaning to make my own. So maybe one of these days that'll happen. But, you know, I do kind of have a lot of devices and a lot of toys, but I didn't, you know, go out and buy these things all at once. Kind of worked my way up to it.

01:00:46 Yeah, that makes a lot of sense to start that way. I guess you could always, if you live in a place that doesn't have a meetup port, you could start your own, right? Like meetup.com is free and easy to use. Or even just create a virtual one, right? Like there's some virtual meetups, you know, that'd be pretty cool as well.

01:01:00 So yeah, it just seems like this is the kind of stuff that's more fun when shared. You kind of discover like, oh, you use that kind of nectar and you use it this way. That's really cool. I'm going to try that, right?

01:01:10 I think so as well. Adafruit has an online show and tell that's remote, you know, live stream sort of thing. So I haven't joined yet, but I keep meaning to.

01:01:18 Yeah, yeah. That sounds like a real fun one. All right. I guess we should wrap things up with a hashtag.

01:01:23 My coworker, Lena Hall, she's in the big data space. She gave me this idea for my PyCon US keynote. She told me to find a hashtag that hadn't been used yet.

01:01:33 You found a good one.

01:01:34 I found a good one. So it's hashtag Python hardware. So if you are interested in what the Python community is doing with hardware, if you want to share your own projects, if you want to talk about people that you're learning from or people that you're teaching, check out Python hardware on Twitter.

01:01:52 I've seen some activity after Python. So we had a flurry of posts and it did kind of drop down a little bit, but I really want to keep the hashtag going.

01:02:00 Yeah, let's keep it alive. And we'll obviously podcast listeners out there can use it and share little videos, pictures of what they're working on, their projects or GitHub, whatever, right? Like that'd be great to like bring that together.

01:02:11 Please do. Whenever I'm having a bad day, I'll go and look at that hashtag and be like, how can I be frowning right now when, you know, there are all these excited people doing these cool things with Python.

01:02:21 Inspired from your talk, right?

01:02:22 Oh, not just your talk, but now I'm blushing.

01:02:25 No, it was a good talk. And I actually linked to your Python keynote as well. It has a lot of pictures of what you're talking about here.

01:02:31 I'll try to post some pictures as well that will link to some of the show notes around it. But yeah, you know, this is really fun. Thanks for sharing all the stuff that you've been up to.

01:02:40 Yeah, thanks for having me.

01:02:41 You bet. Now, before you get to go, two quick questions. I kind of know the answer to this first one after watching work. But if you're gonna write some code, what editor do you use?

01:02:49 I'm a fan of VS Code, especially for this workflow in particular. Something that, you know, folks don't know is these devices are, they are trustworthy, but you don't want to have the only copy of your code loaded on here.

01:03:02 So you do want to have a copy locally, you know, preferably version controlled and get or in GitHub. And so the nice thing about using VS Code for this type of programming is I'll have a workspace, right?

01:03:14 So one of my workspace folders, to back up a little bit, a workspace kind of allows you to organize different folders, just kind of in one common area and work across them as well.

01:03:25 Right, even if they're not within the same parent or something.

01:03:28 Yes, yeah. Which is really great. So I'll have my, you know, CircuitPython folder, which is nice if the device is plugged in in there. But I'll also have my local folder in that same workspace. And that's the one that's version controlled and everything.

01:03:41 And if you have multiple devices plugged in at once, that's also very nice. My original editor that I loved was Emacs. And so I use VS Code with Emacs key bindings.

01:03:52 All right. Yeah, that sounds really good. And you just copy the file over to code.py whenever you want to run that code. That's great. And then notable PyPI package or other library, I guess you can use in this case, like stuff that's cool that helps you, you know, maybe do some CircuitPython.

01:04:07 There's no PyPI package that I'm thinking of. But one of the awesome Adafruit employees, her name is Katni. She writes a lot of guides. So she wrote a lot of the code and reference material that was on your Circuit Playground Express at PyCon.

01:04:23 So I would say check out her repositories for just really good ideas for how to get started with a lot of these things. And then the next is kind of a call to action for Brian Oken, because he was having a chat with Scott about the future of testing on CircuitPython. So maybe, maybe...

01:04:42 pytest extension, maybe, Brian.

01:04:44 Maybe, yeah.

01:04:45 Yeah, the gauntlet's been thrown down. So now he's got to do it.

01:04:47 Yes, Brian. Please do.

01:04:49 Perfect. All right. So people want to get involved in CircuitPython and Embedded Python, all this stuff. Where should they go? What should they do? Like, what should you leave them with?

01:04:58 Yeah, so CircuitPython.org is a great resource for kind of downloading stuff, getting started. GitHub.com slash Adafruit slash CircuitPython for the repo. There's also a Discord that's full of really friendly folks. And the community, just like with Python, is what makes this really, really special. So get involved if you can.

01:05:19 Awesome. Well, thanks again, Nina. It was great to talk to you.

01:05:21 Thanks for having me on the show.

01:05:22 You bet. Bye.

01:05:23 This has been another episode of Talk Python to Me. Our guest on this episode was Nina Zakarenko, and it's been brought to you by Ting and Rollbar.

01:05:31 Ting is the fast, mobile network, custom-built for technical folks. Use their savings calculator to see exactly what you'd pay. Visit python.ting.com to get a $25 credit and get started without a contract.

01:05:44 Rollbar takes the pain out of errors. They give you the context and insight you need to quickly locate and fix errors that might have gone unnoticed until users complain.

01:05:53 Of course. Track a ridiculous number of errors for free as Talk Python to Me listeners at talkpython.fm/Rollbar.

01:06:00 Want to level up your Python? If you're just getting started, try my Python Jumpstart by Building 10 Apps course.

01:06:07 Or, if you're looking for something more advanced, check out our new Async course that digs into all the different types of Async programming you can do in Python.

01:06:15 And, of course, if you're interested in more than one of these, be sure to check out our Everything Bundle. It's like a subscription that never expires.

01:06:23 Be sure to subscribe to the show. Open your favorite podcatcher and search for Python. We should be right at the top.

01:06:28 You can also find the iTunes feed at /itunes, the Google Play feed at /play, and the direct RSS feed at /rss on talkpython.fm.

01:06:37 This is your host, Michael Kennedy. Thanks so much for listening. I really appreciate it.

01:06:42 Now get out there and write some Python code.

01:06:43 We'll see you next time.

Back to show page
Talk Python's Mastodon Michael Kennedy's Mastodon