WEBVTT

00:00.000 --> 00:11.120
Hello everyone, today we'll talk about Micropython, Python for miccontrollers, and the

00:11.120 --> 00:15.640
meta-linics with the focus on sensor oriental applications, because that's what I specialize

00:15.640 --> 00:17.840
in.

00:17.840 --> 00:23.320
So I'm from a company called SoundSensing, we monitor machinery, such as ventilation systems,

00:23.320 --> 00:28.640
et cetera, and for a building like this, for example, and we do that in automatic detection

00:28.640 --> 00:31.720
of problems and notify the maintenance team.

00:31.720 --> 00:36.600
We use micropython to prototype devices, and then they usually go into a dedicated device

00:36.600 --> 00:39.360
using Bluetooth low energy.

00:39.360 --> 00:44.400
So the goal of this presentation is that you as a embedded software and better, or software

00:44.400 --> 00:49.560
developer, either your professional or hub-based, learn enough of micropython to consider

00:49.560 --> 00:54.800
it, at least for a future project, or maybe you will rule it out based on some information

00:54.800 --> 00:56.040
that you get.

00:56.040 --> 01:01.320
So who here has a used, like, play doing micropython so before?

01:01.320 --> 01:08.360
Yeah, that's quite a lot, okay, hopefully we'll learn something, and note that there's a micropython

01:08.360 --> 01:13.760
stand as well in the AWS building, so afterwards I will go there and have it to chat with

01:13.760 --> 01:18.600
others about micropython, but if you used it before or not, who here is used Python, so

01:18.600 --> 01:20.760
just playing Python on the things?

01:20.760 --> 01:24.320
That's basically everyone, that's great.

01:24.320 --> 01:30.520
So you will especially learn something, you'll be able to use your skills in a new domain.

01:30.520 --> 01:35.400
So I focus on sensor node systems, just very broadly, you can consider this as some sort

01:35.400 --> 01:39.720
of device that will lead to red sensor data, process sensor data, and transcripts, or act

01:39.720 --> 01:40.720
on it.

01:40.720 --> 01:44.080
So this could be an iterative things type of device, a kind of logging device, it could

01:44.080 --> 01:50.480
be a very wearable device, a phone or a smartwatch, or something like this, or it could

01:50.480 --> 01:55.640
be used in better, specialized, like we monitor machinery, it could be use in robotics,

01:55.640 --> 01:59.120
industrial automation, et cetera, so there's like a large amount of different things, but

01:59.120 --> 02:03.720
they have similar characteristics, into red, process, and transmitter act.

02:03.720 --> 02:08.080
In this case, we'll also consider, we'll focus mostly on this processing part, well cover

02:08.080 --> 02:12.120
the others as well, where we can also do some digital sync processing in machine learning,

02:12.120 --> 02:18.280
well, they really push that little Python on these little devices, so there's just some

02:18.360 --> 02:25.840
examples that you could have, and we have actually code examples for my project for several

02:25.840 --> 02:26.840
of these.

02:26.840 --> 02:31.200
So we can go everything from really simple temperature logging, just regular logging, very simple

02:31.200 --> 02:38.880
data, and small amounts, to image classification, quite complex or audio classification.

02:38.880 --> 02:44.960
And the outline, we'll do a quick introduction to the project, a micro Python, we'll do a tour

02:44.960 --> 02:49.840
of some of the features, focusing on the sensor stuff, sensor communication, connectivity,

02:49.840 --> 02:55.000
so more usually online, or BLE, as mentioned in the prehistoric, and then especially native

02:55.000 --> 02:56.000
scene modules.

02:56.000 --> 03:00.200
So you don't have to just just Python with micro Python, you can combine it with C, which

03:00.200 --> 03:04.840
is a really powerful feature, and allows you to do much more.

03:04.840 --> 03:08.840
And then we'll cover a bit of sensors that use digital sync processing, or machine learning,

03:08.840 --> 03:13.000
and a tiny bit about themented Linux in micro.

