Flashing the ESP8266 Wifi Module

I initially bought an ESP8266 module from Ebay in an attempt to add network connectivity to an arduino. It didn’t take me long to figure out that it wasn’t simply a case of connecting this module to an arduino and connecting to the network with it.

The ESP8266 module I bought was an AI-Thinker ESP-01 like the one pictured.

esp8266 photo
Photo by SparkFunElectronics

It’s quite hard to find a datasheet for this module, there is one in Chinese available from the AI-Thinker forum. From there I got this helpful image with the pin diagram:
ESP01 pins
Sparkfun have an excellent cheetsheet available and Nurdspace have this great document with all the ESP8266 details. There is a dedicated ESP8266 forum but as an ESP8266 beginner I found it quite overwhelming.

Initially I tried to connect to the ESP8266 using the arduino, I had read a few reports of this working but I could not get this to work. I think one of the problems was that I was trying to power it through the arduino. The ESP8266 module needs 3.3V and the arduino’s 3.3V output does not provide enough current. Another danger of connecting them directly is that the TX / RX of the arduino are rated at 5V, the ESP8266 is rated at 3.3V. Whatever the reason I could not get it to work.

To provide the correct power I bought a ranking breadboard power supply from Amazon. This has turned out to be really useful, all you need to do is push it into the breadboard and it provides power to the power rails. Note that this version has jumpers to determine whether each side gets 3.3V or 5V. The jumpers need to be between the voltage you want and OFF. Here is a datasheet for it.

Ranking Breadboard

I also got an FTD1232 serial adapter from Ebay to connect directly to the ESP8266 without the arduino.

FTD1232 pinout


To connect to the ESP8266 I wired it up like this: ESP8266 Flash

(Note the serial adapter image has it’s pins reversed in the diagram.)

ESP01 pins

Wiring Connections

ESP01 Connection
2. GPIO2 Not connected
3. GPIO0 Flash button
4. RXD Serial adapter TX
5. VCC 3.3V
6. RST Reset button
 7. CH_PD 3.3V
 8. TXD Serial adapter RX

The reset and flash buttons also need to be connected to ground as does the Serial connector.

Once wired up you need a way of communicating with the ESP8266. There are a few options for this:


To connect to the device using putty use the following configuration: PuTTY Configuration

Note that the speed needs to be set to 115200. Once connected if nothing shows up try pressing the reset button and you should see something like this:-dev-ttyUSB0 - PuTTY_027

To send AT commands type them in press enter and then press <CTRL + J>. A list of AT commands can be found here. If your ESP8266 module does not already have some firmware loaded onto it you may need to flash some on to it. Check out the instructions here.


Another way to connect is using Esplorer. If you don’t see anything in the port chooser press the refresh button and hopefully the port will show up. Click on Open and it should connect.

ESPlorer v0.2.0-rc2 by 4refr0nt_031

Esplorer has the advantage of having the AT commands listed and accessible.

Arduino IDE

Simply open up the arduino IDE and use the Serial Monitor to connect. AT commands can be typed sent via the input at the top of the screen.




Once you’ve got the ESP8266 working you can either use the firmware provided, or you can flash something else onto the ESP8266 chip.

I used the esptool for flashing Espressif firmware and NodeMCU (Available in the AUR for Arch users!) and the Arduino IDE for flashing Arduino programmes.

To put the device into flash mode you need to hold down the reset button and press the flash button, the device should blink.

Some of the options of firmware you can flash to the ESP8266 include:

Espressif firmware

The manufactureres of the ESP8266 chip Espressif provide firmware for the ESP8266. This may well be the firmware that your chip came with originally. Tracking it down and flashing it is not easy. In fact I found it the hardest firmware to get installed. The firmware can be found somewhere on the Espressif site. I found V1.5.2 here. Unzip the files and there should be a readme.txt file somewhere with the details of flashing the files. I found one in esp_iot_sdk_v1.5.2/bin/at/readme.txt

The binary files themselves are in the bin and bin/at folders. For example the readme.txt I had said:

***********************BOOT MODE***********************
Flash size 8Mbit: 512KB+512KB
boot_v1.2+.bin 0x00000
user1.1024.new.2.bin 0x01000
esp_init_data_default.bin 0xfc000 (optional)
blank.bin 0x7e000 & 0xfe000

Followed by lots of other options for other flash sizes. The esptool command I ran to flash these files (after holding down reset and pushing flash!) was:

esptool.py -p /dev/ttyUSB1 write_flash 0x00000 esp_iot_sdk_v1.5.2/bin/boot_v1.2.bin 0x01000 esp_iot_sdk_v1.5.2/bin/at/512+512/user1.1024.new.2.bin 0xfc000 esp_iot_sdk_v1.5.2/bin/esp_init_data_default.bin 0x7e000 esp_iot_sdk_v1.5.2/bin/blank.bin 0xfe000 esp_iot_sdk_v1.5.2/bin/blank.bin

Note that/dev/ttyUSB1 is the port my device is connected to and these commands are run from the folder containing the ESP SDK. The lights on the module should flash for a while and after a few messages it should finish and hopefully have successfully flashed the firmware.


I found this much easier to flash than the Espressif firmware. The project can be found on github and there is a really simple to use cloud builder, you can select which modules you want to include. Once it has run it will send you an email containing links to 2 files to download. One will have support for floating numbers and one has support for integers.

This is fairly easy to flash using esptool simply:

esptool.py -p /dev/ttyUSB1 write_flash 0x00000 nodemcu-master-9-modules-2016-03-15-19-45-11-float.bin

You will need to make sure the port is correct and change the filename as it won’t be the same as the one I downloaded. Remember to press reset and flash first!

Arduino IDE

The simplest way I found to flash the ESP8266 was using the Arduino IDE. It takes a bit of setting up but once it is done flashing new sketches is really simple.

To add the board to the IDE go to File > Preferences and enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into Additional Boards Manager URLs. Preferences

Next you need to install the board manager. Go to Tools > Board*** > Boards Manager and look for esp8266 by ESP8266 Community.

Boards Manager

There should be some example sketches to run under File > Examples > ESP8266, if not you may need to install some ESP8266 libraries, Sketch > Include Library > Manage Libraries should have lots of options.

There are other options of firmware I haven’t tested yet including Micropython which I think I may try next.


Add a Comment

Your email address will not be published. Required fields are marked *