Monitor performance issues & errors in your code

#17: Python on bare metal with MicroPython Transcript

Recorded on Thursday, Jun 25, 2015.

00:00 How many layers of abstraction and indirection are between your Python code and machine instructions? What if that number could be 1 and Python itself was the operating system? That would be so amazing, right? In fact, it is amazing and it's called MicroPython.

00:00 This is Show number 17. It's MicroPython with guest Damien George.

00:00 You're listening to Talk Python To Me and this was recorded on Thursday, June 25th 2015

00:00 [music intro]

00:50 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 and follow us on twitter where we are @talkpython.

00:50 This episode we'll be talking to Damien George about rethinking the Python runtime for embedded microcontrollers and MicroPython.

00:50 This episode is brought to you by Codeship and Hired. Thank them for supporting the show on twitter via @codeship and @hired_hq

00:50 Before we get to the interview with Damian, I would like to give a shout out to Ganesh. Ganesh suggested this topic for the show and I think it is a great one, Ganesh- thank you for sending that in and making this happen.

00:50 Now, let me introduce Damian. Damian George is a theoretical physicist at the University of Cambridge and the creator of MycroPython.

02:02 Damian, welcome to the show.

02:02 Hi, Michael, thanks.

02:04 Yes, this is really great, we have talked a lot about software, and we even talked a little bit about robots on the show before, and now we are going to talk about the most low level stuff that you can do with Python that I know of. We are going to talk about running Python directly on microchips and microcontrollers, right?

02:22 Yes, that's right.

02:24 Yeah your project MicroPython at is really cool and some of the listeners said, "Hey, you really need to have Demian on your show and talk about this stuff," because what you guys are doing is really amazing. And so we are definitely going to do that, we are going to talk all about that. But before we do, maybe you could tell me a bit about your background, how you got into programming, how you got into Python, that kind of things.

02:44 Ok, well I mean I always liked computers and I was using computers and programming since I can remember. I know that I have written many toy languages, has always been sort of passion. I think anyone who get into programming at some stage tries writing their own language, that is why there are so many of them. But it is a really great way to understand how a computer works, by inventing your own language or at least implementing something that already exists. That is sort of what I did in my spare time. But actually, formally I also I did computer engineering degree, at University which was based around, microcontrollers and designing computers and designing instruction sets and writing operating systems but it is kind of low level things.

03:41 So that was really good to get actual formal training so that you sort of, you are forced to be exposed to all the things that maybe you didn't want to study.

03:51 Absolutely. Was that mostly in C, or C++- what language did you use in that field?

03:59 We learned a lot of languages, like Haskell and Java, and C and C++. It was a bit about learning languages but also you learn algorithms like hush tables and things like that, and you learn how to write a compiler and it's not so much about the language, it's about the concepts and the algorithms.

04:24 Right, like the abstract syntax trees and things like this, yeah?

04:27 Yeah, that's right. So I mean this is what I studied, I actually also studied theoretical physics, and pure math so I did a lot of extra stuff and all these things I think sort of tie in the end to the same kind of way of thinking, it's that you think like methodically and you try and solve problems. And you use computers a lot in maths and physics to solve problems because there are so difficult math thing that you can't just do them with a pen and paper.

05:01 Yeah, I think you are totally right. My background is- I was working on my PhD in math as well and I got into computers through trying to do research with math, like you are going to have to learn to program this thing and it turned out I liked computers better so I never did get a PhD but- I totally know where you got it from, that's awesome.

05:17 In physics you, if you are an experimental physicist, a lot of the time you end up doing just a lot of programming like multi color simulation and data analyses and things like that, and I mean, if you like that kind of stuff that is really good., but if you don't, maybe you- if you want to build an extra apparatus then you probably need to be an engineer. My background is all these things combined, and yeah, I just really like the technical side of things.

05:48 That's cool. So how did you get into Python, you started out in this sort of what to me feels more like the majority of the work is done in C, C++, Fortran, that kind of space with physics and operating systems and so on. And then, somehow you ended up in Python, right?

