Dear viewer, these subtitles were generated by a machine via the service Trint and therefore are (very) buggy. If you are capable, please help us to create good quality subtitles: https://c3subtitles.de/talk/1074 Thanks!
[Music]
on stage we have Christina Spindler the
talk will be micro Pyon pythons for
microcontrollers and the claim underne
is how high level scripting languages
make your Hardware project beautifully
easy your stage and your
[Music]
applause yes hello everybody and thank
you very much for the
introduction um I'm really overwhelmed
how many people are here so I hope you
will enjoy the
talk as said my name is Christine I'm
with the micropython project um mainly
I'm responsible ible 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 first of all I'm going to give you
a little overview what I'm going through
with you today so first what is
micropython then what are the benefits
um of the script of using a scripting
language in a maker project there will
be some examples of make a project that
use micropython or how you can easily
get started with using micropython for
your own makeup
project um how micropython makes it um
easier to access and how it is special
because of the hard and software
interaction and in the end as as also
already said there will be questions and
answers um so some of you might think
micropython what is this uh super tiny
snake or maybe something to do with uh
montypython or
so the Triple E Spectrum um realized
this ranking of the most 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 micr
controllers and what I find quite
interesting is that assembly entered
into top 10 this year which means
probably because of the Internet of
Things the that are um that are
programmed with
assembly so
micropython um is a fully
reimplementation um of python and it
leims 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 to fit
on the um microcontroller it has a
virtual machine and a runtime system
with garbage collection and everything
you need to make it really efficient
there's B code or native machine code
you can use with this with with
micropython and there 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 to make it more efficient in
some your tiny bits there's also inline
sampler
supported the compilation happens on the
chip so it's not compile your program
you you write is not compiled on your
desktop machine it's um comp compiled on
the um Hardware you use
so um as later as I have this fantastic
camera over here I will show you some
demos um how how you easily can use
micropython how did this start how um
did someone think of having a high level
really high level scripting language to
run on directly on a microcontroller
about five years ago Damen George at the
time working at Cambridge University
thought ah this would be fantastic to
control my little robots with python
because it's easy and I know um and
I don't need to interact with all the
lowlevel stuff um 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 so
um and he wanted to to think maybe other
people will be interested in having 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's welcome to
contribute and it's yeah it's open to
everybody um so this was about 5 years
ago um and today up till today A lot has
happened when you look at our guar 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 there are makers but
there are also people that work as um
embedded developers in the
industry because they saw the benefit of
having um a high Lev 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 fogs which means a lot of people
are working on it um 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 U
modules to the children in the UK to get
them up and run running quite early in
the education process so python is
taught in school in the UK um
and this also so there are other
languages support as well but
micropython is also on it then there are
a lot of different development boards
for example other fruit has his own
micropython port that's called circuit
python so if you want to try micropython
you have a wide range of um development
boards and there is Al of course course
um the official micropython bought the
pie board which I'm going to show you
today because there's always a um 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 uh then last year there was the
first micropython oril book from nichas
toway um which is also quite big except
there are a few um actually a few makeup
um books already out there but this is
kind of milestone for us and also after
5 years it's time to make a new
board and I have this one with me today
so um what I'm going to try to do is
from the original Kickstarter which was
five 5 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 um we were talking to people what
would you like to see what do you
missing at the actual um on the market
and we try to listen and make a new
board as well so what's um the benefit
of scripting language used instead of
traditional C for example to program
microcontroller it's learnability it's
easy you can e read it more easily you
can you have uh 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 in our
makers if you see
oh this is a really really cool project
I did maybe I can do a product out of
this and some people might be
interesting so I 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 um it's also very easy to extend
it by a user so if you have something
already up and running and you want a
spec specific module implemented you
just get out as like it's open source
you can just pick it up and move it into
your own
way um so yeah so this is all very
positive talk but when I go out to
people um 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 micro 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
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 um
area uh so they say they are interpreted
so they are slow they lose they use a
lot of resources python um so this can't
be energy efficient efficient in any way
at all but I say well micropython 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 sides of data sheets and
you need to get anything out of it and
rubbing sometimes you have working
examples from the
manufacturers but you still well that's
when I did my final thesis in electrical
engineering ah 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 in the maker track I
thought um there are a lot of projects
out there so for example Daman George
which was the original idea to do the
pbot for the first Kickstarter uh he
wanted to do a quadopter
and if you want to learn more about this
there will be a QR code later on and or
for example you can do this weather
weather station which
are um run by micropython so if you like
to find out more there are a lot of in
um more make approaches in our
Forum where you can see um and they are
described on gab so you can build up on
them if you're interested to use this so
that's the maker side a lot of people
picked on up but I am also involved in
industrial project that use micropython
for the core architecture and when I
talk to some of the developers over
there um they ask me or they tell
me or I asked them why did you choose
micropython because it's just around for
maybe five years there's no really long
time um 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 um but one of the developers said
yes we were looking for replacement for
our embedded Linux system because an
embedded Linux system for this tiny
device we're using is just too bloated
we don't need it for um that
much
so it the in first product product
prototyp is was bled was was was with
with shell scripts and they replaced it
with
micropython um and after two times not
with this initial project they got on
and on with it because they really like
to use
micropython um they are now in low power
system that consume less than 500
nanoamps with active programming on the
microcontrol which is quite impressive
when you think about the real-time image
processing they're using it in so the
the 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 getes more clear when I'm trying to
do a little demo later
so and what they said is yes of course
you cannot use micropython for
everything because you might need some
assem code there and there bits and then
you just integrate integrated 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
um and also micropython is quite famous
for used in school calculators so about
I think two years ago the first um
calculator picked micropython up which
is numworks it's a
startup and they have these graphical
calculators that use
micropython um on them and just recently
uh we heard about that Kio is also
putting it into the microcontrol
controllers so this is the old uh cute
little Snake logo from the original
Kickstarter which you put on so that's
the good thing about the open source
they allowed to do it so they pick it up
and move it into their
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 b don't worry you can go on our
homepage and there is an
emulator where you have this little pieb
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 um more companies that are using
micropython is obviously Damian George
who created micropython and also offers
um development board around the so he
designs Hardware spe specific Hardware
or specific modules in micropython and
what he says this so my background is
theoretical physics um I'm not a typical
engineer who who looks like more um just
to getting a problem done or solved he's
more research oriented and he believes
and I believe that to that's the thing
why micropython got so so successful to
not just find a solution for a specific
problem um otherwi to go on and make it
more use usable for everybody and there
are other companies so this is just I
pick just one more people are using it
um like these um Consultants that
do uh development board development for
for customers and travel Travis travel
set for example he come across
micropython because it's always uh hard
to to find components and tools that are
on the one side they're easy to use but
need to be on a professional
applications level and this draw him to
micropython so that's what he told me he
can get up set up um adapter boards and
stuff as you can see here these chips
he's using here is the same as the
pyboard which is the original just plug
it into an adapter board and get stuff
up and running easily so just as a
little bit of an as an um
example um so when we look at this it's
the amazing software all this
implementation and 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 uh
micropython 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
soever how small it is this is the
original uh pyboard this is a pyboard
light actually but the form factor is
the same and the new
generation moved to this one because we
was we were thinking what what people
told us were yeah well we like these
little modules you probably have heard
of the ESP 32 or the
esp8266 they are so they are small um
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 a
micro USB
connector to make this up and running
easy um uh cortex M7 CPU for high for
power um a Wi-Fi module with BL and on
the other side a Micro SD card so you
can still exchange your so you have
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 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
um to get you up and started but what we
really want is that people easily can
design their own products and having
their heart of the products um out of
the box already up and
running um yes okay so I would go on
with the demo
now
yeah and show you uh a little bit of the
code that's on the board so I'm
starting I'm starting with the original
pie
board yeah very
good um and here you can see this is
also an adapter board so and here will
um here's a sensor board which can be
plugged
in um as well so here we have a RGB LED
uh temperature and humidity sensor a
light
sensor and 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
um okay
so um I'm going to this one is plugged
in
now and if I switch back
perfect
um
so oh yes I like
this uh so this is the pipe FL just
comes
out as a it pops up like a USB stick or
something
so 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 um and save it to
your board and run it but obviously I
have something prepared because we want
to show I want to show you how easy it
is to
run to run
the uh the little sensor tile I I've
shown you so this is um just a little
driver written for the for the different
for this tile that that I plugged in on
the top um so you have um the optical
sensor as you can see here or the
temperature and humidity this is just to
see um this code is already on there I
don't have time to do all this
now so
um I'm going to show you how easy access
so here in the
background
sorry um as you can see micropython
pipot light help type help help for so
we are already on the sport you can see
I showed you early 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 show showed
you
earlier and run a
little of the test
script
so as you can see there's roughly 25.3
de 32 this seems a little bit
low but um I also want to show you a
little
um if we could now switch back to yeah
so as you can see it's RGB LED just
counting Counting the different colors
up
and I'm going to do some measurements
and
it's going to be shown in the
interactive Rael so there's what's the
amazing thing about is as I would say
when I first come across this is oh I oh
my God I just need nothing to uh to
install or 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 if I'm used 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 I
can use these data easy like from the
plugging it in and using the um or the
data to make some some of my plots or
whatever I need them
for so this is still the original uh
pyot and the same
uh sensors can be used with this one I
like this is this is the half
sizes and the same cone runs on this
board to do this like this I can see
something so and if I now go back to my
code and run exactly the
same um P the same program that's also
on
the so what I try to to to show um we
try to do this all very very modular so
still the old 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 the things should be tiny and
mostly running on very low
power
sorry that's the wrong button the right
button um and as you can see there's a
microcontrol on it and the Wi-Fi module
is separate so why is that to make the
board
more more expensive obviously no to have
the real-time availability of the micr
controller so that you can really focus
on the task and most of the time you
might just need the the Wi-Fi to send
the data off and not don't 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 this just a comparison to the
old uh pyboard 1.1 and the pyboard D
which is the new one the there's the
it's got faster obviously ly because the
microcontrollers
evolved and it's from 34 milliamps to a
deep sleep to 10 microamps with the real
time clock still enabled so which means
you can be it can be woken up so this is
a whole uh 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 um uh every time or I think is
a 20 billion by the time of 2020 they
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 or is not as you can 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 what I
could I use with it so really really
small mcus that don't have enough RAM to
put the in like the micropython source
code on it they use still will use
traditional C because they are just not
made for having these kind of operating
system so micropython is no operating
system like an AOS 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 um um 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 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 used
this Hardware on their um extension
boards and they are running in really
reli like in Industries where you need
to be um have the reliable um
data um
so as I know this is the maker uh track
but when you think about if making a
product or really designing something
for that that's been used in a couple of
thousand times so micropython can help
you with the product development in
productivity traceability because the
the code and the different fir releases
are very like it's very well maintained
in the open so people are can work
together fix problems and the community
can um Can profit from that makes the
test testability um 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 um makes each
other like
better than the license of micropython
is the MIT license with which is very
flexible to 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 uh that generates the profit for
your company for
example and yeah as as said as the
support in general the python Community
is quite open and supportive so is the
micropython as well um 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 too small to fit
micropython on it and you cannot use it
so this needs to be like you always have
to to look at the time you need to pay
for your developer that do does the um
actual hard and software development
compared to to the price of the hardware
you're using in your 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 lowlevel
languages for
um um 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
[Music]
that's a bit where I'm going to get
involved again so if we have some
questions please line up at the whole
microphones that we have over here but
there's three people lining up already
so then then we shoot with microphone
number one please hi hi um I would be
interested which microcontroller
families are
supported um
how uh difficult it is to to build up a
board on my
own and um so one I forgot sorry two is
enough already isn't it um yeah
so there are a lot of microcontrollers
supported the official supported one
from Damian jistic Creator are mainly
the STM STM generation from M4 to M7 and
H7 are coming up but there will be more
but for example example when you look at
the GitHub like the open source
Community put on the
esp8266 which you have might have heard
about or the ESP 32 which are also very
well supported
already thank you then we're going to
jump over to microphone number two um
how does the interaction with C code
look
like so the interaction of microp with
some Seer so you can you can mend um
your C code modules you can call them
from micropython for example so if you
if you use in a special area for I don't
know which is your knowledge for example
or you need faster code like C code um
you can call them from the micropython
code is does that answer your question
yes okay right then we have a question
from the internet because the signal
agel is
signaling yes can you tell us a bit more
more about the new pieo D it's Coast
availability and
so it's very
close um I have to say they're lining up
um 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
support with the software and everything
is supported and there have some mic
some challenges let's call it like that
with the hardware protection so I'm
mainly um the person that needs to take
care of all the hardware and it's at the
moment it's not so easy to line up um
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 uh
yes a question you said there's an
possibility to add an SD card yeah uh is
there also something as a power module
so you can plug it and just lay it
somewhere uh like um a battery or
something uh yeah for example once you
showed it with the micro USB cable y uh
is that the only solution or is there
another solution um the micro USB cable
is just because I it's easy it will be
powered from the computer and I can
program it like out of the box but
obviously when you finalized your
product you will just place it somewhere
so there will be adapter boards that
have a 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 JG yeah yeah yeah obviously
this makes this is the whole internet of
things is about is right thank you
you're welcome then we're going to jump
over to microphone tool again what's um
main difference uh of features between
micropython and P and for BL uh python
for example exception handling uh
threats Etc
um so threats the thread module is
supported um that's easy when when you
go on the micropython um download page
there are different firw because we we
try to have like a Min minimal port and
some ports that Implement more of the of
the features so because it's really how
you want to like use it so threat is for
example supported so if you want to just
flashh it with your micro python board
then you can use the model out of the
box not all um libraries of python are
supported because not all makes sense so
numpy would be cool sure but you smiling
yourself this wouldn't make so much
sense directly run on microcontroller
that's why you have the desktop
for 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 P
Board execution speed it most execution
speed yes
um well it depends on the
code
um no
seriously um seriously uh is how is it
is it 100 times usually C is 100 times
faster than python isn't it something
like
that um so you really have to to pick
out the places when you really need to
as I said micropython is usually fast
enough for everything you like to do
just not in the area you might have your
advantage in
so um it really depends on what you you
do you can 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 uh how
much storage space does the runtime need
and is are there to support AVR
I think it's 128 kiloby at least that
you need to for the minimal port and
what was the second question are there
efforts to support the AVR
architecture ad AVR
ADR sorry
adino
AB
AVR sorry
sorry um yeah well we we plan on a lot
probably that's also on the list
yeah okay then we're going to jump over
to microphone 2 please I don't have a
question I have a remark there's a Pyon
and micropython assembly in Hall to so
if you're interested to play around with
micro Pyon you just can go to the
assembly just it's type it in the
navigation app and then you will find
Pyon assembly and there we have two
boards there you can play around with it
fantastic
microphone number one please is uh Laura
supported Laura
Laura um there is a company called pyom
that does this as an extension module
but it's I think it's always combined
with a microcontroller as well
so well in the end there might we hope
nbiot and everything will be supported
at some point so because we don't really
know where the 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
yeah and now we're going to switch to
microphone number
four hi thanks for the talk um how much
is involved in creating a port to a new
platform or or what's involved what are
what are the basic
steps um when you go on the Forum there
are some hints to get you started but
there is not yet an official like kind
of recipe to do first step second steps
and third step
to because the the thing is if you go to
a new architect do new microcontroller
you really really have
to like write all the C code to make
everything up and running so we Damian
George did this with the STM Dar 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 ask a lot that we need
this kind of how we get started
reporting to 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 uh versions of the board
the main Pi 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 uh Ada fruit and other third party
people to develop the sensor additions
um the sensors themselves we will buy so
for example the ti this is this is in
Texas instrument temperature sensor
because it's really really well so we
pick that and we make the um the add-on
boards that it fits like you mean
probably the extension boards yeah uh so
we try to support a few but we won't we
will we 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 get
started and then a lot of people are
around there to like them building
addons and maybe we just resell them if
they like us to resell them that
everybody can get access to it that's
the idea
yeah okay and the signal Angel is
signaling yeah what about the
ecosystem U so what other boards par
from the pie board does it run on
them oh there are a lot so there are for
example all the py com bols they do all
these Laura and different kind of
networks then there is a camera from
open MV over in the US then there's Ada
fruit who is supporting a really really
wide range of boards and there are a lot
of like I think small vendors from from
China or from overseas who just put
micropython on the ESP board so if you
they are wide range it's not just I'm
just presenting the official ones
because there is the initial software
development try to interact um 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
[Music]
[Applause]
[Music]
you
[Music]
m