 On stage, we have Christina Spindler. The talk will be MicroPython, Pythons for Microcontrollers. And the claim on the news is how high level scripting languages make your hardware project beautifully easy. Your stage and your applause. Yes, hello everybody and thank you very much for the introduction. I'm really overwhelmed how many people are here, so I hope you will enjoy the talk. As said, my name is Christina. I'm with the MicroPython project. Mainly I'm responsible for production logistics of the hardware, but I'm also traveling around doing talks like this and I'm really excited to be here this day. First of all, I'm going to give you a little overview of what I'm going through with you today. So first, what is MicroPython? Then what are the benefits of using a scripting language in a make-up project? There will be some examples of make-up projects that use MicroPython or how you can easily get started with using MicroPython for your own make-up project. How MicroPython makes it easier to access and how it is special because of the hardware interaction. And in the end, as already said, there will be questions and answers. So some of you might think, MicroPython, what is this? A super tiny snake? Or maybe something to do with Monty Python? The triple E spectrum realized this ranking of the most used programming languages in 2018. And it's very interesting. Python is on the top and it has a 100% coverage rank. So it's in the web, it's on your desktop computer and it's now already also used on microcontrollers. And what I find quite interesting is that assembly entered into top 10 this year, which means probably because of the Internet of Things that are programmed with assembly. So MicroPython is a fully re-implementation of Python and it seems to be lean and efficient to run on a microcontroller because you couldn't be just using Python as you know it from your desktop computer. It needs to be, so it was rewritten from sketch to fit on the microcontroller. It has a virtual machine and a runtime system with garbage collection and everything you need to make it really efficient. There's byte code or native machine code you can use with MicroPython and there's also in support for inline assembler. So when you have a project where you like to use Python because you want to get it up easy, but you need to make it more efficient in some of your tiny bits, there's also inline assembler supported. The compilation happens on the chip, so it's not compiled, your program you write is not compiled on your desktop machine, it's compiled on the hardware you use. So as later as I have this fantastic camera over here, I will show you some demos how you easily can use MicroPython. How did this start? How did someone think of having a high level, really high level scripting language to run directly on a microcontroller? About five years ago, Damien George at the time working at Cambridge University thought, oh, this would be fantastic to control my little robots with Python because it's easy and I know, and I don't need to interact with all the low level stuff. So he had the idea, let's run a Kickstarter because at that time everybody was doing it and I would really like to see how it is to do a Kickstarter as well. And he wanted to think maybe other people will be interested and he would like to have an open source community around it to support the project because as we think open source is very important because I profit from it every day and we want to give something back. So this means MicroPython is open source, everybody is welcome to contribute and it's open to everybody. So this was about five years ago and today, up until today a lot has happened, when you look at our GitHub page there are more than 7,000 stars and more than 200 contributors. Very interesting is that the contributors come out of different areas. So they are makers but they are also people that work as embedded developers in the industry because they saw the benefit of having a high level language which you can start up, making it run up easy and focus on the bottlenecks of your actual project. And there are also more than 2,000 forks which means a lot of people are working on it. Some of you might have known the BBC Microbit. That's also one project in the UK. They were given about a million of these little PCB modules to the children in the UK to get them up and running quite early in the education process. So Python is taught in school in the UK and this also, so there are other languages supported as well but MicroPython is also on it. Then there are a lot of different development boards. For example, other fruit has its own MicroPython part that is called CircuitPython. So if you want to try MicroPython you have a wide range of development boards and there is of course the official MicroPython board, the pie board, which I'm going to show you today because there's always an advantage on having your own hardware because you all know the saying if you're serious about your software you should do your own hardware. Then last year there was the first MicroPython O'Reilly book from Nicholas Tollaway, which is also quite big. Actually a few maker books are already out there but this is kind of milestone for us. And also after five years it's time to make a new board and I have this one with me today. So what I'm going to try to do is from the original Kickstarter, which was five years ago, this board is still supported. So if you have one of these software updates are still running and getting to be supported on the old board. But we were talking to people, what would you like to see? What do you missing in the actual on the market? And we try to listen and make a new board as well. So what's the benefit of a scripting language used instead of traditional C for example to program microcontroller? It's learnability. It's easy. You can read it more easily. You can have the ability to do rapid prototyping, which means your time to market is very quick. So even if all of you are just doing this for fun and our makers, if you see, oh, this really, really cool project I did. Maybe I can do a product out of this. And some people might be interested. So I've heard about these stories. Oh, this all started as a hobby, but now I'm selling a couple of thousand units per year. So I started as a maker, but now I'm a kind of already business thing. It's also very easy to extend it by a user. So if you have something already up and running and you want a specific module implemented, you just get out as like it's open so you can just pick it up and move it into your own way. So yeah, so this is all very positive talk, but when I go out to people and tell them what I do, especially when I talk to embedded programmers that work quite near on the hardware, they say, oh my God, why would I do that? My Python is super slow and I can't really use this on a microcontroller. This will kill all my benefit why I'm actually using a microcontroller for this project. So and also, well, we are very used to see and we're very good. And so this is kind of turning a little bit around the open, open the minds of some people that work in this area. So they say they are interpreted so they are slow. They lose, they use a lot of resources Python. And so this can't be energy efficient or efficient in any way at all. But I say, well, micro Python is fast. If you look at the development time, just think about it when you get a new microcontroller out there, there are thousands of sites of data sheets and you need to get anything out of it and rubbing. Sometimes you have working examples from the manufacturers. But still, well, that's when I did my final thesis in electrical engineering. It kept me up a long time to make it up and then make it efficient and make it really, for example, a really ultra low power as they described in the data sheet working. So if you have functions that already give you the access, you can really focus on the bottleneck of your project and don't waste your time in just making it get up and running. So as this is in the maker track, I thought there are a lot of projects out there. So for example, Damian George, which was the initial idea to do the pie board for the first Kickstarter, he wanted to do a quadcopter. And if you want to learn more about this, there will be a QR code later on. And for example, you can do this weather station, which are run by micro Python. So if you like to find out more, there are a lot of maker projects in our forum where you can see and they are described on Github so you can build up on them if you're interested to use this. So that's the maker site. A lot of people picked it up. But I am also involved in industrial projects that use micro Python for the core architecture. And when I talk to some of the developers over there, they ask me or they tell me, or I ask them, why did you use micro Python? Because it's just around for maybe five years. There is no really long time. So there is no saying, yes, we have tested this 10 times in the field and it's up and running and it's running 24-7 or anything. There's nothing there. So it's quite a brave step to do it like this. But one of the developers said, yes, we were looking for a replacement for our embedded Linux system because an embedded Linux system for this tiny device we are using is just to bloat it. We don't need it for that much. So the first product prototype was with shell scripts and they replaced it with micro Python. And after two times, not with this initial project, they got on and on with it because they really liked to use micro Python. They are now in low power system that consume less than 500 nano amps with active programming on the micro control, which is quite impressive when you think about the real-time image processing they are using it in. So the interesting part is you have it in your development phase, but you can also run it on the final product to, for example, get some updates on there. And I hope this gets more clear when I'm trying to do a little demo later. So and what they said is, yes, of course, you cannot use micro Python for everything because you might need some sample code there and there bits and then you just integrate integrate and you're really, really fast to show a first prototype to a customer or to your supervisor that you get something up and running from with new hardware or and also micro Python is quite famous for used in school calculators. So about I think two years ago, the first calculator picked micro Python up, which is NumWorks. It's a startup and they have these graphical calculators that use micro Python on them. And just recently we heard about that Casio is also putting it into the microcontroller. So this is the old cute little snake nougat from the original Kickstarter, which you put on. So that's the good thing about the open source. They are allowed to do it. So they pick it up and move it into the direction. So I hope a few of you got excited about it and think, oh, that's cool. I would try this out, but I don't have a board. Don't worry. You can go on our homepage and there is an emulator where you have this little pieboard and you can run a few demo scripts and can see it if you like it and put it up. So no need to buy hardware. Just we have this emulator as well. More companies that are using micro Python is obviously Damian George who created micro Python and also offers development board around the so he designs hardware specific hardware or specific modules in micro Python. And what he says is, so my background is theoretical physics. I'm not a typical engineer who looks like more just to getting a problem done or solved. He's more research oriented and he believes and I believe that too. That's the thing where micro Python got so successful to not just find a solution for a specific problem, other way to go on and make it more usable for everybody. And there are other companies, so this is just one. More people are using it. Like these consultants that do development for customers and travels that, for example, he come across micro Python because it's always hard to find components and tools that on the one side they're easy to use but need to be on a professional application level and destroy him to micro Python. So that's what he told me. He can get up, set up adaptable to stuff as you can see here. These chips he's using here is the same as the PyBot which is the original, just plug it into an adaptable and get stuff up and running easily. So just as a little bit of an example. So when we look at this, it's the amazing software, all this implementation, like all this rewrite of Python to make it really running like clockwork on the hardware. So that's one side. But the other side is micro Python or George robotics, the company behind it does their own hardware as well. So if we could switch to the camera for a second, I can show you, yes. So you can see here this one is the original, so ever how small it is. This is the original PyBot. This is a PyBot light, actually, but the form factor is the same. And the new generation moved to this one because we were thinking what people told us were, yeah, well, we like these little modules. You probably have heard of the ESP32 or the ESP8266. They are small, tiny, easy to access and everything. But when you buy these modules, you still have to design a little PCB to program it for the first time. So that's what they were missing. So we designed in micro USB connector to make this up and running easy. Cortex M7 CPU for power, a Wi-Fi module with BLE. And on the other side, a micro SD card, so you can still exchange your, so you have an internal file system, obviously, but if you want to really collect data locally, you might like to have an SD card as well or storing all your programs. And here you see these bus connectors, which are officially designed on being plugged in into other adapter boards, which you can design yourself. So that's the aim of MicroPython. There will be some, obviously, to get you up and started. But what we really want is that people easily can design their own product and having their heart of the product out of the box already up and running. Yes. Okay. So I would go on with the demo now. Yeah. And show you a little bit of the code that's on the board. So I'm starting, I'm starting with the original PyBot. Yeah, very good. And here you can see this is also an adapter board. And here is a sensor board, which can be plugged in as well. So here we have RGB LED, temperature and humidity sensor, a light sensor, and a little buzzer for some sound. So you can see, is there actually something happening? Everything is better with a little buzzer, isn't it? Yeah. Okay. So I'm going to, this one is plugged in now. And if I switch back, perfect. Oh, yes, I like this. So this is the pipe flash, just comes out as a, it pops up like a USB stick or something. So when I go in there, I have my main pie, which is empty now, I believe. Yeah. So you can put your code here, just type code and save it to your board and run it. But obviously I have something prepared because I want to show you how easy it is to run the little sensor tile. I've shown you. So this is just a little driver written for the different, for this tile that I plugged in on the top. So you have the optical sensor, as you can see here, or the temperature and humidity. This is just to see, this code is already on there. I don't have time to do all this now. So I'm going to show you how easy access. So here in the background, as you can see, MicroPython, PyBot Lite, help, type help for mine. So we are already on this board. You can see, I showed you earlier before. If you type the help, it says a little bit about the control and everything. And I'm going to import the program I just showed you earlier and run a little of the test script. So as you can see, there's roughly 25.3 degrees. This seems a little bit low. But I also want to show you a little, if we could now switch back to, yeah, so as you can see, it's RGB LED just counting the different colors up. And I'm going to do some measurements. And it's going to be shown in the interactive grapple. So what's the amazing thing about this, as I would say, when I first come across this is, oh, my God, I just need nothing to install anything. I just need my Python code. And obviously, I need to know how to interact with my sensors and everything. But I don't have to install an IDE. I can use one if I'm used to one, but I don't have to. So I'm going to just like lock this into a text file. And then I have this and can use these data easy, like from the plugging it in and using the data to make some of my plots or whatever I need them for. So this is still the original Python. And the same sensors can be used with this one. I like this is the half-size-ish. And the same code runs on this board. To do this like this, I can see something. So if I now go back to my code and run exactly the same program that's also on the... So what I try to show, we try to do this all very modular. So still all of the old hardware will be still supported with the new upcoming sensors and styles. I think most impressive what I said that they managed to make these things very, very small because I think that's the most important part. If you run the Internet of Things at some point, you have the things should be tiny and mostly running on very low power. Sorry, that's the wrong button, the right button. And as you can see, there's a micro control on it and the Wi-Fi module is separate. So why is that? To make the board more expensive, obviously? No. To have the real-time availability of the microcontroller so that you can really focus on the task. And most of the time, you might just need the Wi-Fi to send the data off and don't have to really have it on all the time or something or need to wake it up through Bluetooth or whatever. So when you can see here, there's just a comparison to the old PiBot 1.1 and the PiBot D, which is the new one. It's got faster, obviously, because the microcontroller's evolved. And it's from 34 milliamps to a deep sleep to 10 microamps with the real-time clock still enabled. So which means it can be woken up. So this is a whole new area on what we really like to see the Internet of Things running on. When you think about it, that you don't want to go around and exchange batteries every time. Or I think it's a 20 billion by the time of 2020 that will be out and running and collecting data and sending them back. So the power problem is really a thing that needs to be focused on. So this is all very positive, isn't it? This can't be all so good about MicroPython, can it? So what MicroPython cannot do is not as it always, you need to see your problem that you want to solve. And then you need to look at what is available or what I could use with it. So really, really small MCUs that don't have enough RAM to put the MicroPython source code on it. They still will use traditional C because they're just not made for having these kind of operating systems. So MicroPython is an operating system like in Airtos, you might know. It's reimplemented on the bare metal, but still kind of acts like an operating system. As you can see, how easy it was for me to just switch on and access these different pins. And also, for example, for larger projects, especially when you work with a lot of people, you might like to have an embedded Linux system on your device where you can control everything. But I know of a company that has an embedded Linux system on a product but still uses MicroPython for the special tasks, which is very interesting because they already use this hardware on there, an extension board, and they are running in industries where you need to have the reliable data. So as I know, this is the maker track, but when you think about if making a product or really designing something that's be used in a couple of thousand times, so MicroPython can help you with the product development in productivity, traceability, because the code and the different firmware releases are very, like it's very well maintained in the open, so people can work together, fix problems, and the community can profit from that. Makes the testability easier. As I've shown you before, there are more than 200 different developers involved, and they come all from different areas, and sometimes you get these ideas from people you have not even thought about because that's their main thing they do. And so that's really fantastic to see how everybody makes each other, like, better than the license of MicroPython, the MIT license, which is very flexible, so you can use MicroPython, but you don't have to have everything open source, you can build on it and close up the thing that makes your product that generates the profit for your company, for example. And yes, as said, as the support, in general, the Python community is quite open and supportive, so is the MicroPython as well. The disadvantages, again, well, you might have increased hardware resources if you can use a smaller microcontroller, which is obviously cheaper, but it's too small to fit MicroPython, and you cannot use it, so this needs to be like, you always have to look at the time you need to pay for your developer that does the actual hard and software development compared to the price of the hardware you're using in your product. And sometimes it is in this area still, people don't use Python, they still use C or even a sampler or the low level languages for designing and programming with microcontrollers. Yes, I hope you enjoyed the talk, and I would be happy if you have some questions for me. So if we have some questions, please line up at the whole microphone set we have over here, or three people lining up already, so then we shoot with microphone number one, please. Hi, I would be interested which microcontroller families are supported, how difficult it is to build up a board on my own, and third one I forgot. Two is enough already, isn't it? Yeah, so there are a lot of microcontrollers supported, the official supported one from Damian George, the creator, mainly the STM generation from M4 to M7 and H7 are coming up, but there will be more, but for example, when you look at the GitHub, like the open source community put on the ESP8266, which you might have heard about, or the ESP32, which are also very well supported already. Thank you. Then we're going to jump over to microphone number two. How does the interaction with C code look like? So the interaction of micropython with C code? So you can implement your C code modules, you can call them from micropython, for example, so if you use in a special area for, I don't know, which is your knowledge, for example, you need faster code like C code, you can call them from the micropython code. Does that answer your question? Right, then we have a question from the internet, because the signal agile is signaling. Can you tell us a bit more about the new pi board D, its cost, availability and so on? It's very close. I have to say they're lining up and they need the final testing, but they should be available in the next two weeks. I know we are talking about this for quite some time now, but we really want to have this out and being happy with the software and everything is supported and there have been some challenges, let's call it like that, with the hardware protection, so I'm mainly the person that needs to take care of all the hardware, and at the moment it's not so easy to line up all the components, because the market is like sold out. So hopefully next two weeks. Okay, and then we're going to jump over to microphone number one please. Yes, a question. You said there's a possibility to add an SD card. Is there also something, how much or so you can plug it and just lay it somewhere? Like a battery or something? Yeah, for example, you showed it with the micro USB cable, is that the only solution or is there another solution? The micro USB cable is just because it's easy, it will be powered from the computer and I can program it like out of the box, but obviously when you finalize your product, you will just place it somewhere, so there will be adapter boards that have battery on it, hopefully rechargeable, so that's the whole idea and what we're thinking of is, as we make them so low power, we hope that we can really increase the time that they don't need to be charged for it. Yeah, yeah, obviously this makes, this is the whole internet of things is about, isn't it? All right, thank you. Then we're going to jump over to microphone two again. What's the main difference of features between micro Python and foreign Python? For example, exception handling, threats, etc. So threats, the threat module is supported. That's easy. When you go on the micro Python download page, they are different from those because we tried to have a minimal part and some parts that implement more of the features. Because it's really how you want to use it so threat is, for example, supported, so if you want to just flash it with your micro Python board, then you can use the module out of the box. Not all libraries of Python are supported because not all make sense, so NumPy would be cool, sure, but you smiling yourself, this would make so much sense. Directly run on micro controller, that's where you have the desktop. Okay, then we're going to go over to the signal angel again. Yeah, can you explain more about the execution speed of Python code compared to native code, C code on the py board? Execution speed. Execution speed? Yes. Well, it depends on the code. Now, seriously, seriously, how is it, is it 100 times, usually C is 100 times faster than Python, isn't it? Something like that. So you really have to pick out the places when you really need to, as I said, micro Python is usually fast enough for everything you like to do, just not in the area, you might have your advantage in. So it really depends on what you do. I cannot just say it's like four times slower or something like that. Sorry. Then we're going to jump over to microphone number one again. Yes. How much storage space does the runtime need and is there an effort to support AVR? I think it's 128 kilobytes, at least, that you need to, for the minimal port. And what was the second question? Are there efforts to support the AVR architecture? ADR. Sorry, Arduino? AVR. AVR. Sorry. Yeah, well, we plan on a lot, probably, that's on the list. Okay, then we're going to jump over to microphone two, please. I don't have a question, I have a remark, there's a Python and MicroPython assembly in hall two, so if you're interested to play around with MicroPython, you just can go to the same assembly, just type it into the navigation app and then you will find the Python assembly and then we have two boards there, you can play around with it. Fantastic. Microphone number one, please. Is Lora supported? Lora. There is a company called Pycom that does this as an extension module, but I think it's always combined with a microcontroller as well. So, well, in the end, we hope NB IoT and everything will be supported at some point, so because we don't really know whether Internet of Things will be going. So it won't stick just with Wi-Fi, that's just the first thing that's going to be known here. And now we're going to switch to microphone number four. Hi, thanks for the talk. How much is involved in creating a port to a new platform? Or what's involved? What are the basic steps? When you go on the forum, there are some hints to get you started, but there is not yet an official kind of recipe to do first step, second step and third step to because the thing is if you go to a new architecture, to a new microcontroller, you really, really have to write all the C code to make everything up and running. So we, Damian George did this with the STM, like with the F4 and is building up on the F7 now because he already put in so much effort to make this run really, really fast and efficient on the architecture. So not yet, but that's a good, very good point. I get that asked a lot, that we need this kind of how we get started to port into different microcontrollers. It's getting easy for everybody to do it. Yeah. Thanks for this question. There's one question, microphone number two. So in addition to continuing to develop new versions of the board, the main pie board, is the company that supports that also going to be developing sensors and add-ons like the one you developed? Or are you depending on Adafruit and other third party people to develop the sensor additions? The sensors themselves, we will buy. So for example, the GIs, this is a Texas instrument temperature sensor because it's really, really well. So we picked that and we make the the add-on boards that it fits. Like you mean probably the extension boards. Yeah. So we try to support a few, but we won't, we will, we would like to see that people are just picking up the design and designing in their own sensors, which that's what the open source is all about. So just the first initial one that gets started. And then a lot of people are around there to like them building add-ons. And maybe we just resell them if they like us to resell them that everybody can get access to it. That's the idea here. Okay. And the signal angel is signaling. Yeah. What about the ecosystem? So what other boards apart from the pie board does the run them? Oh, there are a lot. So there are, for example, all the PICOM boards, they do all this Laura and different kind of networks. Then there is a camera from OpenMV over in the US. Then there's other fruit who is supporting a really, really wide range of boards. And there are a lot of, like I think small vendors from China or from overseas who just put MicroPython on the ESP board. So if you, they are a wide range. It's not just, I'm just presenting the official ones because there is the initial software development, try to interact as best as possible with the hardware as well. Christina, I think I can't see anyone queuing up on the microphone. So therefore, thank you very much for the talk. Thanks. And that's your applause. Thank you very much. Thank you.