Friday, 20 November 2015 22:46

Upload sketch to the ESP8266 (ESP-07/ESP-12) using Arduino IDE

ESP 07 Arduino IDE
The ESP-07/ESP-12 is a generic ESP8266 module which have no bootstapping resistors on board, insufficient decoupling capacitors, no reset circuit, and no USB-serial adapter. This is an article shows you how to connect the bootstapping resistor to the ESP-07 module and upload sketches onto the ESP-07/ESP-12 using the familiar Arduino IDE.

In order to use the ESP-07/ESP-12 module, you need to solder 4 pcs 10K ohms resistors & a filtering capacitor onto the module as shown in figure below.

ESP 07
JP1 and SW1 is required when uploading sketch, you can remove them after sketch has been uploaded.

 

Power the ESP-07/ESP-12 module

The ESP-07/ESP-12 module is a 3.3V device. Power the ESP-07/ESP-12 module from the USB port (5V) without a 3.3V regulator could damage the module.

During uploading sketch, I'm power the module from my USB-Serial adapter which the voltage is switched to 3.3V. However, using the power available from USB to Serial adapter is not recommended.

 

Hardware setup

As shown in table below is the connection between USB-Serial adapter & ESP-07/ESP-12

USB-Serial adapter ESP-07/ESP-12 module
VCC (3.3V) VCC
GND GND
TX RX
RX TX

usb serial

 

Testing the ESP-07/ESP-12 module

The ESP-07/ESP-12 comes pre-programmed with AI-Thinkers firmware, it has the AT command set preinstalled. Before uploading sketch to the ESP-07/ESP-12, it's important to test it directly via a serial interface.

Assumes you already have Arduino IDE running on your computer. If you do not have Arduino IDE software on your computer, please download it from Arduino official website & install it to your computer.

  1. Complete the hardware setup as described in the Hardware Setup
  2. Plug in the USB-serial adapter to computer via USB
  3. Run the Arduino IDE
  4. Click on Tools from the Arduino IDE menu
  5. Choose the correct COM port for your USB-Serial adapter
  6. Open the Serial Monitor
  7. Choose the correct baud rate, mine is 9600
  8. Push the SW1 to reset the ESP-07/ESP-12, you should see the following output on the serial console

    [Vendor:www.ai-thinker.com Version:0.9.2.4]

    ready

  9. Congratulation! Your ESP-07 is working.

Installing ESP8266 package for Arduino IDE 1.6.4 or 1.6.5

Do not use Arduino 1.6.2 and 1.6.6, if you do not have Arduino IDE1.6.4 or 1.6.5 software on your computer, please download it from Arduino official website.

  • Choose Preferences from the File menu in the Arduino IDE
  • Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into Additional Board Manager URLs field
    Preferences
  • Choose Board from the Tools menu in the Arduino IDE, click on Boards Manager from the dropdown menu
  • Use the Board manager to install the ESP8266 package
    Board Manager
  • Restart the Arduino once completed installation

 

Uploading sketch to ESP-07/ESP-12

  • Select the correct configuration for the ESP-07/ESP-12 as shown in figure belowArduino IDE settings
  • Load a sketch into the Arduino IDE editor windows.
  • .As described in the Hardware Setup, place a jumper (JP1) between GPIO0 and GND in order to start the bootload mode.
  • Push the SW1 button to reset the ESP-07/ESP-12.
  • Click on Upload button from the Arduino IDE, the blue LED which is wired to TXD (GPIO1) will start blinking rapidly indicated uploading process is going on.
  • Remove JP1 after successfully uploading.

8 LEDs light up in sequence

8 LEDs light up in sequence

Read 52290 times Last modified on Sunday, 12 June 2016 11:47

