Compared with other microcontroller boards (e.g. the Arduinos), the ESP8266 is slightly more complex to hook up with a serial programming port. This post will show you how to connect the ESP8266 to a breadboard and FTDI programmer.
To get started you will need
- 1x ESP8266 (buy 1 from BangGood | buy 3 from BangGood | buy 5 from BangGood)
- 1x FTDI programmer (buy 1 from BangGood)
- 1x mini-B USB cable (buy 1 from BangGood)
- 1x Breadboard (buy 1 from BangGood | buy 5 from BangGood)
- Solderless breadboard jumper cable set (buy 1 from BangGood)
- 2x 4 Pin 2.54mm stackable long legs female connector headers
- 1x 6 Pin 2.54mm stackable long legs female connector header (optional) (buy a small set from BangGood)
- 8x 40 x 30cm female-to-female breadboard jumper wire cables (optional) (buy 40 from BangGood)
The FTDI programmer – the missing link
Like any other microcontroller, the ESP8266 needs to get its code from somewhere. By having no connection port (just pins), this this process is slightly more complex. Although there are other ways, a very popular and relatively safe and easy way to connect the ESP8266 to a serial port is by using a FTDI programmer.
The FTDI programmer is an universal asynchronous receiver-transmitter board (UART) that is assembled with a FTDIFT232RL USB to serial converter chip.
The I/O pins are used to connect to the ESP8266 and the mini-B USB port is used to connect to, for example a PC.
When looking for a new FTDI programmer for this project, make sure it has a 3.3/5V DC jumper.
The pins on the FTDI programmer are clearly marked. The FTDI pins are also breadboard friendly.
To program the ESP8266 it needs to be connected to the FTDI programmer. Generally, the pins on the ESP8266 are not marked. The pinout is as follows:
The ESP8266 is also not breadboard friendly. To achieve the goal with this post, it needs to be. The simplest solution I came up with was by using two, 4 Pin 2.54mm stackable long legs female connector headers. The legs can be bend and the two parts can be ‘superglued’ together.
Connecting the ESP8266 with the FTDI programmer
The FTDI programmer can either be used as power source (not withing the scope of this post) or to program the ESP8266. Note that the wiring will be completely different when the ESP8266 is not being programmed (see later).
To use the FTDI programmer as a ESP8266 programmer the connections need to be as follows:
The connection can be made directly, for example by using modified 40 x 30 cm female-to-female breadboard jumper wire cables, or indirectly using a breadboard. The breadboard solution takes a little more time, but is easier to use in the future, neater and a more sustainable solution.
The FTDI programmer needs to be set to use 3.3V instead of 5V. This is usually done by changing the jumper on the FTDI board itself.
The breadboard can be wired with solderless breadboard jumper cables. On the top left corner, an optional 6 pin 2.54mm stackable long legs female connector header that is bent inwards can be used to connect the FTDI programmer. This will allow the programmer to lie flatter instead of perpendicular to the board.
This breadboard configuration allows simple connection of the ESP8266 and FTDI programmer by using the appropriate connector headers.
ESP8266 programming vs. normal mode
While (and only while) booting up, the status of GPIO0 and GPIO2 is used to check which mode the ESP8266 needs to enter. GPIO15 is also checked, but will not be discussed for the purpose of this post.
Apart from the Tx and Rx connections, the main difference between the wiring for programming mode and normal operational mode is the connections of GPIO0 to GND. By grounding GPIO0 it is being pulled down to Low, to enter programming mode.