M5Paper, Arduino, PlatformIO, and MicroPython (part 1)

I've recently got M5Paper, a programmable phone-sized device with E-ink display:

M5Paper from M5Stack

Whole arrangement sounds very compelling to me. I'd love to have a device of that shape with ability to make it anything I want. A clock, a Gemini client, a todo app with reminders, maybe minimal text editor for notes... what else can I ask for?

But here is the catch: you have to program it. It comes with a little pre-installed demo that looks like a beat-down Kindle without any reader. It's called "FactoryTest" for a reason, it's not useful in any meaningful way. There are no apps to install. There is no operating system. There is not a lot of documentation or examples on the internet. Although the wiring and all the chips and ports are printed right on the back of the device (which, I realized later, is extremely useful).

Having no embedded software engineering experience, I've thought "how hard could it be?"

Let me tell you about my first few days.

Where do you even start?

M5Paper's description mentions it's compatible with Arduino, MicroPython, and even UIFlow. What the heck is UIFlow?

And then when you look up Arduino, you inevitably stumble upon something called PlatformIO.

PlatformIO: Professional collaborative platform for embedded development

That sounds as professional as it gets.


You've likely heard of Arduino. Altogether Arduino is a few things:

(Actually I'm pretty sure the drivers for modules are written in a proper C++)

Arduino boards are kind of like RaspberryPi, but generally quite a bit less powerful. While RaspberryPi's have ARM CPUs which allow installing Linux and become low-power "normal" computers, Arduino-compatible boards (like M5Paper) use all sorts of different microchips (M5Paper uses ESP32) that run different kinds of CPU architectures. Usually GCC can compile to those architectures, but devices are all so different and low-powered that there is no chance to run "normal" operating systems.

Instead you can usually run a "real-time operating systems" (RTOS), FreeRTOS being very popular. RTOS's are almost like a C libraries that provide multi-threading and inter-process communication for you programs. They're nothing like Linux and what comes to mind when somebody says "OS".

Anyways, M5Paper is compatible with Arduino, so you can pull out Arduino IDE and flash some Arduino code on it.

Firstly, as a code editor Arduino IDE is very bare. I think its biggest advantage is how easy it is to choose your board and flash the code and then attach to board's serial port and see what it prints back at you. That's very nice, but I'd still prefer to use my own text editor and I have no interest in using tweaked Arduino C++ if possible.

Also I'd like to develop on my RaspberryPi. Arduino IDE uses up all my memory on RaspberryPi and freezes when I open boards manager. Good thing there is arduino-cli!

The CLI itself works well, but unfortunately it won't build my simple Arduino sketch on RaspberryPi. I think it must have something to do with 'avr-gcc' not working on ARM. I had similar troubles before, when I tried to flash QMK on my keyboard from RaspberryPi. Still couldn't figure out how to fix it.

Well, I still have PlatformIO to explore, which many people mention as a replacement and improvement on Arduino.

(This post suddenly became very long. I'll leave the rest for tomorrow. See you then!)

Part 2

2022-01-18 | #m5paper #arduino

Agent Parsley

All posts