06:05 Yeah, I mean I think it is good if you know more than one language, or more than two or more than 5 languages, so and Python is such a popular language and for a good reason. It's a very nice language, and so yeah, it's just one of the ones that you will I think eventually learn if you are into programming. And yeah, I mean I guess I just stumbled across it like all the other languages the people are in, like C and C++. Because, C is a great language and I like writing code in C, I know it's a very old language but it allows you to be really close to the hardware, I mean, a line of scene translates to a few lines of assembly and you sort of know what is going on.

06:53 And yeah, that means you have to write more code to do the same sort of thing as you would in a level language. But, it gives you more power and when you need speed. But then of course, you want something like Python when you are not so worried about the efficiency and you are more worried about writing something quickly and expressing your idea in a very quick way, and then in very clean and clear way. So a Python program is you know, you think and then you sort of put your thoughts in code and it's sort of the same thing.

07:29 Yeah, that's a lovely thing about Python, isn't it?

07:32 Yeah, exactly, you just don't have to allocate lists and make links in the list, you know, it just works having a list or it just works having a hash table, a dictionary, and you know, you have list comprehension, and you have generator, and these things allow you to think in a certain way. And if you are writing in C, you don't think about generators and you don't think about sort of closures because they are really hard. But they are really good concepts, and a language that allows you to express those concepts easily is a good language.

08:07 I agree. And when I think of microcontrollers and embedded devices, I typically think of people using C because they want to squeeze that extra 5% of energy or performance or you know, those are more or less the same thing in some sense, right? You have taken the opposite perspective, right- you've made Python suitable for microcontrollers rather than saying, "we are going to use a language that already sort of match to the metal". That's really awesome. So you called this project MicroPython, right?

08:36 Yeah, that's right, MicroPython. I think the name says it all.

08:41 Yeah, it's awesome.

08:43 If you want MicroPython on the microcontrollers than that is what you need. I did it as a sort of- to begin with it there was more of a can-it-be done question, because I just, it is technically interesting to try and put a language this big, and this high level, and this dynamic and this memory hungry as Python on a really small microcontroller which has very, very, very little memory. So that was kind of what started it for me was just a technical interest. But, at the same time I also thought why not pick another language or why not just, I mean, C is already on microcontrollers and stuff, but why even choose the high level language to start with.

09:27 My reason is that because microcontrollers now are more powerful than they were a few years ago, when they had almost no memory at all, you know, like a 100 Bytes or something. Now, they have 100 KB and that is starting to be interesting. They also have really sophisticated peripherals, so you buy a $1 chip and it has all these UART, SPI and I2C and ADCs and DACs all these peripherals that do great things. And are very very powerful. It has DMA to do quick transfers, and this kind of stuff when you start writing it in C to control over all of these peripherals it gets really, really hard really quickly because you have got to so many configuration options, you've got so many thing to think about interrupts and interrupt level and it becomes very quickly sort of it can become a bit of a mess to get something to run quickly and easily.

10:30 So if you just want to flash a LED and read some sensor, you don't need to sort of write really efficient code. So to do a low level simple thing like turn a light on, all you are doing is putting a voltage 5w, 3 w on a pin. It's a pretty basic operation. It's something that you can do in Python quite efficiently, and then once you can do turn up an LED on with a Python command you can think about having a list or dictionary of pins and then you can iterate over them or you can pass them along as objects. So, you can start to really abstract the low level hardware and it is still relatively efficient because the way the markup Python is implemented, you still have running relatively efficiently on the marker controller.

11:30 I've seen your API and it looks super clean, I saw your Kickstarter video and the one you have on, as sort of the opener video to introduce people, that's really cool. Maybe, let's take a step back in the show and quickly tell people what MicroPython is and tell them about your board and how it came into existence.

11:48 Sure. Well, so MicroPython is a rewrite, a complete re-implementation from scratch of Python sort of version 3 as it were, 2.4 actually. So, complete rewrite, no components whatsoever that are in common with the c python and the aim in rewriting was to make sure that every operation was done as efficiently and used as little and if possible no RAM at all. So that was sort of the guiding principle as uses as little RAM as possible. So MicroPython the software is this re-implementation of Python and it includes all of your favorites lists and dictionaries and sets and it's complete Python 3.4 in terms of the language specification.

