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

USB to Serial Cable

I was using an ArmorView USB to TTL 4-pin connector. This is a cheap knockoff of a USB-to-serial adapter by Prolific [1], so the Prolific drivers were necessary to make the computer recognize the serial adapter.

The four wires are as follows: Red +5V, Black GND, Green TXD, White RXD

File:USB to TTL.jpg

When the USB adapter was plugged in, it showed up under /dev/cu.usbserial and /dev/tty.usbserial. We can use this device file to communicate with the USB serial adapter.

Wiring Between Computer and ESP8266

The wiring between the computer and the ESP8266 chip looks like this:

Chip Pin          USB-to-Serial Cable
1 TXD ----------- white RXD
2 GND ---------- black GND

7 VCC ----------- red VCC
8 RXD ----------- green TXD

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

Useful Links

Comprehensive Guide

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

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