Monitor performance issues & errors in your code

#108: MicroPython and Open Source Hardware at Adafruit Transcript

Recorded on Tuesday, Apr 18, 2017.

00:00 Michael Kennedy: Wanna learn how to build an Iron Man like Arc Reactor accessory or maybe a solar charging backpack? What if you could program these devices with Python? Now, that would be cool. In this episode, we're gonna be talking about a project and a company combining to make this possible. This week, you'll meet Tony DiCola who works at Adafruit, a company making hardware programming accessible to everyone. And we'll also be talking about MicroPython which lets you program these cool devices in Python. This is Talk Python To Me, episode 108 recorded April 18, 2017. Welcome to Talk Python To Me, a weekly podcast on Python. The language, the libraries, the ecosystem, and the personalities. This is your host, Michael Kennedy. Follow me on Twitter where I'm @mkennedy. Keep up with the show and listen to past episodes at talkpython.fm and follow the show on Twitter via @talkpython. This episode is brought to you by Advance Digital and the Strange Loop conference. Be sure to check out what they're offering during their segments, it helps support the show. Tony, welcome to Talk Python.

01:26 Tony DiCola: Hey, it's great to be here, thanks a lot.

01:28 Michael Kennedy: Yeah, I'm really excited to talk about hardware and MicroPython and all the stuff that we got on deck today. That's gonna be really fun, but before we do, let's start with your story. How'd you get into programming in Python?

01:39 Tony DiCola: I think like a lot of people that you've had on this show, I got into programming just as a kid. When I was 13 or 14, I remember at that time, we had a 486 and I was using Qbasic to learn how to do programming. It's just a fascinating thing to me to understand like, wow, I can actually make something that controls the computer. And of course, I wanted to make video games and that seemed like the coolest thing for me. It was just a really interesting passion that I've followed as a kid. It just took me all the way through college, studied Computer Science. Python is interesting. I remember in college, this is around maybe the early 2000s or so, I started to hear about Python and it had been around for quite a while. I played around with it. I think I learned the basic syntax and then put it away and didn't use it for a long time. I went on and worked a lot in the industry with some of the managed languages like C# and I did a lot with like C++ originally. But I kinda came back to Python maybe about 10 years ago. I was working for an online service, SkyDrive. Well, it used to be called SkyDrive. Big file store service. We had to do a lot of data processing, so things like looking at log files and analyzing data. That stuff is not so fun to do in some of the languages like C++, so Python was like a perfect fit for that so I started to use a lot of that for things like manipulating data. And just really kinda fell in love with the language. It's turned into something that becomes kind of the first things I reach for now when I have some problem of whether it's even just like doing something on the desktop, like manipulating files, manipulating data. It's what I really like and enjoy using. It's become kind of like I'd say the primary language that I use. As I've worked with Adafruit, it's been something that's been interesting to explore of how you take Python and use it to control hardware, because that's been something that's been a little bit difficult. Hardware has typically been a lot of low level languages and direct access to the hardware.

03:34 Michael Kennedy: Right, that's the domain of C, right?

03:35 Tony DiCola: Exactly, yeah. So having like the C and C++ knowledge, that's what your bread and butter was. But nowadays, things have kinda changed a little bit so there are a lot of new processors. It's Moore's law, everything is getting faster even at the low end, so these little processors can actually start to run things like Python code. And so that's super exciting to me to start to see that kinda crossover there.

03:57 Michael Kennedy: I think that's really cool. A couple of questions. One, coming from static languages that are based on C with curly braces, how did you feel about coming in to Python with the whitespace and the dynamic types and what not?

04:11 Tony DiCola: Sure. Yeah, yeah, yeah. I think everyone maybe goes through like a phase of like it feels weird and you may be pushed back against it and think like, oh wow, this is horrible. I don't understand what's happening. The biggest thing for me was losing the destructor. In C++, I love having that knowledge of when some object goes in and out of scope, you can do certain things, and in Python and in some of these managed languages, you just don't have that control anymore. So yeah, your first reaction is kinda to push back. But then after a few years and using it for a while, you get into that zen of Python of just kind of understanding. Nowadays, I love how Python, it almost feels like clay. Like you can just model it into whatever paradigm of programming you like. Like whether you wanna do object-oriented or functional or some combination of those. Yeah, it was a little bit of an adjustment period but you kinda have to think more I guess Pythonically which was another thing that took a while to kind of figure out and understand what that means. But yeah, really not try to do things that you would do in the C and C++ world. Look more at, okay, how do you do that in the Python world and just adjust to that. Yeah, there is a definite period of changing.

05:17 Michael Kennedy: Yeah, that's interesting. I sort of remember that it seemed really odd to me using whitespace for managing structure and stuff. Then, I got really comfortable. It really talk a few hours actually to get comfortable. But then a week or so later, I went back, and I'm like, whoa, what are all these symbols and why is all these stuff here? This is so not fun anymore, and like a week ago, I really loved it. It was so weird.

05:37 Tony DiCola: Oh yeah, exactly. The problem is unfortunately with a lot of the curly braces. Everyone has different styles so you might read some code that looks completely different from the different style of code, and so it is nice that it makes things a little bit more uniform with the spacing.

05:50 Michael Kennedy: Yeah, yeah, for sure, for sure. An article that just came out recently was, I don't remember the title exactly, but it is something like Python's slow and I don't care. And the idea was, we should be optimizing for the programmer in a lot of cases. Much more than we should be optimizing for high performance or close to the metal. Do you think that's kinda happening in like small hardware type stuff? Like Python is making it more accessible and that's way better than making it 10% faster or something?

06:20 Tony DiCola: Yeah, I totally agree. It's definitely a big priority I think of making things easier to create and understand. Especially with a lot of devices and things that are coming out today. The big buzz word is Internet of Things, IoT, where every device has to be connected to the internet for better or worse unfortunately in some cases. In those cases, you're usually talking to web services and dealing with parsing a lot of data. Writing that kind of code in C and C++, it's doable but it's almost like a field of landmines where it's very easy to have like buffer issues or sometimes just really cumbersome to like parse JSON data, for example. But what's there a language like Python is great because you've got a lot of libraries that you can use or just the syntax can be a little bit simpler. I think that's where we'll start to see Python really shine is that when you have these more complex applications where you don't really care about sending like controlling some signal at some super high speed. And when you do care about that, there are ways that you can say, we'll just write that code in C or C++, put the performance critical code in a language that makes sense for that. But then all of your business logic, all of the things that you care about of how your application wants to work, do that in higher level language that it's a little easier to understand, easier to change. You can build your minimum viable product or whatever. You can iterate on it a little bit faster with it. Yeah, I think it's definitely an important thing to consider with Python is you have that simplicity that helps you do things faster when you don't necessarily need like that super critical hardware speed.

07:53 Michael Kennedy: Right, the speed innovation might be more important than how fast your nest can report the temperature or whatever, right?

08:01 Tony DiCola: Exactly, yeah.

08:02 Michael Kennedy: What do you day to day? You work at Adafruit, right?

