Program Any ESP8266 Board/module With AT Commands Firmware




Introduction: Program Any ESP8266 Board/module With AT Commands Firmware

About: hacker working as hacker

Every ESP8266 module and board can be programmed in many ways:

  • Arduino,
  • python,
  • Lua,
  • AT commands,
  • many more probably...

First three of them are best for standalone operation, AT firmware is for using ESP8266 as module or for quick testing with TTL RS232 communication.

BTW programming ESP (e.g. with Arduino, python or Lua) will erase all memory. So if you want to go back to AT commands you have to reflash firmware.

I'll show you how to do it correctly with Espriff's tools and documentation.

Step 1: Required Software and Documents


Step 2: Hardware and Connections

You'll need:

  • any ESP8266 module or board,
  • any USB<>Serial 3.3V converter (ESP is not 5V tolerant) (some boards have one e.g. NodeMCU),
  • optionally 3.3V PSU (not every serial converter has enough power to power ESP8266 up).

For programming you'll have to:

  • pull GPIO15 down (default state for most modules),

  • pull GPIO2 up (default state for most modules),

  • pull GPIO0 down (always have to be done, leave it alone or pull up for normal operation),
  • pull CH_PD up.

Sometimes not all GPIO pins are accessible (e.g. ESP-01 module), in that way they are connected as they should be, sometimes there are flash buttons, which have to be pressed while resetting/powering up for entering flash mode (e.g. NodeMCU) and no additional connection has to be made.

Step 3: Checking Flash Size

In most cases you don't know flash size. Simplest way is checking it in ESP download tool:

  1. Connect module and boot it in flash mode.
  2. Check COM port number in device manager.
  3. Open ESP download tool and select ESP8266.
  4. Uncheck every option in upper window part.
  5. Provide COM port number and 115200 baud rate.
  6. Press START button.
  7. Flash size will be shown in DETECTED INFO window.

Step 4: Programming With AT Commands Firmware

Check memory map in table 4-4 Download Addresses for OTA Firmware in ESP8266 SDK Getting Started Guide. You have to copy exact same pattern for your module.

For example mine has 32Mbit memory so I used 4096KB column and then It was 32Mb not 32Mb-C1, so I used 512+512 column. 1024+1024 is for XXMb-C1 modules.

Remember that 32Mb=4MB and 8XMb=XMB. Table was made for KB which are 8192 times smaller than Mb.

Addresses have to be consistent with files and flash size. Files are located in SDK: ..\ESP8266_NONOS_SDK-2.2.0\bin and ..\ESP8266_NONOS_SDK-2.2.0\bin\at use newest versions.

You can always flash again (with different addresses) if anything went wrong.

Flashing is similar to checking memory size:

  1. Connect module and boot it in flash mode.
  2. Check COM port number in device manager.
  3. Open ESP download tool and select ESP8266.
  4. Browse for files and provide correct addresses and check boxes.
  5. Provide COM port number and 115200 baud rate.
  6. Press START button.
  7. Wait until it shows FINISH.

Step 5: Test It!

You can use any terminal application. "AT" command is simple test for working, "AT+GMR" will tell you firmware version. Every command have to be terminated with CR+LF. You'll find more in ESP8266 AT Instruction Set.

"AT+CWAP" lists all nearby access points, but module have to be in station mode: "AT+CWMODE_CUR=1"

I attached screenshots from my favorite terminal Tera Term and its configuration (CR+LF for new lines and proper baud rate).

Microcontroller Contest

Participated in the
Microcontroller Contest

1 Person Made This Project!


  • Fabric Challenge

    Fabric Challenge
  • First Time Author Contest

    First Time Author Contest
  • Meatless Challenge

    Meatless Challenge


Radio Engineer
Radio Engineer

2 years ago

About the alleged broken link: a bit more info and where to find the correct document that it was intended to point.

The previous poster, @jagganath, correctly identified that the link in Step 1 titled "ESP8266 SDK Getting Started Guide" is not pointing to where it should -- so all credit goes to that user.

While the link is not formally 'broken' (if you click it you will not see "Error 404, page not found") clicking it will open a document which is not what it should be (it opens the same document as the link just below it about the "AT" command set, not the intended document with the flash memory maps).

And why the referred document is important to this project? Because it helps understanding the flash memory sizes discussed in steps 3 and 4 and select the correct values if you would like to use a later version of the AT SDK firmware.

The most error-proof solution to the broken link, that will always work, is to find with Google the website of Espressif, then go to it and find there the Resources Download area and look up there the title "ESP8266 SDK Getting Started Guide". This will always work, no matter how much Espressif revamp their website (in this way you do not rely on a link, you rely on your own intelligence, which is so much more dependable).

And thus, having done the above, I found the document and to save other readers the time, here is the link to it as of 25/July/2020:

ESP8266 SDK Getting Started Guide

(If the above link again gets broken with time you know what to do, but also here is a link to a copy stored in which hopefully will never get deleted there, many thanks to the great people who are behind that not-for-profit project).

I hope the above might help those who attempt to repeat this project. On my behalf many thanks to the author -- this wonderful project helped me understand how to program the "AT" command firmware on to NodeMCU ESP8266 and then onto Wemos D1 boards, great!

Kind regards,
Radio Engineer


3 years ago on Step 1