1 00:00:00,480 --> 00:00:03,480 foreign 2 00:00:08,540 --> 00:00:11,940 there are stickers here and there's been 3 00:00:10,620 --> 00:00:14,099 stickers passed around please feel free 4 00:00:11,940 --> 00:00:16,080 to take them um the micros are mine 5 00:00:14,099 --> 00:00:18,300 please don't take them 6 00:00:16,080 --> 00:00:20,939 um by way of introduction my name is 7 00:00:18,300 --> 00:00:22,500 Matt hi uh I'm an engineer of software 8 00:00:20,939 --> 00:00:24,600 engineer for about 25 years which makes 9 00:00:22,500 --> 00:00:26,640 me feel excessively old 10 00:00:24,600 --> 00:00:28,980 um I I kind of describe myself as a full 11 00:00:26,640 --> 00:00:30,840 stack engineer which uh we'll talk about 12 00:00:28,980 --> 00:00:32,099 that in a minute but uh I've been 13 00:00:30,840 --> 00:00:33,960 exposed to most areas of software 14 00:00:32,099 --> 00:00:35,340 development all the way from low level 15 00:00:33,960 --> 00:00:37,800 assembly stuff all the way to 16 00:00:35,340 --> 00:00:39,180 cloud-based web stuff so but a lot of my 17 00:00:37,800 --> 00:00:42,960 career has been spent 18 00:00:39,180 --> 00:00:44,040 um developing on or close to hardware 19 00:00:42,960 --> 00:00:45,840 um which should kind of make me a bit 20 00:00:44,040 --> 00:00:48,079 jaded because in better development had 21 00:00:45,840 --> 00:00:50,280 sort of been stagnant for a long time 22 00:00:48,079 --> 00:00:51,239 and sort of watch all these wonderful 23 00:00:50,280 --> 00:00:54,660 developments and the rest of the 24 00:00:51,239 --> 00:00:57,000 software Fields uh but yeah sort of saw 25 00:00:54,660 --> 00:00:58,980 the embedded stage just sort of plateau 26 00:00:57,000 --> 00:01:01,800 for a long time until micro python came 27 00:00:58,980 --> 00:01:03,120 along and we'll talk about it today 28 00:01:01,800 --> 00:01:05,400 um I would describe myself as a 29 00:01:03,120 --> 00:01:08,159 micropath and Enthusiast I've 30 00:01:05,400 --> 00:01:10,260 contributed code and documentation uh I 31 00:01:08,159 --> 00:01:12,840 host the Melbourne Michael python Meetup 32 00:01:10,260 --> 00:01:15,960 and I've talked to the previous pycons 33 00:01:12,840 --> 00:01:17,100 about Michael python so uh yeah just 34 00:01:15,960 --> 00:01:18,420 knowing that full stack development I 35 00:01:17,100 --> 00:01:20,100 looked up the definition of what a full 36 00:01:18,420 --> 00:01:21,960 stack developer is it's like 37 00:01:20,100 --> 00:01:25,500 the front end and back end of a website 38 00:01:21,960 --> 00:01:27,420 and I'm like hey kids it's like I'm not 39 00:01:25,500 --> 00:01:29,939 sure what you're talking about 40 00:01:27,420 --> 00:01:31,920 anyway moving along uh can I have some 41 00:01:29,939 --> 00:01:33,720 hands up and I'm gonna start with if 42 00:01:31,920 --> 00:01:36,540 you're human 43 00:01:33,720 --> 00:01:37,680 good audience participation question I 44 00:01:36,540 --> 00:01:39,659 saw most people with their hands up 45 00:01:37,680 --> 00:01:41,280 that's good I suppose uh who knows what 46 00:01:39,659 --> 00:01:44,759 a microcontroller is 47 00:01:41,280 --> 00:01:46,740 also good most people uh how about who's 48 00:01:44,759 --> 00:01:49,320 written software for Market controller 49 00:01:46,740 --> 00:01:51,000 it's quite a lot I guess about 50 00:01:49,320 --> 00:01:53,759 huh I'm 51 00:01:51,000 --> 00:01:56,159 um who knows what micropython is who 52 00:01:53,759 --> 00:01:58,259 went to Damien's talk earlier Damien you 53 00:01:56,159 --> 00:02:00,600 don't get to put your hand up good okay 54 00:01:58,259 --> 00:02:02,220 that means I can sort of briefly go over 55 00:02:00,600 --> 00:02:03,240 these things it's a python conference I 56 00:02:02,220 --> 00:02:05,219 need to know how much of the background 57 00:02:03,240 --> 00:02:06,840 we need to cover so who's seen Avengers 58 00:02:05,219 --> 00:02:08,520 Infinity War 59 00:02:06,840 --> 00:02:10,259 good that's helpful 60 00:02:08,520 --> 00:02:12,180 um right 61 00:02:10,259 --> 00:02:13,800 what's a microcontroller it's just a 62 00:02:12,180 --> 00:02:15,239 small computer right so 63 00:02:13,800 --> 00:02:16,440 microcontrollers is less about 64 00:02:15,239 --> 00:02:19,020 processing power when you compare them 65 00:02:16,440 --> 00:02:22,080 to a PC it's more about precise 66 00:02:19,020 --> 00:02:23,520 dedicated sort of tasks they have a 67 00:02:22,080 --> 00:02:25,440 small amount of resources they're 68 00:02:23,520 --> 00:02:27,060 Limited in what they can do with ram and 69 00:02:25,440 --> 00:02:29,160 Flash because they have very little of 70 00:02:27,060 --> 00:02:31,080 it and they often interact with the real 71 00:02:29,160 --> 00:02:32,940 world so they control Motors pumps 72 00:02:31,080 --> 00:02:33,920 interactive sensors that kind of stuff 73 00:02:32,940 --> 00:02:36,000 so 74 00:02:33,920 --> 00:02:38,819 a key defining factor is that they're 75 00:02:36,000 --> 00:02:40,379 low cost from cents to Dollars typically 76 00:02:38,819 --> 00:02:41,519 uh and they've got very predictable 77 00:02:40,379 --> 00:02:42,780 Behavior because they don't have an 78 00:02:41,519 --> 00:02:45,540 operating system they tend to be just 79 00:02:42,780 --> 00:02:48,060 doing that one task you tell them to do 80 00:02:45,540 --> 00:02:49,860 uh many systems are often comprised of 81 00:02:48,060 --> 00:02:51,660 lots of microcontrollers cars are a good 82 00:02:49,860 --> 00:02:53,700 example you've got dozens or hundreds of 83 00:02:51,660 --> 00:02:55,140 microcontrollers in a single car 84 00:02:53,700 --> 00:02:56,760 and it kind of led me on to think about 85 00:02:55,140 --> 00:02:59,160 the size of the market 86 00:02:56,760 --> 00:03:00,660 um so it's like 30 billion dollar market 87 00:02:59,160 --> 00:03:03,060 and it's expected to get to 50 billion 88 00:03:00,660 --> 00:03:05,640 by 238 which was frankly a lot larger 89 00:03:03,060 --> 00:03:07,140 than I expected and it seems like the 90 00:03:05,640 --> 00:03:08,819 average microcontroller costs about a 91 00:03:07,140 --> 00:03:10,739 dollar because they sell 30 billion of 92 00:03:08,819 --> 00:03:13,379 these things a year which if you compare 93 00:03:10,739 --> 00:03:14,519 it to PC sales is kind of scary 94 00:03:13,379 --> 00:03:15,659 um so there's a lot of these things out 95 00:03:14,519 --> 00:03:18,540 there if you look around you'll see 96 00:03:15,659 --> 00:03:19,500 devices in the room with plenty of them 97 00:03:18,540 --> 00:03:21,480 around 98 00:03:19,500 --> 00:03:23,700 what's Market python if you look at 99 00:03:21,480 --> 00:03:25,560 Reddit it's an Abomination 100 00:03:23,700 --> 00:03:28,140 um quite a funny read actually you have 101 00:03:25,560 --> 00:03:31,260 a look at that it's worth a worth a look 102 00:03:28,140 --> 00:03:34,260 what what it is really is uh 103 00:03:31,260 --> 00:03:34,260 sorry 104 00:03:35,940 --> 00:03:39,000 tough tough 105 00:03:38,280 --> 00:03:41,040 um 106 00:03:39,000 --> 00:03:42,540 what is it really it's it's python three 107 00:03:41,040 --> 00:03:44,099 re-implementation of Python 3 for 108 00:03:42,540 --> 00:03:45,780 microcontrollers so a lot of effort's 109 00:03:44,099 --> 00:03:49,019 been put into making it work on a 110 00:03:45,780 --> 00:03:51,120 constrained device written in C the 111 00:03:49,019 --> 00:03:52,500 Baseline was python34 but a lot of other 112 00:03:51,120 --> 00:03:54,120 features been added since then we still 113 00:03:52,500 --> 00:03:56,580 claim it's python 3-4 but there's 114 00:03:54,120 --> 00:03:59,280 features from all over the shop we've 115 00:03:56,580 --> 00:03:59,940 added as resources allow really 116 00:03:59,280 --> 00:04:01,860 um 117 00:03:59,940 --> 00:04:03,900 yeah so why should we keep updating it 118 00:04:01,860 --> 00:04:06,000 to newer versions of python new features 119 00:04:03,900 --> 00:04:10,700 especially so we can Port libraries more 120 00:04:06,000 --> 00:04:10,700 easily from the C python world yeah 121 00:04:10,799 --> 00:04:14,099 we've got excellent support for the 122 00:04:12,239 --> 00:04:17,699 language it really just feels like using 123 00:04:14,099 --> 00:04:19,040 big python and yes we call it big python 124 00:04:17,699 --> 00:04:21,299 um 125 00:04:19,040 --> 00:04:22,380 and we've got exceptional tests if you 126 00:04:21,299 --> 00:04:23,759 entertainment thought you'll know we've 127 00:04:22,380 --> 00:04:26,759 got exceptional test coverage across the 128 00:04:23,759 --> 00:04:28,440 language above 98 so you can be pretty 129 00:04:26,759 --> 00:04:30,440 confident that language itself is really 130 00:04:28,440 --> 00:04:32,880 robust and stable 131 00:04:30,440 --> 00:04:34,979 if you find a bug in Marketplace we will 132 00:04:32,880 --> 00:04:36,780 give you a sticker yeah 133 00:04:34,979 --> 00:04:39,720 standard library is a little hard harder 134 00:04:36,780 --> 00:04:40,979 it's pretty vast as we all know we've 135 00:04:39,720 --> 00:04:42,720 got a lot of things implemented but not 136 00:04:40,979 --> 00:04:44,100 everything and a lot of the libraries 137 00:04:42,720 --> 00:04:45,900 are written such that they're not so 138 00:04:44,100 --> 00:04:47,580 conducive to work on a microcontroller 139 00:04:45,900 --> 00:04:48,660 so we've got to be careful about what we 140 00:04:47,580 --> 00:04:50,699 put in 141 00:04:48,660 --> 00:04:51,720 it's a similar story for third-party 142 00:04:50,699 --> 00:04:53,460 libraries 143 00:04:51,720 --> 00:04:56,820 really tough to just pick up pandas and 144 00:04:53,460 --> 00:04:58,320 have that run on micro python and some 145 00:04:56,820 --> 00:05:01,500 libraries are built right in the 146 00:04:58,320 --> 00:05:03,600 micropython and others are built in in a 147 00:05:01,500 --> 00:05:05,400 separate repo or micropython lib between 148 00:05:03,600 --> 00:05:06,620 install with a tool called MIP which is 149 00:05:05,400 --> 00:05:09,540 like pip 150 00:05:06,620 --> 00:05:11,639 yeah it's kind of fun 151 00:05:09,540 --> 00:05:13,080 uh in addition to all this stuff we've 152 00:05:11,639 --> 00:05:15,900 got the machine Library which gives you 153 00:05:13,080 --> 00:05:17,040 access to the embedded side of things so 154 00:05:15,900 --> 00:05:19,020 you can Twitter with pins you can 155 00:05:17,040 --> 00:05:22,139 connect to peripherals it's very 156 00:05:19,020 --> 00:05:23,639 pythonic so it gives you a nice familiar 157 00:05:22,139 --> 00:05:25,259 sort of API if you if you're used to the 158 00:05:23,639 --> 00:05:26,759 python world to interact with stuff 159 00:05:25,259 --> 00:05:28,979 that's quite low level and typically 160 00:05:26,759 --> 00:05:31,380 done in uh much more of a Bose and 161 00:05:28,979 --> 00:05:33,600 low-level way 162 00:05:31,380 --> 00:05:36,240 so quick example just setting an LED 163 00:05:33,600 --> 00:05:37,560 turning it on using pwm which is a 164 00:05:36,240 --> 00:05:39,660 technique called pulse width modulation 165 00:05:37,560 --> 00:05:42,300 to flicker an LED on and off at 166 00:05:39,660 --> 00:05:43,500 different rates this is much easier and 167 00:05:42,300 --> 00:05:45,360 if you've done this if you've been in 168 00:05:43,500 --> 00:05:46,919 the Sea World before you'll be aware 169 00:05:45,360 --> 00:05:48,680 that's a lot easier than coding it and 170 00:05:46,919 --> 00:05:51,120 see 171 00:05:48,680 --> 00:05:53,160 why micropython and whenever I hear that 172 00:05:51,120 --> 00:05:55,020 term I think of Avengers Infinity War 173 00:05:53,160 --> 00:05:57,240 there's the throwback right where he 174 00:05:55,020 --> 00:05:58,919 went you know why is Gamora that's what 175 00:05:57,240 --> 00:06:01,500 I hear in my head when people ask me why 176 00:05:58,919 --> 00:06:02,220 do you use micropath you know why 177 00:06:01,500 --> 00:06:04,080 um 178 00:06:02,220 --> 00:06:06,539 so similar reasons to C python it's it's 179 00:06:04,080 --> 00:06:09,720 a readable easy language to learn and to 180 00:06:06,539 --> 00:06:10,740 use it's easy to test 181 00:06:09,720 --> 00:06:12,900 um it's very flexible it's a great 182 00:06:10,740 --> 00:06:14,400 language right but the main better the 183 00:06:12,900 --> 00:06:15,600 main benefit for me at least in the 184 00:06:14,400 --> 00:06:17,039 embedded domain especially when you're 185 00:06:15,600 --> 00:06:19,560 comparing it to CNC plus plus is 30 186 00:06:17,039 --> 00:06:21,180 right 30 for me is an important number 187 00:06:19,560 --> 00:06:22,800 because that's what I think the 188 00:06:21,180 --> 00:06:24,780 development time is reduced by by using 189 00:06:22,800 --> 00:06:26,039 micro python typically 190 00:06:24,780 --> 00:06:29,220 um a lot of caveats around that you can 191 00:06:26,039 --> 00:06:30,840 put around that but um uh I'd also think 192 00:06:29,220 --> 00:06:33,000 we get happier customers but that's 193 00:06:30,840 --> 00:06:34,440 harder to quantify 194 00:06:33,000 --> 00:06:36,479 it does obviously depend on the project 195 00:06:34,440 --> 00:06:38,940 but we've I work for a company uh 196 00:06:36,479 --> 00:06:42,060 planned Innovation that uses micropython 197 00:06:38,940 --> 00:06:43,380 for some um some projects and we've had 198 00:06:42,060 --> 00:06:45,060 handful projects now and they've all 199 00:06:43,380 --> 00:06:47,580 come in roughly through the estimates 200 00:06:45,060 --> 00:06:49,319 that we said and we've often compared 201 00:06:47,580 --> 00:06:52,500 them to the estimates in the CEC Plus 202 00:06:49,319 --> 00:06:53,520 World and 20 to 30 is pretty typical I 203 00:06:52,500 --> 00:06:55,319 also expect that number to actually 204 00:06:53,520 --> 00:06:56,520 improve or at least stabilize towards 205 00:06:55,319 --> 00:06:58,680 the higher end of that range because 206 00:06:56,520 --> 00:07:00,720 micro python is still maturing and the 207 00:06:58,680 --> 00:07:04,319 tooling is getting better and the um 208 00:07:00,720 --> 00:07:06,660 libraries are getting more robust so 209 00:07:04,319 --> 00:07:08,880 um so how do we get that 210 00:07:06,660 --> 00:07:10,680 um it's high level than CNC plus plus 211 00:07:08,880 --> 00:07:12,600 you're all aware of that if you're 212 00:07:10,680 --> 00:07:13,919 familiar with C python but you don't 213 00:07:12,600 --> 00:07:15,360 have to worry as much about memory 214 00:07:13,919 --> 00:07:16,380 management and undefined behavior and 215 00:07:15,360 --> 00:07:17,940 all that kind of stuff that you have to 216 00:07:16,380 --> 00:07:21,000 even see 217 00:07:17,940 --> 00:07:22,979 it's hard to overstate the live reple so 218 00:07:21,000 --> 00:07:24,840 there's a way to get access to a running 219 00:07:22,979 --> 00:07:26,580 device 220 00:07:24,840 --> 00:07:27,960 um and you use the python Rebel on the 221 00:07:26,580 --> 00:07:29,580 device so you can actually communicate 222 00:07:27,960 --> 00:07:31,740 to your peripherals and do a lot of work 223 00:07:29,580 --> 00:07:33,240 on the device itself and that's a huge 224 00:07:31,740 --> 00:07:34,860 Boon to development we can really 225 00:07:33,240 --> 00:07:36,780 explore 226 00:07:34,860 --> 00:07:37,560 um uh the development environment that 227 00:07:36,780 --> 00:07:39,060 way 228 00:07:37,560 --> 00:07:41,039 we've got the Unix support for testing 229 00:07:39,060 --> 00:07:43,199 so we can do a lot of things on x86 230 00:07:41,039 --> 00:07:45,720 which is really helpful I've got really 231 00:07:43,199 --> 00:07:48,539 fast workflow so I need to show you MP 232 00:07:45,720 --> 00:07:50,639 remote which is a tool that we use to 233 00:07:48,539 --> 00:07:53,039 connect to our devices 234 00:07:50,639 --> 00:07:55,440 into our micro python devices you can 235 00:07:53,039 --> 00:07:57,539 see here at this top here there's four 236 00:07:55,440 --> 00:08:00,479 files that that's on my computer at the 237 00:07:57,539 --> 00:08:04,380 top there and then MP remote Mount dot 238 00:08:00,479 --> 00:08:07,380 actually mounts my PC file system at the 239 00:08:04,380 --> 00:08:10,080 at the dot point on the device so it's 240 00:08:07,380 --> 00:08:11,639 just like my device sees the files that 241 00:08:10,080 --> 00:08:13,620 are on the PC 242 00:08:11,639 --> 00:08:16,080 so you can see here if I do an OS Lister 243 00:08:13,620 --> 00:08:18,060 that's running on my microcontroller and 244 00:08:16,080 --> 00:08:19,680 it's just like I'm seeing the files that 245 00:08:18,060 --> 00:08:21,660 um that are on my PC 246 00:08:19,680 --> 00:08:24,360 it's fantastic it's hard to explain how 247 00:08:21,660 --> 00:08:25,919 good this is because it feels a bit like 248 00:08:24,360 --> 00:08:28,139 magic having worked in the embedded 249 00:08:25,919 --> 00:08:30,419 space for some time it means that I can 250 00:08:28,139 --> 00:08:34,080 develop on a PC I can use my regular 251 00:08:30,419 --> 00:08:36,419 tools to do my my coding I can use git 252 00:08:34,080 --> 00:08:38,399 and when I'm ready I can test in the 253 00:08:36,419 --> 00:08:40,919 Unix port and then I can just mount it 254 00:08:38,399 --> 00:08:43,320 and try it on the device it's really low 255 00:08:40,919 --> 00:08:45,380 friction way to get moving 256 00:08:43,320 --> 00:08:45,380 um 257 00:08:45,420 --> 00:08:48,540 practice some of the other benefits 258 00:08:46,800 --> 00:08:50,940 we've seen at least the company is that 259 00:08:48,540 --> 00:08:53,160 the junior developers become superpowers 260 00:08:50,940 --> 00:08:55,920 really quickly like and it's been really 261 00:08:53,160 --> 00:08:58,620 really stark contrast to seeing people 262 00:08:55,920 --> 00:09:00,240 um to seeing Juniors start in the CNC by 263 00:08:58,620 --> 00:09:02,339 Foss world where it takes a long time 264 00:09:00,240 --> 00:09:03,300 for that ramp up to occur 265 00:09:02,339 --> 00:09:05,160 um it happens really quickly with 266 00:09:03,300 --> 00:09:07,560 Michael python um so that's been a 267 00:09:05,160 --> 00:09:09,600 surprise for me I didn't really expect 268 00:09:07,560 --> 00:09:11,339 that it was wonderful 269 00:09:09,600 --> 00:09:13,500 we've found that we're more responsive 270 00:09:11,339 --> 00:09:15,180 to customer requests and we can we can 271 00:09:13,500 --> 00:09:17,100 you know it's an overload a temple we're 272 00:09:15,180 --> 00:09:18,899 certainly a lot more agile and customers 273 00:09:17,100 --> 00:09:20,160 love it they can talk with us and work 274 00:09:18,899 --> 00:09:22,019 with us more 275 00:09:20,160 --> 00:09:24,000 and the other thing that for me at least 276 00:09:22,019 --> 00:09:25,620 was that there's a mental change like I 277 00:09:24,000 --> 00:09:27,360 tend to focus on the problem I'm trying 278 00:09:25,620 --> 00:09:28,560 to solve rather than the Nitty Gritty 279 00:09:27,360 --> 00:09:30,899 details of how to actually get it 280 00:09:28,560 --> 00:09:33,540 happening and how to get it done so for 281 00:09:30,899 --> 00:09:34,920 me that's a big win 282 00:09:33,540 --> 00:09:36,720 yeah we're like 10 minutes in we've got 283 00:09:34,920 --> 00:09:38,040 back around so right 284 00:09:36,720 --> 00:09:39,720 people come with me all the time and say 285 00:09:38,040 --> 00:09:41,820 you can't do that in micro python right 286 00:09:39,720 --> 00:09:43,080 when performance matters you can't do it 287 00:09:41,820 --> 00:09:44,459 market price and if you want to run from 288 00:09:43,080 --> 00:09:45,959 a battery and you can't do a 289 00:09:44,459 --> 00:09:47,940 microphizing if you're running if you 290 00:09:45,959 --> 00:09:48,839 want to worry about manufacturing and 291 00:09:47,940 --> 00:09:51,300 volume 292 00:09:48,839 --> 00:09:52,019 it has a kernel of treason all of these 293 00:09:51,300 --> 00:09:53,880 um 294 00:09:52,019 --> 00:09:56,040 but I think it's worth digging into 295 00:09:53,880 --> 00:09:57,779 right so 296 00:09:56,040 --> 00:10:00,660 the most common concern is Marketplace 297 00:09:57,779 --> 00:10:02,100 and slow and it's true to a degree right 298 00:10:00,660 --> 00:10:04,380 you're really comparing native to 299 00:10:02,100 --> 00:10:06,720 bytecode development so just a quick 300 00:10:04,380 --> 00:10:08,040 refresher with Native coding but this is 301 00:10:06,720 --> 00:10:09,660 you know if you're using C you can go 302 00:10:08,040 --> 00:10:10,380 any language that compiles down to the 303 00:10:09,660 --> 00:10:12,240 metal 304 00:10:10,380 --> 00:10:14,279 you take a code you compile it you're 305 00:10:12,240 --> 00:10:16,920 running code that the device can run 306 00:10:14,279 --> 00:10:18,899 directly right by code interpreters work 307 00:10:16,920 --> 00:10:20,820 a little differently they take code they 308 00:10:18,899 --> 00:10:22,320 compile it to bytecode by code gets run 309 00:10:20,820 --> 00:10:23,940 through the virtual machine and then the 310 00:10:22,320 --> 00:10:25,800 virtual machine runs that on the device 311 00:10:23,940 --> 00:10:27,899 directly 312 00:10:25,800 --> 00:10:28,860 uh and slower it's slower if you're 313 00:10:27,899 --> 00:10:30,420 spending time in the virtual machine 314 00:10:28,860 --> 00:10:32,399 there's benefits to it you've heard it's 315 00:10:30,420 --> 00:10:33,720 more portable there's a lot of things 316 00:10:32,399 --> 00:10:36,300 you can do with that but that's the 317 00:10:33,720 --> 00:10:37,920 difference the yellow bar there is just 318 00:10:36,300 --> 00:10:39,480 something that I only occurred to me 319 00:10:37,920 --> 00:10:40,440 later was worth pointing out is that all 320 00:10:39,480 --> 00:10:41,640 of the things that are next to that 321 00:10:40,440 --> 00:10:44,279 yellow bar actually occur on the device 322 00:10:41,640 --> 00:10:46,920 in micropython by default so the 323 00:10:44,279 --> 00:10:49,620 compiler actually works on the device 324 00:10:46,920 --> 00:10:50,519 um yeah all the way down and we'll talk 325 00:10:49,620 --> 00:10:51,540 about that a little further later 326 00:10:50,519 --> 00:10:53,579 because there's a way you can optimize 327 00:10:51,540 --> 00:10:56,220 some of that 328 00:10:53,579 --> 00:10:57,720 uh so techniques for performance there's 329 00:10:56,220 --> 00:10:59,700 a whole bunch of sophisticated methods 330 00:10:57,720 --> 00:11:00,959 to improve performance and micropism 331 00:10:59,700 --> 00:11:02,220 we're not going to cover them today 332 00:11:00,959 --> 00:11:04,320 Damien's talked about them before I've 333 00:11:02,220 --> 00:11:05,760 talked about them before and we'd need 334 00:11:04,320 --> 00:11:07,920 you need a fair bit of time to cover 335 00:11:05,760 --> 00:11:09,540 them uh but just for completeness uh 336 00:11:07,920 --> 00:11:12,180 hopefully these are court on the video 337 00:11:09,540 --> 00:11:14,279 you can go look these up later I'm going 338 00:11:12,180 --> 00:11:16,019 to look at one performance Hammer which 339 00:11:14,279 --> 00:11:17,160 is just using C um all the other 340 00:11:16,019 --> 00:11:18,660 techniques are really sophisticated 341 00:11:17,160 --> 00:11:21,360 elegant and have their place and they 342 00:11:18,660 --> 00:11:24,959 should be used but just in terms of 343 00:11:21,360 --> 00:11:27,120 um why you don't necessarily need to 344 00:11:24,959 --> 00:11:29,519 exclude micro python for performance is 345 00:11:27,120 --> 00:11:31,920 the fact that you can use c a chair 346 00:11:29,519 --> 00:11:33,720 microphize and shares see Python's Dirty 347 00:11:31,920 --> 00:11:36,600 Little Secret and that we offload our 348 00:11:33,720 --> 00:11:39,839 performance to see when we need to not 349 00:11:36,600 --> 00:11:42,420 so much Fortran on embedded devices but 350 00:11:39,839 --> 00:11:44,459 you know so yeah think about like numpy 351 00:11:42,420 --> 00:11:46,560 Hill sci-fi right they both got seen in 352 00:11:44,459 --> 00:11:48,000 the guts of them that makes them work 353 00:11:46,560 --> 00:11:49,500 faster 354 00:11:48,000 --> 00:11:52,079 there's an interesting 355 00:11:49,500 --> 00:11:53,519 um white paper recently that was talking 356 00:11:52,079 --> 00:11:55,079 about comparing micro pythons of other 357 00:11:53,519 --> 00:11:56,820 languages 358 00:11:55,079 --> 00:11:58,700 it's kind of weird 359 00:11:56,820 --> 00:12:02,760 um like this one for example talks about 360 00:11:58,700 --> 00:12:04,740 crc32 they actually implemented a crc32 361 00:12:02,760 --> 00:12:07,320 algorithm in Python and then tested that 362 00:12:04,740 --> 00:12:08,519 we already have the CSC 32 algorithm 363 00:12:07,320 --> 00:12:10,200 which works at the same performance of 364 00:12:08,519 --> 00:12:11,000 the C but they're trying to compare the 365 00:12:10,200 --> 00:12:13,440 language 366 00:12:11,000 --> 00:12:15,720 overheads and what they conclusively 367 00:12:13,440 --> 00:12:16,620 showed is that by code interpreted 368 00:12:15,720 --> 00:12:18,959 languages are slower than native 369 00:12:16,620 --> 00:12:21,120 languages which wasn't that surprising 370 00:12:18,959 --> 00:12:23,579 the problem I have is at the end they 371 00:12:21,120 --> 00:12:25,019 kind of make or they kind of that's to 372 00:12:23,579 --> 00:12:26,820 the conclusion that micro python is not 373 00:12:25,019 --> 00:12:29,579 appropriate for embedded use if 374 00:12:26,820 --> 00:12:30,899 performance is a concerned and I don't 375 00:12:29,579 --> 00:12:33,420 think that's correct it's kind of like 376 00:12:30,899 --> 00:12:35,040 saying you know big python is not 377 00:12:33,420 --> 00:12:37,800 appropriate for data science use because 378 00:12:35,040 --> 00:12:39,240 you know you can't uh you know python 379 00:12:37,800 --> 00:12:41,220 the language is too slow I don't believe 380 00:12:39,240 --> 00:12:43,620 that and so 381 00:12:41,220 --> 00:12:46,860 um I think you need to take this there's 382 00:12:43,620 --> 00:12:48,899 a bit of grain of salt to be taken here 383 00:12:46,860 --> 00:12:51,480 um so it is easy to extend marketplace 384 00:12:48,899 --> 00:12:53,880 with C you'll find the documentation 385 00:12:51,480 --> 00:12:55,560 talking about user modules 386 00:12:53,880 --> 00:12:56,880 um if there's one thing here we can 387 00:12:55,560 --> 00:12:58,500 improve it'll be around documentation 388 00:12:56,880 --> 00:12:59,820 we've got some good documentation but 389 00:12:58,500 --> 00:13:01,620 you can probably go a little further 390 00:12:59,820 --> 00:13:04,440 because it's a fairly complex topic 391 00:13:01,620 --> 00:13:06,959 about Bridging the the um the python to 392 00:13:04,440 --> 00:13:09,420 C boundary but 393 00:13:06,959 --> 00:13:12,360 the key point is that it's just C right 394 00:13:09,420 --> 00:13:13,680 like it's fast so 395 00:13:12,360 --> 00:13:15,839 um 396 00:13:13,680 --> 00:13:17,760 relevant quotes that I have also heard I 397 00:13:15,839 --> 00:13:19,079 might as well just write and see 398 00:13:17,760 --> 00:13:21,180 I think that comes back to that 30 399 00:13:19,079 --> 00:13:22,380 number before you're paying the cost of 400 00:13:21,180 --> 00:13:24,480 having develop and see if you've got to 401 00:13:22,380 --> 00:13:25,500 do that so my argument would be that you 402 00:13:24,480 --> 00:13:27,180 should spend as much time on micro 403 00:13:25,500 --> 00:13:28,920 python as you can and just optimize the 404 00:13:27,180 --> 00:13:30,779 bits that you need and the projects 405 00:13:28,920 --> 00:13:32,579 we've had at work 406 00:13:30,779 --> 00:13:34,500 there's been any minimal amounts of code 407 00:13:32,579 --> 00:13:35,820 that we've had to develop in C so it's a 408 00:13:34,500 --> 00:13:37,560 small fraction 409 00:13:35,820 --> 00:13:38,940 and the other one here is we're all 410 00:13:37,560 --> 00:13:41,279 human well most of you put your hand up 411 00:13:38,940 --> 00:13:42,720 as a human identify as a human so 412 00:13:41,279 --> 00:13:44,880 um but we're always bad at guessing 413 00:13:42,720 --> 00:13:47,540 where to optimize so 414 00:13:44,880 --> 00:13:50,279 um my I guess my statement would be 415 00:13:47,540 --> 00:13:52,639 Friday Michael python first important to 416 00:13:50,279 --> 00:13:55,320 see only when profiling shows a need 417 00:13:52,639 --> 00:13:57,180 and there's a small caveat there with it 418 00:13:55,320 --> 00:13:58,500 almost in Brackets but there's almost no 419 00:13:57,180 --> 00:14:00,060 performance ceiling like we can drop 420 00:13:58,500 --> 00:14:01,560 into C and you do whatever compute you 421 00:14:00,060 --> 00:14:04,100 need 422 00:14:01,560 --> 00:14:04,100 um yeah 423 00:14:04,680 --> 00:14:08,600 you can't use microphone when you're 424 00:14:06,060 --> 00:14:08,600 running for a battery 425 00:14:09,360 --> 00:14:13,200 so a little bit more background 426 00:14:11,220 --> 00:14:15,480 um modern my controllers have low power 427 00:14:13,200 --> 00:14:17,639 modes and this is kind of the way that 428 00:14:15,480 --> 00:14:18,779 they get good battery life 429 00:14:17,639 --> 00:14:20,579 um 430 00:14:18,779 --> 00:14:24,779 the power mode ruins that they're sort 431 00:14:20,579 --> 00:14:27,000 of uh trading off features for power 432 00:14:24,779 --> 00:14:29,040 consumption so they'll turn off the core 433 00:14:27,000 --> 00:14:30,720 and they'll just listen to some pins or 434 00:14:29,040 --> 00:14:33,120 whatever and these can have dramatic 435 00:14:30,720 --> 00:14:34,260 improvements in terms of power use 436 00:14:33,120 --> 00:14:36,420 and so the key thing if you're running 437 00:14:34,260 --> 00:14:38,040 from batteries is to drive your micro 438 00:14:36,420 --> 00:14:39,420 into the lowest power mode you can and 439 00:14:38,040 --> 00:14:42,120 keep it in there for as long as you can 440 00:14:39,420 --> 00:14:44,040 that's the key thing for low power 441 00:14:42,120 --> 00:14:45,300 applications 442 00:14:44,040 --> 00:14:47,220 so if you think about like temperature 443 00:14:45,300 --> 00:14:48,300 logging it's one of the nice easy 444 00:14:47,220 --> 00:14:49,920 example to think about temperature 445 00:14:48,300 --> 00:14:52,079 doesn't change frequently so we only 446 00:14:49,920 --> 00:14:53,699 need to pull it every so often 447 00:14:52,079 --> 00:14:55,079 so you might what does it read 448 00:14:53,699 --> 00:14:56,519 temperature every 30 seconds and you 449 00:14:55,079 --> 00:14:58,019 store it in a buffer 450 00:14:56,519 --> 00:15:00,899 and every 10 minutes you might offload 451 00:14:58,019 --> 00:15:02,579 it over Wi-Fi okay the key thing is to 452 00:15:00,899 --> 00:15:04,019 where you're not doing stuff driving 453 00:15:02,579 --> 00:15:07,079 into those low power modes and get the 454 00:15:04,019 --> 00:15:09,300 benefit of running at lower power 455 00:15:07,079 --> 00:15:12,240 so some quick charts hopefully it's not 456 00:15:09,300 --> 00:15:14,399 too overwhelming but uh 457 00:15:12,240 --> 00:15:16,079 that middle section there is showing 458 00:15:14,399 --> 00:15:17,579 that we're in a deep sleep mode and 459 00:15:16,079 --> 00:15:19,800 we're consuming one and a half milliamps 460 00:15:17,579 --> 00:15:21,420 for this particular microcontroller 461 00:15:19,800 --> 00:15:23,279 the other areas are just where the 462 00:15:21,420 --> 00:15:25,019 process is running as normal it's not 463 00:15:23,279 --> 00:15:29,339 normally responsive but yeah it's a 30 464 00:15:25,019 --> 00:15:30,300 times difference in power 465 00:15:29,339 --> 00:15:31,980 um 466 00:15:30,300 --> 00:15:33,779 this is with Wi-Fi this particular micro 467 00:15:31,980 --> 00:15:36,120 supports Wi-Fi as well and you can see 468 00:15:33,779 --> 00:15:37,620 that the power use goes right up that 469 00:15:36,120 --> 00:15:39,540 low bar there is actually the high bar 470 00:15:37,620 --> 00:15:42,240 from the previous slide 471 00:15:39,540 --> 00:15:43,800 and so we're up in 120 milliamps or 472 00:15:42,240 --> 00:15:46,680 higher if we're actually connected to 473 00:15:43,800 --> 00:15:48,600 Wi-Fi now it's also worth noting that's 474 00:15:46,680 --> 00:15:49,800 with Wi-Fi just connected not doing 475 00:15:48,600 --> 00:15:54,060 anything as soon as you start 476 00:15:49,800 --> 00:15:55,440 transferring stuff it cranks up again 477 00:15:54,060 --> 00:15:57,600 so 478 00:15:55,440 --> 00:15:59,699 um a key thing to be aware of is that 479 00:15:57,600 --> 00:16:01,500 these low power modes have identical 480 00:15:59,699 --> 00:16:02,880 costs regardless of what language you 481 00:16:01,500 --> 00:16:04,500 use the micro doesn't know that you're 482 00:16:02,880 --> 00:16:06,000 running micropath and you'll see it 483 00:16:04,500 --> 00:16:07,860 doesn't care 484 00:16:06,000 --> 00:16:10,699 um so the key thing is to keep in those 485 00:16:07,860 --> 00:16:12,660 low power modes as much as possible 486 00:16:10,699 --> 00:16:14,579 there is an additional cost to using 487 00:16:12,660 --> 00:16:16,079 micropython and that's because when the 488 00:16:14,579 --> 00:16:18,360 micro starts up 489 00:16:16,079 --> 00:16:19,860 we have to start an interpreter often we 490 00:16:18,360 --> 00:16:21,139 have to start a file system we have to 491 00:16:19,860 --> 00:16:24,240 start reading 492 00:16:21,139 --> 00:16:25,920 python compiling it and doing something 493 00:16:24,240 --> 00:16:28,199 now that takes about 40 or 15 494 00:16:25,920 --> 00:16:29,639 milliseconds varies a bit port to port 495 00:16:28,199 --> 00:16:31,980 but that's pretty typical 496 00:16:29,639 --> 00:16:34,199 so what you need to think about is if we 497 00:16:31,980 --> 00:16:36,540 go back to a deep sleep mode for example 498 00:16:34,199 --> 00:16:38,399 we want to come out of our deep sleep 499 00:16:36,540 --> 00:16:40,680 mode and stay in that higher power mode 500 00:16:38,399 --> 00:16:42,720 for as little time as possible so 501 00:16:40,680 --> 00:16:44,480 micropython adds 40 milliseconds is the 502 00:16:42,720 --> 00:16:46,980 way to think about it and then 503 00:16:44,480 --> 00:16:48,959 if you can live with that you can live 504 00:16:46,980 --> 00:16:51,300 with using micro python with battery 505 00:16:48,959 --> 00:16:52,019 powered applications 506 00:16:51,300 --> 00:16:53,639 um 507 00:16:52,019 --> 00:16:55,500 it's also possible to mitigate that cost 508 00:16:53,639 --> 00:16:57,839 as well there's a hook at the start when 509 00:16:55,500 --> 00:16:59,880 micro python starts to latch a little 510 00:16:57,839 --> 00:17:01,980 bit of C code if you want to so if you 511 00:16:59,880 --> 00:17:03,360 can do something like wake do a check to 512 00:17:01,980 --> 00:17:04,799 see if you should be woken up or if you 513 00:17:03,360 --> 00:17:07,620 need to and go back to sleep you 514 00:17:04,799 --> 00:17:08,160 actually mitigate that cost even so 515 00:17:07,620 --> 00:17:11,760 um 516 00:17:08,160 --> 00:17:13,799 yeah so yes there is a small cost to 517 00:17:11,760 --> 00:17:15,780 selling Marketplace and running in a VM 518 00:17:13,799 --> 00:17:18,299 but the key thing you should be doing is 519 00:17:15,780 --> 00:17:20,339 uh keeping down in those low power modes 520 00:17:18,299 --> 00:17:21,540 as much as possible and so the 521 00:17:20,339 --> 00:17:22,860 suggestion here is build a product in 522 00:17:21,540 --> 00:17:25,199 market price list you'll see a theme 523 00:17:22,860 --> 00:17:26,699 Here build a product in Marketplace and 524 00:17:25,199 --> 00:17:28,679 first where you'll work faster and 525 00:17:26,699 --> 00:17:30,419 you'll get to your end goal quicker 526 00:17:28,679 --> 00:17:33,140 and if you can't achieve your power 527 00:17:30,419 --> 00:17:35,220 budget put it to CNC plus plus then 528 00:17:33,140 --> 00:17:36,120 you'll have already learned a lot you'll 529 00:17:35,220 --> 00:17:37,620 have already been able to work with your 530 00:17:36,120 --> 00:17:39,539 customer more you've already been able 531 00:17:37,620 --> 00:17:41,520 to develop the thing that you want 532 00:17:39,539 --> 00:17:44,059 faster so that porting effort should be 533 00:17:41,520 --> 00:17:44,059 pretty small 534 00:17:45,740 --> 00:17:50,400 drink water but you can't use 535 00:17:48,900 --> 00:17:52,580 micropython if you're Manufacturing in 536 00:17:50,400 --> 00:17:52,580 volume 537 00:17:55,620 --> 00:18:01,200 again some truth here so Market python 538 00:17:58,380 --> 00:18:03,960 places a higher Demand on the resource 539 00:18:01,200 --> 00:18:05,460 uses of a of a microcontroller it needs 540 00:18:03,960 --> 00:18:07,860 higher specs because it needs more Flash 541 00:18:05,460 --> 00:18:09,960 and needs more RAM 542 00:18:07,860 --> 00:18:11,880 they're the key ones 543 00:18:09,960 --> 00:18:14,220 so if bomb costs if your bill of 544 00:18:11,880 --> 00:18:16,380 materials cost is critical my price may 545 00:18:14,220 --> 00:18:18,840 not be your best solution but it's worth 546 00:18:16,380 --> 00:18:19,980 having a look at how critical 547 00:18:18,840 --> 00:18:21,720 um so I put this in perspective 548 00:18:19,980 --> 00:18:23,160 microcontroller costs tend to be in the 549 00:18:21,720 --> 00:18:26,640 terms of like I said before like 550 00:18:23,160 --> 00:18:29,580 high-end is dollars tens of dollars low 551 00:18:26,640 --> 00:18:31,200 end is 20 30 cents 552 00:18:29,580 --> 00:18:34,559 um and still get a whole range in 553 00:18:31,200 --> 00:18:36,299 between now eight bits yeah just like 554 00:18:34,559 --> 00:18:37,919 everyone I'm wouldn't be surprised if 555 00:18:36,299 --> 00:18:39,120 you know we'll have stickers in a year 556 00:18:37,919 --> 00:18:40,740 or two with eight bit microcontrollers 557 00:18:39,120 --> 00:18:42,240 stuck to them 558 00:18:40,740 --> 00:18:43,260 um the microphone is not going to run 559 00:18:42,240 --> 00:18:45,840 the low end we just don't have the 560 00:18:43,260 --> 00:18:47,520 resources to do so 561 00:18:45,840 --> 00:18:49,320 um but how low can we go it's kind of 562 00:18:47,520 --> 00:18:50,520 important to look at because typically 563 00:18:49,320 --> 00:18:52,020 when you first come on a Marketplace and 564 00:18:50,520 --> 00:18:53,880 you'll be told that there's you the 565 00:18:52,020 --> 00:18:57,000 requirements are about about 200k a 566 00:18:53,880 --> 00:18:59,160 Flash and about 32k Ram give or take 567 00:18:57,000 --> 00:18:59,760 um it's not quite the whole story 568 00:18:59,160 --> 00:19:01,260 um 569 00:18:59,760 --> 00:19:02,940 it's kind of like when we package 570 00:19:01,260 --> 00:19:06,059 micropython we it's kind of a kitchen 571 00:19:02,940 --> 00:19:08,580 sink approach because micro python is a 572 00:19:06,059 --> 00:19:10,620 dynamic language runtime you need all of 573 00:19:08,580 --> 00:19:11,940 the features available to use them even 574 00:19:10,620 --> 00:19:13,740 if you're not going to so you have to 575 00:19:11,940 --> 00:19:15,660 package the whole thing 576 00:19:13,740 --> 00:19:17,760 but if you know what your application 577 00:19:15,660 --> 00:19:19,679 needs you can start carving it away it's 578 00:19:17,760 --> 00:19:21,660 pretty easy to build your own custom 579 00:19:19,679 --> 00:19:23,220 firmware of micro Python and just carve 580 00:19:21,660 --> 00:19:26,160 out features 581 00:19:23,220 --> 00:19:28,080 um so the claim here is I guess a 582 00:19:26,160 --> 00:19:30,179 kitchen sink micro python is around 200k 583 00:19:28,080 --> 00:19:31,740 a Flash and a minimal micro python is 584 00:19:30,179 --> 00:19:33,000 about 40K a flash I'm looking at gym 585 00:19:31,740 --> 00:19:36,600 because we're trying to get down there 586 00:19:33,000 --> 00:19:37,679 today yeah thumbs up good okay 587 00:19:36,600 --> 00:19:41,100 um 588 00:19:37,679 --> 00:19:43,200 so what can we trade off like features 589 00:19:41,100 --> 00:19:44,340 um f strings async SBI you can carve 590 00:19:43,200 --> 00:19:46,679 these things out at a pretty granular 591 00:19:44,340 --> 00:19:48,299 level you can drop the file system you 592 00:19:46,679 --> 00:19:49,500 can drop the rebel 593 00:19:48,299 --> 00:19:50,820 um you can drop the compiler so you 594 00:19:49,500 --> 00:19:53,160 start trading off these quality of life 595 00:19:50,820 --> 00:19:56,220 development features to aim at a smaller 596 00:19:53,160 --> 00:19:58,679 micro okay so I mentioned before that 597 00:19:56,220 --> 00:20:00,539 everything happens on the on the micro 598 00:19:58,679 --> 00:20:02,700 that's next to that yellow bar but that 599 00:20:00,539 --> 00:20:04,500 red bar is actually an alternative where 600 00:20:02,700 --> 00:20:06,480 we can actually do compilation and 601 00:20:04,500 --> 00:20:09,120 freeze our code into the into the 602 00:20:06,480 --> 00:20:10,260 firmware so it's kind of like in the sea 603 00:20:09,120 --> 00:20:12,720 world you would compile your application 604 00:20:10,260 --> 00:20:14,820 and deploy it in micropy you would 605 00:20:12,720 --> 00:20:17,640 compile your your source code and just 606 00:20:14,820 --> 00:20:19,260 like in Python you'll get a pi C file 607 00:20:17,640 --> 00:20:21,360 um you'll get a similar deal you get by 608 00:20:19,260 --> 00:20:23,520 code that you can put into your firmware 609 00:20:21,360 --> 00:20:25,580 which means that it's you lose that 610 00:20:23,520 --> 00:20:27,299 ability to do it dynamically at runtime 611 00:20:25,580 --> 00:20:28,500 you've got to build it into your 612 00:20:27,299 --> 00:20:30,780 firmware 613 00:20:28,500 --> 00:20:32,820 but you can Target a smaller firmware 614 00:20:30,780 --> 00:20:35,460 blob 615 00:20:32,820 --> 00:20:36,419 uh yeah 616 00:20:35,460 --> 00:20:38,400 so 617 00:20:36,419 --> 00:20:41,000 a possible workflow you can consider is 618 00:20:38,400 --> 00:20:43,380 to start with like a big monstrous 619 00:20:41,000 --> 00:20:45,480 microcontroller and just don't worry 620 00:20:43,380 --> 00:20:47,160 about your problems so if your volume 621 00:20:45,480 --> 00:20:48,960 manufacturing just get your application 622 00:20:47,160 --> 00:20:51,000 running use something that's got a ton 623 00:20:48,960 --> 00:20:53,340 of Slash a ton of RAM and develop as 624 00:20:51,000 --> 00:20:55,799 quick as possible okay and shift to a 625 00:20:53,340 --> 00:20:56,340 micro it's got smaller resources 626 00:20:55,799 --> 00:20:58,440 um 627 00:20:56,340 --> 00:21:00,360 you can start either customizing your 628 00:20:58,440 --> 00:21:02,160 firmware or maybe just customizing your 629 00:21:00,360 --> 00:21:04,280 application so it uses less less 630 00:21:02,160 --> 00:21:06,539 resources 631 00:21:04,280 --> 00:21:07,980 and then you can do that whole whole 632 00:21:06,539 --> 00:21:09,539 another step where you start really 633 00:21:07,980 --> 00:21:11,460 hacking into the firmware making it as 634 00:21:09,539 --> 00:21:12,780 small as possible and developing it so 635 00:21:11,460 --> 00:21:15,179 that it only supports the application 636 00:21:12,780 --> 00:21:16,860 that you write 637 00:21:15,179 --> 00:21:18,720 um and so the costs are important here 638 00:21:16,860 --> 00:21:19,799 these are real examples of boards that 639 00:21:18,720 --> 00:21:22,020 we've got 640 00:21:19,799 --> 00:21:24,120 um where the board to the left is the 641 00:21:22,020 --> 00:21:27,419 big beefy one we talked about it's an H5 642 00:21:24,120 --> 00:21:30,360 cortex m33 I'll gloss those the details 643 00:21:27,419 --> 00:21:33,419 but tons of flash tons of ram about 4.60 644 00:21:30,360 --> 00:21:36,659 and these numbers are all in units of 645 00:21:33,419 --> 00:21:39,480 10K which is St will give you these 646 00:21:36,659 --> 00:21:43,740 prices but they are relatively accurate 647 00:21:39,480 --> 00:21:45,480 I think a units and US dollars so 460 648 00:21:43,740 --> 00:21:47,880 for the big beefy one with tons of 649 00:21:45,480 --> 00:21:51,240 peripherals the middle one's interesting 650 00:21:47,880 --> 00:21:53,280 that's the same uh core it's 250 Meg 651 00:21:51,240 --> 00:21:54,360 cortex M3 but they've dropped a lot of 652 00:21:53,280 --> 00:21:56,700 peripherals they dropped a lot of flash 653 00:21:54,360 --> 00:21:58,260 dropped a lot of RAM and dropped a lot 654 00:21:56,700 --> 00:21:59,220 of cost and so you're suddenly looking 655 00:21:58,260 --> 00:22:00,780 at a dollar sixty for that 656 00:21:59,220 --> 00:22:03,240 microcontroller 657 00:22:00,780 --> 00:22:05,220 but it's a pretty easy Port because if 658 00:22:03,240 --> 00:22:06,720 your code works on the original H5 it's 659 00:22:05,220 --> 00:22:09,799 usually a pretty small jump to go from 660 00:22:06,720 --> 00:22:09,799 the big one to the medium one 661 00:22:09,840 --> 00:22:13,020 then you've got the small one there's a 662 00:22:11,400 --> 00:22:14,400 g zero that I've selected which is a 663 00:22:13,020 --> 00:22:16,980 dollar twenty 664 00:22:14,400 --> 00:22:19,799 um so you save 40 whole cents but you're 665 00:22:16,980 --> 00:22:20,820 going to a much smaller much lower spec 666 00:22:19,799 --> 00:22:23,760 micro 667 00:22:20,820 --> 00:22:25,500 now getting down to that size is more 668 00:22:23,760 --> 00:22:27,539 difficult 669 00:22:25,500 --> 00:22:30,200 um but it's not it's not out of the 670 00:22:27,539 --> 00:22:30,200 realm of possibility 671 00:22:30,539 --> 00:22:33,840 uh 672 00:22:32,400 --> 00:22:36,480 right so 673 00:22:33,840 --> 00:22:38,280 uh micro again there's a German truth 674 00:22:36,480 --> 00:22:39,740 here like Microsoft does Place High 675 00:22:38,280 --> 00:22:43,440 demands on 676 00:22:39,740 --> 00:22:45,780 a microcontroller resources but there 677 00:22:43,440 --> 00:22:47,760 are ways to offset some of that and so 678 00:22:45,780 --> 00:22:49,620 yeah I'd suggest like I have in all the 679 00:22:47,760 --> 00:22:53,539 other ones I've had micropython first 680 00:22:49,620 --> 00:22:53,539 and make changes if you have to later 681 00:22:54,480 --> 00:22:58,320 and that is my summary really uh 682 00:22:56,760 --> 00:23:00,360 development important to say if you 683 00:22:58,320 --> 00:23:02,340 really must right 684 00:23:00,360 --> 00:23:03,780 um there's no real the barriers here 685 00:23:02,340 --> 00:23:07,020 seem a lot more 686 00:23:03,780 --> 00:23:08,940 um Impressions than actual reality in my 687 00:23:07,020 --> 00:23:10,320 opinion and I guess I believe that 688 00:23:08,940 --> 00:23:11,580 thought was that 689 00:23:10,320 --> 00:23:13,620 I expected to find a lot more 690 00:23:11,580 --> 00:23:14,760 limitations developing with micro python 691 00:23:13,620 --> 00:23:16,620 I thought it was going to be useful for 692 00:23:14,760 --> 00:23:17,940 certain class of microcontrollers for 693 00:23:16,620 --> 00:23:19,980 certain applications 694 00:23:17,940 --> 00:23:22,320 but now it's my default choice I would 695 00:23:19,980 --> 00:23:24,720 need to be convinced to start a start an 696 00:23:22,320 --> 00:23:28,380 application in CNC plus plus and it's 697 00:23:24,720 --> 00:23:31,980 often the wrong choice it might be 698 00:23:28,380 --> 00:23:32,940 okay so uh actually just quickly uh for 699 00:23:31,980 --> 00:23:34,260 you to mentioned the stickers but we've 700 00:23:32,940 --> 00:23:37,500 got we're going to try and get to the 701 00:23:34,260 --> 00:23:38,880 python fair and uh Sprint day Monday 702 00:23:37,500 --> 00:23:40,980 um so if you guys are interested please 703 00:23:38,880 --> 00:23:42,780 stick around and thanks for listening 704 00:23:40,980 --> 00:23:44,700 and thanks to the organizers and 705 00:23:42,780 --> 00:23:47,340 Marketplace and community and especially 706 00:23:44,700 --> 00:23:48,659 to the uh my support team who helped out 707 00:23:47,340 --> 00:23:50,159 with making sure all these claims were 708 00:23:48,659 --> 00:23:51,240 actually possible which they more or 709 00:23:50,159 --> 00:23:51,960 less aren't 710 00:23:51,240 --> 00:23:55,580 um 711 00:23:51,960 --> 00:23:55,580 So yeah thank you 712 00:23:56,270 --> 00:23:59,520 [Music] 713 00:24:00,480 --> 00:24:06,360 all right we have time for a couple of 714 00:24:02,700 --> 00:24:08,880 questions if anyone has any 715 00:24:06,360 --> 00:24:10,140 sure that'll go right here 716 00:24:08,880 --> 00:24:11,640 hi 717 00:24:10,140 --> 00:24:15,120 um I was wondering if you tested and if 718 00:24:11,640 --> 00:24:15,840 so what uh the results were around the 719 00:24:15,120 --> 00:24:17,940 um 720 00:24:15,840 --> 00:24:20,520 what kind of performance gain did you 721 00:24:17,940 --> 00:24:22,860 see when you froze that code and and 722 00:24:20,520 --> 00:24:25,080 pre-compiled it uh did you mention that 723 00:24:22,860 --> 00:24:28,140 at all and see how that went we because 724 00:24:25,080 --> 00:24:30,299 it's a no it's worth talking about 725 00:24:28,140 --> 00:24:33,000 um so just for everyone's benefit like 726 00:24:30,299 --> 00:24:34,620 frozen code we um as we mentioned 727 00:24:33,000 --> 00:24:36,240 briefly we take python code we get by 728 00:24:34,620 --> 00:24:37,020 code out of it that gets stored in the 729 00:24:36,240 --> 00:24:39,900 flash 730 00:24:37,020 --> 00:24:42,240 um normally that would happen uh on the 731 00:24:39,900 --> 00:24:43,440 file system uh so what we do is we avoid 732 00:24:42,240 --> 00:24:45,659 a lot of memory use because we don't 733 00:24:43,440 --> 00:24:48,299 need to invoke the compiler and we don't 734 00:24:45,659 --> 00:24:50,520 need to compile it so 735 00:24:48,299 --> 00:24:52,860 um it varies wildly unfortunately is the 736 00:24:50,520 --> 00:24:55,320 way to say it I don't know if anyone's 737 00:24:52,860 --> 00:24:57,419 got any figures out there but um yeah 738 00:24:55,320 --> 00:24:59,340 yeah 739 00:24:57,419 --> 00:25:02,179 that thing is shaking his head Damien 740 00:24:59,340 --> 00:25:02,179 doesn't know it doesn't it 741 00:25:03,000 --> 00:25:06,419 yep I got a question so you mentioned 742 00:25:04,799 --> 00:25:07,919 that one of the ways to shrink down the 743 00:25:06,419 --> 00:25:09,720 footprint is to custom build that 744 00:25:07,919 --> 00:25:11,640 firmware is there any tools where I can 745 00:25:09,720 --> 00:25:13,440 just point it to my py file and it goes 746 00:25:11,640 --> 00:25:14,700 okay you're using these things I'm just 747 00:25:13,440 --> 00:25:16,980 going to build that firmware against 748 00:25:14,700 --> 00:25:18,480 that not yet yeah we should create that 749 00:25:16,980 --> 00:25:19,679 we should yeah let's do that that's a 750 00:25:18,480 --> 00:25:22,440 great idea we've got a Sprint day Monday 751 00:25:19,679 --> 00:25:25,080 right what are you up to okay 752 00:25:22,440 --> 00:25:27,419 it'd be good to do that analysis yeah it 753 00:25:25,080 --> 00:25:30,179 certainly came up during this discussion 754 00:25:27,419 --> 00:25:31,440 of this talking 755 00:25:30,179 --> 00:25:33,419 so it does sound like you're 756 00:25:31,440 --> 00:25:34,559 volunteering there Adam so are you 757 00:25:33,419 --> 00:25:37,460 showing up with the Sprints on Monday 758 00:25:34,559 --> 00:25:37,460 and building that 759 00:25:38,159 --> 00:25:41,360 if you Melvin come on tonight 760 00:25:41,720 --> 00:25:48,120 do we have any other questions yeah um 761 00:25:45,240 --> 00:25:51,059 I'm very I'm passingly familiar with uh 762 00:25:48,120 --> 00:25:52,860 writing C extensions for C python the 763 00:25:51,059 --> 00:25:54,120 the big python yep 764 00:25:52,860 --> 00:25:57,600 um thank you for using the correct term 765 00:25:54,120 --> 00:26:00,419 yeah sorry I realized as I said it 766 00:25:57,600 --> 00:26:02,580 um I'm just wondering if you have uh if 767 00:26:00,419 --> 00:26:05,460 you couldn't compare the experience of 768 00:26:02,580 --> 00:26:07,860 writing a c extension for big python 769 00:26:05,460 --> 00:26:10,140 versus microfizing uh it's completely 770 00:26:07,860 --> 00:26:11,880 different it's a short answer 771 00:26:10,140 --> 00:26:13,380 um I would say I found having an 772 00:26:11,880 --> 00:26:14,460 embedded background I found it easier to 773 00:26:13,380 --> 00:26:16,260 do the micro python side of things 774 00:26:14,460 --> 00:26:18,720 because it's kind of a it's kind of an 775 00:26:16,260 --> 00:26:20,820 obvious barrier to to jump 776 00:26:18,720 --> 00:26:22,500 um with C python there was more things I 777 00:26:20,820 --> 00:26:24,720 had to learn about how C python operated 778 00:26:22,500 --> 00:26:25,919 to create those extensions 779 00:26:24,720 --> 00:26:26,880 yeah so if you've gone in better 780 00:26:25,919 --> 00:26:28,380 background I think you'll find it 781 00:26:26,880 --> 00:26:29,220 relatively straightforward if you 782 00:26:28,380 --> 00:26:30,000 haven't 783 00:26:29,220 --> 00:26:33,000 um 784 00:26:30,000 --> 00:26:34,559 and probably in general like uh once you 785 00:26:33,000 --> 00:26:37,260 get beyond the sort of beginner range of 786 00:26:34,559 --> 00:26:38,279 micropython the most the biggest ramp up 787 00:26:37,260 --> 00:26:40,380 that you're going to have is becoming 788 00:26:38,279 --> 00:26:43,559 familiar with the embedded domain if 789 00:26:40,380 --> 00:26:45,179 you're not familiar with it so uh yeah I 790 00:26:43,559 --> 00:26:46,380 guess you'll find extensions relatively 791 00:26:45,179 --> 00:26:48,679 easy to do if you're sort of familiar 792 00:26:46,380 --> 00:26:48,679 with that 793 00:26:51,179 --> 00:26:55,260 anyone else 794 00:26:53,640 --> 00:26:57,919 oh cool 795 00:26:55,260 --> 00:26:57,919 um in that case 796 00:27:04,620 --> 00:27:09,419 uh thank you so much 797 00:27:07,380 --> 00:27:11,460 um for giving this talk it's been 798 00:27:09,419 --> 00:27:11,870 amazing thank you so much 799 00:27:11,460 --> 00:27:18,509 thank you 800 00:27:11,870 --> 00:27:18,509 [Applause]