HLLs like python are marvelous for development. The chips are cheap enough you can ship an easy development
platform right in the product. $5 MCUs and what not.
But as I shop for parts for a system I am designing, a "switching power supply for ultra low power designers experimental coding playground", I see 50 cent MCUs and what not that are 32 bit ARM also. It makes one wonder, "What if I could develop with micropython, then offer a tweakable product as usual plus a non-tweakable product for $3 less costs, $3 less price, way higher sales volume?
IOW, what would it take to have micropython emit c code for everything, the developed code and all the linked micropython library code used to make a compilation? Then, if I made code for one of the constrained platforms like the F401, where all the program is "baked in" with the firmware, and no SD cards, the C code for that might apply to a cortex M0 with few modifications. That code might use very small amounts of RAM and fit on a ATSAMD09C13A-SSUT with 12 IO's 14 pins total and a price tag of $0.50!
John Griessen
What is lowest cost micro to micropy with? (control looping A2D, timers)
Sometimes you want to go back to the low level way...
John Griessen blog.kitmatic.com
Re: Sometimes you want to go back to the low level way...
The pieces of the puzzle to do this are starting to fall into place, but are not fully there just yet. You want frozen bytecode, maybe even frozen native code, since that would emit machine code for everything. With frozen code you can remove the compiler, reducing binary size and maximum required heap. In fact, if your entire code is frozen then you can run with almost zero heap (might need a few hundred bytes to initialise the global dictionaries). You don't even need the GC, you can replace it with an "immortal heap" allocator (I've done some work in this direction with the ESA project) which again saves flash and RAM.jgriessen wrote: IOW, what would it take to have micropython emit c code for everything, the developed code and all the linked micropython library code used to make a compilation? Then, if I made code for one of the constrained platforms like the F401, where all the program is "baked in" with the firmware, and no SD cards, the C code for that might apply to a cortex M0 with few modifications. That code might use very small amounts of RAM and fit on a ATSAMD09C13A-SSUT with 12 IO's 14 pins total and a price tag of $0.50!
The minimal port with frozen bytecode and the compiler removed takes up about 55k of flash. So I'd say you could actually have a working MicroPython VM+runtime (but no compiler), and frozen scripts, all within 64k. If you found a chip that had 64k flash and 4k RAM (8k would be better) then I dare say that would be enough for "production code".
55k includes a lot of bloated string processing functions which you probably don't need, maybe could get it down another 10k by removing them. And then if you went further to remove all unnecessary object methods, you could get the code size even smaller. But I really doubt you could get it under 32k. Might be fun to try though
The SAMD09C13 has only 8k of flash, and 4k of RAM. That's probably enough RAM but definitely not enough flash. Try something with 64k flash and you are getting realistic
Re: What is lowest cost micro to micropy with? (control looping A2D, timers)
Hi Dave,
I read your recent commit on the NUCLEO-F411RE, that was good to see as I am trying to decide what STM32F4*-based board to get. Currently I have an STM32F1 & 3 which I have been using (Trying to use) with Mecrisp-Stellaris Forth. However I found the MicroPython project this morning and I am very interested, especially since I want to export data from the STM32F* device into a web service(s) using Python.
Is the NUCLEO-F411RE board a good choice for a ARM Cortex M4 product or should I look at a straight STM32F4-based device like a DISCO? The other issue that I thought was interesting with the Nucleo, was the able to interact with Arduino Unos, of which I have several.
Just after your thoughts (Or anyone elses) based on your experiences with MicroPython so far, and I will not hold you to any comments
TIA, Quaak.
I read your recent commit on the NUCLEO-F411RE, that was good to see as I am trying to decide what STM32F4*-based board to get. Currently I have an STM32F1 & 3 which I have been using (Trying to use) with Mecrisp-Stellaris Forth. However I found the MicroPython project this morning and I am very interested, especially since I want to export data from the STM32F* device into a web service(s) using Python.
Is the NUCLEO-F411RE board a good choice for a ARM Cortex M4 product or should I look at a straight STM32F4-based device like a DISCO? The other issue that I thought was interesting with the Nucleo, was the able to interact with Arduino Unos, of which I have several.
Just after your thoughts (Or anyone elses) based on your experiences with MicroPython so far, and I will not hold you to any comments
TIA, Quaak.
Re: What is lowest cost micro to micropy with? (control looping A2D, timers)
QuaakHaak, please keep in mind that MicroPython has the best support for features of, has the best capabilities and ease of use on, and overall works best with - the original PyBoard, which was specifically made to enable and use the full power of MicroPython.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/
Re: What is lowest cost micro to micropy with? (control looping A2D, timers)
Hi Pfalcon,
I totally agree however cost becomes a significant factor in you live in Australia or New Zealand, as I do.
The "Pyboard" can be sourced from Australia (the closest seller) to New Zealand with current prices being AUD $58.13 & $87.23 (Yes, you read that correctly). Add on AUD $10.00 for Shipping then do the currency conversion, and what was a GDP $23.33 device in the UK becomes at least an NZD $73.10 or $104.32 device way out here.
That is my point, but I certainly get yours, Quaak.
I totally agree however cost becomes a significant factor in you live in Australia or New Zealand, as I do.
The "Pyboard" can be sourced from Australia (the closest seller) to New Zealand with current prices being AUD $58.13 & $87.23 (Yes, you read that correctly). Add on AUD $10.00 for Shipping then do the currency conversion, and what was a GDP $23.33 device in the UK becomes at least an NZD $73.10 or $104.32 device way out here.
That is my point, but I certainly get yours, Quaak.
Re: What is lowest cost micro to micropy with? (control looping A2D, timers)
Whether you consider the 411 nucleo to be a good choice really depends on what you're trying to do with it. The nucleo board are inexpensive, so if size isn't a factor then they're definitely good value for the money if they meet your needs.QuaakHaak wrote:Hi Dave,
I read your recent commit on the NUCLEO-F411RE, that was good to see as I am trying to decide what STM32F4*-based board to get. Currently I have an STM32F1 & 3 which I have been using (Trying to use) with Mecrisp-Stellaris Forth. However I found the MicroPython project this morning and I am very interested, especially since I want to export data from the STM32F* device into a web service(s) using Python.
Is the NUCLEO-F411RE board a good choice for a ARM Cortex M4 product or should I look at a straight STM32F4-based device like a DISCO? The other issue that I thought was interesting with the Nucleo, was the able to interact with Arduino Unos, of which I have several.
Just after your thoughts (Or anyone elses) based on your experiences with MicroPython so far, and I will not hold you to any comments
TIA, Quaak.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: What is lowest cost micro to micropy with? (control looping A2D, timers)
A quick look on the web suggests that one of the official distributors Little Bird electronics in Australia has the Pyboard V1 at AUD $45 which is £22 (plus shipping). Perhaps I should move to Australia...QuaakHaak wrote:The "Pyboard" can be sourced from Australia (the closest seller) to New Zealand with current prices being AUD $58.13 & $87.23 (Yes, you read that correctly). Add on AUD $10.00 for Shipping then do the currency conversion, and what was a GDP $23.33 device in the UK becomes at least an NZD $73.10 or $104.32 device way out here.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: What is lowest cost micro to micropy with? (control looping A2D, timers)
There is always the option of using ESP8266 and an external ADC, for instance, over I2C. There are cheap and easy to use i2c ADC modules out there, with built-in op amps and 12 bit precision.
Re: What is lowest cost micro to micropy with? (control looping A2D, timers)
... yeah but do not move to New Zealand if you think the prices are better. I bit the bullet, and purchased a Pyboard V1.1 (good idea from "pfalcon") from the UK store, total is NZD $69.44 including tracked shipping. It'd be likely more if I purchased it from the "cheaper" AU store.A quick look on the web suggests that one of the official distributors Little Bird electronics in Australia has the Pyboard V1 at AUD $45 which is £22 (plus shipping). Perhaps I should move to Australia...
Sorry but AUD $87.23 for the Pyboard V1.1 is daylight robbery, nothing more.