Introduction: FTDI ESP8266 Definitive Wiring
If you wish to use the cheap ESP8266 ESP-01 module without the nuisance of having to press buttons or connecting new wires just to upload new sketches, here is the definitive wire configuration that allows you to use this module as easy as a common Arduino board.
Step 1: Explanation
- In order to be able to upload to this ESP8266 module the pins GPIO0 and RST must be LOW just before the upload, where the the LOW voltage in the RST pin must go HIGH before the GPIO0, this is exactly what DTR and RTS pins in FTDI are for, where the LOW voltage in DTR takes twice the time than in the RTS, 560 and 280ms respectively;
- This ESP module has current peaks of more than 100mA, so in order to avoid an external power supply, an 1000uF capacitor is added so that these peaks don't disrupt the constant voltage of the FTDI;
- With the exception of pins Vcc and GND in the ESP module, all other pins are of High Impedance (logic gates), meaning that you may apply 5 volts to them without any problem, only the Vcc and GND pins in this ESP module must be fed with 3.3v, because they are of Low Impedance and consequent subject to high currents, so this is why no resistors have been added!
Enabling Serial Monitor:
- The most simple sketch with direct connectors to GPIO0 and RST doesn't allow the opening of the Arduino Serial Monitoring, to be able to use the Serial Monitor like you do in any Arduino board you need to add a 100uF Capacitor and a NPN MOSFET;
- The FTDI's DTR and RTS work in the following fashion depending if you are Uploading or Monitoring trough Serial:
- Uploading: DTR and RTS start LOW at the same time and DTR is low twice the time of RTS;
- Serial Monitor: DTR and RTS always low at the same time.
- So, when you start uploading both DTR and RTS start low, so the ESP8266's RST goes low while the GPIO0 remains floating, then when the RTS goes high and the DTR remains low, the MOSFET is open and GPIO0 goes low, beginning the upload process;
- However, when you start the Serial Monitor, both DTR and RTS go low, meaning that the ESP8266's RST goes low and the GPIO0 remains floating, and when the Capacitor is finally discharged, the RST goes high again meeting this way the required conditions for starting the Serial Monitor:
- The value of 100uF is needed for the Uploading, because during the period that RTS is low the RST must also remain low and to do so you need a high value capacitor.
Step 2: How to Use
- Use a Breakable Pin Header Connector Strip to solder pins in the FTDI board;
- Use Dupont line female to male wire to connect the ESP8266 module to a breadboard or solder the module to a Prototype PCB Board if you prefer;
- Place the FTDI board on a Breadboard or directly in a Prototype board if you prefer;
- Make sure you have connected the ESP8266 Vcc pin to the 3.3v FTDI pin;
- In case you also want to enable the Serial Monitor, add the needed MOSFET and Capacitor as shown in the framed sketch. Note that you shouldn't add other components to the GPIO0 pin, a LED connected this pin will disrupt it's good behavior because will pull it down;
- If you don't have a MOSFET you may use a Switch instead, connecting the GPIO0 to the DTR, then you have to switch manually depending if you wish to Upload or just Monitor the code execution.
Step 3: Your Own Development Board
Use a Prototype Board to build your own ESP8266 Development Board, just add some Arduino Female Pin Header Connectors so that you may remove the ESP and the FTDI modules at any time you want.
You may also add five free pins to your own Development Board connected this way:
- 5v from FTDI;
- 3.3v from FTDI;
- RXD from ESP8266;
- TXD from ESP8266;
- GND from ESP8266.
Then you may plug and use a 3rd party board without the need of removing the FTDI then able to be used as power supply. Very handy if you need to use Analog Sensors that require a board like an Arduino Uno.
Also, you should consider enabling the Serial Monitor, to do so, add the MOSFET and the Capacitor as shown in the sketch. Note that you shouldn't add other components to the GPIO0 pin, a LED connected this pin will disrupt it's good behavior because will pull it down!
If you don't have a MOSFET you may use a Switch instead, connecting the GPIO0 to the DTR, then you have to switch manually depending if you wish to Upload or just Monitor the code execution.