03:13.000 --> 03:19.720
So micro Python was created in 2014, over 10 years ago, so it's now a really mature project,

03:19.720 --> 03:20.720
I would say.

03:20.720 --> 03:27.360
It has its sports devices with 64 kilowatts of RAM and more, although I would really recommend

03:27.360 --> 03:35.720
going for some like 256 or 12 kilobytes to really get the benefits, it's a bit cramped

03:35.720 --> 03:36.720
below that.

03:36.720 --> 03:40.200
It supports a lot of different micro control families, and tries to be compatible with

03:40.200 --> 03:44.000
C, Python as you can.

03:44.000 --> 03:47.200
If you're just starting out, you haven't used micro Python before, I would really recommend

03:47.200 --> 03:52.200
starting ESP32 device, it's one of the best supported ports, they're powered, you can get

03:52.200 --> 03:57.520
chips very cheaply, but also complete devices, you know, you flash them, and they were

03:57.520 --> 03:58.520
micro Python.

03:58.520 --> 04:04.360
So even if you don't like, or if you're not that familiar with electronics yet, then

04:04.360 --> 04:09.040
you might want to start up there instead of buying a chip.

04:09.040 --> 04:15.720
Installing micro Python for ESP32, or similar, it's very simple, ESP32, you have the

04:15.720 --> 04:20.400
program tools or in tip, or your Python package manager, you just tip and still add two

04:20.400 --> 04:26.000
commands to flash your micro Python, and you have a little Python running on your little

04:26.000 --> 04:27.000
device.

04:27.000 --> 04:32.000
So basically from there on, you know how it goes, at least for the general programming

04:32.000 --> 04:33.000
stuff.

04:33.080 --> 04:38.760
You might want to install this NP remote, which is just convenient tool for communicating

04:38.760 --> 04:40.520
with your device from your computer.

04:40.520 --> 04:45.440
Typically, you're plugged in over your speed, but you can also do like a wrap-all over Bluetooth

04:45.440 --> 04:49.200
or Wi-Fi, which can be convenient, for example, if it's deployed somewhere in your home,

04:49.200 --> 04:52.400
you don't want to have to go to plugging all the time.

04:52.400 --> 04:57.840
There's several IDs that support micro Python from like standard like ESCode, or dedicated

04:57.840 --> 05:02.280
one's like Viper ID, online, or Tommy.

05:02.280 --> 05:05.880
Simple things are simple in micro Python, which is fantastic.

05:05.880 --> 05:10.160
So this here is a complete code in order to create a temperature sensor.

05:10.160 --> 05:12.960
We are using one external library.

05:12.960 --> 05:16.440
In this case, this device just has that temperature sensor in the accelerometer, so we're

05:16.440 --> 05:20.280
actually talking to that to get the temperature, but it would be very similar if you would

05:20.280 --> 05:23.520
get it from a digital, 10% or analog one.

05:23.560 --> 05:31.160
So you do, this is using ACing IO, which makes this kind of network type things quite

05:31.160 --> 05:35.320
convenient and concise, and we're communicating over like MQTT.

05:35.320 --> 05:42.360
So you have this old kit and like one slide, which is super nice, and that's very easy

05:42.360 --> 05:43.360
way to get started.

05:43.360 --> 05:49.400
If you use Viper ID, you can, after you flash your device and create a step, you can open

05:49.400 --> 05:54.360
Chromium, and that URL, and that's all you need to program your device with that.

05:54.360 --> 05:57.560
You have the recollects and many other features.

05:57.560 --> 05:58.560
So it's really convenient.

05:58.560 --> 06:02.880
In educational setting, this is fantastic, because you can just give people these devices,

06:02.880 --> 06:08.200
we might create installed, they plug it in, they're device with Chromium, and you have

06:08.200 --> 06:11.640
it also works on Android.

06:11.640 --> 06:14.360
If that's too much, I mean, if you don't have the hardware, maybe we should might

06:14.360 --> 06:20.240
not, you are waiting for getting it from other Expresss, or a digital key or something.

