Author Topic: Micropython for MCUs - is it real or experimental ?  (Read 18539 times)

0 Members and 1 Guest are viewing this topic.

Offline tszaboo

  • Super Contributor
  • ***
  • Posts: 7307
  • Country: nl
  • Current job: ATEX product design
Re: Micropython for MCUs - is it real or experimental ?
« Reply #50 on: December 22, 2016, 11:55:52 pm »
If you are only going to program a handful of chips and they all have full Java or Python support (ready made libraries for those chips), but no direct C support, then go for those languages. You can always switch to C later on same chips.
I did program chips in ASM (AVR), they went on the field, and as far as I know they are still working. I program in C and I program in python. When the task was to count pulses, assign a date stamp, code it in SHA256 and send it over GPRS to a server, expecting JSON, running a database with a billion entries, then the coding was done in python.
I never used ASM after entering the 32 bit era. I remember having a nice ASM library for serial port, with named registers, designated memory spaces, pointers for circular buffers. It was great fun. That was days to write and debug, and sure I used it in multiple projects.
Now, I can simply send a tuple or list of variables though any communication device, and it comes back unchanged. In fact, I can compress the tuple with a single command, and make it use less data, so it arrives faster to the other side of the wire. And the compression is tested, built in, kinda optimal.
Only grudge I have against full python is the memory usage. My benchmark is an almost empty interpreter of python 2.7, on linux, which is around 10 MB. It becomes a problem, if you want to run more than one at the same time.
 

Offline thm_w

  • Super Contributor
  • ***
  • Posts: 6272
  • Country: ca
  • Non-expert
Re: Micropython for MCUs - is it real or experimental ?
« Reply #51 on: December 23, 2016, 12:33:36 am »
I was asking about a trusted source, where I can buy 1K PCS of the modules. I was really cautious about the ESP8266 also, but then Avnet (well, the local Avnet supply chain child company) started supplying it.
I actually asked them about the ESP32, no answer.
Anyway, I've used python for IOT-i stuff. I had big reservations, but it actually worked out quite well in the end. Say, hundred lines of code. The programmer guy reviewing my code told me I do too much error handling...
I kinda starting to like the idea...

ESP32 is not really widely available yet, I would say quite a few more months until its cheap and available as the ESP8266 is. You can buy it for a premium right now though from say adafruit ($9 http://esp32.net/).
Aliexpress is a good measure of availability: esp8266 = 10,300 results, esp32 = 50 results.
Digikey/avnet are dinosaurs with regard to these products. With digikey they don't even sell the chip they are reselling a module from Sparkfun/Adafruit. Which is fine for their clientele (the module will have been fully tested).
Profile -> Modify profile -> Look and Layout ->  Don't show users' signatures
 

Offline krho

  • Regular Contributor
  • *
  • Posts: 222
  • Country: si
Re: Micropython for MCUs - is it real or experimental ?
« Reply #52 on: December 23, 2016, 08:46:11 am »
The esp32 indeed has 512K of SRAM, but this is marketing gimmick. Some of that is ICacheand DCache, then when you use the BT an WIFI stack approximately 257k remains. But this is still more than on any M4 or even smaller sized AVR. And all of them are priced way higher.
 

Offline slicendice

  • Frequent Contributor
  • **
  • Posts: 365
  • Country: fi
Re: Micropython for MCUs - is it real or experimental ?
« Reply #53 on: December 23, 2016, 01:19:19 pm »
We are starting to get a bit off topic here. :-)

Whatever chip you choose to program, if it has full support for MicroPython development and has support for external RAM, and you need to get a lot of features coded quickly then MP is a good choice. Assuming you know how to code in Python.

ESP32 supports up to 16 MB off-Chip SPI Flash and up to 8 MB off-Chip SPI SRAM, which is plenty for most tasks.
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11228
  • Country: us
    • Personal site
Re: Micropython for MCUs - is it real or experimental ?
« Reply #54 on: December 23, 2016, 04:20:44 pm »
Assuming you know how to code in Python.
And someone did all the hard work for you already. And you will be forever limited to a subset of MCUs supported by those ports. Good luck in your embedded endeavors with this approach.
Alex
 

Offline slicendice

  • Frequent Contributor
  • **
  • Posts: 365
  • Country: fi
Re: Micropython for MCUs - is it real or experimental ?
« Reply #55 on: December 23, 2016, 05:27:37 pm »
And someone did all the hard work for you already. And you will be forever limited to a subset of MCUs supported by those ports. Good luck in your embedded endeavors with this approach.

Yep! I started my programming journey using C# only, and thought it would be enough. I was so wrong. Now I use about 10 different programming and scripting languages, all suitable for different applications, to get stuff done reliably and efficiently. And there is still so many new languages to learn. :-/O No single programming language can do it all. Or some can, but in many cases it would be like climbing up a tree with your butt first.  :-DD
 

