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.
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.
29 Comments
2 years ago
This inspired me to do this little project ... I just ordered the PCB and it works like a champ! Here is the link ... I mentioned you and this instructable in the description of the project:
https://easyeda.com/sims.mike/esp8266-programmer
And here are some pics ...
2 years ago
Thank you, this is the best solution I have seen
Question 2 years ago
I try this methods to use with ESP-12F and succeeded.
N
Oddly, I still cannot done it with Mosfet (IRF540). Seems the GPIO0 could not go LOW.
So I did it with all component, but the Mosfet.
Only pulled up the EN and pulled down GPIO15.
Anybody can give me enlightment?
Reply 2 years ago
Try with an higher capacitor, instead 100uF try 200uF for instance, this will make DTR and RTS low at the same time for longer before the RST goes high again. Also, make sure the Mosfet is doing the transition at the expected value, around 2.5volts gate voltage, by other words, try a different one because there are manufacturing variations on their specs.
Reply 2 years ago
Thanks Rui. But, how to test the Mosfet? Just inject the 2.5v to the Gate? And check weather Drain and Source connected?
Reply 2 years ago
Also, is it save to leave this circuitry without Mosfet?. Sometimes I have to reset once or twice before the serial monitor spitted the display.
2 years ago
Can I use this for esp-01s? Needs tweaking?
I almost frustrated. I will try and report back here.
Reply 2 years ago
Thanks Rui,
I finally made it with ESP-01S. Now i can upload sketch and connect to serial monitor without touching anything.
The first ESP-01S unfortunately died (or DOA). Shorts between Vcc and ground.
I don't know what's causing this to happend.
Although still a mistery for me, because i don't use the 1000uF Capasitor nor mosfet.
Somebody enlight me, maybe?
Also i want to add reset button. Just shorts the CH_PD pin to ground?
thank you all!
Reply 2 years ago
Sure it works fine without modification
2 years ago
Thanks Buddy,
Made a protoboard using FTDI adaptor, both capacitor and a BS170 mosfet. Everything run flawlessly.
Use this code for testing, with serial monitor enabled @115200
/*
ESP8266 Blink by Simon Peter
Blink the blue LED on the ESP-01 module
This example code is in the public domain
The blue LED on the ESP-01 module is connected to GPIO1
(which is also the TXD pin; so we cannot use Serial.print() at the same time)
Note that this sketch uses LED_BUILTIN to find the pin with the internal LED
*/
void setup() {
pinMode(LED_BUILTIN, OUTPUT); // Initialize the LED_BUILTIN pin as an output
Serial.begin(115200);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, LOW); // Turn the LED on (Note that LOW is the voltage level
// but actually the LED is on; this is because
// it is acive low on the ESP-01)
delay(1000); // Wait for a second
Serial.println("led off");
delay(250); // Wait for one-quarter of second
digitalWrite(LED_BUILTIN, HIGH); // Turn the LED off by making the voltage HIGH
delay(2000); // Wait for two seconds (to demonstrate the active low LED)
Serial.println("led on");
delay(250); // Wait for one-quarter of second
}
3 years ago
hi guys, how can i automatically boot from flash from esp 8266?
Question 3 years ago
Thanks for posting this. I tried creating it myself but have run into
an issue. I don't have a 1000uF capacitor, so I'm using another 100uF
capacitor instead in both places. And while I can serial into the
ESP8266 and send AT commands, I'm unable to flash it. The specific
error I get is "Timed out waiting for packet header".
I'll get a
1000uF capacitor soon and test, but I'd hoped for some sign that I'm
doing something right before then. Do you think only that difference
would cause it to fail entirely? I'll follow-up when I've tested with a
larger capacitor.
Parts:
ESP8266
RFP30N06LE N-Channel MOSFET 60V 30A
Electrolytic Decoupling Capacitors - 100uF/25V
USB-C CH340C breakout
Photos of connections
Answer 3 years ago
Tested with full circuitry, it worked great with both flashing and connecting to the serial monitor with the full circuitry.
Answer 3 years ago
Follow-up: realized that the FTDI board in the diagram has both a CTS and an RTS pin. It occurred to me that they might not be interchangeable names for the same thing (lol). My breakout doesn't in out the RTS pin, but I looked up the datasheet and figured out which pin it is. Holding the RST lead the RTS pin on the chip itself worked as the article described. Now I gotta figure out how to connect to that pin.
Answer 3 years ago
FYI in the photos of my breadboard, had the RTS/RST capacitor on the wrong way. This is because I've been testing in both directions. The schematic on this instructable shows the positive end connected to the FTDI, but this other derivative design by @EasyGoing1 shows it reversed. But either way (even with fresh capacitors each time) the behavior is the same: "Timed out waiting for packet header"
https://easyeda.com/sims.mike/esp8266-fluid-programmer
Reply 3 years ago
Follow-up: adding a 1000uF capacitor did not fix it.
3 years ago
I created a couple of PCBs for this project. One you can etch at home and one you can have made professionally for about $10: https://easyeda.com/sims.mike/esp8266-fluid-programmer
3 years ago
This is one of the best instructables I've seen this year. The circuit that does both uploading and Serial monitoring works EXACTLY like a standard Arduino which makes programming these ESP8266's a delight now ... instead of a PITA! THANK YOU!
4 years ago
Will the circuit still work if an 10k Pullup would be added to GPIO0 and Reset of the esp8266?
My plan is to built a programmer board with the Capacitor & MOSFET that can be attached via Dupont cables on programming/Debuggung and can be seperated when i only want to run the ESP8266 circuit.
Reply 3 years ago
It works, great!