08:04 Tony DiCola: Yeah, exactly right. I work for Adafruit, and basically, so my title is Engineer but I do a lot of things from the software side. I have a background in software but I did a little bit of hardware also in college. I have a Computer Science degree but did kinda mix Computer Engineering. Basically, I do a lot of the software and I originally started doing things with Raspberry Pi. Adafruit builds a lot of hardware, a lot of educational hardware and sensors and boards and things like lights that you can control or motors that you can move around. But a lot of that stuff wasn't, well, it was originally written or created to work with platforms like Arduino which are these little microcontrollers that you program directly. But then things like the Raspberry Pi came around, and we'll talk more about that later I'm sure, but the Raspberry Pi is a platform that's more of a Linux-based system that you can run actual CPython on that system. Maybe three or four years ago or so, I came around, was doing a lot of stuff for Adafruit and they brought me on to help port a lot of the drivers that they had in the Arduino world to the Raspberry Pi, so to convert that code from C and C++ to Python code. I did a lot of that and then just got a lot more involved in the products that Adafruit creates and helping to support them. The day to day for me is doing a lot of things like, I usually, there's some certain projects that we're working on. There's maybe a lot of things in like the Raspberry Pi world like drivers to write or to support. There are a lot of projects that we do also because a big thing that Adafruit does is teach people how to use stuff. We show people, it's not just good enough to sell your board that lights up and does things, you have to understand how to use that and how to control it yourself. And so we created a lot of different content like guides and tutorials that walk you through how to use a product. But they'll even walk through the concepts of like, okay, here's how temperature sensors work and here's how maybe you calibrate them, and here's how the equations work to convert the raw data into temperature reading and things like that. It's just a lot of interesting knowledge to share that helps people learn and they can kind of build on that knowledge to build different things and do their own projects. I'll do guides and things. Then in recent years, we've gotten into video because that's kind of become the new medium as far as like how people learn things. The internet started out just as a text thing and nowadays, like Netflix I think is 90% of all the bandwidth on the internet. Video's such a critical thing that, we're there on YouTube and actually Twitch and some of these livestreaming platforms too. I do some of those things too. I do some videos. I try to do a video every week just kinda showing off maybe things that I'm hacking on or if I didn't like a guide or tutorial, kinda walking through how to do that. Yes, a lot of showing people how things work.

10:49 Michael Kennedy: That sounds like a really fun job. I heard just the other day that YouTube is the second largest search engine on the internet.

10:57 Tony DiCola: Wow.

10:57 Michael Kennedy: Bigger than Bing. Bigger than Yahoo. Bigger than a bunch of others. There's Google and then there's YouTube. For the kind of stuff that you're doing, you definitely wanna be putting your guides there and what not, right?

11:10 Tony DiCola: Yup, exactly, yeah.

11:11 Michael Kennedy: It sounds like a really fun job that you kind of get to see what people need to know and then just come up with these little projects for them, right?

11:18 Tony DiCola: Yeah. I definitely consider it maybe like a dream job in some ways because it is really cool to have a lot of freedom to build things that are interesting to me. Then, yeah, to show people how I build things. I kinda think of myself in some ways as like if you remember Bob Ross who did the Joy of Painting. He did these instructional videos on PBS. He had his amazing hair, the afro. I don't have the afro, unfortunately, but I kinda think of myself, and I don't wanna be too presumptuous but I think of myself in some ways as a Bob Ross but more for codes. I like showing people how do you this project? Or for example, I'll do videos maybe that show how I convert a driver to run on the Raspberry Pi and how to write it in Python. I like to show process of creating that driver and show even the mistakes and things that happen as I code this up and I get some of the Math wrong and so you can watch me fidget around and figure out, like debug this thing. Because I think back to when I was learning, and it was so hard to just understand, to make that leap from beginner to a more experienced programmer 'cause back in my day, in the early days of the internet, it was like you'd be lucky to find maybe a text file or something that explains how something works. You'd be going to be bookstore and reading these 300, 400 page books and hoping to understand things. Whereas now I'm hoping that maybe the 13-year old me kid out there could watch me and hopefully learn a little bit and see like, yeah, this is how I can get into programming or how things can work for this.

12:53 Michael Kennedy: It sounds super fun, super fun. Let's talk a little bit about microcontrollers. You said that there's Arduino which is a microcontroller and then there's Raspberry Pi which is more like a computer on a board or something like that, right? What's the difference? When would I know to call which 'cause I didn't study hardware.

13:10 Tony DiCola: Good question.

13:10 Michael Kennedy: I didn't study hardware in college, I studied Math and

13:13 Tony DiCola: Yeah, totally.

13:13 Michael Kennedy: computer programming, right?

13:14 Tony DiCola: It's a good question. The honest answer it it's kind of a gray area because when you get down to it, they're both really similar. The computer that people are using right now, like if you're listening to this on your phone or on your desktop computer, on your laptop, that has a little CPU that just runs instructions. A microcontroller is the exact same thing. It's just a tiny little CPU that runs program instructions and it can do Math, it can do all kinds of processing. But the big difference is usually the microcontrollers are much more constrained. So they have much less memory. Your computer or even your phone, I think the new phones these days have like four gigabytes of memory which is kind of insane to me. We have a lot of resources like that. Whereas a microcontroller and Arduino has for example two kilobytes of RAM. So that's a huge difference as far as just the amount of things that you can store, the programs that you can have. Then the processing speed is usually a lot different too. In Arduino, it's usually like 16 or eight megahertz or so. Whereas your phone or your laptop or your computer is well into the multiple gigahertz, three or four gigahertz sometimes. There's a big difference there. There's some other differences as far as your computer is usually built to run an operating system which is a layer that does a lot of work for you. It can talk to your peripherals and it can control access to a lot of things. Whereas on a microcontroller, you're usually doing things, what they call bare metal where you write your code and it might be in a higher level language like C or C++ but it gets compiled down into the raw assembly language and it just controls that processor directly and has complete control over all the memory. There's nothing stopping it to say, hey, stop your program for a little bit to let another program run. Whereas on your desktop computer, you've got all kinds of programs running for that.

15:03 Michael Kennedy: I see.

15:06 Tony DiCola: The Raspberry Pi is maybe on one end where it's the more computer style where you have a full Linux operating system and it's running multiple programs, and you have a little bit less direct access to the hardware. You still do have pretty close control over the hardware but ultimately there's maybe some control that you give up in that case. Whereas with Arduino, yeah, you've got a much less powerful microcontroller. Sometimes in a lot of cases, they're a little bit less expensive though because of that. And so you've got less power, less memory but more control over the hardware. Your code runs directly on CPU and you can know for example if you write a loop how long it's gonna run, that nothing's gonna stop it or keep it from

15:46 Michael Kennedy: Right. Basically your program is the whole thing, right? It has access to the hardware, it just runs, and there's no other preemptive multithreading or anything like that, right?

15:56 Tony DiCola: Exactly, yup. The only thing that chip knows how to do is run your program.

16:01 Michael Kennedy: Very cool. Which one would you say is easier to work with?