Offline timb

  • Super Contributor
  • ***
  • Posts: 2536
  • Country: us
  • Pretentiously Posting Polysyllabic Prose
    • timb.us
Re: Micropython for MCUs - is it real or experimental ?
« Reply #56 on: December 23, 2016, 08:14:05 pm »
Assuming you know how to code in Python.
And someone did all the hard work for you already. And you will be forever limited to a subset of MCUs supported by those ports. Good luck in your embedded endeavors with this approach.

The source is available, so there's nothing stopping you from porting it to a new MCU...

It's actually not too hard to port! I've been working on a PSoC 5LP port in my spare time and almost have all the basics working I think. I haven't put that much time into it, either.
Any sufficiently advanced technology is indistinguishable from magic; e.g., Cheez Whiz, Hot Dogs and RF.
 

Offline free_electron

  • Super Contributor
  • ***
  • Posts: 8515
  • Country: us
    • SiliconValleyGarage
Re: Micropython for MCUs - is it real or experimental ?
« Reply #57 on: December 23, 2016, 08:41:54 pm »
Assuming you know how to code in Python.
And someone did all the hard work for you already. And you will be forever limited to a subset of MCUs supported by those ports. Good luck in your embedded endeavors with this approach.
source is avaialble. written in plain c. and there is a hooks library to attach your own custom functions.

anyway. the thing that is interesting for me is that this is a turnkey platform with internet connectivity. i can focus on acquiring the data. blasting it into the backbone server is handled by the micropython engine. I really do not want to deal with learning how to run a ble or wifi stack and have to bother with 'sometimes it don't work' .

there is a point where you have to let go and focus on your product. otherwise your development cycle becomes so long and complicated you never get anywhere.
i have a ton of idea's for iot products. i can;t make em cause i run into endless misery getting my data out of the platform and onto someone's server. it is all too complicated.
i tried Lua but that is dead in the water... micropython seems to do the trick. i despise python as a language ( whitespace formatting -puke- ) but it gets the job done and it runs on a beautiful, cheap chip that has both ble and wifi. all i need is access to the i2c bus and a couple of io pins ( very slow toggle rates. so no problem if micropython is slow on that )

i was able to make a prototype sending data into a bakcbone in a few hours. been running for weeks without a single glitch.
Professional Electron Wrangler.
Any comments, or points of view expressed, are my own and not endorsed , induced or compensated by my employer(s).
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11228
  • Country: us
    • Personal site
Re: Micropython for MCUs - is it real or experimental ?
« Reply #58 on: December 23, 2016, 08:44:06 pm »
source is avaialble. written in plain c. and there is a hooks library to attach your own custom functions.
I'm not worried about the Python itself. But all those libraries that actually make it marginally useful may not be so easy to port / debug.
Alex
 

Offline timb

  • Super Contributor
  • ***
  • Posts: 2536
  • Country: us
  • Pretentiously Posting Polysyllabic Prose
    • timb.us
Re: Micropython for MCUs - is it real or experimental ?
« Reply #59 on: December 23, 2016, 08:52:07 pm »
Assuming you know how to code in Python.
And someone did all the hard work for you already. And you will be forever limited to a subset of MCUs supported by those ports. Good luck in your embedded endeavors with this approach.
source is avaialble. written in plain c. and there is a hooks library to attach your own custom functions.

anyway. the thing that is interesting for me is that this is a turnkey platform with internet connectivity. i can focus on acquiring the data. blasting it into the backbone server is handled by the micropython engine. I really do not want to deal with learning how to run a ble or wifi stack and have to bother with 'sometimes it don't work' .

there is a point where you have to let go and focus on your product. otherwise your development cycle becomes so long and complicated you never get anywhere.
i have a ton of idea's for iot products. i can;t make em cause i run into endless misery getting my data out of the platform and onto someone's server. it is all too complicated.
i tried Lua but that is dead in the water... micropython seems to do the trick. i despise python as a language ( whitespace formatting -puke- ) but it gets the job done and it runs on a beautiful, cheap chip that has both ble and wifi. all i need is access to the i2c bus and a couple of io pins ( very slow toggle rates. so no problem if micropython is slow on that )

i was able to make a prototype sending data into a bakcbone in a few hours. been running for weeks without a single glitch.

I wish someone would revive the LUAmcu project and get it going again... LUA just isn't as popular as Python, despite being an amazingly fast scripting language (just as fast as compiled C, in some cases). It's also very elegant, syntax wise.
Any sufficiently advanced technology is indistinguishable from magic; e.g., Cheez Whiz, Hot Dogs and RF.
 

