Page 1
Aside

Fix to MicroPython's Memory Allocation Problem on ESP8266

I've been trying to write code that allows me to display text on my ST7735 display. The font module I found is around 4kB of source code that needs to be loaded by Python, compiled into byte code and executed by the Python Virtual Machine, or VM (for more details refers here). This process works somewhat like Java's VM approach, but on devices with limited memory, i.e. the ESP8266, can become troublesome. Loading, compiling and storing the byte code takes up precious memory, which may not always be allocatable; thus throwing an MemoryError: memory allocation failed, allocating XXX bytes.. In this little post I want to show you how you can pre-compile modules for the ESP8266, so you will avoid wasting space. And if that option is too cumbersome for you, I also present a little hack to increase the ESP's heap memory, but that's more of a bodge-job for lazy people: i.e. me :p

Continue Reading →

more
Aside

ESP8266 file transfer - the post I forgot...

In all my excitement about getting MicroPython running on the ESP8266, and then to get it talking to a ST7735 driven TFT LC display, I completely forgot to explain how I get the code saved on the little chip. It is very possible to write all the code in the terminal using picocom, minicom or screen. Yet this approach is very tedious, prone to errors, and if you do mistype something you'll have to start from scratch. Luckily, the MicroPython image allocates some space for a local file system (around two frecking Mega-Byte on the ESP if I'm not mistaken!), and you can write files to it and read them back using the built in webrepl module.

Continue Reading →

more
Standard

TFT display for ESP8266 - shapes

Programming is awesome! Having gotten to grips with the ESP8266 on the HUZZAH board from Adafruid made me appreciate this even more. Back in my "wild" embedded-C days I was under the impression that programming a microchip was only for the hardcore geeks (myself included) and really difficult to grasp. How wrong I was! The object orientated platform MicroPython makes this little ESP an amazing platform for learning to code and getting immediate results. Only one thing is missing is a screen: or is it?

Continue Reading →

more
Standard

ESP8266 getting started

Little did I know, that programming can become so easy! When I started my electronic engineering degree back in 2009, I could not even code. Nor did I know anything about hardware, registers, or protocols. Over the past I have accumulated an immense knowledge that always relied on me writing tens, sometimes hundreds, of lines of code, just to set up a bloody micro controller and turn on a single LED. But with amazing projects and the community a little micro controller has become my favourite playground for cheap and extremely easy prototyping: the ESP8266.

Continue Reading →

more
Aside

iPython from Anaconda in PyCharm

Lately I fell in love with Python and its easy capability of interfacing with DLLs. Yet so far I always relied on using MATLAB for generating reports and plots for our papers. My good old friend Dawid pointed out I could just use iPython to do the plotting for me. Removing the middle man (i.e. MATLAB) would also be beneficial since our University's license will expire in 3 days 🙁

The only issue I've had with getting iPython going in PyCharm (my preferred Python IDE) was that it just would not start the Kernel. IPython  natively installs when deploying Anaconda and should just work when making a notebook. But it doesn't. Here I will go through how I managed to "fix" this and have my notebooks run beautifully in PyCharm.

Continue Reading →

more