Micropython On Microcontrollers

There are plenty of small microcontrollers available for all kinds of tasks, each one with its unique set of features and capabilities. However, not all of us want to spend time mucking about in C or assembly to learn the intricacies of each different chip. If you prefer the higher planes of Python instead, it’s not impossible to import Python on even the smallest of microcontrollers thanks to MicroPython, which [Rob] shows us in this project based on the ESP32.

[Rob] has been working on a small robot called Marty which uses an ESP32 as its brain, so the small microcontroller is already tasked with WiFi/Bluetooth communications and driving the motors in the robot. Part of the problem of getting Python to run on a platform like this is that MicroPython is designed to be essentially the only thing running on the device at any one point, but since the ESP32 is more powerful than the minimum requirements for MicroPython he wanted to see if he could run more than just Python code. He eventually settled on a “bottum-up” approach to build a library for the platform, rather than implementing MicroPython directly as a firmware image for the ESP32.

The blog post is an interesting take on running Python code on a small platform, and goes into some details with the shortcomings of MicroPython itself which [Rob] ended up working around for this project. He’s also released the source code for his work on his GitHub page. Of course, for a different approach to running Python and C on the same small processor, there are some libraries that accomplish that as well.

Your Microcontroller Is Your IDE

What if your microcontroller IDE was running on the microcontroller itself and not hosted on the computer you use to do the programming? The greatest legacy of Arduino in all its forms has arguably been a software one, in that it replaced annoying proprietary development environments with one that installed easily on a range of operating systems, was easy to use, and above all, worked. The next level of portability is to get rid of any specialize computer-side software. [Ronny Neufeld] wrote MicroIDE for ESP32 as an IDE accessible through a web browser, which interestingly is hosted on the target device itself.

Using the IDE is easy enough, install a binary, connect to the ESP with a web browser, start writing MicroPython code. There is a choice of connecting directly to the chip as a hotspot, or connecting via another WiFi network. The interface is looking pretty slick but he’s at pains to remind us that it’s a work in progress. Sadly there is no source code yet as it’s a binary distribution that is free for non-commercial use, we’d hope that an open-source release might one day happen. It’s not for everyone, but the convenience of accessing the same interface from almost any modern device should help attract a healthy community.

This appears to be the first web-based on-chip ESP IDE we’ve shown you. But it’s not the first on-chip coding example, as this BASIC interpreter shows.

[Main image source: Ubahnverleih / CC0]

A Pocket-Sized Terminal For Mobile Python Hacking

Inspired by the good old days when your computer would boot directly into BASIC, [Le Roux Bodenstein] has created a handheld device he calls “DumbDumb” that can drop you into a MicroPython environment at a moment’s notice. If that doesn’t interest you, think of it this way: it’s a (relatively) VT100 compatible serial terminal with a physical keyboard that can fit in your pocket.

Being essentially just a dumb terminal (hence the name), there’s actually not a lot of hardware on the board. Beyond the 320×240 NewHaven 2.4 inch LCD, there’s just an STM32G071R8 microcontroller and a handful of passives. Plus the 57 tactile buttons that make up the keyboard, of course.

The MicroPython part comes in thanks to the spot on the back of the board that accepts an Adafruit Feather Wing. In this case, it’s the HUZZAH32 with an ESP32 on board, but it could work with other variants as well. With the wide array of Feather boards available, this terminal could actually be used for an array of applications.

So even if fiddling around with MicroPython isn’t your idea of a good time, there’s almost certainly some interesting software you could come up with for a tiny network-attached terminal like this. For example, it might be just what you need to start working on that LoRa pager system.

Now Even Your Business Card Can Run Linux

It takes a lot of work to get a functional PCB business card that’s thin, cheap, and robust enough to be practical. If you can even blink a few LEDs on the thing and still hand them out with a straight face, you’ve done pretty well for yourself. So you can imagine our surprise when [George Hilliard] wrote in to tell us about his $3 business card computer that boots into a functioning Linux environment. If this were a bit closer to April, we might have figured it was just a joke…

Of course it helps that, as an embedded systems engineer, [George] literally does this kind of thing for a living. Which isn’t to say it was easy, but at least he keeps close enough tabs on the industry to find a suitable ARM solution at a price that makes sense, namely the Allwinner F1C100s. This diminutive chip offers both RAM and CPU in a single package, which greatly simplifies the overall design and construction of the card.