06:20.240 --> 06:25.400
Then you can, for example, go to this walkway.com, they have a browser-based simulator,

06:25.400 --> 06:28.920
which doesn't look like this, where you can start programming right away, so if we

06:28.920 --> 06:34.520
find me talking very boring, you can go into there and start programming.

06:34.520 --> 06:38.080
There's also a PiScript, it's a project for Python in browser.

06:38.080 --> 06:42.480
They also have a Python repel, just a plain repel on the front page, just go to the front

06:42.480 --> 06:43.480
page, you have my Python.

06:43.480 --> 06:48.000
It takes like, like, 100 milliseconds to look.

06:48.000 --> 06:49.000
Quick tour.

06:49.000 --> 06:54.000
So, my Python is Python, it is Python's implementation, but from scratch, right, and for

06:54.000 --> 06:55.640
these constraint devices.

06:55.640 --> 07:01.160
So which means there is not 100% CPython compatibility, like the Python that we are used

07:01.160 --> 07:02.160
to running.

07:02.160 --> 07:06.560
There's a very high degree, and the goal is to get as close as possible, but there are

07:06.560 --> 07:09.760
some differences that are in parent, like when you're running under one megabyte of RAM,

07:09.760 --> 07:13.440
or 100 kilobytes of RAM, there are some, for example, some,

07:14.440 --> 07:19.240
modules in the standard CPython library, which doesn't really make sense there.

07:19.240 --> 07:24.880
So, it's quite minimal, but you get when you flash your base micro Python, but then you

07:24.880 --> 07:30.840
can install libraries from micro Python lib, for example, to get more featured libraries

07:30.840 --> 07:37.120
from the standard CPython standard library, or common things like their quest module,

07:37.120 --> 07:40.320
which is used for HTTP communication, where you can type them.

07:40.360 --> 07:44.160
There's a documentation about known incompatibilities, and they most of them have a good

07:44.160 --> 07:45.160
reason.

07:45.160 --> 07:48.600
Like, there's like a reason where it's really tricky, or it could just cost too much

07:48.600 --> 07:51.800
to implement it in the perfectly compatible way.

07:51.800 --> 07:55.400
There's also a bunch of things that are not implemented, so like CPython, they add

07:55.400 --> 07:59.000
the feature, of course, all the time, and for a project to follow, that has quite

07:59.000 --> 08:00.000
challenging.

08:00.000 --> 08:04.320
So, there's, you will find on the issues, you will find for each CPython major release,

08:04.320 --> 08:08.000
you will find documentation about like what's implemented, how are people considering

08:08.000 --> 08:12.200
to implement it, and if you have a pet feature that's not implemented, well, then you

08:12.200 --> 08:14.760
can go there, and you can help out.

08:14.760 --> 08:19.800
So, there's no CM module, CFFI compatibility, so it means like most of your Python

08:19.800 --> 08:26.280
stuff will work if you massage it a bit, maybe use a little bit older syntax or not

08:26.280 --> 08:33.280
the latest stuff, but CM modules like Python, and I'm sorry, pandas, or numpy, or such,

08:33.280 --> 08:37.280
it doesn't work at all, because the CPython is different, but there is a CPython where

08:37.280 --> 08:38.280
we get that.

08:38.280 --> 08:44.360
It's also garbage collected, and this is very important, on a tiny device where it's not

08:44.360 --> 08:48.840
the fastest thing in the world, that cycle will take like 1 to 10 milliseconds, and it's

08:48.840 --> 08:52.640
very variable, so when you're doing low latency stuff, that can be tricky.

08:52.640 --> 08:57.200
So if you have a risk case that is that, check and do some prototyping and see if that's

08:57.200 --> 08:58.200
realistic.

08:58.200 --> 09:02.960
We have some control over the garbage selector, like a kind of enabled disable force

09:02.960 --> 09:08.200
collection, so on, but you can't do like incremental GCE, or an arena in GCE, or some

09:08.200 --> 09:09.200
of that.

09:09.200 --> 09:13.800
So, yeah, you will find it very familiar, small script will work at large programs,