12:43 Probably not the same standard library though, things like dvapi2 is not there and something like that, yes?

12:49 Yes, so there is the language in terms of the syntax and the semantics, you know crosses and function definitions. And then there is the library, so import numpy or whatever, import this import that. Python comes with batteries included with all of the standard library and everything you need, you know, statistics to compute the main of something and things like that and these things some of them are not tentable to run on microcontroller or some of them weren't fit on microcontroller so not that many of the standard libraries are available. But the ones that are useful are there like json string parsing for example and regular expressions are there in a cut down form, and I mean we are looking to add more it's just 13:43 all these things in microways.

13:47 Do you have to re-implement every standard library package or module that you are using?

13:52 Some of them really have for example json printing and pausing is rewritten because we want to make it efficient but other things actually import directly, we can just copy over the CPython standard library and use that code directly, so it depends what you want to do, the idea really is to provide markup python as the core language and then if people need some extra feature they can copy it from CPython and it should work. And it needs a few little tweaks here and there but yeah, we concentrate most on the core language in providing very robust and hopefully efficient core language. So that's the software side of things. Then there is the hardware side of things, which is so a pie board which is this little microcontroller that runs MicroPython and all the peripherals on this py board are well supported like the I2C bus or the UI for example. And the aim for this was to be able to sort of Kickstart this whole idea we went to Kickstarter-

15:14 Yeah, why don't you tell everybody a little but about your Kickstarter, it was super, super successful, I saw you originally were going out for £15000 and you raised £97000 or a $103000. You must have been super thrilled?

15:30 Yeah, well it was a great reception, a lot of people get on board and yeah, I mean it was really good, I didn't expect it to be that big I mean as I said I started out as a sort of technical interest be like you know, it would be really great to be able to see if it is all fit and then getting it running, making a little board so the idea with the board was I could give something to the Kickstarter backers if they back it is nice to actually have something physical as a backup instead of a piece of free software which is going to be free for everyone. So the hardware was a way to sort of to give an incentive to say look there is actually something physical it can run on and you can do cool stuff with that.

16:13 That's cool, that work of creating it was it mostly actually writing the re-implementation of Python or was it- how much of it was hardware work and how much of it was software work?

16:23 I'd say it was about 50- 50% to begin with, up until when I launched the campaign, The software I mean, yeah, I didn't write the entire thing before the Kickstarter campaign started I wrote enough to be able to convince myself and others that it would actually work. Like you can turn the lights on and off and so on. So there are bits of the language missing, at the Kickstarter stage, and probably few tips was actually build in the hardware so I had to learn about these microcontrollers and how they work, and the hardest thing is getting a tool chain up and running to cross compile stuff and download it and then debug and a lot of USB thing work and so on, there is a lot really technical and difficult things to sort of get your head around when you first get into microcontrollers and these days will they

17:49 Yeah, it looks really rich. Maybe you could tell everyone a little bit about the feature because when I learned about it I was surprised all the things it has, an accelerometer for example, storage, all sorts of stuff, it seems pretty much like I can take that put it into something with the power source and use it.

18:08 Yeah, well for sure, I mean you plug into USB and it works straight away, I just need to power source and it's got- the accelerometer is not built into the microcontroller that is a separate little tube that is on there but the idea of putting that on was so that people could have the sort of some input to play with straight away instead of buttons or switches or something. And accelerometers are like a lot more fun to play with.

18:34 And your video you have a little app you wrote where there is a robot that can lean forward and backwards, left and right. And as you tilt the board the robot kind of leans in the way and you are doing this with accelerometer and in Python and that was really cool example.

18:51 Yeah, well I mean that certainly a handful of lines, it's just an infinite loop while true and then you read the accelerometer which is like one line, in Python. And then you set the server angle by accelerometer reading, so you know, it really is just a few lines to do that stuff.

19:10 Ok, cool. So maybe you could walk the listeners through what it's like from going your file new project to having what was that a that runs when you turn on the board?

19:20 Yes?

19:22 What's the life cycle look like there?

