ESP8266 Thing Developpment Board w/ Headers Introduction

1/23/2018 ESP8266 Thing Development Board Hookup Guide - learn.sparkfun.com
https://learn.sparkfun.com/tutorials/esp8266-thing-development-board-hookup-guide/all 24/24
COPY CODE
A lot of the core Arduino libraries have been re-written to work for the ESP8266, including:
Wire – The ESP8266 should work with any I C sensor you can throw at it – just use the same Wire API calls you’re used to.
There are a few differences:
Pin definition: The ESP2866 doesn’t actually have any hardware I C pins – those labeled on the Thing are the default,
but you can actually use any two pins as SDA and SCL. Calling Wire.begin() will assume pins 2 and 14 are SDA
and SCL, but you can manually set them to any other pin by calling Wire.begin([SDA], [SCL]) .
SPI – The ESP8266 Thing can control an SPI bus using function calls made standard by the Arduino SPI library.
An additional function to set the frequency – SPI.setFrequency([frequency]) – is added. You may need to call that in
your setup to slow the clock down from its default value. For example, SPI.setFrequency(1000000) will set the SPI
clock to 1MHz.
The MISO, MOSI, and SCLK SPI pins are hard-coded and can’t be moved, they are:
Pin Number SPI Function
12 MISO
13 MOSI
14 (SCL) SCLK
15 CS
Deep Sleep
The ESP8266 has a pretty decent low-power sleep mode – operating around 70µA. To put the ESP8266 to sleep, use
the ESP.deepSleep(<microseconds>) function.
ESP.deepSleep(30000000); // Sleep 30 seconds
For it to wake itself back up, the ESP8266 requires an external connection between pin 16 and its RST pin. Use the handy “Sleep-
EN” jumper to set this connection up.
Resources and Going Further
An astoundingly awesome community has grown around the ESP8266. We owe them big time for the amazing Arduino addon
they’ve cooperatively built. For all of your ESP8266 needs, we recommend checking out the esp8266.com Community Forum. In
addition to that, here are a few ESP8266-related resources we’ve found incredibly helpful:
ESP8266 GitHub User Repos – Tons of incredible tools can be found here. From Crosstool (to compile your own Xtensa
GCC, G++, etc.) to the ESP8266 Arduino GitHub Repo
ESP8266 Community Wiki – Related to the community forum, there’s a good amount of information available in this wiki.
NodeMCU Firmware and the NodeMCU Flasher – NodeMCU is a popular firmware for the ESP8266. It implements a LUA-
based interpreter on the ESP8266 MCU.
Espressif Board Forums – Espressif, the manufacturers of the ESP8266, have a forum of their own. You can sometimes find
updated software development kit downloads, or other helpful links here.
Espressif GitHub Repos – Espressif is also somewhat active on GitHub. They host a couple versions of the SDK here.
The ESP8266 Thing is open source hardware! If you need, or just want to look at, the PCB design files, you can find them in
our ESP8266 Thing Development Board GitHub repository.
2
2