My task was to add the ESP8266-12E module to circuito.io Pro.
I started by buying some ESP8266-12E modules to play around with and a few ESP8266 WIFI Breakout Board Adapters from a local supplier since the ESP module pins are not breadboard-compatible. The connections require some additional resistors, capacitors and a regulator we already had in the workshop.
After soldering them together I understood that the adapter isn’t good for my needs. It breaks out the ESP pins but takes the whole width of the breadboard, which means no jumper wires can be attached to the BB. Therefore, I decided not to use it and I wouldn’t recommend using it.
Dropping the adapter meant I had to solder wires straight to its pins and connect it to the BB. Kind of looks like a spider, doesn’t it?
The basic way to upload code to the ESP8266-12e in standalone mode is by connecting it to an FTDI module. I took this one by Sparkfun.
The connections are simple, but when searching on Google for “ESP8266-12E FTDI” I got many results that were either not written clearly, lacked a schematic diagram or were missing details. So I decided to clear things up a bit. If you have any questions or comments, you’re welcome to share them with us on this dedicated thread on our forum.
From my initial research, the datasheet and my previous knowledge, I knew that the ESP module is driven by regulated 3.3v to its VCC pin. The top result websites don’t tell you this but you must power the module using an external regulator, the one on the FTDI just isn’t enough.
The ESP12e module has 3 booting modes, to enter these modes the following pins need to be connected as shown:
In order to program the ESP module using an FTDI module we need to set it to boot in programming mode, and set the rest of the connections:
We want to program it using the Arduino IDE. In order to do so, you’ll need to install the ESP8266 board pack. We're going to write a short tutorial on how to do this soon, so stay tuned!
I found some online references that said to choose the ‘ESP Generic module’ and play around with the settings, but that didn’t really work for me. Instead, I chose the ‘NodeMCU 1.0’ option, didn’t touch the settings and it worked on the first try. If you have any insights about this, you can share them with us on the dedicated thread.
Connect the ESP module to the power and the FTDI module to your computer using a USB cable, open the Arduino IDE, choose your board and COM port and click upload.
Note that in this configuration the board does not reset by itself, so in order to successfully upload the code, you must reset it the moment the IDE has finished ‘Compiling’ the code. If successful, you will see the IDE uploading the code.
To reset the board, put the ESP EN pin to GND and back to VCC, this will boot the module in programming mode.
OK, so we made it work, now let’s do it right.
Instead of connecting the pins straight to VCC or GND as explained before, we will use resistors to pull up/down the pins and add a reset button to the EN pin and a switch to go between modes. It’s a better method than moving the jumper wire each time you want to upload code.
Here’s a diagram from Upverter for reference:
To go between modes we need to switch the GPIO0 connection from VCC to GND. Adding a switch, as seen in the schematics, makes it very easy. When connected to GND the ESP module will boot in programming mode.
In order to reset the board, you can either use the EN pin or the RESET pin (in this case EN stays connected to VCC) by connecting them to GND for a short moment.
To do this we will connect a push button from EN pin to GND.
Now you can power the board and connect it to your PC as described before, set the IDE and upload. Remember to press the push button the moment you see the IDE ‘Uploading’.
To eliminate the need of manual resetting I wanted to add an ‘Auto reset circuit’, like the one found on the NodeMCU.
Here is a link to the NodeMCU schematic diagram. On page 3 you can find the auto-reset circuit:
Looks very simple! However, there was one problem: I didn’t have an RST pin on my FTDI module, only DTR and CTS. which won’t work. So I went and bought a new one with the pins I need on its breakout, here’s is a link.
To make this circuit you can use ordinary NPN transistors (I used BC337) and 10K resistors. Connect them to the FTDI pins RST and DTR and to the ESP pins RST (RESET) and GPIO0.
Using the RST and DTR signals from the FTDI, this circuit resets the ESP module and makes sure to pull GPIO0 to LOW at the right time so the module will boot in programming mode.
This connection is made in parallel to the reset button - so it is still functional for resetting the board.
The circuit includes:
1. ESP8266-12E module
2. Reset circuit
3. External 3.3v regulator
4. FTDI header.
That's all for now. Soon, you’ll be able to create this schematic on circuito.io Pro, so stay tuned! And if you have any questions or insights about esp-12e please share them with our community.