projects:group_projects:esp2866

Working With the ESP8266 Wifi Module

This page documents the “findings” of a series of MHV workshops started in late 2014 that investigated setups and usage of recently released wifi modules labelled as “esp8266”.

The main contributors to the workshops were Eyal Lebedinsky and David Lyon. You can see the project unfolding on a series of forum posts.

We have included a lot of background info here for those just getting started with these modules. We'll write up individual projects on separate pages.

The first esp8266 modules were released by Espressif (a Chinese manufacturer) in August 2014. They excited interest in the maker community because they were cheap (around $5 each) and apparently had a lot of potential - they are more than just a wifi module - they can be programmed as standalone microcontrollers accessing the wifi functions through firmware and have a dozen or so GPIO (General Purpose Input-Output) pins including an analog input pin (via an inbuilt Analog to Digital Converter - ADC). The chips have around 30K of user addressable program memory (for both the firmware and your programs).

The esp8266 is seen as an affordable and relatively easy way to create “Internet of Things” devices or to interact over a web link with an existing device.

The first modules available (the “ESP-01”) were very small and had only three GPIO pins brought out the module periphery as standard 2.54mm header pins. Nevertheless, they provided a good test bed for using the chip.

The original ESP-01 module. This is still the most common form factor available online.

David Lyon made one of his clixx_io mounting boards for the ESP-01 module. This gives easier access to the pins and provides an alternative mounting system for add-ons (which David also supplies).

We used David's version to get familiar with the process of uploading firmware, issuing basic commands and eventually uploading our own programs to the esp8266.

Since the arrival of the ESP-01, a proliferation of different boards has been released by, mainly, Chinese manufacturers. They are all over ebay and Aliexpress. At last count, we were up to esp-12.

The main variations are:

  • the number and arrangement of pins brought out of the chip (and whether or not the ADC pin is included);
  • the type of wifi antenna included, if any;
  • whether or not the chip itself is shielded to meet FCC requirements (see “Warnings and Gotchas” below)

Because the variety of boards is likely to increase rapidly, we won't cover each one here, only to say that as we have moved to more complex applications, the MHV workshop group has started to play around with the ESP-07 and ESP-12 versions, which have all the pins available.

The “ESP-12” module with pinouts.

The “ESP-07”, which has a ceramic antenna and a plug for an external mini antenna

The esp8266 is very new and its origin and history are largely unknown. The original datasheets were in Chinese and very sparse. There's still a lot we don't know and the company is not always completely upfront when it does answer users' questions. For example, we don't know if:

  • the company pays the licence fees attached to wifi;
  • the stated FCC certification of some of the newer modules is genuine;
  • the standard firmware (see below) will be open-sourced.

These issues probably don't affect hobbyists at the moment but would certainly be cause for pause for anyone thinking about embedding these in a critical or commercial application.

Other things that potential users need to be aware of include:

  • Most of the modules (except the original ESP-01 and the clixx_io board) have 2mm pin spacing rather than the breadboard-friendly 2.54mm. This means that to use them with a standard breadboard you will need to either get an adapter or do some ugly dead-bug soldering of wires directly to the connectors on the module. The MHV group is working on solutions to this annoying issue.
  • The board is rated at 3.3V and is NOT 5V tolerant.
  • The boards all come with the manufacturer's proprietary(?) firmware installed (which is the version that takes the “AT command set” - see below)
  • Interacting with the board (eg. to upload new firmware or programs or to just send commands from another device) requires a standard FTDI (USB to serial) cable or connector.
  • Uploading firmware or programs to a module requires GPI0 to be pulled LOW and the CH_PD pin to be pulled HIGH. These pins must then be released and the module restarted to use it.

Things change quickly in the esp8266 world. Not only do new modules become available regularly but both the official and unofficial firmware and tools are developing rapidly. A new version of something seems to appear weekly. This is exciting but can also be confusing if you are still trying to get your head around basic concepts. There are a few web sites that are worth watching to keep track of important developments. We list a few of them here for easy reference:

To interact with the chip you need firmware installed. The modules come with “factory standard” firmware referred to as the Espressif SDK. This firmware allows you to send commands directly via a terminal program like screen (in linux) or putty (Windows) to the module (via your usb/serial connection).

The Espressif SDK is also suitable for sending commands via a script (eg from an Arduino or RasPi program), again via a serial (Rx/Tx) connection. The commands available are called “the AT command set” and are documented here.

At our MHV Workshops, we played with the SDK for a while, establishing and verifying a wifi link to the MHV server. It is probably a suitable way to use the ESP8266 as an add-on module to another system but does not really take full advantage of the program memory of the chip. If you want to use the ESP8266 as a stand-alone device, as we did, you will probably want to move quickly to another type of firmware - like nodemcu (see next section).

It is all very well to have a firmware file or a program, but you need a way to write these to the chip from your computer.

This involves compiling, linking and then sending the binary packages to the module via your usb/serial device (ie an FDTI cable of some kind). It also involves having some “helper programs” properly configured so that the right files are written to the right memory locations on the device you are using.

Fortunately, a complete toolchain is available for the Espressif SDK and it is relatively easy to install.

Warnings and Gotchas

It is likely that any module bought from ebay, Aliexpress etc. will have a non-current version of the SDK installed. The latest version is available from the Espressif github repo at the Espressif github repo.

The current alternative to the Espressif SDK is a package called nodemcu. This is firmware that allows you to use the Lua scripting language to interact with the ESP8266 via line-by-line commands or a Lua program that you upload to the device as init.lua. Lua is a lot like Python and the nodemcu version has support for many protocols like i2c, 1-wire, spi and uart which gives it a lot of power when it comes to connecting sensors etc. directly to the esp8266. It is also pretty straightforward to serve up data and controls via a simple web page with Lua.

The nodemcu firmware is open-source and available from the nodemcu github repo

Flashing the nodemcu Firmware

There are some good guides for the tools you need already posted online.

For Windows - see this guide: Flashing the NodeMCU firmware on the ESP8266 (Windows)

For Linux - see this one: Flashing the NodeMCU firmware on the ESP8266 (Linux)

  • projects/group_projects/esp2866.txt
  • Last modified: 2015/01/27 23:50
  • (external edit)