16:04 Tony DiCola: That's a great question. There are advantages to both. In the microcontroller world, for the longest time, it was a little bit hard to get started especially before these platforms like Arduino came around because in a lot of cases those microcontrollers sometimes have very customer-specific toolchains where you couldn't just pick up the GCC compiler years ago and use that to write code for the processor that Arduino uses. Nowadays, you can because they've added support to those platforms. But for a while you had to get these custom toolchains and you have to figure them out and they'll usually be more constrained and you'd have to know how to set those things up so it was a big barrier to entry. Then platforms like Arduino came around and said hey, let's simplify all that stuff and let's just give you this prepackaged environment like a little IDE that you can download that does all that for you, so you're just writing your code. And you still have to use kinda maybe those higher level or the C and C++ style languages but we'll make it easier. It's not as hard to get started with microcontrollers. Whereas something like the Raspberry Pi that runs Linux, if you're already familiar with using Python on your desktop, just installing the Python, the CPython interpreter, it's really similar on those platforms. It's just learning how to hook up this Raspberry Pi and maybe how to connect to it. Then once you're connected, it's no different from your computer. If you have absolutely no hardware experience at all and you're used to Python on your desktop, the Raspberry Pi might be a little bit easier to get started with, but Arduino and those systems aren't as bad. The one difference with Arduino though was that the language is different, so you have to use C and C++. But it's a little bit easier when you use some of the systems that give you, here is a development environment that's kinda ready to go for that. I'd say start with Raspberry Pi but also look at things like Arduino and then MicroPython also that I'm sure we'll talk about how to get into Python on some of these little microcontrollers.

17:58 Michael Kennedy: Yeah, absolutely. The devices are interesting but to the Python audience, it's like, okay well, how do I use Python on this device? Back on episode 17, almost a few years ago, I talked to Damien George who was one of the guys that created MicroPython. Maybe tell us a little bit about what that is.

18:17 Tony DiCola: Yeah, totally, right. MicroPython, it's a really cool project. Like you said, it was created by Damien George I think maybe four years ago in 2013 or so. It's basically a Python interpreter that runs on these small memory-constrained environments like little boards that might be used with Arduino. It doesn't run on what is typically the Arduino that everyone uses, the Arduino Uno. That's a really low end. That's the one with two kilobytes of memory. It runs on a little bit larger microcontroller, so microcontrollers that have around like 32 kilobytes of memory or so, or even much more in some cases. But it is a Python interpreter. The nice thing is it's not the first Python interpreter that runs on hardware. I think there's been a few other embedded Python projects, and there still are some other ones around. But one of the big goals and things that kinda separates from other Python on hardware implementations is that it tries to be a very strict implementation of the Python 3.0 core language. So basically, all the features that you would expect in Python as far as like classes and functions, just the basic syntax, pretty much all of that is there. I think something like 90% of it is implemented and they're working on getting more support. So that makes it really cool as a Python user because you can dive in and there are less surprises. You do things that are a little more natural and it in most cases works. The one thing I should say though is that not all of the Python library is implemented though, so things like all the things that you've probably come to know and love on the Python world of just being able to import a JSON parser or import like a csv-parse(r) or something like that. Some of that stuff is there in the MicroPython world but again these run-on, these tiny little microcontrollers that just have kilobytes of memory. So you have to make some trade-offs there unfortunately.

20:03 Michael Kennedy: Yeah, that's a pretty serious constrained environment compared to 16 gigs of RAM.

20:08 Tony DiCola: Exactly, yup. And it's just different priorities. So how do you get Python to work in that kind of a world with much less memory?

20:16 Michael Kennedy: You basically put this on one of the microcontrollers. You put your Python code there and then your Python code basically is the only thing running on that chip more or less, right?

20:25 Tony DiCola: Exactly, yeah. There's not necessarily like an operating system that's running. Your code is, actually it's compiled into a bytecode internally by MicroPython, and then it executes that byte code. So it can be very dynamic and do all kinds of cool fun Python things.

20:40 Michael Kennedy: Nice, can you pip install to it?

20:41 Tony DiCola: A lot of that stuff is being figured out in the MicroPython world. Like I said, MicroPython is still pretty new. It's only maybe four years old which is actually really new in the grand scheme of things. And so there's not a super solid story yet on libraries and modules. MicroPython does have a concept of it supports packages where you can have a folder structure within init dot py and you can have modules and things that you import based on that. You can actually do this precompilation step where you convert a Python file into what's called an NPY file which is just precompiling it into bytecode because again, it's optimizing for the memory usage. Because if you're just storing the raw Python source code of your program, that's pretty large. You have big text files. And so, if you're trying to fit a bunch of Python code onto like 256 kilobytes of flash memory, you're gonna run out at some point. There are little optimizations you can make like precompiling some of the stuff into bytecode. But yeah, there's no pip, well, there is a pip for MicroPython but it's not the same pip that you might expect on the desktop. It's not like you connect to your board and run a pip command, and it goes to the internet and downloads your package. It's more on your desktop. You can grab these MicroPython libraries and then you still have to get them onto your board and import them yourself. I think in the future though, there'll probably be more of a story for how you get packages and things. But again, in the MicroPython world, definitely they're trying to follow the Python kind of paradigms and systems out there. Using things like PyPI and pip in the tools like that to make it work.

22:24 Michael Kennedy: This portion of Talk Python is brought to you by Advance Digital. How would you like to build one of the most visited new sites in the US? That sounds fun. The folks at Advance Digital would love to talk to you. They're primarily a Python shop located in beautiful Jersey City, just one subway stop from Lower Manhattan. Spend your time building an amazing web app with Python and do it with a small team of developers focused on agile development. Are you gonna miss PyCon this year 'cause your company wouldn't fund the travel and expense? If you join this team, they'll cover your conference and training initiatives. It's time to take your Python to the next level. Build an amazing web app. Get started by visiting python.advance.net right now. One of the things that Damien talked about was that you could basically hook a lambda expression directly up to a hardware interrupt. That kind of blew my mind.

23:11 Tony DiCola: Yeah, it's really cool. I love it too because like I said with Python I love how you can make it work the way you want. So if you wanna do like really cool functional programming, you've got all of the constructs to do that in Python. You've got filter and map and all these cool functions you can chain together and stuff and do reactive programming or whatever. It's fascinating to transfer that over to the hardware world and start playing with it because at the end of the day, I mean, hardware, it's just a different set of functions you're calling. You're calling functions to control the voltage of an output or to read an analog input or something like that. Having that core language and yeah, doing lambda expressions with hardware interrupts, it is a really cool thing. And again, it's so interesting to me because for the longest time, we really didn't have that in the hardware world. You've had the lower level languages like C and C++ that are static and everything is done up front ahead of time because you needed optimized memory and stuff like that. Yeah, it's kind of a brave new world in some ways of figuring out like, because, yes, you can hook up a lambda expression to a hardware interrupt but maybe we'll learn like, well maybe you shouldn't. Maybe there are reasons why. It maybe doesn't make sense or it gets too complex or something, but that'll be fun to figure out what works and what doesn't work.

24:20 Michael Kennedy: Yeah, absolutely. Being new, it really makes it exciting as well. When would make a lot of sense to use MicroPython and when would you maybe pick something else?

24:30 Tony DiCola: MicroPython, it's good at some things and it's maybe not as good at other things right now in the embedded world because again, you can't get away from the fact that you're running on a much more constrained environment. You have much less memory than your desktop computer. Things that you might do in the Python world that you might not even realize take a lot of resources like having a tight loop that's creating a bunch of objects which might just be a few lines of Python code. You might not even realize what's happening behind the scenes there. That might not be great in MicroPython because sure, it can run that code, but it's gonna be allocating a lot of memory and then you're gonna be having this garbage collector kicking in and things. MicroPython, it's really good at like I said, doing the high level business logic of I'm creating like an IoT device and I need to talk to a web service and get some data and process it and then maybe actuate some devices or maybe read some sensors and then send that reading up into the cloud. It's really good at being kind of that glue that goes between the low level hardware and other different things that you're doing. It's great for that kind of thing. It's also great for like when you wanna update and change how something works, because again, it's all interpreted code so you can change the code on the fly. If you want to change how your program runs with like Arduino or C and C++ or older embedded software programming, you have to connect that board to your computer and just completely reprogram it. Whereas with MicroPython, if you can just change that Python file, it could even just be downloading that file from the internet itself. You can send new code to the board and you can start running it. Actually, that's a cool use case that I heard about recently. I think the European Space Agency, they've been looking at MicroPython and potentially going to use that on satellites because they like that idea of being able to send new code up to the satellites and have it just run that code instead of having to reprogram the satellite while it's in orbit because sometimes things go wrong. You're writing to flash memory and something might get corrupted. I think they like having that kind of capability. You can do that with MicroPython. Then the other cool thing too that you get, because it's interpreted, you've got a REPL. You've got an ability to just connect and arbitrarily run Python code. That's a really good case for education and learning and something I think that we'll see a lot with MicroPython where it's a lot easier to learn about things like hardware when you can just connect to your board and run a function that says turn on this LED or turn off this LED or read this microphone value, and you can get that result back directly and play with it and maybe build little programs from that. MicroPython's really good at that stuff.

27:12 Michael Kennedy: Yeah, that sounds so much better than I'm going to recompile and ship a new binary and restart the device and all that kind of stuff, right?

27:20 Tony DiCola: Exactly, right. There's just more steps, more complexity, especially for people that are learning things. It's difficult enough to even just understand how the tools work and things like that. And so just the less things that you have to learn, the easier it will be and the more it opens up to more people to use.

27:36 Michael Kennedy: Yeah, that's really great. Could you have the device auto-update itself or the Python auto-update its own code on MicroPython with over-the-air updates type things?

27:46 Tony DiCola: Yeah, you definitely could. There are few different things you could do. The way MicroPython works is there's an interpreter like a firmware that's written onto to the chip that has the implementation of MicroPython. It has things like how it converts your Python code into bytecode and how it executes that, and how it turns your Python functions that might talk to hardware, how those actually access the hardware. Then there's actually a little file system that MicroPython adds which is one of the cool things that it does differently or maybe that's an advantage over systems like Arduino, in MicroPython, there's a little file system that all the boards have. It's just like a FAT file system, so you can put .py files on there but you can also put text and data files on there. That's a case where, yeah, if you wanna change your program code, you just have to figure out a way to update that file system and you can usually write to that file system using all the same Python functions like open, read, write. So you could build a project where maybe it looks to a web service to download its latest code and it can see, okay, what's the version of my code, and grab the latest code and update it. That would update your Python code. Then updating the MicroPython firmware itself, it's a little more challenging. There are ways to do that. Some boards and systems support this concept of doing an over-the-air updates. It's usually more complicated because when you're changing the firmware itself, you sometimes have to have like two copies of it and then you tell the MicroPython to swap over.

29:14 Michael Kennedy: Yeah, I was thinking more of just your code and just letting the MicroPython be.

29:19 Tony DiCola: Exactly, yeah. It's great for that because it's just a .py file, and so if you've got a way to tell the board to update that file, in a lot of cases, it's easy as that.

29:29 Michael Kennedy: I'm thrilled to hear that the European Space Agency might be using it. How cool is that?

29:33 Tony DiCola: Yeah, Python in space. That is just too cool, I think. Really, really neat, yeah.

29:38 Michael Kennedy: Yeah. You hear about the thing is not responding. This rover is lost because something went wrong with its software and what not. This is as simple as you'd go, we're gonna ship you a few bytes of a new py file and you're gonna come back to life. That's pretty cool.

29:54 Tony DiCola: Yeah, totally. Maybe not too far off in the future, maybe it'll be something that we could even do ourselves. They've got cube satellites and maybe you've got kind of private enterprises sending shuttles and rockets and things up. Maybe one day, there'll be a Raspberry Pi that I can send up and start controlling myself with Python. That would be really fun.

30:14 Michael Kennedy: Yeah, hook a little camera to it. That'd be awesome.

30:16 Tony DiCola: Oh, yeah.

30:17 Michael Kennedy: All right. That's when it's a good idea to use it. Maybe when would you say probably not the best option?

30:24 Tony DiCola: The one big thing though with MicroPython is again, it's interpreted so you do pay a cost as far as performance goes with that. It's a significant cost in some cases because these little microcontrollers, they run at like maybe 80 megahertz, 40 megahertz or so.

30:38 Michael Kennedy: It's like a 486DX.

30:40 Tony DiCola: Exactly, right. The kind of computer when I got started programming, I think it was a 486, it was 50 megahertz. Even that's probably faster than some of the systems we have now. For a lot of people today that maybe got into programming later, they might not realize that computers back then were pretty slow. That could be a little bit of shock to some people where especially if you've done things in Arduino like blinking LED. You have a little loop, you turn it on, you turn it off, you sleep in between there. You tried the same thing in Python and it might not work as well or at least it might not go fast as Arduino. Things that are timing critical where you're trying to generate a signal that maybe tells some hardware, like talking to a Servo, you need to generate a signal that has a very specific pulse width or talking to a lot of these RGB LEDs, these NeoPixel strands. They need a very specific pulse train sent to them. That type of stuff is more difficult with MicroPython because you've got less speed because it's interpreted. That just means that rather than your code running directly on the CPU, you've got code on the CPU that has to load your code from memory and then figure out, okay, what is it doing? Then actually convert that into CPU instructions. There's overhead with that. Then there's also a little sometimes overhead with the memory management where in the Python world, you don't worry about managing memory because Python does that for you. But in the embedded world when you're in this memory-constrained environments, it doesn't come for free. There's no magic wand. When MicroPython manages your memory, it might not manage it the best way. It might be creating and allocating memory and then it has to go clean things up and so that takes some time. Anyways, the long story short, things that are timing critical are more difficult in MicroPython. Things that need that direct access to the hardware sometimes are more difficult. But it doesn't have to always be the case. I say more difficult but I don't really mean that it's impossible to do that stuff because the really cool thing that MicroPython did is make itself very easily extensible so that you can combine both C code and Python code in the MicroPython firmware so that when you need to do that advanced signal generation, you can drop down to a C function that you implement that does that and has very critical loop code and things like that and very tight constraints on how much memory it uses. Then you can just expose that as a Python function. It's very similar syntax to how you do C extensions in desktop and CPython.

33:02 Michael Kennedy: Yeah, that was my next question. That sounds like there's you escape hatch for those little parts that are really critical.

