Introduction

ESP8266 on PCB

The ESP8266 MCU chip is a self-contained processor and WiFi controller. The chip runs on 3.3V and is available on a variety of PCB breakout boards with some or all pins exposed. It provides either 1MB or 4MB of memory (large with respect to an Arduino) and its built-in network capability means it is ideal for remote sensing applications and sketches can be uploaded wirelessly. You can also program the ESP8266 using the Arduino IDE with additional ESP8266 libraries.

The ESP8266 can communicate with peripheral devices using I2C and SPI and of course with other MCUs using TCP/IP. If none of these are suitable, then you can always use serial communications. The maximum current draw on the digital output pins is 12mA, though the sum for the whole chip isn't clear. There is one 10-bit ADC input that accepts 0-1V. This may prove inconvenient for some analogue sensors and so a 1, 2, 4 or 8-way ADC from Microchip can be used instead. They all use 2.4GHz WiFi only.

My need for the ESP8266

Image of pressure gauge

My own requirement was a remote sensor for water pressure. I was planning to use a UNO as a web server with an Ethernet 2 shield. However, its limited memory meant that I was unable to generate SVG images because of the large amount of boilerplate required. The intention was always to create a single HTML file so off-loading styling to an external CSS file wasn't really an option either. I contemplated using the Ethernet 2's on-board SD card slot for storing part of the boilerplate but this proved inconvenient and the overall cost for genuine Arduino boards and the SD card was too high. I also considered a Raspberry Pi, but that seemed overkill for a trivial application and would have to be a Pi 3 or had a USB WiFi adapter. Enter the ESP8266 - my version is from Makerhawk on Amazon.

Lots of variety

Image of board with chip outlined

There are different ESP8266 breakout boards and modules; some have different amounts of memory, some have been FCC approved, some have fewer pins exposed, etc. If you are cost-conscious then there's one that will suit your needs. Board makers seem to use the same ESP8266 chip on its own small PCB, outlined in red here. It comes complete with track aerial and is soldered to their own breakout board with as many or as few pins exposed as required, their preference for CH340 or CP2102 USB-to-UART controller, etc.

Many choices of board are available at, and in no particular order: CPC, RS Components, Pimoroni, Adafruit, Amazon, Ebay, Sparkfun, etc., - just use the website for your country. Be aware that some small boards require an additional board for prototyping and programming purposes. Once programmed, these boards can normally run without the prototyping board. Also, note that a few boards do not have any USB or other power supply, so you'll have to have to make and connect up your own. Remember that the ESP8266 is 3.3V and cannot be connected to USB directly without a 3.3V regulator. Several breakout boards are not breadboard friendly and you'll need to straddle the breakout board across two breadboards with a power rail down the centre.

Confused about the ESP8266 and which board to use? This webpage aims to clear that up and provides an explanation about the boards available and their advantages and disadvantages. But first, some explanation of the ESP8266 terminology you may already have seen:

  • ESP8266 is the CPU chip model number
  • NodeMCU (Node microcontroller unit) is an open source platform for IoT applications. It includes the firmware that runs on the ESP8266 Wi-Fi enabled processor.
  • Lua is a lightweight scripting language that's designed for embedded systems. You don't need to know how to write Lua
  • ESP-12 moduleESP8266 chip with 1MB flash
  • SoC means system on a chip
  • ESP-12 is an ESP8266 chip with 128kB of RAM and 1MB of flash memory and has FCC approval
  • ESP-12E is an ESP8266 chip with 128kB of RAM and 4MB of flash memory and has no FCC approval
  • ESP-12F is an ESP8266 chip with 128kB of RAM and 4MB of flash memory and has FCC approval
  • CH340, CH340G and CP2102 are different types of USB-to-serial controller chips
  • SPIFFS is a filesystem that stores files directly in flash memory instead of having an external SD card

This is an ESP8266 on a PCB that is the same shape as an Arduino Uuo. Superficially, it looks useful but it only resembles an Arduino and is not compatible with it because:

  • GPIO uses 3.3V wheras the Arduino uses 5V and there is no protection against 5V inputs
  • not all ESP8266 GPIOs are exposed and some use multiple pins, for example, D5 and D13 share a common GPIO pin and so cannot be driven independently
  • it's expensive
  • standard shields will not work due to pin incompatibility

There's more information about NodeMCU on Wikipedia.