19:24 So there is this actually a few different ways of using it. The simplest way is you just plug it in to USB and then it becomes a serial port like a com port, which you can log into. It depends if you use Linux or Windows or Mac but you just use internal program and then you can connect to the serial port of the board and you have a Python prompt, a REPL right there.

19:54 And that runs directly on the board so you could type commands in straight away. And that will be executed into whatever you ask on the board. So that's a good way to just play around with things, debug things, test things. The other way of programming is to write your code, your script in a file and you call it and you copy that to the little mini file system that is on the board and then whenever it turns on, or whenever it gets power, it runs that script, straight away and just does whatever you have in there so you could have an infinite loop in a reading sense or an outputting some IDs or server angle or something like that.

20:37 And of course it's not just the single file, you've got the full import machinery of Python so if you also copy some libraries to the little file system on the board then you can import them as well. So you can do lots and lots of different things.

20:53 That's cool, and how much storage space do I have?

20:53 [music]

20:53 Codeship is a hosted Continuous Delivery Service focusing on speed, security, and customizability. You can set up Continuous Integration in a matter of seconds and automatically deploy when your tests have passed. Codeship supports your GitHub and Bitbucket projects. You can get started with Codeship’s free plan today! Should you decide to go with a premium plan, Talk Python listeners can save 20% off of any plan for the next 3 months by using the code: TALKPYTHON

20:53 Check them out now at, and tell them thanks for sponsoring the show on Twitter where they are @codeship.

20:53 [music]

21:50 It has about just under 200 or 100KB of file system which is not very big so you can put a few scripts or maybe some data, but it does have expansion SD cards so you can put a little Micro SD card in for a few dollars you can buy something as a Gigabyte of storage and then you can run scripts from there so you can out everything there and log lots of data, do whatever you like. So, it is expandable in that sense.

22:22 Yeah, that's excellent, so you should be able to put a lot of code on there for 200K?

22:26 Yeah, yeah and there is actually a lot of- the third way to use it is you can actually sort of you can write your script on your PC and then run it remotely by using another parting???22:47 script that downloads your script onto the board and runs it straight away so that is a quick way to sort of prototype your code.

22:53 Yeah, that's cool. How do you get files on there other than this prototyping way? Does it like show up as a drive when I connect or…?

23:01 Yeah, it shows up as a USB drive, it's just like a USB stick. That's it.

23:09 Yeah, cool. Can I set up networking if I want to do a little Internet thing type stuff?

23:14 Yes, so the pyboard itself has drivers for a wireless chip so you have to buy extra wireless chip and connect it up and then it will work as the sort of Wi-Fi extension so you have your normal Python sockets so you can create a socket and you buy on and connect to a server and you can either be a server or a client. So you can do that kind the same Python stuff you can do on your PC on the board, it's a bit restricted.

23:47 Yeah, can I run a web-server on it?

23:50 Yes, you can.

23:51 So I probably want one of the micro- one of the micro frameworks like Flask or Pyramid or something like that it might be better.

23:58 Yeah, Flask might be a little bit big, I mean you would be surprised, Flask is when you load up a full Python app a lot of the stuff actually gets imported that you don't think about. So, in MicroPython which we have to think about all that, but there has been a few of the Kickstarters based around MicroPython, since almost 2 years ago started, just recently there was this WiPy kickstarter which is actually a Wi-Fi module that runs MicroPython so it's one chip, it has WiFi built into it so it really is an internet of things device that you that is like the PyBoard and it runs MicroPython. And you can tell that in to get a REPL prompt and you can FTP into copy of script, so it's really a proper wireless from the ground, MicroPython device. And on that, you can make a server, or client and you can sort of attach a battery, put it behind your sofa and then there is this little python wireless thing running behind your sofa.

25:22 That is really cool, yeah, I just Googled WIPY Kickstarter- it's awesome and it looks like it also really exceeded its Kickstarter goal, they were going for £30000 and they got £75000. That's great.

25:39 Yeah, I think they are in euros, but yes.

25:42 Oh yes, that's right, it's in euros. So yeah, more or less like dollars right now. Ok, very cool.

25:42 Several times I've had the thought as you are talking about this, you were like, "Oh we've really got to squeeze the performance out of this framework, without the framework it is actually heavy and this way I rewrote these things to be more efficient"- is there a place for MicroPython in the data center?