Offline rob77

  • Super Contributor
  • ***
  • Posts: 2085
  • Country: sk
Re: Micropython for MCUs - is it real or experimental ?
« Reply #60 on: December 23, 2016, 10:03:13 pm »
Assuming you know how to code in Python.
And someone did all the hard work for you already. And you will be forever limited to a subset of MCUs supported by those ports. Good luck in your embedded endeavors with this approach.
source is avaialble. written in plain c. and there is a hooks library to attach your own custom functions.

anyway. the thing that is interesting for me is that this is a turnkey platform with internet connectivity. i can focus on acquiring the data. blasting it into the backbone server is handled by the micropython engine. I really do not want to deal with learning how to run a ble or wifi stack and have to bother with 'sometimes it don't work' .

there is a point where you have to let go and focus on your product. otherwise your development cycle becomes so long and complicated you never get anywhere.
i have a ton of idea's for iot products. i can;t make em cause i run into endless misery getting my data out of the platform and onto someone's server. it is all too complicated.
i tried Lua but that is dead in the water... micropython seems to do the trick. i despise python as a language ( whitespace formatting -puke- ) but it gets the job done and it runs on a beautiful, cheap chip that has both ble and wifi. all i need is access to the i2c bus and a couple of io pins ( very slow toggle rates. so no problem if micropython is slow on that )

i was able to make a prototype sending data into a bakcbone in a few hours. been running for weeks without a single glitch.

I wish someone would revive the LUAmcu project and get it going again... LUA just isn't as popular as Python, despite being an amazingly fast scripting language (just as fast as compiled C, in some cases). It's also very elegant, syntax wise.

are you serious ? :D  writing object-like structures in plain C is probably better than LUA  :-DD no just kidding.. lua is great in some rare cases but definitely not for the "general public" . you have to do everything yourself in Lua even inheritance , not talking about libraries for basic stuff someone would consider granted ;) however lua is great in cases when you let's say have a complex project written in plan C with many own libraries and you want to shorten the turn-around times for new releases... so you rewrite the high level logic in lua while using all your existing libraries written in C.
 

Offline slicendice

  • Frequent Contributor
  • **
  • Posts: 365
  • Country: fi
Re: Micropython for MCUs - is it real or experimental ?
« Reply #61 on: December 24, 2016, 08:00:13 am »
want to shorten the turn-around times for new releases... so you rewrite the high level logic in lua while using all your existing libraries written in C.

Spot on!  :-+
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4196
  • Country: us
Re: Micropython for MCUs - is it real or experimental ?
« Reply #62 on: December 25, 2016, 12:27:30 am »
Quote
the thing that is interesting for me is that this is a turnkey platform with internet connectivity.
Does micro-python provide internet connectivity, or does it just interface to the existing internet support on platforms like ESP8266?

I haven't used micro-python, and I've just started to learn/use "real" python.  It seems to me that micro-python is "real" and likely to become "more real" if more people use it.  Whether it's limitations (compared to real python) will prevent that remains to be seen.  Whether it's a good idea is a third question.

Don't forget that BASIC52 and PBASIC (basic stamp) were "viable" and popular for a long time, despite being "horribly slow" by compiled-language standards.
 

Offline miceuz

  • Frequent Contributor
  • **
  • Posts: 387
  • Country: lt
    • chirp - a soil moisture meter / plant watering alarm
Re: Micropython for MCUs - is it real or experimental ?
« Reply #63 on: December 25, 2016, 09:10:16 am »
I'm a professional programmer with over 15 years of experience, I know a bunch of languages and platforms and I hate the current trend of those hipster webdev languages.

I was very sceptical about micropython at first. Then I just spent an hour looking on the web for a proper parameters to flash micropython on esp8266 and gave it a shot.

Having a terminal access to all the hardware via an interface of the familiar programming language was... a fine experience. I have spent some time writing a library for I2C - based SHT25 sensor - you make an I2C call, you observe results, you write some code to parse those results into a meaningful data structure - all in the terminal live on the hardware.

Library for SPI-based ssd1306 display was built in and worked out of the box. Another builtin library HTTPRequest did not work for me unfortunately - I didn't figure out what exactly Sparkfun phant expects in a POST request.

All in all - it's a nice toy to string something quick in no time. I wouldn't go with it in a commercial design of any reasonable size, but it can take you looong way in the process of prototyping. And no, it's no biggie when you have to "redesign" everything in a "proper" language - you had everything for free in micropython anyway and all algorithms specific to your application should be language agnostic - you have to be just adding {'s and ('s.

I can understand why people are looking at it for space applications. For one thing - python is a lingua franca for all trades of scientists, on another hand - having rock solid interpreter that makes firmware update easy is lucrative. I won't do navigation and communication tasks in micropython, but scientific payload - why not?


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf