Live data from Hacker News

CircuitPython – The easiest way to program microcontrollers

circuitpython.org

21–30 of 46 posts

Re: CircuitPython – The easiest way to program microcontrollers

#21

Earlier quoted context omitted.

It's really quite nice to be able to telnet into a running micro-controller (over wifi even!), play around with pins directly, all that. Being able to run code at runtime with no compile step also opens up the possibility of micro-controllers that can load "apps" or other user code at run time. Somehow I don't think people would be this snobby about the advantages of an interpreted language if it was running lisp^1 i…

It's not about being snobby - it's about choosing the right tool for the job. Challenge: Come up with a set of project requirements for a practical electronics device, and evaluate if Python is the right tool for the job. I'm suspicious you'll run into headaches with interrupts, DMA, concurrent processes interfering with each other due to taking up too much CPU time, onboard peripherals beyond the most popular in the…

Having just used it to interactively play around with PWM settings controlling some motors and solenoids for a music project, I found it much more useful than compiling a new firmware and flashing the microcontroller for every tweak I'm making. I don't have a very compelling reason to port it to anything else at this point, for doing control-rate (in other words: slow) updates to PWM outputs on a microcontroller, it works perfectly.

Re: CircuitPython – The easiest way to program microcontrollers

#22

Earlier quoted context omitted.

It's not about being snobby - it's about choosing the right tool for the job. Challenge: Come up with a set of project requirements for a practical electronics device, and evaluate if Python is the right tool for the job. I'm suspicious you'll run into headaches with interrupts, DMA, concurrent processes interfering with each other due to taking up too much CPU time, onboard peripherals beyond the most popular in the…

Having just used it to interactively play around with PWM settings controlling some motors and solenoids for a music project, I found it much more useful than compiling a new firmware and flashing the microcontroller for every tweak I'm making. I don't have a very compelling reason to port it to anything else at this point, for doing control-rate (in other words: slow) updates to PWM outputs on a microcontroller, it…

Yes, being able to fiddle with peripherals right there on the repl skipping the compile and flash step is a huge productivity gain.

Re: CircuitPython – The easiest way to program microcontrollers

#23

My suspicion is that this, and MicroPython, which it's based off, are designed for people who know Python, and are hesitant to learn another language, or expand their toolbox. Python is a great language in some domains. For example, numerical computing, web servers, and scripting. Embedded programming is, unfortunately, only suitable to a handful of languages that can operate with high speed and low memory use. At th…

CircuitPython is designed for beginner hobbyists and the lower grade education market. Basically those with none to little programming experience.

Re: CircuitPython – The easiest way to program microcontrollers

#24

My suspicion is that this, and MicroPython, which it's based off, are designed for people who know Python, and are hesitant to learn another language, or expand their toolbox. Python is a great language in some domains. For example, numerical computing, web servers, and scripting. Embedded programming is, unfortunately, only suitable to a handful of languages that can operate with high speed and low memory use. At th…

> designed for people who know Python, and are hesitant to learn another language, or expand their toolbox

I've been in this position and all I'd say is a little more complicated than that. I'm happy to learn other languages (in fact I am learning Rust at the moment), however I opt for CircuitPython a lot of the time because theres a job I need doing. Expanding your toolbox is great, and often having a project to work on with whatever your learning is a great way to do that, but sometimes you just have a job that needs doing, and in that case a language thats both fast to work with and your familiar with seems like an ideal choice, as long as your aware of the drawbacks of it.

Re: CircuitPython – The easiest way to program microcontrollers

#25

My suspicion is that this, and MicroPython, which it's based off, are designed for people who know Python, and are hesitant to learn another language, or expand their toolbox. Python is a great language in some domains. For example, numerical computing, web servers, and scripting. Embedded programming is, unfortunately, only suitable to a handful of languages that can operate with high speed and low memory use. At th…

> Embedded programming is, unfortunately, only suitable to a handful of languages that can operate with high speed and low memory use.

There are plenty of applications where the performance or resource needs aren't great and the number of units being produced aren't sufficient to justify the marginal savings on a microcontroller. Then there are situations where it may be desirable to make it easy for multiple people to go in and modify a program on a regular basis, where languages like Python tend to be clearer at communicating intent since the low level implementation is handled by the language. (While you may be able to provide high level abstraction in languages like C, you cannot abstract away all of those details in C.) Of course, Python also provides an REPL. That can remove the need for developing your own command language for managing the device.

For some reason this feels like the same argument I had to present for the opposite situation, pointing out that sometimes optimized C or assembly code were necessary since there were cases where it is more cost effective to use microcontrollers that offered bytes of RAM or non-volatile storage. This is especially true when something is developed once, widely deployed, never modified, and does not need to be managed.