26:05 Well, maybe, maybe in the future.

26:08 Yeah, so what I am thinking is you know, if you've got like these little Docker containers, and if you are looking for server density, maybe having something that was focused on a microcontroller that uses so few resources you might be run really really dense sort of cloud computing systems and do interesting things with it. What are your thoughts?

26:28 Yeah, definitely, that's actually one of the directions of the project as well. So it's- the micro project software runs on the pyboard and the wipy and other pieces of hardware, but it also runs on your PC, Windows, Mac or Linux, and it's basically Python but unbloated so it's tries a really efficient version of Python and as compatible as it can be so it is really very quick to start up, it uses almost no memory, and I've actually tried sort of sponing a 1000 MicroPythons on my computer and it's fine, it runs 1000 MicroPythons. And then I tried sponing 1000 Python normal Pythons and my computer just grants to a whole. That's just sort of a fun game but it shows you that as you were saying if you want to have a container and put in some app and you needed to be efficient because you wanted to run lots of them- them maybe MicroPython can do what you need. So in those movement there are some people helping to there is quite a lot of people that could help working on MicroPython which is great--

27:46 Yeah that's cool and that's just right?

27:50 Yes that's right, yes. But one of the things they are doing is implementing as much of the Python standard library as can be done, in order to run some real life applications like a web server for example. And, yeah, I mean this is maybe interesting application as well but running a web server is sort of the number one thing that you think about when you thinking about Python and running lots of instances. So that's definitely something that we are working towards, I mean it already can run web server, for sure, but I don't know anyone who is using that in production just yet.

28:36 Actually doing it; well maybe we are giving some people some ideas out there. It seems like an interesting thing to be the sort of foundation of some light way restful services that you want to just have lots of horizontal scale on.

28:50 Yeah. There is definitely lots of scope for this, lots of scope.

28:56 Ok, so the actual operating system on the microcontroller that's written in Python?

29:01 Python is the operating system, that is what- I think that's a good way to describe it.

29:07 That's really awesome.

29:08 On the microcontroller there is no operating system just spare metal so the first thing that happens when it boots up is you have to set the stackpoint you have to copy the data from ROM to RAM and then you can do whatever you like so it jumps into some initialization loads up the Python runtime and then jumps to the REPL. So, Python essentially is the operating system and it is giving you full control over the microcontroller there is nothing, there is no context switching every cycle is yours to spend on Python code.

29:47 That's fantastic.

29:50 Yeah. So you can do things like disable interrupts with the Python call and then everything's nice and quiet, you can do things in cycle count and then turn them back on again, you can set interrupts to triggers so you can have a timer which counts and say, "Ten times a second, fires and interrupt," you can call a lambda function in Python to do something and then it will return. So you can call Python on an interrupt.

30:18 That's pretty awesome, to hook a lambda function straight to like a hardware interrupt, that's super cool.

30:23 Yeah, so you can do that and the other I think very nice thing I thing is quite cool is you can write inline assembly card within Python. So just like in C how you can say inline assemble and your function is there. In Python you can write a function and use the inline assemble decorator for that function, that's a special decorator and then the compiler knows that instead of compiling Python it compiles the ARM assembly. And then it turns out into a normal function that you can call from Python, you can even parse arguments to that function. And then you can do whatever you want to do and assemble and it can even return stuff back to Python. So, this way if you really need to do some low level things then it is on your finger tips.

31:16 That's very cool. That's kind of your skey patch, if you haven't thought of it, in Python. If you guys haven't pre-made this feature available, that's the way to do it, right?

31:27 That's right, yeah, you can access direct hardware...

31:34 I'm not sure that I would be super comfortable doing much in direct assembler, but I would be in C, is there a possibility of having like inline C in the future?

