From charlesreid1

Notes on the ESP8266 chip.

ArduinoWifi.jpg

Overview

This board enables Arduinos and other embedded devices to communicate with wireless networks via the 802.11 protocol.

The board has a microchip that implements the entire TCP/IP stack, so you don't have to implement it on your embedded device. The embedded device simply uses serial commands to control and interact with the chip. Think of it as a dumbed-down, physical API for wifi.

The chip has an 8-pin array on the underside. The pins here use 3.3 V logic, so it is important you use it with embedded devices that also use 3.3 V logic! Some embedded devices (such as the Arduino Uno) use 5 V logic. If you have a device using 5 V logic, you need a down-converter (also called a level shifter) to convert the 5 V logic signals to 3.3 V logic signals.

Pinout

The 8 pins on the chip are arranged as follows:

___________________________________________
|        _______            _____________  |
|   (1)  | O O | (2)        |   _________| |
|        |     |            |   |________  |
|   (3)  | O O | (4)        |    ________| |
|        |     |            |   |________  |
|   (5)  | O O | (6)        |    ________| |
|        |     |            |   |________  |
|   (7)  | O O | (8)        |            | |
|        -------            |            | |
|__________________________________________|

(1) TXD     (2) GND
(3) CH_PD   (4) GPIO2
(5) RST     (6) GPIO0
(7) VCC     (8) RXD

Serial Communication

To communicate with the chip, use serial commands, at a baud rate of 57600.

Commands fall into three different categories:

  • Set
    • Modify the parameters on the chip
  • Inquiry
    • Read the current state of the chip's parameters
  • Test
    • Return the different modes supported

The AT commands are all listed in the following table: http://wiki.iteadstudio.com/ESP8266_Serial_WIFI_Module#AT_Commands


Mini USB to Serial UART Board

I was using a PL2303 board, which has a Mini USB connector on one side and four serial pins on the other. Once nice aspect of this board is, you can control the voltage level with a jumper, so it can operate in 3.3 V or 5 V mode, depending on how you place the jumper.

Originally, I made the mistake of using an ArmorView USB to TTL 4-pin connector, which was a cheap knockoff of a USB-to-serial adapter from Prolific. I hooked it up to the board and tried to send a signal to it. However, the ESP8266 requires 3.3 V, so I fried the board. The board was only hooked up for about 5 seconds, but it still got cooked - it smelled like overheated electronics and was physically hot.

Using the PL2303 board solves that problem. It is relatively straightforward:

Wiring of PL2303 and ESP8266

To wire up the Mini USB to serial adapter,

Serial Software

To communicate with the serial device, I used Pyserial, which is a Python library for communicating with serial devices.

The program we will write will communicate with the wifi chip by sending various AT commands out over the transmit wire. There is a comprehensive list of all of the AT commands here: http://wiki.iteadstudio.com/ESP8266_Serial_WIFI_Module#AT_Commands

To test communication with the device, I started by sending a simple "AT" command. The ESP8266 should return an "OK" message.

Serial Experiments

I had problems hooking this thing up. These boards have no documentation whatsoever, there are ten different versions of the board floating around, several different versions of firmware, and nobody who has tinkered with this board, it seems, is capable of articulating complex ideas with words. (Or pictures.)

That means I'm pretty much on my own.

ESP8266/Serial Debugging

Still no luck.

Reflashing the ESP8266

I have had zero luck communicating with this chip. I can't even get the LEDs on the board to light up.

Solution: reflash the firmware with the AT command binary image. This will, I guess, get the chip to accept AT commands on the serial RX/TX pins.

Useful Links

Comprehensive Guide

There is a (confusing) comprehensive guide to this chip here: http://wiki.iteadstudio.com/ESP8266_Serial_WIFI_Module

Reflashing the ESP8266

The only sensible guide I've found to flashing the ESP8266: http://www.xess.com/blog/esp8266-reflash/ (Warning: requires Windoze)

Github Pages

The ESP8266 has a wiki and a collection of related repositories on Github.

Link to wiki: https://github.com/esp8266/esp8266-wiki/wiki

Link to Github repos: https://github.com/esp8266

Flags