News for hackers. Stuff that matters.
Re:MicroPython by not_the_fda on Sunday August 16, 2020 @03:09PM (#24180319)
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 < $1.

A difference of $40 in BOM cost makes it only applicable to the hobbyist. Which is fine, but its just a toy.

Re:MicroPython by ChuckMcM on Sunday August 16, 2020 @04:27PM (#24180984)
Going to disagree here, i2c and spi work fine in micropython.

Is it as fast as C? No. Does that mean it's useless? No.

The absolute coolest thing is to take a $2 Wemos D1 clone, put micropython on it, hook it to a sensor (I've been using temp and humidity sensors lately) and have it periodically fetch "http://webserver-ip/temp?t=<value>&p=<value>" every 10 seconds and have a little python webserver sitting on an machine on your network that is stuffing the values into influx or some other DB.

This is trivial to do, and takes little to no embedded coding experience on the ESP8266. That's a win as far as I am concerned.

Re:MicroPython by dcmorton on Sunday August 16, 2020 @10:46PM (#24183394)
I've done something pretty similar that with my project here [0]. Instead of using MQTT the ESP32 feeds directly to an InfluxDB database.

[0] - https://github.com/dcmorton/esp32-dht22-upython

Re:MicroPython by sitkack on Sunday August 16, 2020 @10:00PM (#24183145)
Not only that, but you can live code in the repl on the same device. One can solve a physical problem in less than 15 minutes using these devices.
Re:MicroPython by embedpythony on Sunday August 16, 2020 @03:34PM (#24180528)
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 by jennasys on Sunday August 16, 2020 @04:15PM (#24180871)
On the boards it has been ported to, I2C and SPI are directly supported (https://docs.micropython.org/en/latest/library/machine.SPI.h...). No C coding necessary. It's not a replacement for C on every embedded application, but for prototyping and one-off applications it's hard to beat the productivity gains. It will run on an ESP8266-01 module for as low as $2 ea.
Re:MicroPython by fxj on Sunday August 16, 2020 @08:40PM (#24182664)
Look into ArduPy, which lets you compile arduino libs as loadable python modules:

ArduPy is a combination of Arduino and MicroPython. MicroPython uses the universal Arduino API to control the hardware so that it can be compatible with new platforms quickly. With the help of the aip package manager we provided, you can transform your favorite Arduino library into a MicroPython library.

https://github.com/Seeed-Studio/ArduPy

It works very well on the Seeeduino XIAO (https://www.seeedstudio.com/Seeeduino-XIAO-Arduino-Microcont...) which is arduino compatible and costs $4,90 per piece. You can even get a grove shield for the same price and you are ready to go.

Re:MicroPython by dnr on Sunday August 16, 2020 @05:19PM (#24181424)
Huh? I use MicroPython on ESP8266's that I'm sure are way under $5 in bulk these days. Including I2C support and various other stuff, without writing any C. I am a hobbyist but I don't see any reason why the same thing wouldn't work in a commercial product.
Re:MicroPython by dybber on Sunday August 16, 2020 @03:16PM (#24180383)
It runs very well on ESP32.
Re:MicroPython by not_the_fda on Sunday August 16, 2020 @03:34PM (#24180526)
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 by jononor on Sunday August 16, 2020 @04:04PM (#24180760)
If they need you for that they probably would not have been able to write it themselves in C in the first place?
Re:MicroPython by matt_trentini on Sunday August 16, 2020 @08:59PM (#24182769)
The ESP32 port still has a few rough edges, particularly around peripheral control. But it's a popular device and the port is improving all the time.