26 comments

  • Comment Link admin Thursday, 07 December 2017 12:34 posted by admin

    It seems that upload unsuccessful

  • Comment Link manlio Wednesday, 06 December 2017 00:04 posted by manlio

    When I try to upload a sketch, the following output is shown at the bottom of the IDE:

    esptool v0.4.12 - (c) 2014 Ch. Klippel
    setting board to ck
    setting baudrate from 115200 to 115200
    setting port from to /dev/cu.usbmodem1421
    setting address from 0x00000000 to 0x00000000
    espcomm_upload_file
    espcomm_upload_mem
    opening port /dev/cu.usbmodem1421 at 115200
    tcgetattr
    tcsetattr
    serial open
    opening bootloader
    resetting board
    trying to connect
    espcomm_send_command: sending command header
    espcomm_send_command: sending command payload
    espcomm_send_command: receiving 2013 bytes of data
    error: failed reading byte
    warning: espcomm_send_command: can't receive slip payload data
    error: failed reading byte

    trying to connect
    espcomm_send_command: sending command header
    espcomm_send_command: sending command payload
    espcomm_send_command: receiving 2013 bytes of data
    error: failed reading byte
    warning: espcomm_send_command: can't receive slip payload data
    trying to connect
    espcomm_send_command: sending command header
    espcomm_send_command: sending command payload
    espcomm_send_command: receiving 2013 bytes of data
    error: failed reading byte
    warning: espcomm_send_command: can't receive slip payload data
    resetting board
    trying to connect
    espcomm_send_command: sending command header
    espcomm_send_command: sending command payload
    espcomm_send_command: receiving 2013 bytes of data
    error: failed reading byte
    warning: espcomm_send_command: can't receive slip payload data
    trying to connect
    espcomm_send_command: sending command header
    espcomm_send_command: sending command payload
    espcomm_send_command: receiving 2013 bytes of data
    error: failed reading byte
    warning: espcomm_send_command: can't receive slip payload data
    trying to connect
    espcomm_send_command: sending command header
    espcomm_send_command: sending command payload
    espcomm_send_command: receiving 2013 bytes of data
    error: failed reading byte
    warning: espcomm_send_command: can't receive slip payload data
    resetting board
    trying to connect
    espcomm_send_command: sending command header
    espcomm_send_command: sending command payload
    espcomm_send_command: receiving 2013 bytes of data
    error: failed reading byte
    warning: espcomm_send_command: can't receive slip payload data
    trying to connect
    espcomm_send_command: sending command header
    espcomm_send_command: sending command payload
    espcomm_send_command: receiving 2013 bytes of data
    error: failed reading byte
    warning: espcomm_send_command: can't receive slip payload data
    trying to connect
    espcomm_send_command: sending command header
    espcomm_send_command: sending command payload
    espcomm_send_command: receiving 2013 bytes of data
    error: failed reading byte
    warning: espcomm_send_command: can't receive slip payload data
    warning: espcomm_sync failed
    error: espcomm_open failed
    error: espcomm_upload_mem failed

    Any advice would be appreciated.
    Manlio

  • Comment Link manlio Tuesday, 05 December 2017 23:57 posted by manlio

    After setting the HW as indicated, I powered up the ESP and got the following output on serial monitor:

    ets Jan 8 2013,rst cause:2, boot mode:(3,7)

    load 0x40100000, len 1396, room 16
    tail 4
    chksum 0x89
    load 0x3ffe8000, len 776, room 4
    tail 4
    chksum 0xe8
    load 0x3ffe8308, len 540, room 4
    tail 8
    chksum 0xc0
    csum 0xc0

    2nd boot version : 1.4(b1)
    SPI Speed : 40MHz
    SPI Mode : QIO
    SPI Flash Size & Map: 8Mbit(512KB+512KB)
    jump to run user1 @ 1000

    ⸮⸮ՁMEM CHECK FAIL!!!
    ⸮sl⸮⸮r⸮
    Ai-Thinker Technology Co. Ltd.

    ready

    Any guess?

  • Comment Link admin Thursday, 06 July 2017 22:25 posted by admin

    It can be any capacitor, the best value is between 0.0uf to 0.1uf. It also should works without the capacitor.

  • Comment Link Daniel Fernandes Thursday, 06 July 2017 08:59 posted by Daniel Fernandes

    Hello Friend!
    Can an electrolytic capacitor be used in the circuit? what value? Thank you

  • Comment Link Daniel Fernandes Thursday, 06 July 2017 08:58 posted by Daniel Fernandes

    Hello Friend!
    Can an electrolytic capacitor be used in the circuit? what value? Thank you

  • Comment Link admin Thursday, 25 May 2017 12:15 posted by admin

    Sorry for the delayed response. What is your error message?

  • Comment Link dematantra Tuesday, 09 May 2017 10:58 posted by dematantra

    I've tried to device circuit, but in compile program why still error? Please help

  • Comment Link admin Thursday, 10 November 2016 10:13 posted by admin

    Yes, it is 0.1uF. The capacitor voltage must be larger than 3.3V, therefore 3.5V is OK.

  • Comment Link kova Thursday, 10 November 2016 04:18 posted by kova

    The capacitor is 0.1uf 3.5v?

  • Comment Link admin Friday, 12 August 2016 20:19 posted by admin

    Yes, you can use the Arduino UNO as an USB to serial TTL converter. You need to remove the ATMega328 from the board and connect a jumper from RESET to GND. Finally make sure you are supplying 3.3V to the ESP8266 module.

  • Comment Link Noerachman Saleh Thursday, 11 August 2016 12:54 posted by Noerachman Saleh

    Can I use Arduino UNO to upload the sketch (instead of using USB to Serial board?
    If so what is the schematic would look like..

    Thanks

  • Comment Link admin Monday, 27 June 2016 16:41 posted by admin

    Make sure you have set the baud rate correctly, normally it is 9600.

  • Comment Link shafiqah Monday, 27 June 2016 15:39 posted by shafiqah

    hi, im using esp01 module, when i pushed reset button, it only so some rubbish, it do not show
    "[Vendor:http://www.ai-thinker.com Version:0.9.2.4]

    ready"

    please help me.

  • Comment Link admin Saturday, 02 April 2016 23:18 posted by admin

    You need a Flash Download Tool
    http://bbs.espressif.com/viewtopic.php?f=57&t=433

    and the firware
    http://bbs.espressif.com/viewforum.php?f=46&sid=caa46a705b47c3376aac21fb3e71c0e3

    Please let me know if you have used it. BTW I did not use it yet.

  • Comment Link Gautam Friday, 01 April 2016 16:22 posted by Gautam

    Once the steps on this tutorial have been followed, if you want to bring the original firmware back up, how to do it?

  • Comment Link admin Friday, 18 March 2016 11:41 posted by admin

    It seems that the board is switched to programming mode. For normal running mode, you must remove jumper from JP1 in order to set GPIO 0 high.

  • Comment Link Christiaan Friday, 18 March 2016 07:38 posted by Christiaan

    At step 8 of testing I won't get ready but "ets Jan 8 2013,rst cause:2, boot mode:(1,7)"

  • Comment Link admin Tuesday, 15 March 2016 21:01 posted by admin

    You can't get 3.3V from a laptop, you need an ATX power supply from desktop computer.

    http://www.overclock.net/t/1388027/computer-wont-power-on-turn-on/10

  • Comment Link Shafeek Tuesday, 15 March 2016 20:45 posted by Shafeek

    Now it happends more often.it doesnt even boots up.and the led stays like as i mentioned befor.i tried to flash the module,but the problem occurs while getting connected and it gets disconnected. Hence im not even able to flash it via flash tool nor with arduino ide.all the resistors and the capasitors ive used is as you mentioned.10k and 0.1uf.how can i get 3.3v regulated from my laptop ?. And i have orderd a new witty cloud development board since this module has became unstable.i wanted to use this for an home automation project to control relays since this module is very cheap and compact.

Leave a comment

Back to Top