ESP8266: Difference between revisions
From charlesreid1
| Line 115: | Line 115: | ||
Test 3A: 57600 baud rate, RX on ESP8266 connected to RX on PL2302 (mini usb to serial board), CH_PD pin floating | Test 3A: 57600 baud rate, RX on ESP8266 connected to RX on PL2302 (mini usb to serial board), CH_PD pin floating | ||
* | * Nope. | ||
Test 4A: 57600 baud rate, RX on ESP8266 connected to RX on PL2302 (mini usb to serial board), CH_PD pin high | Test 4A: 57600 baud rate, RX on ESP8266 connected to RX on PL2302 (mini usb to serial board), CH_PD pin high | ||
Revision as of 01:26, 23 June 2016
Notes on the ESP8266 chip.
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
Because this didn't work immediately, I had to try a couple of combinations of different parameters.
Variables:
- Baudrate - 57600 or 115200 (depending on chip/board version)
- RX/TX pinouts
- High/floating CH_PD pin
First round (slow rate, v 1):
Test 1A: 57600 baud rate, RX on ESP8266 connected to TX on PL2302 (mini usb to serial board), CH_PD pin floating
- Nope.
Test 2A: 57600 baud rate, RX on ESP8266 connected to TX on PL2302 (mini usb to serial board), CH_PD pin high
- Nope.
Test 3A: 57600 baud rate, RX on ESP8266 connected to RX on PL2302 (mini usb to serial board), CH_PD pin floating
- Nope.
Test 4A: 57600 baud rate, RX on ESP8266 connected to RX on PL2302 (mini usb to serial board), CH_PD pin high
- Nope.
Second round (fast rate, v 2):
Test 1B: 115200 baud rate, RX on ESP8266 connected to TX on PL2302 (mini usb to serial board), CH_PD pin floating
Test 2B: 115200 baud rate, RX on ESP8266 connected to TX on PL2302 (mini usb to serial board), CH_PD pin high
Test 3B: 115200 baud rate, RX on ESP8266 connected to RX on PL2302 (mini usb to serial board), CH_PD pin floating
Test 4B: 115200 baud rate, RX on ESP8266 connected to RX on PL2302 (mini usb to serial board), CH_PD pin high
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
| Arduino all the arduino things
Arduino/Micro · Arduino/Leonardo · Arduino/Esplora
Arduino/Micro/Hello World · Arduino/Leonardo/Hello World · Arduino RGB LED
Arduino/Micro/Blink · Arduino/Leonardo/Blink
Arduino/Morse Code Libraries · Arduino/Morse Code Circuit · Arduino/Micro/Blink Morse Code
|