The ESP8266 -- an introduction

The ESP8266 is a remarkable little chip, made in China and available in abundance for extremely low prices. It is the heart of many IoT (internet of things) projects because it offers WiFi connectivity. However, I find it to be an entirely useful and economical controller all on its own if you want to just turn off the Wifi section.

Many people think of it as a Wifi "add-on" for other projects, which I think is a big mistake. It can certainly be that, but is absolutely useful as a self contained microcontroller with or without Wifi.

I used to have an extensive set of notes on working with the ESP8266, but they were lost when the machine holding my website had a disk crash. I hope to redo them someday in a better form if I ever stop playing with ARM processors and go back to finish up some of my ESP8266 projects.

What to buy

My strong recommendation is to purchase some "NodeMCU" modules on AliExpress. These sell for about $3.50 (which includes shipping). You get a nice little board with the ESP8266 module, a USB to serial chip, and a built in 3.3 volt power supply so you can run the whole thing from the USB cable (which also serves as a serial console).

If you start wanting to run things from a battery, you will want to ditch the USB to serial chip and LED's and just run a bare module. You will need to give it 3.3 volts somehow, and you will need an independent USB to serial converter for debuggin and to load software. Go buy some ESP-12E modules on AliExpress. They typically sell for about $1.70.

You will wait for 2-3 weeks when ordering via AliExpress direct from China. I order in batches of 10 and am delighted that I can get 10 of these things for less than a miserable AVR controller board.

Software development options

You can apparently use something called "Arduino" to develop code for the ESP8266, but this involves you in some horrid half baked IDE, along with some mongrel dialect of C++ they call "Sketches". I found nothing to interest me here and moved on.

I played around for a while with Lua and NodeMCU, but quickly discovered that the NodeMCU developers had used up almost all of memory for NodeMCU, leaving nothing for the end user. I was unable even to load and run simple demos without running out of memory, and beside that the resulting error messages were cryptic. I gave up in disgust an have never looked back.

Developming code in C using the SDK is remarkably pleasant and entirely appropriate for a device like this. I have worked up a number of projects, which you will find on my Github page. You can also find my Lua projects there as well, but you need to recognize that this is a dead end road.

Disassembling the bootrom

The ESP8266 has a bootrom in immutable mask rom in the chip. This is easy enough to read out and I spent some time disassembling it and annotating the resulting disassembly

The ESP32

A "big brother" (the ESP32) was announced in 2016, but has been in short supply and is significantly more expensive than the ESP8266. I have mostly lost interest in it, but I have some information here for those that are interested.