33:08 Tony DiCola: Exactly, yeah. I think that kinda plays back to the really big advantage of MicroPython of getting into that world where you do your low level interface logic and all that performance critical code in C and then do all of your business logic and all that interesting stuff, the things that make your smart device smart, do all of that in Python and you get all the advantages. You get both advantages. You get maybe easier, faster to iterate in the Python code but then all the low level and fast control in the C functions.

33:35 Michael Kennedy: Nice, so let me run some examples by you and you tell me if good or not good for MicroPython.

33:41 Tony DiCola: Totally, yeah.

33:42 Michael Kennedy: If I was a farmer and I wanted to have an automated irrigation system or something that managed, like watched the pH level of all my dirt around all my plants and reported that back and maybe controlled valves from water or whatever. It seems like something like that would be totally fine for MicroPython.

34:02 Tony DiCola: Yeah, I think that'll be great. That's a good option because you're talking of little sensors and in a lot of cases, those sensors have kind of a standard interfaces. There are some protocols. One is called I2C or another one's called SPI. MicroPython has a lot of good support for that. Your hardware itself kinda generates those signals and knows how to talk those protocols. Yeah, it's easy to hook up external sensors in a lot of cases and just talk to those directly from MicroPython. Yeah, that's a great case. Then when you wanna report back to some central service, it's amazing because you've got all of the great Python syntax and fun things you can do there.

34:37 Michael Kennedy: Okay, that sounds really awesome. What if I wanted to outfit the front of my drone with a camera. I don't have a drone, my brother has a drone, but I don't. With a camera, and when it saw another drone, it would change color or something like that. Almost like an image recognition thing or something like that. Would that make any sense?

34:56 Tony DiCola: Yeah. That's a good case. Drones are interesting because yeah, with the drone case, maybe that case of like recognizing a thing, you might be able to do that in MicroPython. That would probably be a little more challenging just because when you get in to like advanced image recognition stuff, you probably wanna use something more like a Raspberry Pi where you can use like OpenCV and some of these really powerful and amazing image processing libraries because you probably don't wanna have to like hand-code a neural network or something in MicroPython yourself, yeah, exactly.

35:24 Michael Kennedy: Right, but if I wanna use like a TensorFlow or something, like it obviously wouldn't make any sense, right?

35:29 Tony DiCola: Exactly, yeah. Use the tool for that. But then the other thing with the drone too, you might think like, well, could I have the drone, the code that controls the motors, could that be in MicroPython? Like, that's controlling the actual flight of the drone. That might be a case where you wouldn't wanna use MicroPython because that's a very critical control loop where you need a lot of speed. You need just milliseconds and microseconds of the sensor detected I'm tilting slightly so now I need to offset this motor and make it spin a little bit faster. If you've got a loop in Python that has all these interpreter overhead, that could be the difference between your done crashing or it staying in the air there. That's maybe a case where you wouldn't want MicroPython to do that really timing-critical control loop.

36:14 Michael Kennedy: Okay. But maybe if it's a Raspberry Pi, I could do like a C extension in there, right? Something like that, some combo.

36:21 Tony DiCola: Exactly, yeah. Actually, there's a board that's even better for drones these days, the BeagleBone boards, BeagleBone Black is one, because they're kind of cool. They're like the Raspberry Pi but they add a little microcontroller that sits alongside the main processor that runs Linux. So you can run code on there that the Linux operating system doesn't even touch at all. That's where you put your little super critical control loops and things like that. Then your Linux processor can communicate with it and send it instructions and things like that. Yeah, lots of options in that case.

36:51 Michael Kennedy: That sounds really cool. What other hardware could I use MicroPython on?

36:55 Tony DiCola: Great question. Again, it's a little bit new, it's only four years old. There's just maybe a handful of boards right now that support it. The original board was called the PyBoard and it's a pretty powerful microcontroller. It's this STM, I think it's an F4. It's basically a fancy processor. It runs at a couple, I think at like 70 or so megahertz, something like that. That was kind of the first board. It has a lot of peripherals and features. Then the ESP8266 is another board that came around and this is a really popular board. It started out as the brains behind an internet connected light bulb. Then the company that created it, they released I think the developer toolchain. It's a company called Espressif. They realized like, oh, people like hacking this thing. This is cool. Because it was just a little microcontroller with a WiFi radio. It can run code that talks to your WiFi network and web services. And so people kinda rammed with that and they integrated it into Arduino and people take a lot of control over it. But that became a platform for MicroPython. There was a big Kickstarter for it a few years ago, and that became a really great platform for MicroPython because the ESP8266 has a good amount of memory and it has that WiFi chips so you can do lots of cool stuff. That's a great chip. Then let's see, there's some other boards. The WiPy and the LoPy, and some of these boards that Pycom creates that are basically similar to like the ESP8266, more Internet of Things oriented but there are also moderate amounts of speed and performance and things like that for it. I think the last board that's really interesting that we're probably gonna see a lot more of these types of boards are the micro:bit. The BBC micro:bit was this really neat little board over in England that they gave to I think all of the seventh grade students in the country. They made like maybe millions of these boards or hundreds of thousands of them. They're little boards that have these tiny little microcontrollers that are a little more powerful than in Arduino but not much more powerful. I think they only have like 16 kilobytes of memory and there's a really nice effort to port MicroPython to run on those boards. The cool thing with the micro:bit is that it's not just the microprocessor, it has a few peripherals. It has some LED's, it has some buttons and things. An idea with it was, you give this to a kid who's learning programming and they can get started right away. They don't have to learn how to solder all these stuff together or how to install a toolchain. They make the tools really nice and easy. That's a really cool fit with MicroPython because with things like the REPL where you can just connect to the board and start running Python code. On the micro:bit, it's even cooler because you just literally pick up this board, plug it into your computer, connect to a terminal, and then you start typing Python code and you're turning on LEDs and you're controlling a speaker and you're making it say things and listening to microphones and stuff.

39:32 Michael Kennedy: That's really cool. Does it ship with MicroPython?

39:34 Tony DiCola: It does not, I don't think it ships with MicroPython. But it's really easy to have a web editor. I think if you just search online for the BBC web editor, you go to a web page and it will give you, like you type in your Python code on the webpage and you click a button, it gives you a file, and then you just drag that file onto the board. The board shows up as a USB drive and it programs itself based on that. It's really easy to get MicroPython going on it.

39:59 Michael Kennedy: This portion of Talk Python is brought to you by the Strange Loop conference. Do you love to present technical topics? Are you looking for your first major speaking event? The Strange Loop conference just announced their call for proposals. Whether you're interested in languages, web development, distributed systems, AI, security, or something else, be sure to submit a proposal to Strange Loop by May 8th. There are opportunity grant applications for developers in underrepresented groups. Last year, they are able to grant travel, hotel, and admission for 115 attendees, and they're hoping to expand on that for 2017. Don't just attend the Strange Loop conference, submit a talk and you'll be speaking at a beautiful venue in St. Louis, Missouri September 28th to 30th. Visit talkpython.fm/strangeloop to submit your proposal. Hurry, it closes May 8th. One more hardware question for you. One of my, well I'd say my favorite smart watch is the Pebble Time Round. Really thin, really small little lightweight smart watch. Those guys recently went out of business which is a super sad story across the board. Could you build something like that? Could you build a smart watch type thing with MicroPython?