31:41 There already is such a thing, it's not inline C but it's a more of a compiler, a Python compiler, back code compiler, it compiles the postry into some back code, but there is sort of an option to instead of emitting byte codes it can emit direct machine code. So this is kind of just in time compiling although it is ahead of the time compiling but this is how the VA Javascript works instead of targeting virtual machine by code it just targets the direct hardware by emitting. So if I wanted to load an integer onto the stack then instead of calling a bar code I could just do actual machine code and then if I wanted to call a function, I'll call a method, then I just implement the machine code to actually do that. So this makes your code run faster but it also allows you to declare types to say, Ok, using Python's type 32:52 I'm going to say that this argument is an integer, and this one is an integer and then MicroPython can optimize that when you do an addition and instead of calling lots and lots of calls to do addition of these two numbers it knows that it can use a single hardware add and it just adds them. And, in this way, you essentially burn your Python code into sort of C like code but it still looks Python but it is compiled to something that would have happen if it was written in C, so you just got pointers and you got integers and you can do loops so you can sort of you can write much faster code that way if you really need to.

33:35 Yeah, that sounds really interesting. One thing I would like to sort of think about with you is what is the trade of in terms of performance if i were to say, "work with embedded C on a regular like say embedded Linux or something, versus Python on MicroPython on this board." So you are versus Python in terms of relative performance. What's the trade outs here?

34:06 So, ok, if you want a number it is something like a factor on slower when you are running Python ... This is very rough number, you know, if you wanted to do a loop which was flashing a LED on and off, and if you had written that loop in Python, we can get maybe 100KHz out of that loop but if you are writing it directly in C, you will probably get 10MHz. Now, MicroPython is not meant to replace C in any form, it's supposed to be there for doing high level control of all these sophisticated components, and if you really need to run a 10MHZ loop you can use the inline assemble maybe or you could use this other model I was talking about before or you could write your own C function and then we compile MicroPython and use that C function as sort of your extension to MicroPython if you need to. So, you have lots of different options. But there is of course going to be some kind of over head in terms of the speed, I mean, you can't escape that.

35:20 Yeah, now that is totally reasonable, I guess one of the things I was trying to like get is how does MicroPython compare to CPython on the same hardware?

35:30 I see.

35:30 [music]

35:30 This episode is brought to you by Hired. Hired is a two-sided, curated marketplace that connects the world's knowledge workers to the best opportunities.

35:30 Each offer you receive has salary and equity presented right up front and you can view the offers to accept or reject them before you even talk to the company.

35:30 Typically, candidates receive 5 or more offers in just the first week and there are no obligations ever.

35:30 Sounds awesome, doesn't it? Well did I mention the signing bonus? Everyone who accepts a job from Hired gets a $2,000 signing bonus. And, as Talk Python listeners, it get's way sweeter! Use the link and Hired will double the signing bonus to $4,000!

35:30 Opportunity is knocking, visit and answer the call.

35:30 [music]

36:41 On the same hardware it is impossible to measure because CPython weren't run on the pyboard.. That's really not working, but ok, if you want to try and compare apples with apples you can run MicroPython on your PC and you can run CPython on your PC and you can compare the two. You know, using some benchmark that you like. And, actually, MicroPython is slightly faster than CPython for reasonable range of benchmarks that we have, for example the Pyston benchmark- MicroPython runs a bit faster than CPython and that is because the users ... resources and the way it handles integers is a bit more efficient. So not having to allocate RAM to do certain things makes it faster. But of course there are other things that the CPython is quicker at.

37:40 OK, that's very interesting, so it is more like the CPython is kind of unsuitable for these microcontrollers because it is so big and memory hungry, yeah? One thing that might be worth talking about is where is MicroPython used, are there some some notable- I'm not sure deployment is the right word- but products or devices with MicroPython?

38:03 Well it's been used I think in quite a lot of places, some of them I don't know about and some of them I do know about. I think it is used a lot in robotics, there's been a few other Kickstarters as well, to do with MicroPython, there is this robot called Kickstarter where they made a little sort of robot brain that run MicroPython so could make robots. And then Wi- Py obviously for Internet things. It's been used in teaching, there are some people that will be using it for a teaching university classes because it is sort of a good mix of- in university course you don't have always time to go into the details of doing cross compilers work and all these stuff you just want to teach some basics about low level interrupts and controlling

38:54 And doing that in Python seems like a really good way because Python is so simple, you totally understand what's going on, and so it lets you focus on the concept, right?