As with anything, it depends upon your application.

Re: CircuitPython – The easiest way to program microcontrollers

#26

My suspicion is that this, and MicroPython, which it's based off, are designed for people who know Python, and are hesitant to learn another language, or expand their toolbox. Python is a great language in some domains. For example, numerical computing, web servers, and scripting. Embedded programming is, unfortunately, only suitable to a handful of languages that can operate with high speed and low memory use. At th…

> designed for people who know Python, and are hesitant to learn another language, or expand their toolbox I've been in this position and all I'd say is a little more complicated than that. I'm happy to learn other languages (in fact I am learning Rust at the moment), however I opt for CircuitPython a lot of the time because theres a job I need doing. Expanding your toolbox is great, and often having a project to wor…

Especially for prototyping.

Here I am working on a widget, it takes some sensors and runs some output. Well, I can prototype basically the whole thing using adafruit boards, quic i2c connectors, and do it relatively cheap.

Chips are cheap!

If I wanted to actually mass produce this, we would make our own PCB, integrate all the sensors onto a single board, and so forth, but for playing around with a concept? Yeah, I'll take adafruit and some adapters any day.

(Currently doing this right now for a pressure sensor that predates standard MAP sensors but operates similarly). If the concept is right... then we can think about making it for real real

Re: CircuitPython – The easiest way to program microcontrollers

#27
post #8

Earlier quoted context omitted.

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.

> I never had to do something that could not be done with python. Do you write embedded code professionally?

This days I`m more an android dev.

But I do as a side gig.

Me and a friend to small projecrts for smartcities like interative propaganda totens, wifi access points, smart traffic warnings. Things like that.

I also programed some small scale things in my last to job. One of them was a tamagotchi. I did not filmed the completed version, but I done a video testing the animations: https://youtu.be/fltoTmUJPBE

Re: CircuitPython – The easiest way to program microcontrollers

#28

My suspicion is that this, and MicroPython, which it's based off, are designed for people who know Python, and are hesitant to learn another language, or expand their toolbox. Python is a great language in some domains. For example, numerical computing, web servers, and scripting. Embedded programming is, unfortunately, only suitable to a handful of languages that can operate with high speed and low memory use. At th…

I remember the "Handy Board" [1], a 68HC11-based micro-board (that came out of MIT?) that had an amazing "Interactive-C" language. C code was compiled to a byte-code that was interpreted in real-time on the Handy Board. So cool to type code on the C/L and have it execute on the microcontroller and return a result back to your terminal. I suspect Python on a microcontroller gives a similar experience/thrill. [1] So ch…

I've recently been watching some videos of people resurrecting mid-1970's vintage computers based upon the then new microprocessor. Even though the base configuration of these machines came with about a kilobyte of RAM and a similar amount of ROM, they managed a degree of interactivity through a machine language monitor. Of course, upgrading the memories allowed for more sophisticated interactive languages like BASIC.

It left me quite surprised that a similar progression in interactive development tools has been, at best, a novelty item in the microcontroller world. Most microcontrollers are more capable and include the requisite UART, yet the only way you're going to interact with most of them is with a much more powerful computer and a frequently costly[1] hardware interface for debugging. While those are fine in most cases, there are times when I would have (figuratively) killed to be able to go in and change a couple of bytes.

[1] Yes, I am cheap. Incidentally, I think one of the brilliant things about the introduction of the Raspberry Pi Pico was not just having MicroPython available on the day of introduction, but instructions on programming a second identically inexpensive Pico to be an SWD.

Re: CircuitPython – The easiest way to program microcontrollers

#29

Earlier quoted context omitted.

It's really quite nice to be able to telnet into a running micro-controller (over wifi even!), play around with pins directly, all that. Being able to run code at runtime with no compile step also opens up the possibility of micro-controllers that can load "apps" or other user code at run time. Somehow I don't think people would be this snobby about the advantages of an interpreted language if it was running lisp^1 i…

It's not about being snobby - it's about choosing the right tool for the job. Challenge: Come up with a set of project requirements for a practical electronics device, and evaluate if Python is the right tool for the job. I'm suspicious you'll run into headaches with interrupts, DMA, concurrent processes interfering with each other due to taking up too much CPU time, onboard peripherals beyond the most popular in the…

If you're doing any serious amount of work in any situation then I agree with you, but sometimes the best tool for the job is the one that gets the job done.

CircuitPython is special-built for this exact task -- to make microcontroller work more approachable and accessible for beginners and/or projects with a small scope.

Anecdote: I used it a few weeks ago for a project that was small and had a tight timeline. As a beginner to electrical engineering with microcontrollers it was nice to not have to struggle through language syntax as well. This solved my use case perfectly.

Post reply on HN