41:07 Tony DiCola: Oh yeah, definitely. I think that would be a great project in MicroPython. If you just think of the components of the smart watch, it's pretty straightforward. I mean, you've got your processor. You have a display of some sort, and most displays have standard interface like either this I2C or SPI protocol that most of the MicroPython boards support. So you could get like a little OLED, an organic LED display or there even are ePaper displays which are the really nice, kinda like the Kindle style or what the original Pebbles used.

41:35 Michael Kennedy: Yeah, the Pebble Time Round has a color e-ink.

41:38 Tony DiCola: Exactly, yeah. You could get one of those displays and that talks usually like an I2C or an SPI protocol. You'd have to figure out from the data sheet what are the commands to send it, things like that. But that would be perfect. That's easy to connect to the board. Then the actual clock part, you might want a real-time clock connected to it where these are little hardware peripherals that have, or basic little watches that just run off of a coin cell battery so that your main watch might go to sleep just to save power but this thing will keep the time running so that it always knows what's happening. That's all you need for maybe a basic smart watch or a basic watch. Then, if you use a board that has a Bluetooth radio or a WiFi radio, then you can go crazy and add all kinds of things. Like okay, I want my watch to connect to some internet service and pull down a little weather or the time or things like that from it. Yeah, that would be a great case for MicroPython too because it's again, you wanna write all that fun watch logic in Python code but you don't wanna write necessarily maybe like controlling the e-ink display. That's maybe not as interesting. You maybe use a library or something like that or some C code potentially to talk to it.

42:45 Michael Kennedy: Yeah, and you will also have a great extensibility model or even wanna write apps for it, give a little Python file or something like that, right?

42:50 Tony DiCola: That would be too cool. Would that be amazing? You just plug your watch in your computer and you just edit .py files on it. That would be really cool. Like 13-year old me would just be probably freaking out. That'll be so much easier than trying to figure out like, I don't know, it would be more interesting than I guess like opening up QBasic and loading Nibbles or Gorilla or something like that.

43:08 Michael Kennedy: Yeah, for sure. All right. Let's move off of MicroPython just a little bit and let's move into the broader hardware world and talk about the company that you work for and what you guys are doing there with Adafruit. What is Adafruit?

43:22 Tony DiCola: Adafruit, it is an electronics company that helps make electronics more accessible to people. It was founded about I think 11 years ago in 2005 by Limor Fried. She goes by the handle Ladyada. Found it in her dorm room at MIT. She's a brilliant electrical engineer. Really, the core DNA of Adafruit is showing people how things work. Like taking the mystery out of electronics. A lot of things that Adafruit did early on were things around like Arduino or even before Arduino actually existed of like, hey, I'm building, I'm an artist and making really cool installation, and I need to control some of these lights. I know how I wanna animate them but I'm looking at all these wires, and what do I do now and how do I make this stuff work? Limor did a lot of great stuff. She had a website ladyada.net where she would show tutorials that show hey, here's how you program this little microcontroller. Here's how you set up this crazy toolchain and make it as easy as just follow these steps and you'll get the stuff working. It's just built on top of that because people realize like oh okay, now I can program this microcontroller, but I wanna connect it to things. I wanna talk to the sensor. Unfortunately for a while, it was difficult in that if you wanted to maybe use like a temperature sensor, well you'd have to build a board that has all the supporting hardware for it, because you buy the sensor but when you read the data sheet for it, which first of all you have to figure out how to read data sheets. Then you realize like, oh man, I have to put this on a board. I have to connect all these components to it, maybe some capacitors or other things to it. Then at that point, it's like uh oh, now I have to learn how to make a circuit board. That's a little annoying and difficult. And so Adafruit does a lot of things like builds a lot of breakout boards. To take some of those interesting sensors and things and give you a board that just does all that ground work for you of, okay, I buy this board and then it gives me these connections that I care about like maybe the I2C or the SPI connection so that I can just run a few wires to my Raspberry Pi and then grab the code that we published that knows how to talk to this device. So that now you can just start running some Python code on your Raspberry Pi and dealing with it. Again, it's all in that pursuit of making electronics easier for people because we wanna open it up and make it less of an electrical engineer's playground and more of a playground for anyone. That's the cool thing and the thing that I get a lot of joy out of is just seeing what people do with this. Seeing someone who's an artist who's totally intimated by hardware and circuits and thinking, there's no way I can make this thing work, and then building real cool interactive things or things that blow your mind as far as like interesting art installations or even beyond that. Things like students and learning and just hobbies. I still love just the projects that people do, like hey, I have my barbecue grill and I wanna build a temperature sensor to maybe control the opening and closing the vents on it to smoke a brisket or something like that. They're just fun things that someone could do. Sure, you could buy probably like a $4,000 or $5,000 barbecue that does that. I like the kind of do-it-yourself aspect in that too. Again, Adafruit is all about helping people do things themselves and taking the mystery out of a lot of this electronic stuff.

46:28 Michael Kennedy: Yeah, that's really cool. It's a great mission and you all create more creators, right?

46:32 Tony DiCola: Exactly, yeah.

46:34 Michael Kennedy: Limor was talking about open-source hardware at Adafruit. I can imagine what that means, but what do you guys think that means to you there?

46:41 Tony DiCola: Open-source hardware and open-source in general again is kind of a core of Adafruit because from the very beginning, Adafruit was created to teach people how things work. It wouldn't have been very successful if it's like, get this board, but if you wanna know how it works, that's off limits, we can't tell you that. That's our secret sauce or whatever. We realized early on that telling people how things work doesn't hurt. It helps you because will just build on your thing and they'll use more of your stuff because of that. But at the core, so open-source hardware, there is actually the Open Source Hardware Association which has, I think there is an official definition, but the basic idea is you release the schematics and build materials and how your device is built so that someone could replicate it themselves if they wanted to. The same idea with software. Something like the GCC compiler. All of that source code is out there so that if you want to add a new language to it or whatever, you can take it, you can study it, and you can extend it, and all of that code is available for you to change. Same thing with open-source hardware. If you want to build one of these little temperature sensor breakout boards, you can do that. You can get the design files. You can see how all of the layout was routed and you can tweak it if you want or you could even just go and build it yourself. You're gonna need like a big robot pick and place in a lot of cases to assemble the board. That's one of the advantages of getting it from Adafruit is that we've done that for you. Yeah, we don't wanna constrain people. We wanna put it out there so that people can build on it and learn from it. The whole, everyone kind of grows when everyone see how things work.

48:14 Michael Kennedy: Yeah, that's great. It seems to me like 3D printing would be a good complement to these kinds of things.

48:20 Tony DiCola: Yeah, definitely. Especially for a lot of the projects that you see in the maker world of, yeah I have, maybe I'm building a costume in cosplay. I have some cool, maybe like a sword that I wanna light up or something. Yeah, being able to make some custom enclosure for it is really cool. I love it too, just seeing with 3D printing, people using it in different ways. Again, going back to the art aspect and building cool sculptures and things. They're just fascinating. I think there's a lot more that we'll see with 3D printing. 3D printing dovetails very nicely with microcontrollers because you're building things and usually you want those things to move or sense the world or light up or something like that.

