Saturday, June 13, 2015

ESP8266 Basics and Direction

The ESP8266 has become the price/performance darling of the Maker community.  What is not to like: small size, connectivity, powerful microcontroller.
ESP8266 Modules - the ESP-01 on the left, the ESP-12 module on the right

Well, there are frustrations.  Wiring the modules is not so easy, as pinouts are not breadboard friendly.  The microcontroller is new and not well documented in English, with some information proprietary, yes not Open Source (but processors generally are not fully open).

So what is driving the interest: size and cost.  The ESP-01 module is 14.54 mm x 24.9 mm(about an inch by a bit over half an inch - tiny compared to modules that proceeded it (which did not include a microcontroller).  And the cost of the ESP-01?  $6.95 from Adafruit (flashed with a reliable firmware and tested) down to $2.88 or so on eBay from China.  Compare to a $25 Arduino Uno and a $35 CC3000 wifi module.  A tenth the cost or less and perhaps a tenth the size.

The basic ESP-01 version has limited input/output pins.  Other models,up to the ESP-13 have additional pins of the microcontroller available.  A list of various versions is at www.esp8266.com.

So if you see the connections on the modules above, The ESP-01 has two rows of 4 pins, making it hard to breadboard.  The ESP-12 module has metric pin spacing which does not connect to 0.1 inch breadboard spacing.  What to do?  Various people have various solutions.  On the ESP-12, companies have mounted them to larger 0.1" boards.  From plain carriers on eBay to Adafruit's new Huzzah board.

Power

The following data are based on a 3.3V power supply, ambient temperature 25C and use the internal regulator measured. Data is from https://nurdspace.nl/ESP8266
ModeMinTypicalMaxUnits
802.11b, CCK 1Mbps, POUT=+19.5dBm215mA
802.11b, CCK 11Mbps, POUT=+18.5dBm197mA
802.11g, OFDM 54Mbps, POUT=+16dBm145mA
802.11n, MCS7, POUT =+14dBm135mA
802.11b, packet size of 1024 bytes, -80dBm60mA
802.11b, packet size of 1024 bytes, -70dBm60mA
802.11b, packet size of 1024 bytes, -65dBm62mA
Standby0.9uA
Deep sleep10mA
Saving mode DTIM 11.2mA
Saving mode DTIM 30.86mA
Shutdown0.5uA
The units should never be powered off more than 3.3 volts DC.  Using a voltage other than 3.3 volts, you will need to use a power regulator.  Looking at the power requirements above, a 250 ma regulator like the L4931-3.3 is pushing the limit.  If you are breadboarding, most people appear to be using the LD1117.3.3 800 ma linear regulator which gives plenty of current without requiring a heat sink on the regulator.  It is best to use a 10 microfarad capacitor on the input and especially the output to keep the output smooth.  If you are breadboarding only, there are breadboard power supplies that make it easier to generate 3.3 or 5 volts when you want it.

Firmware

There are currently two general variations on firmware.  The first implements an "AT" command set to instruct the module how to connect via wifi.  A second firmware has been developed by NodeMCU implementing the Lua scripting language.  There are some other firmware images including one implementing the MQTT protocol.

User Software

Some smart folks have added the Espressif code compiler to the Arduino IDE.  This allows for the average person to write code that runs on the ESP8266 board itself (no Arduino or other controller required).  This makes it exciting that in a one inch size board, you have a complete Internet of Things node.

Where to go from here

While Lua allows for web apps with a small amount of code, I believe there is a great deal one can do to interface hardware with the ESP modules and compile code directly.  As a person who has done Arduino code for 2+ years (and a C die hard), that's where I'll be looking to provide projects.

For my first published project, See an ESP-01 connected to a temperature and humidity sensor, available via any web browser - at https://learn.adafruit.com/esp8266-temperature-slash-humidity-webserver/overview.

No comments:

Post a Comment