Live data from Hacker News

MicroPython

micropython.org

31–40 of 152 posts

Re: MicroPython

#31
I've done quite a few firmware development projects (they're commercial type and deployed in fitness industry, police vehicles, etc). They type of thing they do, I have a hard time imagining doing it in Python.

Re: MicroPython

#32
Does anyone have any experience beyond short programs/sketches with micropython? The most I've used it for is playing around with a microbit. How does it hold up?

Re: MicroPython

#33
post #29

Neat, but not very practical. To be of any use you still need board support to drive the I2C, SPI, etc which means you have to use C anyhow. You can buy one of their boards with the BSP but that's over $40, yikes. To use micropython you need at least an M4 class micro-controller so that a $5 or greater part. Or you could just stick with C and use a M0 class micro that costs A difference of $40 in BOM cost makes it on…

It runs very well on ESP32.

I've done work for a couple of clients, converting a micropython implementation to C on and ESP32, that would disagree with that statement.

Re: MicroPython

#34

Neat, but not very practical. To be of any use you still need board support to drive the I2C, SPI, etc which means you have to use C anyhow. You can buy one of their boards with the BSP but that's over $40, yikes. To use micropython you need at least an M4 class micro-controller so that a $5 or greater part. Or you could just stick with C and use a M0 class micro that costs A difference of $40 in BOM cost makes it on…

To be fair, there are BSPs for cheap chips like Espressif microcontrollers and a myriad of minimal development boards. You don't need to buy a pyboard, and part of the reason those are so expensive is because they help fund the project's continued development.

But it definitely does have issues with memory usage. Personally, I hope that it will become more viable as its development continues and RAM densities increase. I love the syntax and ease-of-use, but I don't love needing a $10 chip for a $1 task. Hopefully it'll be usable for non-trivial tasks on a $1 Cortex-M23 chip in a few years.

It also really shines in educational environments. I see a lot of promise in the progression from MakeCode (primary school) to MicroPython (middle/high school) to programming "real computers" (high school/college). It's a natural progression, and understanding simple microcontrollers takes a lot of the scary "magic" out of learning about complex application processors. See, for example, the BBC micro:bit (which also has a MicroPython BSP).

Re: MicroPython

#36
post #30

MicroPython is stellar. If you're building an embedded system for people to hack and customize, make the highest level abstraction of the embedded system in MicroPython so that users can easily modify/patch/contribute/hack your system with ease. This is what Arduino and Arduino IDE did for millions of hobbyist, but it is time to ditch C/C++ for MicroPython. In this [1] PyCon talk by Matt Trentini, a demo of QR code g…

Great so now in order to create a performant embedded app i need to write everything in two languages. We should make Rust compile to Arduino and other embedded devices and be done with it.

It already does! (As long as the target supports LLVM)

https://rust-embedded.github.io/book/

Re: MicroPython

#37
post #14

MicroPython seems to be heavily focused on embedded systems . Is there any support for embedding it within an application , i.e. as a replacement for Lua? Or is there another lightweight Python implementation (or Python-like language) that supports this?

What is lightweight for you?

I bundled the official Python (CPython 2.7, that was some years ago; but I don't think CPython 3 would be so much different) in an application (http://albertz.github.io/music-player/), and the whole MacOSX app zip file ended up at 11 MB. This includes my whole app + whole CPython 2.7 (including all stdlib) + extra Python libs (all the ObjC/Cocoa bindings, which I use for the GUI). I find this is still pretty ok.

(Still much smaller than Qt, wxWidgets, Electron, or whatever else there is. But maybe this comparison is unfair.)

The scripts to build CPython suitable for embedding it into an app are here: https://github.com/albertz/python-embedded/ (But this is not really updated, and so far for CPython 2.7, not CPython 3. But this is not really so difficult anyway. These scripts are mostly such that you have it as a Xcode project and also compiles on iOS.)

I think Dropbox does the same, as far as I remember.

Re: MicroPython

#38

I once built a METAR light map like this - https://slingtsi.rueker.com/making-a-led-powered-metar-map-f... However, I did it with an ESP8266 running MicroPython; I was impressed that such a small, cheap little computer was able to connect to the internet, retrieve XML, parse it (this step in particular), and update the state of each of the WS8211 lights with ease, all with some quick, easy-to-write Python.

I have an ESP8266 wired into my intercom buzzer for opening the door remotely[0]. It has been unreasonably stable and reliable. Many months, possibly into years, of consecutive uptime. I used the arduino IDE and modified demo code for a web server. The cheapo dev board had it's blue LED die (mercifully) but is still chugging along. It's crazy what these things can do.

[0] https://jeremypoole.ca/posts/put-your-door-on-the-internet/

Post reply on HN