With a root filesystem that weighs in at just 2.4 MB, the environment on the card is minimal to say the least. There’s no networking, limited I/O, and forget about running any heavy software. But it does boot in about six seconds, and [George] managed to pack in a MicroPython interpreter and a copy of the classic Unix dungeon crawler rogue.

Oh yeah, and it also has his resume and some samples of his photography onboard. It is, after all, a business card. All the user has to do is plug it into the USB port of their computer and wait for the virtual serial port to pop up that will let them log into the system running on the card. It also shows up as a USB Mass Storage device for recipients who might not be quite as adept at the command line.

In addition to the high-level documentation for this project, [George] has also prepared a deeper write-up that goes into more technical detail for anyone who might be looking to follow in his footsteps. Thanks to all of the source code that he’s made available, it should be a lot easier for the next person to get their own disposable pocket computer up and running.

We’ve seen all manner of electronic business cards over the years, but never anything quite like this. Which, of course, is quite the point. If you’re ever given a business card that doubles as a computer running a full-fledged operating system on it, you aren’t likely to forget it anytime soon.

Numpy Comes To Micro Python

[Zoltán] sends in his very interesting implementation of a NumPy-like library for micropython called ulab.

He had a project in MicroPython that needed a very fast FFT on a micro controller, and was looking at all of the options when it occurred to him that a more structured approach like the one we all know and love in CPython would be possible on a micro controller too. He thus ended up with a python library that could do the FFT 50 times faster than the the pure Python implementation while providing all the readability and ease of use benefits that NumPy and Python together provide.

As cool as this is, what’s even cooler is that [Zoltan] wrote excellent documentation on the use of the library. Not only can this documentation be used for his library, but it provides many excellent examples of how to use MicroPython itself.

We really recommend that fans of Python and NumPy give this one a look over!

A Retro Gaming Console For The New Generation

Ostensibly the ESPboy is an open-source hackable game engine built as an IoT platform for STEM education and play, but there’s no way [RomanS] could have been inspired by anything other than retro gaming consoles from the near past. For anyone who grew up playing with Tamagotchi pets or Palm Pilots, this project is going to be a major throwback.

The Saint Petersburg-based microcontroller hobbyist utilizes a ESP8266 microcontroller to build a series of modules for different game play modes, including a TFT display, GSM phone, MP3 player, GPS navigator, FM radio, and keyboard module. He has plans to build even more modules, including a LoRa messenger and thermal camera, to really expand the system’s capabilities.

Since the board has built-in WiFi, firmware can be uploaded to the device without a wired connection and compiler. The nature of the project makes the board compatible with the Arduino IDE and Micropython, which makes hacking the software even easier.

A TP4056 battery charging module charges the LiPo, although depending on the battery capacity, the charging current (set by the R3 resistor on the controller) does require some change. A MCP4725 I2C DAC is used for smooth driving the LCD’s backlight. In order to extend the battery life, the battery controller uses sleep mode to periodically wake up to measure and send data, which allows it to extend its battery life without external power. There’s also transistor driven buzzers that provide a little extra feedback to the user when playing games, complete with a variable resistor to adjust the sound volume.

A number of free pins run along the periphery for connecting to other modules, including pins for GPIO extension, sensor adapters, connectors to addressable LEDs, and an extension slot for actuators. For anyone interested in making their own version of the ESPboy, the PCB schematics are accessible online.

Projects like the Arduboy have shown that a small microcontroller-based game system can be equal parts fun and educational, so we’ve been excited to see more of these types of projects popping up during the course of the 2019 Hackaday Prize.

Continue reading “A Retro Gaming Console For The New Generation”

Tiny ESP32 Fits Inside USB-A Connector

The ESP32 was introduced a few years ago as an inexpensive way to outfit various microcontrollers with WiFi or Bluetooth. Since then it has been experimented with and developed on, thanks to its similarities to the ESP8266 and the ability to easily program it. Watching the development of this small chip has truly been fascinating as it continues to grow. Or, in this case, shrink.

The latest development in the ESP32 world comes from [femtoduino] who, as the name suggests, makes very small things. This one is a complete ESP32 which fits inside a USB-A connector. The brains of the projects is the ESP32-D2WD which is a dual core chip with 2 Mb of memory, making it more than capable. In fact, a big part of this project was [femtoduino]’s modifications to MicroPython in order to allow it to run on this chipset. For that alone, it’s cool.

This project is impressive for both reasons, both the size and the addition to the MicroPython libraries. If you need something really really tiny, for whatever reason, you might want to look into picking up one of these. Be careful though, and be sure to get the latest version of the SDK.