esp8266 micropython uasyncio experimental build

Esp8266 is the super cheap chip which can run Micropython. You can buy it on Amazon for as little as €8 or less, and as little as $5 or less on Bangood/AliExpress.

The ESP8266 (ESP-12E spec) has a 4MB Flash RAM and about 96KB of  RAM. 

One nice thing is you can use an async mode easily  and it works great. So I took this very good complete tutorial on asyncio, and hacked a bit the micropython source code to offer to you a super-breeze async version
First of all I taken the last version of Micropython (1.10) and started to push to its limit to offer at least 44Kb to the interpreter. 51Kb is the theoretical limit, but you must left some space for the interpreter to work correctly.
To increase Micropython available memory, you must download Micropython source code and hack it. It is a bit complex, so a Linux machine is recommended, anyway I managed to to it on a Windows10 with linux subsystem (WSL) which is a bit slow but it is a nice environemnt to work with.
On this forum [1]  I found some specific information, then I forked micropython code base (below you will find my proposed modifications, also a pre-made image is provided).


First of all edit heap size in main.c
This step needs a bit of caution, because the interpreter needs RAM to work correctly, but you can try to grab a few kilobytes

Then we will liste all the C modules pre-compiled, using the help function:

Now the best way is to “scaffold” your micropython for the final target use. For instance I do not plan to use neopixel or frameuffers, because my little esp8266 will act like a server for tuning stuff on and off.

Also webrepl and websocket could be ripped off. At the end of my work, I ended with the following module list

I have prepared a forked git hub repository with my hacks [3]: look at the  daitan-hacks branch.


Download the ready made image!

  1. “Super Expander” version (Work in progress) 40Kb with basic uasyncio and no webrepl
  2. Simpler version with asyncio and more RAM


[2] Micropython reference
[3] GitHub source


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.