# Adafruit HUZZAH ESP8266 breakout

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/024/792/medium800/adafruit_products_2471_iso_assembled_01_ORIG.jpg?1429908417)

Add Internet to your next project with an adorable, bite-sized WiFi microcontroller, at a price you like! The ESP8266 processor from Espressif is an 80 MHz microcontroller with a full WiFi front-end (both as client and access point) and TCP/IP stack with DNS support as well. While this chip has been very popular, it's also been very difficult to use. Most of the low cost modules are not breadboard friendly, don't have an onboard 500mA 3.3V regulator or level shifting, and aren't CE or FCC emitter certified.... **UNTIL NOW!**

![](https://cdn-learn.adafruit.com/assets/assets/000/024/794/medium800/adafruit_products_2471_top_180rotated_ORIG.jpg?1429909187)

The HUZZAH ESP8266 breakout is what we designed to make working with this chip super easy and a lot of fun. We took a certified module with an onboard antenna, and plenty of pins, and soldered it onto our designed breakout PCBs. We added in:

- Reset button
- User button that can also put the chip into bootloading mode,
- Red LED you can blink
- Level shifting on the UART and reset pin
- 3.3V out, 500mA regulator (you'll want to assume the ESP8266 can draw up to 250mA so budget accordingly)
- Two diode-protected power inputs (one for a USB cable, another for a battery)

The module itself is FCC certified and contains the ESP8266 chip with&nbsp;64 KiB of instruction RAM, 96 KiB of data RAM, and 4 MB of QIO FLASH (32 Megabits)

![](https://cdn-learn.adafruit.com/assets/assets/000/024/795/medium800/adafruit_products_2471_iso_breadboard_demo_ORIG.jpg?1429909446)

Two parallel, breadboard-friendly breakouts on either side give you access to:

- 1 x Analog input (1.0V max)
- 9 x GPIO (3.3V logic), which can also be used for I2C or SPI
- 2 x UART pins
- 2 x 3-6V power inputs, reset, enable, LDO-disable, 3.3V output

One breakout at the end has an "FTDI" pinout so you can plug in an FTDI or console cable to upload software and read/write debugging information via the UART. When you're done with your coding, remove the cable, and this little module can be embeded into your project box.

![](https://cdn-learn.adafruit.com/assets/assets/000/024/793/medium800/adafruit_products_2471_demo_ORIG.jpg?1429908458)

[We recommend using the Arduino IDE. Once you download the ESP8266 core, you can treat it just like a microcontroller+WiFi board, no other processors needed](../../../../adafruit-huzzah-esp8266-breakout/using-arduino-ide)!

![](https://cdn-learn.adafruit.com/assets/assets/000/024/796/medium800/adafruit_products_2471_kit_ORIG.jpg?1429910218)

Each order comes with one assembled and tested HUZZAH ESP8266 breakout board, and a stick of 0.1" header that you can solder on and plug the breakout into a breadboard. A soldering iron and solder is required for that, and aren't included. **You'll also need a USB-serial cable** such as a [USB console cable (Windows only)](https://www.adafruit.com/product/954),&nbsp; [FTDI Friend (any OS)](https://www.adafruit.com/products/284), or&nbsp;[FTDI cable (any OS)](https://www.adafruit.com/products/70)to upload software to the HUZZAH ESP8266!

_[Don't forget to visit esp8266.com for the latest and greatest in ESP8266 news, software and gossip!](http://www.esp8266.com/)_

# Adafruit HUZZAH ESP8266 breakout

## Pinouts

Warning: 

![](https://cdn-learn.adafruit.com/assets/assets/000/024/724/medium800/adafruit_products_2471_top_180rotated_ORIG.jpg?1429823189)

This ESP8266 breakout has a ton of pins available, compared to the mini ESP-01 module. When programming the breakout in Lua or via the Arduino IDE, you can control these I/O pins to light up LEDs, read buttons, talk to sensors etc. There's also a bunch of pins for power and control.

![](https://cdn-learn.adafruit.com/assets/assets/000/024/741/medium800/adafruit_products_powerpins.jpg?1429900668)

# Power Pins

The ESP8266 requires 3.3V power voltage and peaks at 500mA or so of current for small periods of time. You'll want to assume the ESP8266 can draw up to 250mA so budget accordingly. To make it easier to power, we put a high-current-capable 3.3V voltage regulator on the board. It can take 3.4-6V in but you should stick to 4-6V since the ESP8266 has high current usage when WiFi is on.

There are two inputs for the regulator, **V+** and **VBat**. Both have Schottky diodes so you can connect both at different voltages and the regulator will simply power from the higher voltage. The **V+** pin is also on the FTDI/serial header at the bottom edge.

We recommend connecting your LiPoly or AA battery pack directly to **VBat** and then keeping **V+** unused for when an FTDI cable is attached. You can also use the extra **V+** pin for getting the 5V USB power from the FTDI connector for servos, NeoPixels, etc!

There's also a 3.3V output from the regulator available on the **3V** pin

![](https://cdn-learn.adafruit.com/assets/assets/000/024/742/medium800/adafruit_products_uart.jpg?1429900683)

# Serial pins

**RX** and **TX** are the serial control and bootloading pins, and are how you will spend most of your time communicating with the ESP module.

The **TX** pin is the output _from_ the module and is 3.3V logic.

The **RX** pin is the input _into_ the module and is 5V compliant (there is a level shifter on this pin)

The pins are available in two places, one set is on the right side breakout. The same pins are also at the bottom on the "FTDI/Serial" breakout

![](https://cdn-learn.adafruit.com/assets/assets/000/024/743/medium800/adafruit_products_gpio.jpg?1429900690)

# GPIO pins

This breakout has 9 GPIO: **#0, #2, #4, #5, #12, #13, #14, #15, #16** all GPIO are 3.3V logic level in and out, and are **not 5V compatible. &nbsp;** Read the [full spec sheet](http://www.adafruit.com/datasheets/ESP8266_Specifications_English.pdf)&nbsp;to learn more about the GPIO pin limits, but be aware the maximum current drawn per pin is **12mA**.

These pins are general purpose and can be used for any sort of input or output. Most also have the ability to turn on an internal pullup. Many have _special_ functionality:

**GPIO #0,** which does not have an internal pullup, and is also connected to both a mini tactile switch and red LED. This pin is used by the ESP8266 to determine when to boot into the bootloader. If the pin is held low during power-up it will start bootloading! That said, you can always use it as an output, and blink the red LED.

**GPIO #2** , is also used to detect boot-mode. It also is connected to the blue LED that is near the WiFi antenna. It has a pullup resistor connected to it, and you can use it as any output (like #0) and blink the blue LED.

**GPIO #15** , is also used to detect boot-mode. It has a pulldown resistor connected to it, make sure this pin isn't pulled high on startup. You can always just use it as an output

**GPIO #16** can be used to wake up out of deep-sleep mode, you'll need to connect it to the RESET pin

**GPIO**  **#4** and **#5** are used for I2C SDA and SCL (respectively) by default on Arduino IDE. We recommend that if you are using Arduino, connect your I2C devices there!  
Rev A of this board had GPIO #4 and #5 swapped (the modules changed pinouts on us) so if #4/#5 aren't working for you, try swapping!

![](https://cdn-learn.adafruit.com/assets/assets/000/024/744/medium800/adafruit_products_analog.jpg?1429900699)

# Analog Pins

There is also a single analog input pin called **A**. This pin has a ~1.0V maximum voltage, so if you have an analog voltage you want to read that is higher, it will have to be divided down to 0 - 1.0V range

# Other control pins

We have a few other pins for controlling the ESP8266

- **LDO** - this is the enable pin for the regulator. By default it's pulled high, when connected to ground it will turn off the 3.3V regulator and is an easy way to cut power off to the whole setup. There is a 10K pullup is to whatever has a higher voltage, **V+** or **VBat**. (See the schematic if you're unclear)
- **RST** - this is the reset pin for the ESP8266, pulled high by default. When pulled down to ground momentarily it will reset the ESP8266 system. This pin is 5V compliant.
- **EN (CH\_PD)** - This is the enable pin for the ESP8266, pulled high by default. When pulled down to ground momentarily it will reset the ESP8266 system. This pin is 3.3V logic only

# Adafruit HUZZAH ESP8266 breakout

## Assembly

![](https://cdn-learn.adafruit.com/assets/assets/000/024/761/medium800/adafruit_products_2471_kit_SIZED.jpg?1429901755)

## Prepare the header strip:

Cut two strips to length if necessary. It will be easier to solder if you insert it into a breadboard - **long pins down**

![adafruit_products_header.jpg](https://cdn-learn.adafruit.com/assets/assets/000/024/746/medium640/adafruit_products_header.jpg?1429901413)

## Add the breakout board:

Place the breakout board over the pins so that the short pins poke through the breakout pads

![adafruit_products_place.jpg](https://cdn-learn.adafruit.com/assets/assets/000/024/747/medium640/adafruit_products_place.jpg?1429901506)

## And Solder!

Be sure to solder all pins for reliable electrical contact.  
  
Solder one side of the board at first  
  
_(For tips on soldering, be sure to check out our_ [_Guide to Excellent Soldering_](http://learn.adafruit.com/adafruit-guide-excellent-soldering)_)._

![adafruit_products_solder1.jpg](https://cdn-learn.adafruit.com/assets/assets/000/024/748/medium640/adafruit_products_solder1.jpg?1429901523)

![adafruit_products_solder2.jpg](https://cdn-learn.adafruit.com/assets/assets/000/024/749/medium640/adafruit_products_solder2.jpg?1429901536)

![adafruit_products_solder3.jpg](https://cdn-learn.adafruit.com/assets/assets/000/024/750/medium640/adafruit_products_solder3.jpg?1429901542)

![adafruit_products_solder4.jpg](https://cdn-learn.adafruit.com/assets/assets/000/024/751/medium640/adafruit_products_solder4.jpg?1429901554)

Flip the breadboard around to solder the other strip

![adafruit_products_solder5.jpg](https://cdn-learn.adafruit.com/assets/assets/000/024/752/medium640/adafruit_products_solder5.jpg?1429901579)

![adafruit_products_solder6.jpg](https://cdn-learn.adafruit.com/assets/assets/000/024/753/medium640/adafruit_products_solder6.jpg?1429901583)

![adafruit_products_solder7.jpg](https://cdn-learn.adafruit.com/assets/assets/000/024/754/medium640/adafruit_products_solder7.jpg?1429901589)

You're done! Check your solder joints visually and continue onto the next steps

![adafruit_products_done.jpg](https://cdn-learn.adafruit.com/assets/assets/000/024/755/medium640/adafruit_products_done.jpg?1429901599)

If you're planning on programming with an FTDI or console cable, it's handy to have 6 pins soldered on the end for plugging in.

&nbsp;

Cut another 6-pin strip to length if necessary. Insert it into a breadboard - **long pins down**

![adafruit_products_header2.jpg](https://cdn-learn.adafruit.com/assets/assets/000/024/756/medium640/adafruit_products_header2.jpg?1429901620)

Place the breakout on the breadboard facing down

![adafruit_products_place2.jpg](https://cdn-learn.adafruit.com/assets/assets/000/024/757/medium640/adafruit_products_place2.jpg?1429901674)

Solder all 6 pins!

![adafruit_products_solder8.jpg](https://cdn-learn.adafruit.com/assets/assets/000/024/758/medium640/adafruit_products_solder8.jpg?1429901691)

![adafruit_products_solder9.jpg](https://cdn-learn.adafruit.com/assets/assets/000/024/759/medium640/adafruit_products_solder9.jpg?1429901698)

You're done! Check your solder joints visually and continue onto the next steps

![adafruit_products_done2.jpg](https://cdn-learn.adafruit.com/assets/assets/000/024/760/medium640/adafruit_products_done2.jpg?1429901709)

# Adafruit HUZZAH ESP8266 breakout

## Using NodeMCU Lua

Warning: 

Lua is still a work in progress, so we strongly recommend visiting NodeMCU and [updating your Lua version to the very latest as they have the ability to make you the latest continuous build](https://nodemcu-build.com/index.php). Then [follow their guide on how to update Lua!](http://nodemcu.readthedocs.io/en/latest/en/flash/)

The Lua interpreter runs on the ESP8266 and you can type in commands and read out the results over serial. A serial console cable is perfect for this!&nbsp;[Use either an FTDI cable](https://www.adafruit.com/product/70) or [any console cable](https://www.adafruit.com/products/954), you can use either 3V or 5V logic and power as there is level shifting on the RX pin.

_[Don't forget to visit esp8266.com for the latest and greatest in ESP8266 news, software and gossip!](http://www.esp8266.com/)_

Info: 

# Connect USB-Serial cable

Connect either your console cable or FTDI cable. If using FTDI, make sure the black wire goes to the GND (ground) pin

![](https://cdn-learn.adafruit.com/assets/assets/000/024/766/medium800/adafruit_products_ftdiconnect.jpg?1429903736)

If using a console cable, connect the black wire to ground, red wire to **V+** , white wire to **TX** and green wire to **RX**

![](https://cdn-learn.adafruit.com/assets/assets/000/024/764/medium800/adafruit_products_console.jpg?1429903717)

You will see the red and blue onboard LED flicker when powered up, but they will not stay lit.

# Open up serial console

Next up, on your computer, use a serial console program such as **CoolTerm** (Mac) or **Putty** (Windows) or **screen** (linux). Teraterm seems to dislike the initial 115.2kbps data stream from the ESP8266 so you can try it but you'll possibly need to reset the terminal software.

Connect up to the COM or Serial port used by your cable, at 9600 Baud

Make sure you have turned off any hardware handshake or flow control

Also make sure you have **line endings** set to CRLF "\r\n" You may also want to turn on inter-character delay if you are pasting in large chunks of code. Each terminal software is different in setting it up, check the manual for the software you're using!

&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/024/767/medium800/adafruit_products_putty.png?1429903854)

![](https://cdn-learn.adafruit.com/assets/assets/000/024/768/medium800/adafruit_products_tera.png?1429903896)

Once the terminal software is connected, click the **Reset** button on the HUZZAH ESP board to reset it and have it print out the welcome message:

![](https://cdn-learn.adafruit.com/assets/assets/000/024/770/medium800/adafruit_products_lualaunch.png?1429903965)

If you don't get this message, first check that the red/blue leds flickered when you press the reset button. If they didnt, make sure the board is powered via **V+** or **Vbat**. If they do flicker, make sure you've got the right baud rate selected in the software (9600) and the RX/TX/GND pins connected right

# Hello world!

Ok we can now turn on an LED. There is a red LED on each board, connected to **GPIO #0**

Warning: 

Info: 

So to set the pin #0 LED on and off first make it an output by typing (not copy & paste)

```
gpio.mode(3, gpio.OUTPUT)
```

Turn the LED on by typing (not copy & paste)

```
gpio.write(3, gpio.LOW)
```

And off by typing (not copy & paste)

```
gpio.write(3, gpio.HIGH)
```

You can make this a little more automated by running a longer script.

For longer text, pasting can be difficult as the lua interpreter needs a little delay time between characters and also require CR-LF settings. For that reason you may want to paste each line and then hit return manually.

```
gpio.mode(3, gpio.OUTPUT)
while 1 do
  gpio.write(3, gpio.HIGH)
  tmr.delay(1000000)   -- wait 1,000,000 us = 1 second
  gpio.write(3, gpio.LOW)
  tmr.delay(1000000)   -- wait 1,000,000 us = 1 second
end
```

![](https://cdn-learn.adafruit.com/assets/assets/000/024/775/medium800/adafruit_products_loopblink.png?1429904800)

The LED will now be blinking on and off.

Note that since it's in a loop, it's not possible to get it to stop via the interpreter. To stop it, click the **Reset** button again!

This code halts the processor during the tmr.delay, a smarter way to blink an LED is to use the timer capability to set off the LED control ([code from here](https://roboindia.com/tutorials/esp8266-led-blinking-lua))

```
-- Pin definition 
local pin = 3
local status = gpio.LOW
local duration = 1000    -- 1 second duration for timer

-- Initialising pin
gpio.mode(pin, gpio.OUTPUT)
gpio.write(pin, status)

-- Create an interval
tmr.alarm(0, duration, 1, function ()
    if status == gpio.LOW then
        status = gpio.HIGH
    else
        status = gpio.LOW
    end

    gpio.write(pin, status)
end)
```

# Scanning & Connecting to WiFi

We'll continue with a quick demo of scanning for WiFi and connecting.

Once you're back at the Lua prompt, set the ESP8266 into WiFi Client mode with

```
wifi.setmode(wifi.STATION)
```

Then you can run the scanner and have it print out the available AP's

```
-- print ap list
function listap(t)
      for k,v in pairs(t) do
        print(k.." : "..v)
      end
end
wifi.sta.getap(listap)
```

or for more detail...

```
-- print ap list
function listap(t)
      for ssid,v in pairs(t) do
        authmode, rssi, bssid, channel = 
          string.match(v, "(%d),(-?%d+),(%x%x:%x%x:%x%x:%x%x:%x%x:%x%x),(%d+)")
        print(ssid,authmode,rssi,bssid,channel)
      end
end
      
wifi.sta.getap(listap)
```

![](https://cdn-learn.adafruit.com/assets/assets/000/024/778/medium800/adafruit_products_loopblink.png?1429905120)

We can connect to the access point with **wifi.sta.config** and **wifi.sta.connect** - it will take a second or two to complete the connection, you can query the module to ask the status with **wifi.sta.status()** - when you get a 5 it means the connection is completed and DHCP successful

```
      wifi.sta.config("accesspointname","yourpassword")
wifi.sta.connect()
tmr.delay(1000000)   -- wait 1,000,000 us = 1 second
print(wifi.sta.status())
print(wifi.sta.getip())
    
```

![](https://cdn-learn.adafruit.com/assets/assets/000/024/780/medium800/adafruit_products_connect.png?1429905711)

# WebClient example

Once you've got the IP address you can connect to adafruit, for example, and read a webpage and print it out:

```
sk=net.createConnection(net.TCP, 0)
sk:on("receive", function(sck, c) print(c) end )
sk:connect(80,"104.236.193.178")
sk:send("GET /testwifi/index.html HTTP/1.1\r\nHost: wifitest.adafruit.com\r\nConnection: keep-alive\r\nAccept: */*\r\n\r\n")
```

![](https://cdn-learn.adafruit.com/assets/assets/000/024/781/medium800/adafruit_products_byip.png?1429906228)

You can also have the module do DNS for you, just give it the hostname instead of IP address:

```
sk=net.createConnection(net.TCP, 0)
sk:on("receive", function(sck, c) print(c) end )
sk:connect(80,"wifitest.adafruit.com")
sk:send("GET /testwifi/index.html HTTP/1.1\r\nHost: wifitest.adafruit.com\r\nConnection: keep-alive\r\nAccept: */*\r\n\r\n")
```

![](https://cdn-learn.adafruit.com/assets/assets/000/024/782/medium800/adafruit_products_dns.png?1429906276)

This is just a light overview of testing out your HUZZAH ESP breakout! For much more, check out NodeMCU's documentation page [https://nodemcu.readthedocs.io/](https://nodemcu.readthedocs.io/) for the details on what functions are available to you, as well as&nbsp; [http://www.lua.org](http://www.lua.org) to learn more about the Lua scripting language

# Adafruit HUZZAH ESP8266 breakout

## Using Arduino IDE

While the HUZZAH ESP8266 breakout comes pre-programmed with NodeMCU's Lua interpretter, you don't have to use it! Instead, you can use the Arduino IDE which may be more familar. **This will write directly to the firmware, erasing the NodeMCU firmware** , [so if you want to go back to Lua, use the flasher to re-install it](https://github.com/nodemcu/nodemcu-flasher)

In order to upload code to the ESP8266 and use the serial console, you will need a USB to serial converter!&nbsp;[Use either an FTDI cable](https://www.adafruit.com/product/70) or [any console cable](https://www.adafruit.com/products/954), you can use either 3V or 5V logic and power as there is level shifting on the RX pin.

_[Don't forget to visit esp8266.com for the latest and greatest in ESP8266 news, software and gossip!](http://www.esp8266.com/)_

Info: 

# Connect USB-Serial cable

Connect either your console cable or FTDI cable. If using FTDI, make sure the black wire goes to the GND (ground) pin

![](https://cdn-learn.adafruit.com/assets/assets/000/024/783/medium800/adafruit_products_ftdiconnect.jpg?1429906754)

If using a console cable, connect the black wire to ground, red wire to **V+** , white wire to **TX** and green wire to **RX**

![](https://cdn-learn.adafruit.com/assets/assets/000/024/784/medium800/adafruit_products_console.jpg?1429906770)

You will see the red and blue onboard LED flicker when powered up, but they will not stay lit.

# Install the Arduino IDE 1.6.4 or greater

[Download Arduino IDE from Arduino.cc (1.6.4 or greater) - don't use 1.6.2! You can use your existing IDE if you have already installed it](http://www.arduino.cc/en/Main/Software)

[You can also try downloading the ready-to-go package from the ESP8266-Arduino project](https://github.com/esp8266/Arduino), if the proxy is giving you problems

## Install the ESP8266 Board Package

Enter ` http://arduino.esp8266.com/stable/package_esp8266com_index.json` into _Additional Board Manager URLs_ field in the Arduino v1.6.4+ preferences.

![](https://cdn-learn.adafruit.com/assets/assets/000/026/652/medium800/adafruit_products_Screen_Shot_2015-07-23_at_12.15.52_PM.png?1437668186)

[Visit our guide for how to add **&nbsp;new boards to the Arduino 1.6.4+ IDE** for more info about adding&nbsp;third party boards](../../../../add-boards-arduino-v164).

&nbsp;Next, use the **Board manager** to install&nbsp;the ESP8266 package.

![](https://cdn-learn.adafruit.com/assets/assets/000/026/654/medium800/adafruit_products_Screen_Shot_2015-07-23_at_12.20.12_PM.png?1437668436)

# Setup ESP8266 Support

When you've restarted, select **Adafruit Feather HUZZAH ESP8266&nbsp;** from the Tools-\>Board dropdown. Note that even though this is a Huzzah breakout, its the same 'definition' file as the Feather so just use that!

![](https://cdn-learn.adafruit.com/assets/assets/000/053/348/medium800/adafruit_products_featherhuzzah.png?1524842458)

 **80 MHz** as the CPU frequency (you can try 160 MHz overclock later)

![](https://cdn-learn.adafruit.com/assets/assets/000/053/349/medium800/adafruit_products_freq.png?1524842508)

 **115200 baud upload** speed is a good place to start - later on you can try higher speeds but 115200 is a good safe place to start. You can move down to lower speeds if you are having upload issues, or speed it up if your setup is stable, for faster uploads!

![](https://cdn-learn.adafruit.com/assets/assets/000/053/350/medium800/adafruit_products_uart.png?1524842530)

The matching COM/serial port for your FTDI or USB-Serial cable

![](https://cdn-learn.adafruit.com/assets/assets/000/026/170/medium800/adafruit_products_com.png?1435597643)

You don't have to set **Programmer** because it will always use the serial port, just ignore that menu item!

# Blink Test

We'll begin with the simple blink test

Enter this into the sketch window (and save since you'll have to)

```
void setup() {
  pinMode(0, OUTPUT);
}

void loop() {
  digitalWrite(0, HIGH);
  delay(500);
  digitalWrite(0, LOW);
  delay(500);
}
```

Now you'll need to put the board into bootload mode. You'll have to do this before each upload. There is no timeout for bootload mode, so you don't have to rush!

1. Hold down the **GPIO0** button, the red LED will be lit
2. While holding down **GPIO0** , click the **RESET** button
3. Release **RESET** , then release **GPIO0**
4. When you release the RESET button, the red LED will be lit dimly, this means it's ready to bootload

Once the ESP board is in bootload mode, upload the sketch via the IDE

![](https://cdn-learn.adafruit.com/assets/assets/000/024/789/medium800/adafruit_products_espblink.png?1429907595)

If the upload is successful, it should end with this message:

```cpp
Hard resetting via RTS pin...
```

Once you see that, press the **RESET** button and the sketch will then run.

# Connecting via WiFi

OK once you've got the LED blinking, lets go straight to the fun part, connecting to a webserver. Create a new sketch with this code:

```
/*
 *  Simple HTTP get webclient test
 */

#include &lt;ESP8266WiFi.h&gt;

const char* ssid     = "yourssid";
const char* password = "yourpassword";

const char* host = "wifitest.adafruit.com";

void setup() {
  Serial.begin(115200);
  delay(100);

  // We start by connecting to a WiFi network

  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);
  
  WiFi.begin(ssid, password);
  
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println("");
  Serial.println("WiFi connected");  
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
  Serial.print("Netmask: ");
  Serial.println(WiFi.subnetMask());
  Serial.print("Gateway: ");
  Serial.println(WiFi.gatewayIP());
}

int value = 0;

void loop() {
  delay(5000);
  ++value;

  Serial.print("connecting to ");
  Serial.println(host);
  
  // Use WiFiClient class to create TCP connections
  WiFiClient client;
  const int httpPort = 80;
  if (!client.connect(host, httpPort)) {
    Serial.println("connection failed");
    return;
  }
  
  // We now create a URI for the request
  String url = "/testwifi/index.html";
  Serial.print("Requesting URL: ");
  Serial.println(url);
  
  // This will send the request to the server
  client.print(String("GET ") + url + " HTTP/1.1\r\n" +
               "Host: " + host + "\r\n" + 
               "Connection: close\r\n\r\n");
  delay(500);
  
  // Read all the lines of the reply from server and print them to Serial
  while(client.available()){
    String line = client.readStringUntil('\r');
    Serial.print(line);
  }
  
  Serial.println();
  Serial.println("closing connection");
}
```

Dont forget to update

`const char* ssid     = "yourssid";`  
`const char* password = "yourpassword";`

to your access point and password, then upload the same way: get into bootload mode, then upload code via IDE

![](https://cdn-learn.adafruit.com/assets/assets/000/024/790/medium800/adafruit_products_wificlient.png?1429907891)

Open up the IDE serial console at 115200 baud to see the connection and webpage printout!

![](https://cdn-learn.adafruit.com/assets/assets/000/024/791/medium800/adafruit_products_consoleconnect.png?1429908198 Don't worry if it says this is a test of the CC3000 modules. We wrote this little webpage in 2013 and haven't updated it much! :))

That's it, pretty easy!

This page was just to get you started and test out your module. For more information, check out the[ESP8266 port github repository](https://github.com/esp8266/Arduino) for much more up-to-date documentation!

# Adafruit HUZZAH ESP8266 breakout

## Other Options

- [You can load MicroPython onto your ESP8226 and write code in Python! It's an official MicroPython core and is fairly well supported. We even have tons of projects and getting started guides!](../../../../search?q=esp8266%20micropython&view=all)
- You can also try using [emcode](https://emcode.weebly.com/) (formerly embedXcode) which has a template for the ESP8266 with Xcode
- [esp-open-sdk](http://www.esp8266.com/wiki/doku.php?id=toolchain) is a toolchain that will let you program the ESP8266 processor directly ([more info at the esp8266.com wiki](http://www.esp8266.com/wiki/doku.php))

# Adafruit HUZZAH ESP8266 breakout

## Downloads

# Datasheets

- [ESP8266 specification sheet](http://www.adafruit.com/datasheets/ESP8266_Specifications_English.pdf)
- [ESP8266 Datasheet v4.3](https://cdn-learn.adafruit.com/assets/assets/000/035/388/original/0a-esp8266_datasheet_en_v4.3.pdf)
- [SPX3819 3.3V linear regulator on board for rev A](http://www.adafruit.com/datasheets/SPX3819_DS_R202_052014.pdf)
- [AP2112K-3.3 linear regulator on board for rev C and greater](https://cdn-shop.adafruit.com/product-files/2471/AP2112.pdf)
- [FCC test report](http://www.adafruit.com/datasheets/ESP12FCCtestreport.pdf) for the module used on this breakout
- [CE test report for the module used on this breakout](http://www.adafruit.com/datasheets/ESP12CE.jpg)

# CAD Files

- [Fritzing object in the Adafruit Fritzing Library](https://github.com/adafruit/Fritzing-Library)
- [EagleCAD PCB files on GitHub](https://github.com/adafruit/Adafruit-Huzzah-ESP8266-Basic-Breakout-PCB)

# More Information!

- Huuuuge amount of information on [http://www.esp8266.com/](http://www.esp8266.com/) community forum!
- [NodeMCU (Lua for ESP8266) webpage](https://www.nodemcu.com/index_en.html)&nbsp;with examples and documentation on the Lua framework
- [Arduino IDE support for ESP8266](https://github.com/esp8266/Arduino)
- [NodeMCU PyFlasher - a cross platform ESP flashing tool](https://github.com/marcelstoer/nodemcu-pyflasher/releases)

_[Don't forget to visit esp8266.com for the latest and greatest in ESP8266 news, software and gossip!](http://www.esp8266.com/)_

# Schematic

**LDO regulator changed from SPX3819 to AP2112 in rev C** , now 6V max (but lower dropout) and 600mA out max

![](https://cdn-learn.adafruit.com/assets/assets/000/048/352/medium800/adafruit_products_schem.png?1511209629)

# Fabrication print

Dimensions in mm & inches

![](https://cdn-learn.adafruit.com/assets/assets/000/024/679/medium800/adafruit_products_espprint.png?1429743272)

![](https://cdn-learn.adafruit.com/assets/assets/000/024/680/medium800/adafruit_products_espinch.png?1429743316)

# Adafruit HUZZAH ESP8266 breakout

## ESP8266 F.A.Q.

### 

The ESP8266 uses some of the pins as 'boot mode' pins so on boot they must be set to certain values:

- **CH\_PD (EN)&nbsp;**should be always pulled high (it will disable the entire module if low)
- **RST** should be always pulled high (it will disable the entire module if low)
- **GPIO 0** sets whether the bootloader is active, it must be pulled HIGH during power up/reset for the user program to run. If it's pulled LOW, it will activate the bootloader. The built-in red LED on #0 pulls it up
- **GPIO 2** must be pulled high on power up/reset.
- **GPIO 15** must be pulled low on power up/reset.

### 

The most common reason for crashes is power failure. Make sure you're powering the Huzzah with a good ~5V power supply, and if you're using a USB-Serial cable, that it's plugged into the mainboard of your computer or through a **powered** hub!

### I can't seem to find the Serial port on my computer for the Feather HUZZAH?

Don't forget to install the&nbsp;[CP2104 VCP drivers](https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers) for your computer, they are required!

### 

Many cheap electronics come with charge-only USB cables, which cause headaches later. Make sure you are using a proper data/sync USB cable. If you find a cable that is charge-only (not data/sync also) throw it out so you don't have the same problem again.

### 

If your error message looks like this:

_fork/exec /Users/xxxxxxx/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-g++: no such file or directory_  
_Error compiling._

To fix this problem, do this:

1. Open the Boards Manager in the Arduino IDE
2. Uninstall the ESP8266 support
3. go to your ~LIbrary folder (in the Finder, select "Go::Go to folder:, and enter **~Library** ). Find the folder Arduino15.
4. In the Arduino15 folder, go into packages, and delete the folder **esp8266**
5. Go back to the Arduino IDE, and install ESP8266 board support.
6. Now go back to the Finder, and check that you have the xtensa-lx106-elf-g++ file&nbsp;in the path&nbsp; **_Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-g++_**
7. That's it!

### 

This is the ROM debug messages, it's transmitted at 74880 baud so you rarely see it in proper 'ascii output' - instead usually it gets corrupted into a bunch of strange characters.

### 

Make sure you're using a good quality USB/Serial cable. Install the official drivers for that cable too! We've also noticed that PL2303-based cables don't work on Macs for some reason. FTDI or CP210x based chipsets work best

### 

Sometimes, it helps to switch the board type to "Generic ESP8266 Module". &nbsp;Set the Reset Method to "nodemcu"

See [this forum post](http://forums.adafruit.com/viewtopic.php?f=24&t=75423#p474048)

### 

You say your led is stuck on dim and&nbsp;you get an error trying to upload? And you're sure your serial cable is connected and working correctly? Well, here's a potential fix: Connect the GPIO0 pin to GND through a 220 ohm resistor. Leave it connected while you upload. &nbsp;You may have to try it a couple of times, but it should eventually upload and get the HUZZAH unstuck from bootload mode! You can then remove the resistor connection, and your HUZZAH will be happy ever after!

(Note: you may also have to tie RST and EN (CH\_PD) together to get this to work. &nbsp;Remove the connection once you have the module programmed).

Thanks to [forum user misslevania for the tip](https://forums.adafruit.com/viewtopic.php?f=19&t=91951&p=475182#p475182)!

### 

Make sure your terminal software is sending correct line endings! The default PuTTY settings may be wrong when trying to talk to Lua on an ESP8266. Lua expects CRLF "\r\n" line endings, and apparently PuTTY defaults to just LF "\n"!


## Featured Products

### Adafruit HUZZAH ESP8266 Breakout

[Adafruit HUZZAH ESP8266 Breakout](https://www.adafruit.com/product/2471)
Add Internet to your next project with an adorable, bite-sized WiFi microcontroller, at a price you like! The ESP8266 processor from Espressif is an 80 MHz microcontroller with a full WiFi front-end (both as client and access point) and TCP/IP stack with DNS support as well. While this chip...

In Stock
[Buy Now](https://www.adafruit.com/product/2471)
[Related Guides to the Product](https://learn.adafruit.com/products/2471/guides)
### USB to TTL Serial Cable - Debug / Console Cable for Raspberry Pi

[USB to TTL Serial Cable - Debug / Console Cable for Raspberry Pi](https://www.adafruit.com/product/954)
The cable is easiest way ever to connect to your microcontroller/Raspberry Pi/WiFi router serial console port. Inside the big USB plug is a USB\<-\>Serial conversion chip and at the end of the 36" cable are four wire - red power, black ground, white RX into USB port, and green TX out...

In Stock
[Buy Now](https://www.adafruit.com/product/954)
[Related Guides to the Product](https://learn.adafruit.com/products/954/guides)
### FTDI Serial TTL-232 USB Cable

[FTDI Serial TTL-232 USB Cable](https://www.adafruit.com/product/70)
Just about all electronics use TTL serial for debugging, bootloading, programming, serial output, etc. But it's rare for a computer to have a serial port anymore. This is a USB to TTL serial cable, with a FTDI FT232RL usb/serial chip embedded in the head. It has a 6-pin socket at the end...

Out of Stock
[Buy Now](https://www.adafruit.com/product/70)
[Related Guides to the Product](https://learn.adafruit.com/products/70/guides)
### FTDI Friend with Micro USB Port + extras

[FTDI Friend with Micro USB Port + extras](https://www.adafruit.com/product/284)
Long gone are the days of parallel ports and serial ports. Now the USB port reigns supreme! But USB is hard, and you just want to transfer your every-day serial data from a microcontroller to computer. What now? Enter the FTDI Friend!

The FTDI Friend is a tweaked out FTDI FT232RL chip...

In Stock
[Buy Now](https://www.adafruit.com/product/284)
[Related Guides to the Product](https://learn.adafruit.com/products/284/guides)
### ESP8266 WiFi Module

[ESP8266 WiFi Module](https://www.adafruit.com/product/2282)
This interesting module is a lot of fun for hobbyists and students who are interested in experimenting with the ESP8266 WiFi chipset. We bought a bunch of these modules, updated the firmware to the much-easier-to-use v0.924 and wrote some Arduino code to grab a webpage.

We do not...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/2282)
[Related Guides to the Product](https://learn.adafruit.com/products/2282/guides)
### Huzzah! Adafruit.io Internet of Things CC3000 WiFi Starter Kit

[Huzzah! Adafruit.io Internet of Things CC3000 WiFi Starter Kit](https://www.adafruit.com/product/2678)
OK you've signed up for [Adafruit.io](http://adafruit.io) and you're ready to build something cool and Internet-connected. All you need is this starter kit which will get you going with lots of parts that go very well with our service and are the most common sensors and...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/2678)
[Related Guides to the Product](https://learn.adafruit.com/products/2678/guides)
### Huzzah! Adafruit.io Internet of Things Feather ESP8266

[Huzzah! Adafruit.io Internet of Things Feather ESP8266](https://www.adafruit.com/product/2680)
OK you've signed up for [Adafruit.io](http://adafruit.io/) and you're ready to build something cool and Internet-connected. All you need is this starter kit which will get you going with lots of parts that go very well with our service and are the most common sensors and...

In Stock
[Buy Now](https://www.adafruit.com/product/2680)
[Related Guides to the Product](https://learn.adafruit.com/products/2680/guides)

## Related Guides

- [MicroPython Basics: Loading Modules](https://learn.adafruit.com/micropython-basics-loading-modules.md)
- [Remote Control with the Huzzah + Adafruit.io](https://learn.adafruit.com/remote-control-with-the-huzzah-plus-adafruit-io.md)
- [MicroPython Hardware: Digital I/O](https://learn.adafruit.com/micropython-hardware-digital-i-slash-o.md)
- [CircuitPython Hardware: MPR121 Capacitive Touch Breakout](https://learn.adafruit.com/circuitpython-hardware-mpr121-capacitive-touch-breakout.md)
- [CircuitPython Libraries on Linux and ODROID C2](https://learn.adafruit.com/circuitpython-libaries-linux-odroid-c2.md)
- [Adafruit HUZZAH32 – ESP32 Breakout Board](https://learn.adafruit.com/huzzah32-esp32-breakout-board.md)
- [MicroPython Smart Holiday Lights](https://learn.adafruit.com/micropython-smart-holiday-lights.md)
- [MicroPython Basics: ESP8266 WebREPL](https://learn.adafruit.com/micropython-basics-esp8266-webrepl.md)
- [A Sillier Mousetrap: Logging Mouse Data to Adafruit IO with the Raspberry Pi](https://learn.adafruit.com/a-sillier-mousetrap-logging-mouse-data-to-adafruit-io-with-the-raspberry-pi.md)
- [MicroPython Hardware: Analog I/O](https://learn.adafruit.com/micropython-hardware-analog-i-o.md)
- [MicroPython Hardware: I2C Devices](https://learn.adafruit.com/micropython-hardware-i2c-devices.md)
- [XBee Radios](https://learn.adafruit.com/xbee-radios.md)
- [MQTT, Adafruit IO & You!](https://learn.adafruit.com/mqtt-adafruit-io-and-you.md)
- [Using Zapier with Adafruit IO](https://learn.adafruit.com/using-zapier-with-adafruit-io.md)
- [Internet of Things Printer](https://learn.adafruit.com/internet-of-things-printer.md)
