Scratch Your Itch to Program a Microcontroller

Scratch Your Itch to Program a Microcontroller

One of the fun things about “old school” computers is that it was fairly easy to get kids into programming them. The old Basic interpreters were pretty forgiving, and you could do some clever things easily with very little theory or setup. These days, you are more likely to sneak kids into programming via Scratch — a system for setting up programs via blocks in a GUI. Again, you can get simple results simply. With Scratch or Basic, complex things have a way of turning out complex, but that’s to be expected. If you want to try a Scratch-inspired take on microcontroller programming, check out MicroBlocks. It will work with several common boards, including the micro:bit and the Raspberry Pi Pico. You can use it in a browser or download versions for Linux, Windows, Mac, or even Chromebooks.

You can see a video below about the micro:bit version from a year ago. The tool is advancing, so you’ll find many new features compared to the video, but it will still give you an idea of what’s happening.

We were impressed with the range of blocks and libraries including like I2C, SPI, and NeoPixel. You can graph data easily. We were unable, sadly, to make the browser version work with an ESP32 S3 module we had sitting on the desk. The tutorials have videos and snippets of graphical “code” you can drag directly into the IDE.

We aren’t sure if it was a configuration issue or if the S3 isn’t supported. Or it could have been simple operator error. The web page says it can be “tricky” to get the initial firmware on the ESP32, and — for us — it was apparently too tricky. We even grabbed some firmware images from GitHub and flashed them. We also tried building the smallvm component from scratch, but getting it to build for the S3 took some modifications and uncovered some typos in the code base. It did work in the end and it worked as advertised for a “stock” ESP32 development board.

We get it. You don’t want to shower kids with cryptic error messages. However, there didn’t seem to be many options for troubleshooting or for a teacher or coach to just flash the image in some regular way. There was a GUI — we think — to flash the base firmware on GitHub but with little documentation.

But if you have a supported board, it looks great. We know that block programming isn’t the language of choice for most Hackaday readers. But if you are looking for a gateway drug for a friend or a child, this could well be it.

You shouldn’t write kernel modules in Scratch, either, but people have. If you’d rather stick with Python, you can do that, too.

0Shares