IOT

How To Program Raw ESP8266-12E/F Chip using Arduino IDE

In this blog, we’ll go through how to program the raw ESP8266 (ESP8266-12E/F) chip as well as the circuit that allows the chip to work in real-time applications. At the end of this post, we’ll look at the ESP8266 Programmer Circuit and PCB, which are particularly small and compact for real-time projects.

Electronics hobbyists and IoT experts alike are familiar with the NodeMCU. When it comes to prototyping something that includes WiFi, the NodeMCU is the first development board that comes to mind. The best solution is to use the NodeMCU board during the prototype process. Using the full NodeMCU board in the project’s PCB beyond the prototype and testing phases is not, however, a good idea. The ESP8266-12E/F raw chip is required, not the whole development board, which is designed for newbies to work with.

Using the raw ESP8266-12E/F chip reduces the cost of the project and increases its robustness. We can easily program this raw chip with an external programmer by hooking up a few wires to the custom PCB. So let us learn to program the raw ESP8266 chip using Arduino IDE.

Hardware required:

  • ESP-12E/F
  • 22K ohm resistor
  • 330-ohm resistor
  • 470PF capacitor
  • 0.1 micro F capacitor
  • NPN transistor (BC547)
  • Push Buttons
  • Single strand hookup wire
  • Jumper wires
  • FDTI converter (USB to UART bridge)

Traditionally way of using NodeMCU

We develop the firmware in either the Arduino IDE or Platform IO during the prototyping phase of the project, and then upload it by plugging the USB jack into the NodeMCU and selecting the appropriate port and board in the Arduino IDE or Platform IO (in Platform IO, it automatically detects the port, you can also choose the port by configuring the upload options in platfomio.ini, for more upload options).

A USB to UART bridge included within the NodeMCU is used to build firmware into the chip. Before flashing the firmware, the chip should be reset in flash mode, and the inbuilt USB to UART bridge converts USB data into UART format and connects with the device via the RXD0 and TXD0 pins. The NodeMCU’s supporting circuit takes care of everything automatically.

When the auto-loading fails, the NodeMCU is restarted in flash mode using additional Flash and Reset pins.

Programming Raw ESP8266 Chip

Let’s have a look at the physical properties and specifications of the raw chip. Before learning how to program the ESP8266 chip, you must first complete this step.

ESP-12E pinout

Pin configurations

Let’s have a look at each of the 22 pins on the ESP-12E module.

PINNAMEDESCRIPTION
1RSTReset Pin of the module
2ADCAnalog Input Pin for 10-bit ADC (0V to1V)
3ENModule Enable Pin (Active HIGH)
4,5,6,7,11,12, 16, 17, 18, 19, 20GPIO16, GPIO14, GPIO12, GPIO13, GPIO9, GPIO10, GPIO15, GPIO2, GPIO0, GPIO4, GPIO5General Purpose Input Output Pins
8VDD+3.3V Power Input
9CS0Chip selection Pin of SPI interface
10MISOMISO Pin of SPI interface
13MOSIMOSI Pin of SPI interface
14SCLKClock Pin of SPI interface
15GNDGround Pin
21RXD0UART0 RXD Pin
22TXD0UART0 TXD Pin

We need access to the raw chip’s pins and a full grasp of the chip’s operating, booting, and flashing operations to program it.

The module’s physical dimensions are 16mm x 24mm x 3mm, with a 2mm lead pitch. However, the breadboard’s lead pitch is 2.54mm (0.1 inc). I attached the single-strand hookup wires to the chip to make it breadboard-friendly.

Different booting modes

BOOTING OPTIONSENABLE PIN (EN)GPIO0GPIO2GPIO15
Programming ModeHighLowHighLow
Flash start-up (normal mode)HighHighHighLow
SD card boot-upHighLowLowHigh

By pulling up or down on specific GPIOs, we can reboot the ESP8266-12E/F in multiple booting modes. To install the firmware, we need to put the chip in programming mode first. During standard modes, the chip should boot into flash start-up mode. As a result, only the first two booting modes are of importance to us.