39:03 Yeah, exactly. And turn an LED on and off and sort of get some hands on use of some hardware straight away so I mean, in the UK there is a big push for students of primary school even to start learning languages and they have to learn 2 languages and mostly Python is one of the languages they learn. And they also do some hardware in their sort of design science class so these two things go together MicroPython because they already know Python and they need to do some sort of simple exercises. It's a very easy path for them to take. So, it's been used in education and I think it will grow a bit more. One other very exciting thing is that the European space agency has actually its best interest in using MicroPython for space based applications-

40:02 That's awesome.

40:04 Because the hardware that runs in space is very limited, in resources, because it has to be improved that it takes a long time to prove that a piece of hardware actually run in space given its radiation hardening and so on. So, yes, the European space agency has agreed to fund some further development of MicroPython to see if it can be made robust and deterministic so that it can be put in a space based application. So, there is more than just Internet things.

40:41 Yeah, that's... yeah, space, that is really cool. I guess space agencies like the European one and NASA and so on they are traditionally not really thought of as rapid agile type places, and anything they can do to move away from these languages like Fortran and C that make it really hard to build reliable tested stuff and something simple like Python, it seems like a really big win for them so, that would be amazing.

41:11 It will, I mean, we look forward to the development to see what will happen with this, we are very excited.

41:17 Yeah, maybe some amazing picture of Galaxies will be pulled down some day and it will be have taken by Python, that would be cool.

41:17 So, speaking of space, and robots and things like that, another area where we have had people on the show and I know Python is used is robot operating system ROS, and RosPy, is there anything going on between those two projects?

41:42 With MicroPython not, no, we don't have direct communication with them yet. I mean, ROS is more of a ROS is sort of a large operating system, in the sense that it needs sort of PC to run it doesn't run directly on a microcontroller.

42:05 Yeah, it's more like an i7 or something like that, right?

42:08 So yeah, so MicroPython could fit into picture that if they wanted to run an efficient Python implementation so instead of running CPython they could run MicroPython but it would be sort of the PC version of MicroPython it wouldn't be the pyboard version because the ROS has already taken over the system and it is controlling it.

42:30 Yeah, ok. That is really cool, good to know.

42:34 But there are other real time operating systems that have MicroPython sort of already built in so Natex 42:45 is one of them. And Riot is another real time operating system that we are working to get Micropython into.

42:58 Yeah. That is really nice, there is a lot of stuff going on there and the more you guys work together, the better I guess.

