Tuesday, October 20, 2015

Programming ESP8266-ESP07 modules

ESP8266-ESP07 module on the breadboard
We recently bought few of the cheap ESP8266-ESP07 modules from the market and wanted to try them. Initially, we had a huge challenge trying to understand how to program them following different tutorial and resources. Somehow finally we found the way. Since this is a completely new thing for many people, I decided to write the steps clearly for everybody's purpose. Here we go.

(1) Download and install Arduino 1.6.5 version (go to build directory and type 'ant run').

(2) Start the Arduino IDE and then open the preferences menu. There's a text field for Additional Board Manager. Enter the following string in this field.


(3) Now open the Board Manager from Tools->Board menu, search for esp8266 platform and install it.

(4) Now, go to the Tools->Board menu and select "Generic ESP8266 Module". Settings related to this board from the Tools menu should be configured as follows.

Flash Frequency: 40MHz
CPU Frequency: 80MHz
Upload Using: Serial
Upload Speed: 115200
Flash Mode: QIO
Flash Size: 1M (512K SPIFFS)

Now our Arduino IDE is ready.

(5) Connect the ESP8266-ESP07 module with the USB-FDTI module as shown below.


ESP8266-ESP07 FDTI programmer
Tx Rx
Rx Tx
GND GND
GPIO15 GND
GPIO0 GND
VCC 5V *
CH_PD (EN) 5V *


* = connect two diodes to drop the voltage to 3.3v

(6) Connect the USB-FDTI module to a USB port of the PC where we run the Arduino IDE. From File menu go to Examples->ESP8266WiFi->WiFiAccessPoint sketch. Change the access point name given in the code to whatever we want.

Now, we can directory program it to the ESP8266 module but before clicking the Upload button of the Arduino IDE, disconnect the VCC supply from the module and connect again. Then only we can program it. Otherwise, it will throw an error. While the code is uploading, blue LED of the ESP8266 module will blink.

(7) After the code is completed uploading, remove the GPIO0 pin from the GND connection. Then disconnect and reconnect the VCC of ESP8266-ESP07 from the FDTI VCC supply. Now, we can check whether the access point is up and running.

Open a Linux terminal and issue the following command which will list the ESSIDs of the access points in the vicinity together with their signal strengths.

sudo iwlist wlan0 scanning | grep -e "ESSID:" -e "Signal level"

In this list, we should be able to see our new access point created by the ESP8266 module.

(8) If we get connected to this access point using the correct password, then we can open a web browser and enter the IP address http://192.168.4.1/ in the address bar. It should return a HTTP response saying "You are connected".

References:


8 comments:

  1. Hi. In your table it says that GPIO0 should be connected to GND when programming th µC. In text you write "After the code is completed uploading, remove the GPIO0 pin from the VCC connection". Do i connect GPIO0 to VCC or GND for programming?

    ReplyDelete
  2. Hi, thank you for pointing out my mistake. GPIO0 is connected to the GND at the beginning and after the module is programmed, we need to remove its connection with the GND line,

    ReplyDelete
  3. Hi, Asanka: Tank you for this article. I'm trying to run this code in my esp8266-07 module without success. Arduino IDE says "Done uploading" then i remove GPIO0 from GND and reset the esp. I can't found the ESPap network. I tried a blink sketch too and not run.
    I don't remember the last CIOBAUD I wrote in esp using AT commands. What about "reset method" .
    Thank you and best regards

    ReplyDelete
  4. Hi Fernando,
    If the Arduino IDE says "Done Uploading", I'm wondering why and access point is not getting started after removing GPIO0 connection from GND and also disconnect and reconnect of the VCC.
    Did you double check whether you have made the settings of the board exactly as I have done such as "Flash Frequency", etc ?
    Or may be a short circuit which keeps the GPIO0 pin connected with GND all the time?? :)

    ReplyDelete
  5. Additionally, watch that youtube link I have given. That's where I learned most of the things. Perhaps, I have forgot to mention something important we have to do. You might find it from the video of that guy.

    ReplyDelete
  6. Thanks a lot!!! This was a great help!!! :)

    ReplyDelete
  7. Hi, I would like to ask if you could help me with connection of my ESP-07 to airduno mega and send my signals from "mega" to the internet(ubidots).First I would like to connect the two units together (mega TX -> ESP TX and mega RX -> ESP RX)? how can I test if connection is OK and it runs? How do I send data from digital pin 7 to the ESP?
    Thanks for helping with with my first project.
    Martin.

    ReplyDelete
  8. I followed this tutorial, but the led that blinking is the led of the USB-TTL converter, not of module ESP

    ReplyDelete