Live data from Hacker News

CircuitPython – The easiest way to program microcontrollers

circuitpython.org

41–46 of 46 posts

Re: CircuitPython – The easiest way to program microcontrollers

#41
post #37
post #10

How does it compare with MicroPython? In any case, can be good for PoC or similar things where your microcontroller is largely oversized for the application, but in practice you hardly can exploit your microcontroller's power using such a non-compiled high-level language. For a hobby project you can get a microcontroller that has 10x the actual power you need and use Python on it, but on an industrial scale it's not…

CircuitPython is a fork of MicroPython, and they periodically bring in commits from MicroPython to stay up to date. One advantage of CircuitPython is that your board gets mounted as a volume like a USB drive, and you can just copy code.py onto it to install your program; it's just a more user-friendly experience. For comparison MicroPython only exposes a file system through a tool called rshell[1], that you need to u…

Various MicroPython implementations, specifically the STM32 port (which runs the PyBoard), expose their filesystem as a USB mass storage device that you can copy files into directly. So I wouldn't say that it's exclusive to CircuitPython by any stretch.

Re: CircuitPython – The easiest way to program microcontrollers

#42
I’m building a custom MIDI controller and it took me no time at all to get a prototype going with a linear pot and an I2C display: https://taoofmac.com/space/blog/2022/06/05/0025

Extremely impressive in that regard, although I might switch to C++ later if the response seems slow.

Altogether, I think CircuitPython (and MicroPython, of which I own the original development board) is an amazing achievement given the number of boards it currently runs on and the state of affairs we were in a decade ago…

Re: CircuitPython – The easiest way to program microcontrollers

#43
post #37
post #10

How does it compare with MicroPython? In any case, can be good for PoC or similar things where your microcontroller is largely oversized for the application, but in practice you hardly can exploit your microcontroller's power using such a non-compiled high-level language. For a hobby project you can get a microcontroller that has 10x the actual power you need and use Python on it, but on an industrial scale it's not…

CircuitPython is a fork of MicroPython, and they periodically bring in commits from MicroPython to stay up to date. One advantage of CircuitPython is that your board gets mounted as a volume like a USB drive, and you can just copy code.py onto it to install your program; it's just a more user-friendly experience. For comparison MicroPython only exposes a file system through a tool called rshell[1], that you need to u…

RShell is a nice tool but the 'official' way to interact with a MicroPython device is with mpremote [1].

One of the key features of mpremote is that it allows folders to be mounted on your device from your PC.

For me, this allows a workflow that's even more efficient than using USB since no copying is required at all. Work on your PC (often using the unix port in a container [2] to test), then mount the folder and execute on the device. Brilliant. :)

I should probably write up how I use this workflow..!

It would be good to also allow USB volume mounting on more MicroPython ports (stm32 only) as - I agree - it's more intuitive for beginners. But LittleFS [3] is a much more robust filesystem than FAT, which is required for USB mounting. LittleFS is preferred by the core team and has had more focus recently.

[1] https://docs.micropython.org/en/latest/reference/mpremote.ht... [2] https://hub.docker.com/u/micropython [3] https://github.com/littlefs-project/littlefs

Re: CircuitPython – The easiest way to program microcontrollers

#44
post #4

Earlier quoted context omitted.

What was the downside? Why only prototyping? I've not used a pico but other microcontrollers with c++ interfacing tools, and my thoughts are these things don't have interpreters onboard so the language choice is likely not that important. But I'm limited to TI boards.

In general with the the embedded Pythons, they are 2 or 3 orders of magnitude slower than C (big surprise) and they don't support all the hardware features. By necessity, they have a one-size-fits all approach that works fine for hobbyists but might not be sufficient for production. That all said, I love to bang out a prototype or one-off project with CircuitPython or MicroPython. Or Arduino if it makes sense.

They're slower if you spend cpu-intensive time in the interpreter. If you're calling wrappers for C functions then there's little difference. For example, sending SPI or I2C data are effectively identical. Same too if you want to render a QR code using a C library for example [1].

So if you ever find that you need more performance you can drop into C, write a user module, and get the benefit of easier Python syntax and C performance.

The only reason some hardware features aren't supported is a lack of effort to expose those features. Come help us fill in the gaps! :P

[1] https://www.youtube.com/watch?v=437CZBnK8vI (Not my best presentation, I'm sorry; I was running on very little sleep and a high degree of stress!)

Re: CircuitPython – The easiest way to program microcontrollers

#45

Earlier quoted context omitted.

In general with the the embedded Pythons, they are 2 or 3 orders of magnitude slower than C (big surprise) and they don't support all the hardware features. By necessity, they have a one-size-fits all approach that works fine for hobbyists but might not be sufficient for production. That all said, I love to bang out a prototype or one-off project with CircuitPython or MicroPython. Or Arduino if it makes sense.

They're slower if you spend cpu-intensive time in the interpreter. If you're calling wrappers for C functions then there's little difference. For example, sending SPI or I2C data are effectively identical. Same too if you want to render a QR code using a C library for example [1]. So if you ever find that you need more performance you can drop into C, write a user module, and get the benefit of easier Python syntax a…

I haven't really needed much added to MicroPython or CircuitPython for my use cases, but I see people on r/python or r/iot or wherever gripe occasionally. Thanks for the video link!

Re: CircuitPython – The easiest way to program microcontrollers

#46
post #8

Earlier quoted context omitted.

In general with the the embedded Pythons, they are 2 or 3 orders of magnitude slower than C (big surprise) and they don't support all the hardware features. By necessity, they have a one-size-fits all approach that works fine for hobbyists but might not be sufficient for production. That all said, I love to bang out a prototype or one-off project with CircuitPython or MicroPython. Or Arduino if it makes sense.

I never had to do something that could not be done with python. Probably some libs for more exotic hardware, but depending of how you program you can loose events like button presses if you do not consider the slow response time in python.

[deleted]
Post reply on HN