09:13.800 --> 09:19.000
we'll need restructuring the refactoring, and some of this is due to the nature of going

09:19.000 --> 09:21.400
on to the tiny device.

09:21.400 --> 09:27.240
So hardware access, that's of course additional from CPython, CPython doesn't have

09:27.240 --> 09:33.400
this, but Python has this machine module with a set of classes to do your typical hardware

09:33.400 --> 09:34.400
peripherals.

09:34.400 --> 09:43.120
So this is what GPIO, analog digital buses, like SPI, ITC, communication, etc.

09:43.120 --> 09:49.440
This is mostly combined in there, so that's something to familiarize yourself with, you

09:49.440 --> 09:53.120
actually want to talk to something around your device.

09:53.120 --> 10:00.120
It's common for all ports, it's a high degree of standardization by now, a few exceptions,

10:00.120 --> 10:04.400
but means that your code will be portable across different devices.

10:04.400 --> 10:10.520
Quite a component, there's a file system, so my programming with my Python is more like

10:10.520 --> 10:17.480
programming a little computer rather than like a classical microcontroller device is much

10:17.480 --> 10:21.440
more familiar, you get the Python experience.

10:21.440 --> 10:27.360
Usually, it's only file system is only until a flash, or you can put it on a SD card

10:27.360 --> 10:28.360
or both.

10:28.360 --> 10:35.200
A little effect is recommended, like a proper embedded file system, a fat 32 is not great,

10:35.200 --> 10:38.800
but it's supported a lot of places, so if you want to expose it over USB, you kind of have

10:38.800 --> 10:39.800
to do that.

10:39.800 --> 10:45.040
That means you can save and load from standard files using open and like this completely

10:45.040 --> 10:49.000
stand, that's just Python by that time.

10:49.000 --> 10:53.520
An MP remote is useful because then that has some tools to allow you to copy things

10:53.520 --> 10:59.520
to that file system on your microcontroller or to a couple things back, which is really

10:59.520 --> 11:02.880
nice, especially when we work with data, we want to be able to store data when we

11:02.880 --> 11:09.680
will store data in a standard format, so I can save audio files as a wild file, and I can

11:09.680 --> 11:15.440
just copy it over and read it as a wild file, instead of managing with custom data formats

11:15.440 --> 11:17.680
and it usually gets very messy.

11:17.680 --> 11:20.560
This makes it super easy.

11:20.560 --> 11:26.880
There's a package manager called mid introduced right from two years ago, so you can then

11:26.880 --> 11:31.400
from your computer with your USB attached device, you can do MP remote install in an

11:31.400 --> 11:38.120
library that will be pulled from micro Python lib, or you can specify a via GitHub, where

11:38.120 --> 11:43.560
it comes, or you can use a specific URL to basically get it from anywhere, which is accessible

11:43.560 --> 11:45.200
on HTTP.

11:45.200 --> 11:52.400
That can use that with your computer when your device is connected, or if you have configured

11:52.400 --> 11:58.920
Wi-Fi or internet somehow on your device, like a USB 32, you can use mid as a package manager

11:58.920 --> 12:06.320
as a module, so you don't need to go through your computer, which is super, can be quite

12:06.320 --> 12:11.880
nice, but what I find the most interesting is that you can install native C modules at

12:11.880 --> 12:17.920
a run time as well, so you don't just type in code, you can add some native code,

12:17.920 --> 12:22.520
which is then accessible as a Python module, for that you need to specify a full URL,

12:22.520 --> 12:26.400
and you need to specify the architecture of my Python version, so it's very quite a bit

12:26.400 --> 12:33.760
of care to pick the right thing, but you can just drop in new native code, which is

12:33.760 --> 12:39.520
super cool and quite unique for a better platform, and that's what I use a lot for

12:39.560 --> 12:41.560
machine learning in the SPSL.

12:41.560 --> 12:46.840
Connectivity, Bluetooth Low Energy is a very real supported, there's a high-level interface called

12:46.840 --> 12:52.720
IoBilly, do use that if you can, and only go to the Bluetooth low-level if you have

12:52.720 --> 12:59.880
to, it's much more convenient, it's one of actually the most pedagogical ways of dealing

12:59.880 --> 13:03.200
with Bluetooth Low Energy in my experience in a better world.

13:03.200 --> 13:09.200
Wi-Fi, there's the network.long, VLAN module, and internet on network.long modules.

13:09.200 --> 13:16.960
Sport on at least many of the most common ports, so yeah, that means you can, 10 things

13:16.960 --> 13:20.560
online, you can fetch things online, you can build things like this, yes, and then like

13:20.560 --> 13:26.800
this Tesla example shown before, it would be feasible or just post something to social media,

13:26.800 --> 13:31.480
like you detect an image of your cat, and you send it directly to the interwebs, that's

13:31.480 --> 13:33.480
what it's for, huh?

13:33.480 --> 13:41.400
So, see module, this is my favorite feature of micro-python, because it allows us to combine

13:41.400 --> 13:46.960
efficient C code with convenient Python scripting, as is basically how we program Python

13:46.960 --> 13:54.160
on computers for data science, type things like Undas, NumPy, TensorFlow, Keras, PyTorch,

13:54.160 --> 14:00.680
all of that is implemented in C or C++ or Rust or only, and then access to Python.

14:00.680 --> 14:06.080
You can do the same with micro-python, which is super powerful, and you can mix and match

14:06.080 --> 14:08.920
as much as you want, find a balance.

14:08.920 --> 14:14.560
So you can implement that as a user, or as a library, I have one library I will show you.

14:14.560 --> 14:20.400
Of course, in the first micro-python modules that come with a core that you use, they are

14:20.400 --> 14:29.120
a lot of them, not only, it uses Python as much as a C, but somewhere as in C.

14:29.120 --> 14:33.000
Then you can also use, actually, as long as you're some code, you can either compile

14:33.000 --> 14:36.600
to C or expose it and see API, you can use that as well.

14:36.600 --> 14:42.400
So there's a project that goes through a wasom ahead of time compiler, and then you can

14:42.400 --> 14:45.840
do C++, Rust, C, time and go, etc.

14:45.840 --> 14:47.960
So there's a lot of powerful.

14:47.960 --> 14:48.960
That is quite new.

14:48.960 --> 14:53.000
So if you're doing that, beware that that's probably not like super smooth, but super

14:53.000 --> 14:56.000
cool, and then we can help us improve that support.

14:56.080 --> 14:57.480
The module looks something like this.

14:57.480 --> 15:02.680
You, at the bottom, is the declaration of the module, like what kind of entry points to

15:02.680 --> 15:03.680
you have.

15:03.680 --> 15:08.680
In this case, there's a, it's called Global, but that's actually attached on the module

15:08.680 --> 15:14.000
object, a factorial name, and that exposes its factorial function.

15:14.000 --> 15:17.600
And then often you put, as long as it's done nothing, you know, with the binding kind

15:17.600 --> 15:20.680
of layer, usually has plain C code from the outside.

15:20.680 --> 15:25.880
So you can include a library, thread a couple of wrappers like that, expose it, and you're,

15:25.880 --> 15:28.720
you can use your C code in my proprietary.

15:28.720 --> 15:34.240
And thanks to the package manager, you can drop it in at runtime.

15:34.240 --> 15:39.560
There are two ways of packaging the C modules, native modules, those are ones that can be

15:39.560 --> 15:42.040
dropped in at runtime.

15:42.040 --> 15:44.840
There are some limitations there around the linker.

15:44.840 --> 15:49.760
There's a pull request, which has not been approved, it's not yet merged by Volodymyr

15:49.760 --> 15:55.360
Schuminsky, that improves that a lot, so this is coming in the next release.

15:55.360 --> 15:58.920
And the mixture is a little bit low, and then the external C modules, that's the modules

15:58.920 --> 16:06.200
that are built into a firmware, like a firmware built as kind of traditional build process.