48:59 Michael Kennedy: Yeah. At least it would be in some kind of enclosure so it looks shiny and not just a bunch of wires, right?

49:04 Tony DiCola: Right, not the box of wires that might scare airport security or something like that.

49:08 Michael Kennedy: Exactly. He has a bomb.

49:12 Tony DiCola: It's always difficult for me. I travel sometimes in Maker Faire and I always worry every time I go through, I'm like, I just know they're gonna look in my bag and I've got this box of wires and just having to explain to someone what an Arduino is. It hasn't happened yet but I know at some point I'm gonna have to do that.

49:27 Michael Kennedy: It's coming, yeah, yeah, yeah. One thing I saw you guys have is the Adafruit WebIDE. What's that?

49:34 Tony DiCola: That was something in the Raspberry Pi world. Basically, it's a program you can run in your Raspberry Pi and it gives you a little web interface to type in code and run it like Python code. I think you can even access the file system. It came about actually in the early days of the Raspberry Pi. The Raspberry Pi, I think it's about four years old now. In those early days, they initially spend all their time getting this $35 computer out there and making it work and turning Linux into something that a beginner could reasonably get started with and use. There wasn't-

50:06 Michael Kennedy: You mean telling a sixth grader to fire up Emacs is probably not the way?

50:10 Tony DiCola: Exactly, yes. Early days in the Raspberry Pi world, it was still a little bit, I mean it was good. They had a graphical interface. But it was maybe a little more difficult sometimes to just get going and start programming things. Yeah, we created that a way to do some of these early Raspberry Pi tutorials to show people like, okay, here's how you connect to your board and here's how you start running code. But nowadays, the Raspberry Pi foundation, they have a lot of time and they've grown quite a bit. They've done a lot more polish as far as like how you go from zero to starting running code. I mean, they have their new PIXEL operating system which is really nice re-skin of the Linux environment. They've got some nice editors. I think they're like graphical block-based editors and things now. These days, maybe WebIDE hasn't been updated as much to or you might be able to get more things from kind of what Raspberry Pi's doing, but it was originally created as a way to get code running quickly on the Raspberry Pi for people.

51:02 Michael Kennedy: Sure, very cool. One of the things at Adafruit I really like is learn.adafruit.com. There's just all these projects and some of them are kinda like you talked about at the beginning like here's how you understand batteries or displays or whatever, but a lot of them are, hey, I made a really cool thing for Halloween and here's how I made it. These projects that you could make or take and customize, right?

51:25 Tony DiCola: Yeah, exactly right. There's a ton of things. I just checked there are 1,200 tutorials on the Adafruit Learning System. There is an immense amount of things there. Yeah, you're right, it falls into a lot of categories. Every product usually has a guide that goes with it that just shows you, here's what you do when you get it, here's how you might have to solder some things to it, or here's how you download the software to get started with it. But then yeah, like you said, there are lots of projects that just serve as like sometimes it's inspiration. Like, hey, this is cool. Like the GPS dog collar. Maybe I wanna make a cat-dog collar or something like that, so I can take some of the same code and ideas from that. Yeah, inspiration is a good thing for it and just kind of showing off cool things you can do with the projects. There are also some guides that yeah, teach the basics. Interesting things. There's one guide that tells you how to do sensor readings and analog readings. It seems like a boring topic of like, okay, how do you read an analog digital converter and then how do you smooth out the data to make it maybe not jump around as much, and stuff like that. There's a guide to learn stuff like that which sounds boring but it's actually a really critical thing that you need to learn when you deal with these analog things.

52:36 Michael Kennedy: Yeah.

52:37 Tony DiCola: We span quite a broad range. I don't think I know of any case where we looked this on and said, no, that's not a guide or something. Almost anything, we can turn into a guide because it's either teaching someone how to do something or showing how a product works or just giving inspiration. Some of the guides and projects are really advanced. There's some of these light painting projects where like the Raspberry Pi light painter. You take a wand of these RGB pixels and when you wave it around, you can do the persistence of vision effects where if you light up the pixels in a certain time and then you have a camera that has a long exposure, it can average out the movement and so you can see really cool things floating in the air. It looks like an image floating in the air. But some of those projects can be a little more advanced to build. It might require more difficult soldering and stuff like that. Everyone might not wanna build those but just seeing that like, wow, that's really cool. I have no idea that I can make something that looks like that. I mean, it may be inspired you to do something a little bit simpler or more capable.

53:38 Michael Kennedy: Yeah, that sounds awesome. I've picked a few that I like. I'll read them off so people can get a sense for what's up there. One that you guys had was an Onion Pi, P-I, not P-Y, which was like a Raspberry Pi made out of Tor proxy which is kinda cool. A GPS dog collar for your dog's fitness. LED bicycle things. Wrap it on your bike and it can light up in certain ways. A DeLorean time circuit. A Raspberry Pi streaming radio for like Pandora type stuff. There was a couple of Halloween things like costumes and what not. I think my favorite was a solar charging handbag which is pretty cool.

54:12 Tony DiCola: Yeah, that's a great one. I love those projects where it's the kind of thing where you could see that being a commercial product. Something that people would probably pay hundreds of dollars for and just with a few dollars of components you can build it yourself and customize it and make it the way you want. Like if you want a cool design or whatever, if you wanna put into some really neat funky bag that you have, you can do that. Yeah, it's great stuff.

54:33 Michael Kennedy: Yeah, that one looks cool. That's one of the things like I could see myself using that. GPS dog collar, interesting, but probably not.

54:39 Tony DiCola: Yeah, yeah, right, right.

54:40 Michael Kennedy: What are the couple of common things you see created with the Adafruit hardware?

54:45 Tony DiCola: I think there are a couple standout projects that are very Adafruit, has Adafruit DNA in them for sure. The PiGRRL which is basically a Raspberry Pi that you put into a 3D printed enclosure that looks like a Game Boy, like a portable game playing unit. You add a little display to it. We have a display called the PiTFT. It's a real low cost display that you just snap on to the Raspberry Pi. It's cool because it gives you what looks like a Game Boy so you've got your direction pad and a couple of buttons. But because it's a Raspberry Pi, you can run any games and emulators and things that the Raspberry Pi has. You can play old Nintendo games or Super Nintendo games and stuff like that on there.

55:25 Michael Kennedy: Nice.

55:26 Tony DiCola: Yeah, that one's super popular. I think it's just-

55:27 Michael Kennedy: Can I play Pitfall on it?

55:29 Tony DiCola: Oh yeah, you could definitely play Pitfall.

55:30 Michael Kennedy: Nice.