The enable(EN) and GPIO2 pins are HIGH in both working modes, whereas the GPIO15 pin is LOW, as shown in the table above. So, with 10K/12K ohm resistors, bring up the enable (EN), GPIO2, and draw down the GPIO15 pin. Normally, the reset and GPIO0 pins are held high and connected to the ground via push buttons.

manual flashing schematic

Flashing process

Let’s look at how to program the ESP8266 chip. First, turn on the circuit by pressing the GPIO0 pushbutton, then release it once the chip has booted up. The chip has now entered programming mode.

Take any USB to the UART bridge (FT232RL preferred) and connect the RX and TX pins of the FT232RL to the TXD0 and RXD0 pins of the chip, making sure the FT232RL module’s jumper is toggled to 3.3V.

Upload the firmware to the FT232RL by connecting it to the PC. The upload settings that you must use while uploading firmware to Arduino are listed below. Select the generic esp8266 module as the board type, the upload speed as 115200, and the right port. Selecting Espressif ESP8266 ESPf-12E as the board choice under platform IO will work.

After the flashing is complete, press the reset push button to return the chip to normal mode.

This method requires manual intervention, such as pushing the reset and push-buttons. The DTR (Data Terminal Ready) and RTS (Ready to Send) signals of the FT232RL USB to UART bridge must be used to avoid manual interventions and seamlessly flash the firmware into the device, as we did with the NodeMCU.

The RTS pin of the FT232RL module is situated in a different location, and accessing it requires soldering the male header.

FTDI with RTS pins

Automatic flashing

The ESP8266 Programmer Circuit, also known as the automatic flashing circuit, is virtually identical to the manual flashing circuit except for a transistor circuit that handles the FT232RL’s DTR and RTS pins.

The DTR signal is used to keep the chip in flash mode while the RTS signal is used to reset the chip. When the upload command is recognised, transistors Q1 and Q2 retain the chip in flash mode, allowing a new sketch to be uploaded effortlessly.

These transistors also ensure that the chip does not reset if the DTR and RTS signals are low and that the chip starts in normal mode (Flash start-up) if the upload command is not received.

ESP8266 Programmer Circuit

I had the BC547 NPN transistor and 470pF capacitor in an SMD package when I wrote this post. As a result, to make it breadboard compatible, I soldered these components to the male headers.

Complete the wiring as shown in the schematic, connecting the FT232RL’s RTS, DTR, RX, TX, VCC, and GND pins to the chip’s proper pins. Also, make sure the FT232RL module’s jumper is set to 3.3V.

ESP-12E automatic flashing circuit

Connect the FT232RL module to the computer after establishing the necessary connections, and then follow the upload options as described previously. The firmware has now been flashed without the need for manual intervention. When the autoloading/auto flashing firmware fails, we can utilize the two pushbuttons (reset and flash) to upload the firmware.

Compact PCB for the Autoflashing circuit

If you’re looking for a small ESP8266-12E/F programmer with power and access to a few of the chip’s GPIOs, this is the PCB for you. EasyEDA was used to create this ESP8266 Programmer Circuit PCB. The circuit’s schematic footprint is shown in the diagram below.

The Gerber File for the PCB is given below. You can simply download the Gerber File and order the PCB from https://www.nextpcb.com/

Download Gerber File: ESP32-CAM Multipurpose PCB

Now you can visit the NextPCB official website by clicking here: https://www.nextpcb.com/. So you will be directed to the NextPCB website.

You can now upload the Gerber File to the Website and place an order. The PCB quality is excellent. That is why the majority of people entrust NextPCB with their PCB and PCBA needs.

The components can be assembled on the PCB Board.

You can also add some Battery charging IC and add some active-passive components to make your Battery Powered ESP8266 Board for IoT applications.

Conclusion:

I hope all of you have understood how to Program Raw ESP8266-12E/F Chip using Arduino IDE. We, MATHA ELECTRONICS will be back soon with more informative blogs.

Leave a Reply

Your email address will not be published.