❌

Reading view

There are new articles available, click to refresh the page.

CircuitPython Goes Turbo With Precompiled Functions

It would not be at all original to declare that Python is the new BASIC. Like BASIC, it has been the first programming language for a whole generation of coders, and its main advantage is that it’s quick and easy to write in. Like BASIC it is an interpreted language, and thus rather slow to execute.

Thus while CircuitPython can be very useful for beginners and quick projects, it hits the limitations of the hardware far sooner than it needs to β€” unless you can pre-compile critical parts of the code, which you now can, thanks to CircuitPython Turbo by [Mikey Sklar] with some help from Anthropic’s Claude LLM.

Now if that sounds a lot like MicroPython’s β€˜Viper’ and machine-code compiler, that’s because it is. CircuitPython is a fork of MicroPython with some handy extras on Adafruit boards, but Viper wasn’t one of them until now. Before the Turbo version, CircuitPython only ran in interpreted mode.

Like MicroPython, using CircuitPython Turbo you can flag sections to run as β€˜native’, where instructions are compiled but values stay as python objects, which gets you about a 3X speedup. A little more rewriting to declare your variables and pointers and you can use β€˜viper’ mode, which can β€” depending on what you’re up to β€” result in a 20x to 70x speedup. In Adafruit’s documentation, they demonstrate a Metro RP2040 calculating the Mandelbrot set 3x faster in Native and 19.7 times faster with Viper than normal Python bytecode.

The one thing that we miss from BASIC that CircuitPython Turbo doesn’t give is inline assembly– though interestingly enough, that is in the upstream MicroPython implementation, so perhaps its day will come here too. Not every job is suited to the use of Python on microcontrollers, but we’ve seen it used for everything from e-bikes to a Winamp-inspired music player.

All The Best Computers Boot To… Python?

Among all the machines of the 8-bit home computer era which booted straight to a BASIC prompt, there were a very few that went their own way with another language. The Jupiter Ace springs immediately to mind, a diminutive Z80-based machine similar to Sinclair’s ZX81, which booted to FORTH.

The Ace wasn’t a commercial success, but what would have happened had it booted to a more accessible language? It’s a question [jordanhubbard] appears to be trying to answer, with an OS that boots to a Python interpreter.. The OS is Python, and everything on top of it uses the interpreter. Better still, it has a GUI mode.

The OS boots on an x86-64 platform or in QEMU, and appears to have been created using an LLM. There are two build options for the GUI version or the interpreter version. It provides a set of UNIX-like commands for interacting with the OS and disk, something which brings back memories of disk-based systems back in the BASIC days. We’re surprised to see no screenshots of the GUI in action though, an omission he’d do well to correct, we think.

It’s fair to say that in 2026 this is more a bit of fun than a serious OS contender, but maybe someone will run with it. It has competition too, not so long ago we featured a similar OS that runs a BASIC interpreter.

A 1024 Byte Python Interpreter

Like many of us, [Austin] finds writing code satisfying β€” especially if it is challenging. His latest challenge: shoehorn something that looks like Python into 512 bytes. Ok, that didn’t work out, but would you believe 1024 bytes of source code?

The goal was to properly execute a fizzbuzz program using a decidedly Python-like syntax. Since he is only interpreting Python, some things were simplified. In addition, he tried hard to minimize things like whitespace and variable names. Still, there were other things to do, and he borrowed from tips for code golfing.

The resulting code is essentially illegible, but it handles integer variables and literals, assignment, arithmetic, many control structures, functions, and even print. Not bad for 1 K.

Despite being tiny, the parser does a lot, but it does cut corners. No bytecode, no syntax tree, and no error handling. Variables have to be a single lowercase letter. So, ok, it isn’t really Python. But it is something.

Naturally, this reminded us of the obfuscated C code contest. If you really want to go small, we appreciate small Forth.

Voicebox FX is a Blueprint for CircuitPython I2S Audio

[Adafruit]’s Voicebox FX gadget is a fun, well-documented project that serves another useful purpose: being a fantastic reference design for audio on CircuitPython, with I2S audio components. Be sure to check it out if you have a project that involves any of that and could use a few pointers, or if you just want to jog a few ideas loose.

I2S (Inter-IC Sound) is a protocol aimed squarely at moving audio data between components as digital signals. Our own [Jenny List] can tell you everything you need to know about I2S. It’s a relatively simple interface that is not at all fussy about actually being used for audio, and that has led to it being put to some unusual uses.

The Voicebox FX uses an I2S microphone, an I2S amplifier, and an RP2350 microcontroller to record and play sound as well as offer a variety of effects controlled by physical inputs. It’s all wrapped up in a slick 3D printed case, and while it’s a fantastic reference design, it looks like a fun toy in its own right.

❌