16:06.200 --> 16:11.480
And that's really excellent, that's like how it's been doing in the 10 last 10 years.

16:11.480 --> 16:15.360
So yeah, you need a little bit of picking shoes, but we're really improving this native

16:15.360 --> 16:16.360
modules.

16:16.360 --> 16:23.160
So Audiumput, you can as well do, with the machine I2S, it supports digital microphone,

16:23.240 --> 16:25.440
external ADC, et cetera.

16:25.440 --> 16:30.880
Unfortunately, right now, PDM microphones, or the protocol is not supported, so that's

16:30.880 --> 16:32.840
something where it's ongoing.

16:32.840 --> 16:36.600
We would love help, someone is working with the area.

16:36.600 --> 16:43.680
There's a lot of good examples for dealing with I2C in audio, by I2F and it can look

16:43.680 --> 16:45.480
something like this.

16:45.480 --> 16:51.560
Camera input, there's no standard API for this, like a generic port that's available on

16:51.560 --> 16:52.560
ports.

16:52.560 --> 16:59.200
A good project for ESP32 called MicroPit and Camera API, which is a really good

16:59.200 --> 17:03.360
to provide pre-built binaries that you can put on your ESP32, which has a camera on it,

17:03.360 --> 17:04.360
and it really works.

17:04.360 --> 17:08.880
There's also open and game, which is complete MicroPit and distribution with a lot of

17:08.880 --> 17:12.560
computer vision and machine modules already built in.

17:12.560 --> 17:17.520
So that's really powerful for that specific niche, if that's what you're interested in.

17:17.520 --> 17:22.320
So a couple of examples, sensor nodes, with MicroPit on an EM learn, EM learn is a library

17:22.360 --> 17:28.200
that I maintain and has EM MicroPit on bindings for digital scene processing and machine

17:28.200 --> 17:29.200
learning.

17:29.200 --> 17:36.240
Here's an example of a noise sensor, machine is sound level, for that you need to do this

17:36.240 --> 17:40.800
A-weight incur, and you need to do infinite impulse response filter in or do that, there's

17:40.800 --> 17:41.800
a standard way.

17:41.800 --> 17:46.600
If you try to do that in MicroPit on, like even with a few performance tricks that is

17:46.600 --> 17:52.280
available for MicroPit on, it still takes like almost 10 times as much time as you have.

17:52.360 --> 17:59.560
For instance of time, so it doesn't work, but if you do this, you add the same module in,

17:59.560 --> 18:04.680
and it runs in a fourth of the CPU that works really well.

18:04.680 --> 18:08.880
There's example, these are all available as examples online.

18:08.880 --> 18:14.720
And you can do them in a timid detection, this is like what you're doing, and that's

18:14.720 --> 18:19.280
using around the forest, training a second learn, and that runs connects faster.

18:19.280 --> 18:22.680
As you can do with Python, but it's much faster with C.

18:22.680 --> 18:28.280
Image classification, with convolutional neural network, you can do like one to 10 FPS of

18:28.280 --> 18:31.960
small images with a few layers CNN, so you can look quite a lot of simple tasks with

18:31.960 --> 18:32.960
this.

18:32.960 --> 18:40.880
That's also available as a C module that you can just drop in and for embedded Linux, motivation

18:40.880 --> 18:42.840
there is memory efficiency.

18:42.840 --> 18:49.240
So if you have a device which has under 512 megawatts RAM running Linux, regular Python,

18:49.560 --> 18:51.080
is a bit, can be a bit painful.

18:51.080 --> 18:55.640
For example, psychic learning will take 128 megabytes for just loading these modules.

18:55.640 --> 18:57.280
So you haven't started doing anything useful yet.

18:57.280 --> 18:59.600
So that's, can be painful.

18:59.600 --> 19:05.880
The same you can do in a few megabytes with micro Python, going to be fast, so we have

19:05.880 --> 19:08.600
time for some questions.

19:08.600 --> 19:12.880
And the unique micro Python port though, it's really good for testing, like I do almost

19:12.880 --> 19:18.600
all the development of the business logic on my machine, and then I run it on the

19:18.600 --> 19:20.920
device for the hardware.

19:20.920 --> 19:24.560
But the hardware parts in the Unix module is very sparse.

19:24.560 --> 19:30.080
So we would love some help if anyone's interested in actually deploying that and using hardware

19:30.080 --> 19:31.080
to implement that.

19:31.080 --> 19:36.480
For example, Raspberry Pi, we should be able to use GPIO, etc., right to see and so on.

19:36.480 --> 19:45.680
So to summarize, and take ways, I say that micro Python is a very productive environment,

19:45.680 --> 19:51.320
mature, or 10 years now, especially for sensor devices, that's what I'm familiar with.

19:51.320 --> 19:58.080
It's very, it gives the familiar Python environment an ease of use, excellent connectivity,

19:58.080 --> 20:03.880
like Wi-Fi, et cetera, really convenient fast to get that up and running.

20:03.880 --> 20:09.840
This mid-package manager is nice, especially the native modules, and we just drop in new

20:09.840 --> 20:14.320
modules to test the Python experience and promote it very useful.

20:14.320 --> 20:20.480
And then you can implement a lot of quite advanced processing of sensor data, especially

20:20.480 --> 20:27.320
when you drop in some C modules here and there for efficiency reasons.

20:27.320 --> 20:33.200
And then we provide this E-mode micro Python library, which is set of modules for digital

20:33.240 --> 20:35.040
processing and machine learning.

20:35.040 --> 20:40.080
So to just make that super easy, you don't have to write all those modules yourself.

20:40.080 --> 20:44.800
So more, to where I'm going to be going to talk about low-sized machine learning, so

20:44.800 --> 20:49.040
like really going more into the C level and really low-power machine learning on micro

20:49.040 --> 20:52.480
controllers, if you just need to not come check it out.

20:52.480 --> 20:58.640
And then there's a stand, what micro Python in the AWS building, and I will go there

20:58.680 --> 21:03.880
after the first set of your talk, and hope to see people there.

21:03.880 --> 21:09.640
There are stickers, boards, devices, other people interested in the same stuff, so happy

21:09.640 --> 21:12.640
to chat there later.

21:12.640 --> 21:15.640
And here what you are interested in.

21:15.640 --> 21:16.640
So thank you very much.

21:16.640 --> 21:31.640
So we have a time for one question.

21:31.640 --> 21:35.720
When I went to a ride some code for a micro Python, you can choose between native or

21:35.720 --> 21:42.720
C, it's up to you after, but what's the size difference in your experience?

21:42.720 --> 21:48.160
That depends a lot on the type of task.

21:48.160 --> 21:53.720
It can be quite small actually, but you mean C quite smaller than Python or whatever.

21:53.720 --> 21:59.320
So your micro Python has a lot of tools to make it the byte code part efficient, and

21:59.320 --> 22:03.880
there are actually some, I didn't show it, but there are some, there's like in head of time

22:03.880 --> 22:08.440
compiler that you can add as a decorator to your function, and they will actually, there's

22:08.440 --> 22:15.000
a compiler that will compile that into native code on your device, and that will basically

22:15.000 --> 22:22.040
bring you to C level, so yeah, so it can be really close, but then there are some specific

22:22.040 --> 22:27.800
cases where it can be quite different, but run time like the execution speed, that's like

22:27.800 --> 22:34.440
10x, can be 100x, because micro Python is quite bad with floats, because they're all proper

22:34.440 --> 22:39.800
Python objects, so each number is at least one allocation, so if you're adding two numbers

22:39.800 --> 22:46.920
that's like four allocations, painful, so yeah, so but I always start the Python, add these

22:46.920 --> 22:51.560
magical decorators, see if it's fast enough, and only if it's not fast enough or small enough,

22:51.560 --> 22:53.560
then I use a C module.

22:53.560 --> 23:01.720
So in that works like 90% of the time, you can just stay in Python land, cool, thank you, thank you

