When compared to other microcontroller boards (e.g. the Arduinos), the ESP8266 is slightly more complex to hook up to a serial port for programming. This post will show how to connect the ESP-01 module to a breadboard and FTDI programmer for ‘flashing’ purposes.
The ESP8266 is the micrcontroller chip that is used on the ESP-01 module / microcontroller board. The chip has at least two different boot modes: ‘normal mode’ and ‘programming mode’. ‘Programming’ (or ‘flashing’) refers to uploading any (custom or default) software (or firmware) to the ESP8266’s flash memory. Flashing will overwrite the previous programming/firmware (including the AT command set if that was flashed). The breadboard setup in this post will allow booting into programming mode which will allow the module to be flashed with a new firmware. A FTDI USB/UART module will be used as communication module.
To get started you will need
- ESP-01 (buy 1 from BangGood | buy 3 from BangGood | buy 5 from BangGood)
- FTDI USB/UART module (buy 1 from BangGood)
- Mini-B USB cable (buy 1 from BangGood)
- Breadboard (buy 1 from BangGood | buy 5 from BangGood)
- Solderless breadboard jumper cable set (buy 1 from BangGood)
- 2x 4 Pin 2.54 mm stackable long legs female connector headers
- 1x 6 Pin 2.54 mm stackable long legs female connector header (optional) (buy a small set from BangGood)
- 8x 30 cm female-to-female breadboard jumper wire cables (optional) (buy 40 from BangGood)
- 1x Tactile push button switch (optional) (buy 1 from BangGood | buy 100 from BangGood)
- 3 Pin PCB SPDT Slide Switch (optional) (buy 20 from BangGood)
ESP8266 programming mode 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.
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. During the normal operational mode, the status of GPIO0 and GPIO2 will be high (by default). By grounding GPIO0, it is being pulled down to low, to enter programming (bootloader) mode. GPIO15 should also be grounded, but does not need any consideration here and will not be discussed for the purpose of this post.
The FTDI USB/UART module (FTDI programmer)
The purpose of this post it to be able to flash new firmware onto the ESP-01 module. For this to happen, another device containing a copy of the firmware needs to be connected to the module. Because ESP-01 modules do not contain any sort of serial communication chips/ports, serial communication to other devices need to be done using a serial to USB converter. There are many such devices available, but for the purpose of this article the FTDI USB/UART module will be used.
The FTDI USB/UART module is an universal asynchronous receiver-transmitter board with a FT232R chip. The chip is manufactured by FTDI (Future Technology Devices International). It is able to transform RS232 or TTL serial data into USB signals.
The FTDI USB/UART module has a mini-B USB port which is connected to a device with an USB input (e.g. a PC), and on the other side it has breakout pins (Tx, Rx, Vc and GND) that is connected to the ESP-01 module.
When looking for a new serial to USB converter, make sure it is 3.3 VDC compatible. It also needs to be able to supply an excess of 300 mA to power the ESP-01 adequately. The FTDI USB/UART module in the Getting started section above has a 3.3/5V DC jumper and will supply 500 mA through its Vc pin.
The pins on the FTDI USB/UART module are clearly marked. The FTDI pins are also breadboard friendly.
Some devices might need drivers to register the FTDI USB/UART module to be able to appear as a COM port. This allows application software to access the module in the same way as it would access a standard COM port. Although some operating systems might install the drivers automatically after its first use, others might need these drivers to be installed manually. For more information, visit the official FTDI Virtual COM Port Drivers page.
The ESP-01(s) module
To flash an ESP-01 module, it needs to be connected to the FTDI USB/UART module and GPIO0 needs to be connected directly to GND. Generally, the pins on the ESP-01 are not marked:
The ESP-01 is 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 ESP-01 with the FTDI USB/UART module
The FTDI USB/UART module is used as power source and to program the ESP-01. To use the FTDI USB/UART module as a ESP-01 programmer, the connections need to be as follows:
The connection can be made directly, for example by using modified 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, looks neater, is upgradable and a is little more sustainable.
When connecting to an ESP-01, the working voltage of the FTDI USB/UART module needs to be set to 3.3V (instead of 5V). On some modules this can be 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 USB/UART module. This will allow the module to lie flatter instead of perpendicular to the board. The 4 pin 2.54mm stackable long legs female connector headers are where the ESP-01 will be plugged into.
In addition to 3.3V DC (red wire) and ground (black wire), this configuration connects the Tx/Rx (yellow/green wires) of the FTDI USB/UART module to the RX/Tx of the ESP-01.
On the ESP-01, both Vcc and CH-PD needs to be connected to 3.3V DC (red wires) and GPIO0 needs to be connected to ground as well (brown wire). As mentioned earlier, by grounding GPIO0 it is being pulled down to low which makes it boot into programming mode.
This board will allow the ESP-01 boot up in program mode, and only program mode. It works well, but when it comes to testing, the ESP-01 has to be transferred to another board. Rebooting is also only possible by disconnecting the USB cable from the FTDI USB/UART module (i.e. disconnecting the entire setup, which often crashes the operating system).
To overcome these shortcomings, a reset switch and a SPDT slide switch can be added:
To be able to reset the board, a tactile push button is wired between the ESP-01’s GND and the RESET pin (purple wire). The tactile button should be normally open (NO) so that when it is pressed, the connection is made.
Finally, a SPDT slide switch can be used to connect GPIO0 to ground (or not). This will allow switching between program mode and normal boot mode. After switching, the reset button can be pressed to enter that state. Programming can start immediately after all the components has been added to the breadboard.
More ESP8266 related posts
Buy great value for money micro-electronic components online from BangGood.com. Free international delivery, including to South Africa.
23 February 2018
Check out the inexpensive ESP-01 Wi-Fi module... ESP8266 #microcontrollers #DIY
19 December 2017 | Updated 15 January 2018
Read more about the digital read pin on a #microcontroller... #Arduino #ESP32 #DIY
6 July 2017
See #howto install the #Arduino IDE on a #RaspberryPi 3...
1 July 2017
#ESP32 #microcontroller development boards with build-in Wi-Fi & Bluetooth... #tinkering #DIY #homeautomation #IoT
25 June 2017 | Updated 26 June 2017
See #howto get started with the #Arduino Nano... #ArduinoNano
3 January 2016 | Updated 31 October 2017