Program ESP8266 With NodeMCU

by Arnov Sharma in Circuits > Arduino

5326 Views, 17 Favorites, 0 Comments

Program ESP8266 With NodeMCU

02 (6).gif
03 (6).gif
IMG_20201027_185108.jpg
IMG_20210109_210615.jpg

Hey everyone what's up!

so you got yourself an esp12f module and now you want to program it? here's how you can do that in an easy way that doesn't involve that complex FTDI module with the button's method.

so the easy way is to use a Nodemcu here. actually, the trick is to use the CP2102 chip instead of the esp12f on Nodemcu.

here's the setup video-

Supplies

We will need the following things for this Instructables!

  • CUSTOM PCB (which was provided by JLCPCB)
  • TARGET ESP12F Board wth LED soldered
  • Nodemcu
  • Header pins

Getting Setup Ready

Image4.jpg
Image7.jpg
auto-reset_auto-program.png
IMG_20201027_185117.jpg

we start first by shorting the Enable pin and GND, this will turn off the esp12f of the Nodemcu and now we can hook an external esp12f setup with the Nodemcu according to the given schematic.

Flashing with Nodemcu instead of using FTDI Module is easier but this doesn't mean that it's a proper replacement, for more advanced prototyping with ESP12F in which you need to make a whole setup of ESP12F with a programming IC, you can use the auto-reset method which uses two Transistor to put the esp12f into flash mode.
I've added its schematic and this method is basically used in all similar boards even in the Nodemcu.

CUSTOM PCB AND ITS ASSEMBLY

09 (3).gif
08 (3).gif
06 (4).gif
07 (3).gif
03 (6).gif

I prepared a Programmer PCB for this job, I first design this PCB according to the given schematic and then gave this PCB to jlcpcb for samples and recovered them after a few weeks; you can check them out if you need great PCB service at a low cost! www.jlcpcb.com

This PCB is basically an expansion board for Nodemcu, I have added 31 header pins and additional OLED breakout points so I can use this Setup for something else if it's not being used as a programmer. The Assembly process of this custom PCB includes adding the header pins to the board with soldering iron and connecting the Nodemcu on those header pins.

ESP12F MINIMAL SETUP

04 (5).gif
IMG_20210109_210615.jpg
Capture3.PNG
IMG_20210109_210559.jpg
Capture.PNG

As for the ESP12F Setup, ill be using a board I design for my previous RGB Glasses Project. This PCB breakouts the ESP12F points and also pull down a few necessary pins with a 10K Resistor which is the minimal requirement of driving the ESP12F Board.

For Programming this, I've connected the Programming pins which are the 3V, GND, RST, GPIO0, TX, and RX Pins to a CON6 point for adding header pins on it. Basically, I designed this PCB in such a way that I can connect NODEMCU PROGRAMMER PCB with this setup by male and female header pins. It's a clever method to use as because of this external programmer, we don't need to add FTDI Chips on ESP12F setup and we can make smaller PCBs and for programming them we just breakout 6 important pins and connect our external programmer with it.

WIRING CONNECTIONS

Image1.jpg
IMG_20210107_205657.jpg

For Programming the ESP12F board, we need to connect the NodeMCU with our ESP12F Setup in this way-

  • 3v to 3v
  • GND to GND
  • RST to RST
  • GPIO0 to GPIO0 //D3 is GPIO0 on Nodemcu
  • TX to TX
  • RX to RX

Also, do not forget to add a Jumper wire between ENA and GND Pin on Nodemcu. this will turn off the ESP12F of the Nodemcu and our external ESP12F will get connected with the Nodemcu's CP2102 chip.

CODE and Flashing Step

11 (3).gif
IMG_20210109_210559.jpg
IMG_20210108_213046.jpg

As for the test sketch, I have added an SMD green led between GPIO12 and GND.

I used a simple webserver to connect the esp12f with my phone and just toggle the SMD LED but before that, you need to change the SSID and Password in the Sketch according to your credentials.

  • Connect the Nodemcu programmer with the ESP12F Board
  • open Arduino ide, plug the USB on Nodemcu
  • then go to the Tools menu and select the Nodemcu board that you are using
  • select the right port and hit upload

after uploading goto the serial monitor and hit the reset button on Nodemcu. as you can see, our setup has been connected with the smartphone...

now copy this IP address and open this in your web browser,

RESULT

05 (4).gif

Open the Webserver by writing the IP Address in the serial monitor on your smartphone's web browser and press the LED ON or OFF link to toggle the state of the LED.

And we have successfully programmed an esp12f with a Nodmcu, the webserver sketch can be run with any esp8266 board so you can use that for controlling anything like a relay for example.

Watch the video for better demo-

Leave a comment if you guys need any help!

BONUS STEP

10 (2).gif

Wait, here's a bonus thing!

this NODMCU Programmer has an OLED output so here's an OLED animation sketch for no special reason ;)

WILL POST A TUTORIAL ABOUT THIS SOON!