55:30 Tony DiCola: You could play the 2600 version. You could play the Super Nintendo, whatever versions of it. Yeah, lots of options there. Another one is the Cupcade which is a mini-arcade cabinet with the Raspberry Pi. This one's fun. Both of these actually. I've seen kind of commercial projects now. I think I was just in a Target now recently. I saw this tiny little arcade cabinet that reminded me of this Cupcade project which now is I think like three or four years old. But it's a little miniature like an arcade cabinet, like you might imagine a Pac-Man cabinet with a little joystick and a couple of little buttons. But again, it's got that little Raspberry Pi behind it in the display and so you can run a full emulator. You can run all kinds of arcade games. Those are definitely really popular projects. Things that use Raspberry Pi are really popular because the Raspberry Pi community is really large. Adafruit, we're really well-known. We did a lot of things with wearables, so we have some different boards that are great for sewing on to clothing and controlling things like lights and sensors and stuff like that. We have fun projects like that.

56:28 Michael Kennedy: Nice. I saw you had made, I saw some picture where you had one of those Arc Reactor type of things from Iron Man.

56:34 Tony DiCola: Yeah, exactly right. I was at the Emerald City Comic-Con here at Seattle and yeah, that was fun. Basically, I took a board that we called Circuit Playground that has a ring of little lights on it. It's the easiest thing. I just put a magnet on the back, a nametag magnet, and just clipped it to my shirt and it's these little circle of lights but then I could control, I could program it because in the Iron Man universe, I think the Arc Reactor's a little boring. Tony Stark, it only glows blue and maybe that's because of the way it works. In my world with Tony D's Arc Reactor, I'm gonna make it glow different colors. I had mine going to like rainbow colors and pulsing in different effects and things like that. That's cool because I could just write the code that controls it myself. I built it myself so I have total control over it.

57:15 Michael Kennedy: Those are all cool projects. One more project question. Do you know if any commercial projects or Kickstarter type things that people used MicroPython or Adafruit to prototype something and then make it into a project even if it-

57:30 Tony DiCola: Good question. I do see Kickstarters all the time. I can't think of any off the top of my head, but I've definitely seen a few. If you look at a Kickstarter in a lot of cases, they'll be showing the prototype that they build. Look for like a little blue board with a white star or white flower on it, and that's in a lot of cases, if they're using a sensor or something, they've probably gotten an Adafruit board on there. Because it's great for, if you're doing a Kickstarter, you're trying to very quickly build this prototype, and so you don't have time yet to lay out that circuit board and figure out how it works. Just grab the sensor off the shelf and make it work but then the cool thing is because we publish all of our designs with open-source, when you're ready to turn it into that product, you just grab our design files and you can see, here's how they built their sensor boards so now I can integrate it in my component. One thing though that was a really popular Adafruit project was the Firewalker sneaker, which is basically you put a ring of LEDs, RGB controlled LEDs around the bottom of your shoes and then you put some little sensors in the shoes that detect when you take a step and you can light up and animate the sneakers. That was a project that I think it's about four years old or so and was really novel and cool. Nowadays, you can walk into pretty much any shopping mall and there's like a stand in the middle of the shopping mall where they're selling commercial versions of these Firewalker sneakers.

58:39 Michael Kennedy: I have seen people walking around with these.

58:41 Tony DiCola: Yeah, and a lot of them if you look at them they're not as advanced. Most of them don't have the sensors that detect when you'll take a step. They'll just like have a fixed animation. That's not as interesting. When you build it yourself, you can make it more fun and interesting. I haven't seen anything yet with MicroPython but I'm pretty sure we'll start to see that in the near future, because that would be fun. Make the MicroPython Firewalker sneakers where you can have Python code controlling it or maybe use a board that talks to your phone and maybe your sneakers can glow when you get a notification or something or your sneakers could tweet every time you take a step, which might be a little excessive. That'd be the future of things that we'll see with our products.

59:21 Michael Kennedy: That sounds pretty cool. Very nice. I think we're pretty much out of time Tony. Thank you for sharing all those stories. Hopefully, people are inspired to go out and try to create cool things they've always wanted to see exist.

59:34 Tony DiCola: Yeah, totally, exactly. That's what we love to do in Adafruit is to show people how things work and see what you've done with it. Come back and show us what you built with it.

59:43 Michael Kennedy: Show that it's not like so difficult like, hey, these are all the steps it takes. You can do this.

59:47 Tony DiCola: Yeah, the greatest thing. We do every Wednesday at I think it's 4:30 Pacific, 7:30 Eastern time, we have a show and tell on our YouTube channel and it's a live show. People can come on and we'd hang out and you can show off the projects you built. The best thing and Limor said that the greatest moments for her are when you have like a seven-year old girl come on to show off what she built or what she made. It happens quite often that we inspire someone. Then I think pretty soon, we'll start to see those seven-year olds who came on the show five, six, seven years from now are gonna be coming back and saying, hey, now I'm in college and look what you inspired me to do. Looking forward to that.

01:00:27 Michael Kennedy: Yeah, that's awesome. It just came to mind you go to these school Science fairs and they have these projects and a lot of them are like, well, I put a tadpole in a tank and we watched it and measured it. It seems like if you took some of these things, you could do a really cool Science project.

01:00:42 Tony DiCola: Yeah, yup, exactly. This is maybe Science projects on easy mode. You just find cool projects we've done and then modify them yourself and build on top of them.

01:00:51 Michael Kennedy: Yup, exactly. All right, two final questions before I let you out of here. If you're gonna write some Python code, what editor do you open up?

01:00:58 Tony DiCola: I use the Atom text editor these days. I like it a lot. It's simple, it runs on all the different operating systems. I like the color scheme it has by default, too.

01:01:07 Michael Kennedy: Yeah, I like Atom as well. Nice one. Most notable or PyPI package you wanna recommend?

01:01:13 Tony DiCola: I really like the Click package. It's used to build command line interfaces. I think it was created by the person who created the Flask web framework. It's really nice. It has that same kind of concept of building command line apps but breaking it down into kind of simpler functions that you implement for it. It makes it really easy to build an app that does something or a command line tool that does something.

01:01:33 Michael Kennedy: Yeah, excellent, excellent. All right, final call to action for people to get started with all these stuff? What should they do?

01:01:39 Tony DiCola: If you're new to Python and hardware, like I said, the Raspberry Pi is a great platform if you're just used to desktop Python and you just want something that feels like a desktop computer. But then also explore MicroPython and some of the boards I mentioned. Things like the ESP8266. That's probably the best entry-level MicroPython board right now just because it's a good balance of cost and performance and really easy to get started. But keep your eyes peeled for more boards coming in the future. Circuit Playground board I mentioned. We've got some boards that are coming soon that are gonna run MicroPython and CircuitPython and some of these versions of Python that run on microcontrollers. That would be another good getting started option for people. Yeah, definitely check out those boards. Don't be afraid to get started. One thing that hold people back is just thinking, I'm gonna break something, I'm gonna spend a bunch of money, and it's gonna just destroy this piece of hardware. They're more resilient than you think. Like I said, if you follow a guide, if you look at project that someone's already done, you're gonna run into less problems usually and have a little bit more fun and get kinda quicker feedback on things.

01:02:39 Michael Kennedy: Yeah, absolutely. Check out learn.adafruit.com. There's a ton of inspiration there for you. All right, Tony, thanks for being in the show.

01:02:45 Tony DiCola: Oh yeah, thank you so much, it's great.

01:02:47 Michael Kennedy: Yup, talk to you later.

01:02:48 Tony DiCola: Yup, see you.

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