es. Programming ESP8266-13 with MCP2200 USB to TTL RS-232 communication bridge

ESP8266 module is one of the cheapest ways to connect and control homebuilt electronics devices to IoT Wi-Fi networks. A powerful Tensilica’s L106 Diamond series 32-bit processor provides not only for fast communication, but it can also act as a device controller. L106 processor has no internal EEPROM to store inbuilt software or user programs and it needs an external serial EEPROM to operate. ESP8266 is therefore a two chip module, and its version is more or less defined by size of the EEPROM chip and a number of implemented external input/output pins and. ESP8266 modules also defer by internal crystal oscillator speed.

Connecting to ESP8266

ESP8266 requires an RS-232 interface with 3.3 V TTL voltage levels to connect to a PC. A voltage level adapter from RS-232 voltage levels (+12 V, -12V) to ESP8266 TTL voltage levels (3.3 V, 0 V) should therefore be used with a standard PC RS-232 port.

A small USB to TTL RS-232 bridge costing around 5 USD is preferable, because most modern PCs also have a number of USB ports and no RS-232 ports, and it is also more convenient to use than a voltage adapter. However, most of USB to TTL RS-232 bridge implementations provide 2 wire communication through RX and TX lines, only. Though a number of resistors and a micro switch can be used to produce ESP8266 control signals, a TTL RS-232 bridge with additional digital input/outputs is more convenient and easier to use.

MCP2200 USB to TTL RS-232 bridge has all it takes to make an excellent interface to connect an ESP8266 module to a PC. The chip implements HID (human interface device) and CDC (USB Communications Device Class) USB interfaces and it can be simultaneously controlled through both. A HID interface is used to control ESP8266 operation mode, while a CDC interface acts as an RS-232 serial communication relay between PC and ESP8266. MCP2200 defines 5 control signals (reset, enable, IO0, IO2, IO15) to enable a user to easily operate the module with a program application. You can download ESP8266 Control Application here. See the schematic below for details.

Wire connections and communication speed

ESP8266 programming requires a reliable high speed RS-232 communication (74880, 115200, … bauds) between ESP8266 and a PC, which can only be achieved through a wire connection, not exceeding 10 cm in length. The easiest way to satisfy the length restriction is to solder MCP2200 and ESP8266 module to the same PCB. Standard prototyping PCBs with 2,54 mm spacing between wholes can only be used with a 1 mm to 2,54 mm spacing adapter. Another option is to attach an ESP8266 module to a PCB through short connection wires. I tried both, and though it takes more time to solder an ESP8266 through the adapter the latter provides much shorter and more reliable connections to the PCB.

Exotic data transfer speeds (eg. 74880 bauds on modules with 26 MHz crystals) for programming ESP8266 are not uncommon, but you may also opt for a module with a 40 MHz crystal with a standard RS-232 transfer speed of 115200 bauds. Luckily, most of the USB to TTL RS-232 communication bridges can match the exotic transfer speeds with an error of 2 % or less. MCP2200 can communicate at 75000 bauds only, but it is still able to synchronize correctly during stop bits and there is no data lose.

The next question is how fast can an MCP2200 TTL RS-232 communication bridge talk to a ESP8266 module. My tests produced excellent results even with the maximum communication speed of 921600 bauds.

Software

Microchip MCP2200 microcontroller is factory preprogrammed, so no firmware is needed for this project. LIB_PCUSBProjectsv7.7.NET4.6.dll 64-bit programming library enables easy access to a full set of MCP2200 control functions, available through HID interface. It also allows for speed optimizations of the user application programming code by reducing the amount of data transferred through the USB HID interface. It is notable that the original 32-bit Microchip SimpleIO-M.dll programming library only provides access to a limited set of MCP2200 control features.

ESP8266 CONTROL APP v2.0 64-bit Microsoft Windows application enables quick changes of ESP8266 operation modes and communication speeds. It is needed for programming and normal operation of the ESP8266 module. The source code is included, so it may also be modified and used for other MCP2200 projects.

READ MORE (ESP8266-13 with SD card)

CLICK HERE TO DOWNLOAD ESP8266 PROGRAMS

Schematic: ESP8266-13 to PC connection (click to enlagre)

Programming ESP8266-13 with MCP2200 RS-232 to TTL Bridge (click to enlarge)

Running Wi-Fi scan sample application - Arduino IDE (click to enlarge)

Runnint Wi-Fi scan application - Tera Term (click to enlarge)