Chris Dzombak

Initial Impressions of ESP8266 + Arduino

I’ve spent some time over the last few weeks toying with Arduino development on the ESP8266 platform, using PlatformIO and Wemos D1 Mini boards. The result is this GitHub repository with some simple Arduino + ESP8266 demos; and in this blog post I’ll outline my first impressions/thoughts and some tips, in no particular order.

These boards are cool. For a few dollars, you get a well-supported WiFi-enabled microcontroller dev board, with 4 MB of flash memory, that can run at 160 MHz. This is mind-blowing. I’m definitely a fan, and I highly recommend picking one up.

ESP8266 wasn’t quite designed to be a general-purpose microcontroller, IMO. It feels like it was initially designed to be used as a WiFi module, controlled via AT commands over a serial interface. Some places this awkwardness comes up:

Reiterating some advice from my ISR crash debugging post (click through for more details):

Not all Internet troubleshooting suggestions are accurate. Forum threads will often provide all sorts of answers, some of which seem too easy to be true. Think critically and thoroughly validate your solution before moving on.

Be careful what libraries you let into your codebase. I’ve run into several popular open-source Arduino libraries with code I considered unacceptably low-quality, and in this resource-constrained environment, code quality is critical.

Avoid floating-point operations whevever possible. This is especially true in interrupt service routines — you cannot perform floating-point math in an ISR, or you risk a crash.

Some other, general advice:

PlatformIO sometimes rewrites your platformio.ini file, losing any comments. Keep this in mind; either don’t keep comments in this file, or carefully use source control to preserve important comments.

Add this to platformio.ini to get debugging output on the serial console from various parts of the ESP8266 Arduino core:

build_flags =

It’s useful to get debug builds working, alongside exception decoding. PlatformIO makes this reasonably straightforward, and I cover it in a separate blog post.