43:04 Yeah,` well, I mean we can open source project it is an open source project, it's got an MIT license and anyone is free to contribute. It's not something that's going to move quickly and has help from the community.

43:22 Of course, You also said that the hardware was open hardware- I don't do much with hardware so that doesn't mean anything to me, but it sounds cool, can you talk about that?

43:31 Just meant that schematics are available for people to download and they can make their own board. So the idea with the pyboard it is not supposed to be a sophisticated piece of hardware that is impossible for anyone to make themselves, it was supposed to be simple enough that you could hold 43:51 by hand, I mean I made the first prototypes by hand, so it is not an overly complicated piece of hardware, it's just there so that you can run markup Python and connect it to some senses and get things working straight away and then if the pyboard isn't exactly what you need if it doesn't have enough IO or you want to use a different microcontroller, you need more leds or something like that- you can make your own board, very easily and MicroPython is configurable enough so you can put it on your own chip.

44:26 That's really excellent, it runs on ARM chips right?

44:30 Yes it runs ARM but it also runs on other things, as well it doesn't just have to be an ARM. There are certain things that are optimized for ARM but there are other chips we also have it running on. Like, microchip PIC, and this Wi- Fi chip as well and these architectures are all different so it is not just an ARM architecture that it is relying on.

44:58 Oh, that's really cool. So when I think of what I do during the day, I go and I sit down and I plug in my Mac book into a larger monitor and have my keyboard and that's pretty much how I work. But you are talking about things like hardware, and all sorts of stuff, you must have an interesting place where you work or interesting setup.

45:21 Yeah, well, I think it is a mess like everyone else's setup, right. There is juts lots of stuff lying around, but yeah, you are right, lots and lots of stuff and pyboards lying everywhere.

45:39 How many revisions did you get through the pyboards, like is what you are shipping kind of what you started with or is it really different?

45:45 It's the same controller and pretty much the same- it started out with the same features, accelerometer, SD card, few IDs and switches and it just sort of got a little bit smaller and all of the components went onto the top to make it cheaper to manufacture. But otherwise, it's pretty much the same I think this is the final version with the fifth revision.

46:08 Ok, excellent. So if people want to get started working with MicroPython, and the pyboard, how do they do that? Can they come and buy that from you?

46:18 Yes, they can. They have different option, they can buy directly from us and it is £23, if you buy outside of the EU but if you are inside of the EU you can add 20% tax so it is £28. We also have a distributor in America who stocks them so you can buy directly from them, we have also distributors in Australia and in Italy and in Belgium. And on the website there are links to these places, so you can buy from a few different places. And if you just want to try the software you can run it on your PC, you can go to GitHub and download the code and compile it and see what it is like, browse through the code. It will also run on some other boards that maybe some people already have and just want to try it out, like a 47:11 STMielectronics discovery kit so there is a few different options. If you got o GitHub page there is quite a lot of explanations there, there is also the form which has a lot of people we can talk to them and ask questions. These are all linked from

47:30 Ok, excellent. And I recommend just to see what is going on that you go to and just play the video it's like 9 minutes or something and it will give you- it's a good video and it really gives you a quick visual review of what you guys are all about.

47:43 Yes, great.

47:45 Yes, and I'll put of course all that stuff, links to all that stuff in the show notes. So, Damian, I think this might be a good place to kind of wrap up the show on. Question I usually ask my guests on their way out the door is there is the tone of stuff on PyPi, the package index that is really amazing and everybody kind of has their own favorite packages they work with and things they have discovered- do you have any favorites you want to give a shout out to?

48:08 Well it is a whole bunch of MicroPython PyPy packages because MicroPython also uses PyPy and has a built in package manager micro pip, so you can download lots of things from PyPy there. But as for myself, in normal Python, there are so many things that I use. I mean, you may work in physics I use a lot of scientific computing light numpy of course, and scipy is very good. I don't know if I could narrow down to one particular thing.

48:46 Yeah, it's kind of like a candy sort a little bit, it's very nice, a lot of stuff that looks good. Awesome. Ok, anything else you want to let the listeners know about that I haven't asked you about, we haven't had a chance to talk about?

49:00 Only that if they are interested in please go to GitHub and take a look and there is a lot of code that could be done from beginner stuff to more advanced stuff, you can write tests or you can just implement some module or some feature that is missing, write up try to fix some nasty bugs or help improve, make it more efficient, reduce memory usage. So, there is lots of stuff that can be worked on and for me it is a lot of fun so maybe someone else would also find it fun to join in in the coding experience.

49:39 Yeah, that's great. And you guys have 63 contributors on GitHub so I'm guessing you are pretty open to have people jump in and help out and add to that?

49:48 Yeah, sure, we are very open.

49:50 Ok, great. Damien, it's been a really good conversation, I really learned a lot.

49:55 Yeah, well thanks for having me Michael, it's been great.

49:57 Yeah, you bet, talk to you later.

49:59 Ok, thank you, bye.

50:02 This has been another episode of Talk Python To Me.

50:02 Today's guest was Damien George and this episode has been sponsored by CodeShip and Hired. Thank you guys for supporting the show!

50:02 Check out Codeship at and thank them on twitter via @codeship. Don't forget the discount code for listeners, it's easy: TALKPYTHON

50:02 Hired wants to help you find your next big thing. Visit to get 5 or more offers with salary and equity right up front and a special listener signing bonus of $4,000 USD.

50:02 You can find the links from the show at

50:02 Be sure to subscribe to the show. Open your favorite podcatcher and search for Python. We should be right at the top. You can also find the iTunes and direct RSS feeds in the footer on the website.

50:02 Our theme music is Developers Developers Developers by Cory Smith, who goes by Smixx. You can hear the entire song on our website.

50:02 This is your host, Michael Kennedy. Thanks for listening!

50:02 Smixx, take us out of here.

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