Introduction: ESP8266-01 Programmer With Automatic Reboot and Program
When programming and testing ESP8266 modules it is necessary to repeatedly disconnect the power supply for Reset, and a the same time connect GPIO0 to Ground to start it in Program mode.
After a while the ballet with wires got a bit boring so I wanted a better solution.
There are some automatic programmers out there on the internet, but most of then require a couple of transistors and some resistors, and maybe a capacitor. I didn't want that.
Then I tried the 'Korean method': starting with a working prototype, and remove parts until it stops working. The last part must be placed back before continuing. Repeat until there are no non-essential parts left to remove. This is the result.
- 1 USB to Serial converter for ESP8266-01
- 2 pieces of wire (isolated)
- 2 LED's, preferably different colors (optional)
- 1 resistor 220 to 560 Ohm (optional)
- heat shrink tubing (optional)
- Soldering iron and solder
- Side cutter
- Fireproof fingers (optional)
- A PC with Arduino Development program
- Hot glue gun (optional)
Step 1: Schema
The DTR of the Serial-chip is used to force the ESP into program mode at reboot-time.
The RTS of the Serial-chip is used to reset the ESP, wether in normal or in Program-mode.
Step 2: The Programmer
Start with a USB to Serial converter like one of these.
It contains a chip called CH310G. It is totally possible to use an other programmer (like FTDI). But then you have to find out the places to connect the wires yourself, I only added pictures of these 2 PCB's. However, most time the connection names (DTR, DCD, RTS) are printed on the PCB's, so it should be quite possible.
Step 3: Remove the Switch
If there is a 'Program' switch, it is best to remove it to get easy access to the IO0 connection of the ESP. If you cannot get it out: the switch may stay: in the 'uart' position it is not connected. But we want to use the center connection below the switch to keep the wires short, so remove it if possible.
Step 4: Solder 2 Wires to the CH310G
Remark: the pictures show 2 different interface PCB's; a red and a black print. Just look at the one you have, and ignore the other.
Locate pin 13 and 14. Solder the 2 pieces of wire onto them. The color doesn't matter, that is just for the picture.
Solder the wire from 13 to the middle connection of the switch (aka IO0 of the ESP). If there is no switch: see next step.
The pin-numbers are counted from the dot on the corner of the chip, anti-clockwise.
Step 5: Solder the Other Sides of the Wires
Locate the connections of IO0, IO2, and RST at the bottom side of the ESP connector. (same picture for both prints)
Solder DTR(13) to IO0 if it is still sticking out from the previous step. The red wire in the picture.
Solder RTS(14) to RST, just on the opposite row of IO0. The blue wire.
Step 6: Test
So far so ... maybe.
you should now be able to test the following:
- when connected to the PC and the Arduino program running, start the Serial-Monitor (Ctrl-Shift-M). You should see the ESP rebooting: first a line of rubbish, then some readable text (or else check your baudrate). The Reset is working now.
- Upload a sketch (Ctrl-U). The ESP is automatically restarted in Program mode, the program is written into EEPROM, and the ESP is rebooted afterwards in normal run-mode. Without [re]connecting or changing any wires !
Step 7: Bonus: 2 LEDs
Maybe you want to connect two LED's to GPIO0 and GPIO2.
When the soldering iron is still on, ... why not do it right away ?
The LED's have a PLUS and MINUS, so be careful. If mounted wrong, there will be no light. Look inside your LED's for the leg with the flat surface. That one is the minus. Often it was the shortest leg before you cut it.
Step 8: Prepare LED's
I used red and green LED's, the color is not important. But I doubt if blue or white LED's will glow on 3.3 Volt, and I just wanted to see different colors for the 2 IO's.
Put a short piece some heat shrink tubing on the MINUS legs of the LED's. Just long enough to have the LED's stick out of the board, and protect them from shorting the other wires at the bottom of the ESP.
Bend those wires just at the end of the tube. Bend the wires the opposite ways: one left, the other right.
Cut them at 1 or 2 mm around the corner.
Step 9: Solder - Side of LED's to the ESP8266
Solder them to IO0 and IO2. (see picture @ step 5 for their location).
Solder the resistor to 3V3. Any resistor between 220 Ω and 1KΩ is fine. 220 will make the LED glow brighter, 1K will make them glow faintly, but modern LED's will be visible anyway.
Because only one resistor is used, both LED's will not glow at the same time. If you want to see them both at the same time, give each LED its own resistor.
Step 10: Connect + Side of LED's
Bend the other wire of the resistor over the LED wires. Cut the 3 wires al the correct length (just crossing a bit).
Put some heat shrink tubing on the 2 remaining LED's. Solder the junctions.
Heat the heat shrink tubes with a candle flame or match to make then fit tight. If the tubing turns black and the green LED catch fire, it was not heat shrink tube, and you have to buy a new green LED. I know.
Step 11: Add Capacitor (if Not Present Yet)
Some prints (like the black one) comes with a capacitor. That's fine. It is a good idea to have a current buffer there, especially while programming.
So if it isn't there already, it is a good idea to add one between +3V3 and Gnd. For example on top of the AMS1117 stabilizer. Any electrolytic cap over 5 Volt and 2 uF will do (so for example 22uF 6.3Volt will be fine).
On the black print you can see the silver 1000uF 6.3V, so that one doesn't need an extra cap.
Step 12: Finished
So this is how it looks wit an ESP8266-01 on top.
You may finish it with a large piece of heat shrink tubing around the whole rig, or sculpture some hot glue around it to make sure it cannot touch any other loose electrical wiring at your work bench when floating around. That's totally up to you.
Have fun !
Step 13: Small Warning
The DTR and RTS signals of the GH310G are directly coupled to IO0 and IO2 of the ESP8266.
DTR and RTS are both outputs. And IO0 and IO2 are inputs. Perfect.
Even if the ESP8266 is programmed to have pull-up resistors at IO0 and IO2, there is no problem.
However, you can (and may) program IO0 and IO2 as outputs yourself, to make the LEDs glow. Then you have the ESP8266 outputs fighting with the CH310G outputs. This is at your own risk.
I guess there is no problem, since the output currents are very limited, and the chips do not feel warm after a while. But I'm not sure if it is working within device limits. It may cause a problem.