ESP8266 WiFi Module: Getting started

I have been playing with a new WiFi module that has recently come onto the market – the ESP8266 Serial WIFI Wireless Transceiver Module – that I found on eBay for about $4. This unit promises a lot and at this price is clearly a bargain if it delivers!

ESP8266 WiFi Module

ESP8266 WiFi Module

NOTE: There’s tons of information available online and some if it is excellent. However, I found that much of it was either incomplete or assumed the reader had a greater understanding of the module. I’ve tried to collect information that helped me – a novice to the module – to get started. It is drawn from myriad sources and I assume no ownership. Having said that, I tip my hat to the definitive source – the esp8266.com website.

As the module is not breadboard-friendly, I made a simple breakout board to spread the 8 pins of the module connector. Looking at the face of the module, the connector pins are as follows:

(top left)        GND, GPIO2, GPIO0, RX
(bottom left) TX,    CH_PD, RST,     VCC.

For normal operation, Vcc and CH_PD (chip enable) pins are tied to 3.3V with GND to 0v, and TX and RX pins connected to your serial interface of choice (Arduino, FTDI USB interface, etc.). As the module operates at 3.3v, if your serial interface operates at 5v, you will need a level converter in the module’s RX line to prevent over-voltage. A simple resistor divider (1kΩ and 2.2kΩ) or resistor and 3.3v zenner will do the trick. For better performance, use a FET level shifter in both RX and TX lines.

Next, this puppy needs a rock-solid 3.3v PSU, and you not be able to supply it from your Arduino’s 3.3v supply, As it can draw up to 250mA (!) a 78L33-type 3.3v regulator will be dissipating too much power, getting too warm, and pulling the rail down. I designed a meatier one with a 5v and 3.3v power regulator in series (see ESP8266_PSU design files) so that the module could be powered from any supply above 5V. With a beefy supply you will find the operation of the ESP8266 to be more stable.

Now, with the power supply and level shifters, connecting the module’s RX and TX pins to the TX and RX pins (respectively) of an FTDI USB interface allows you to exercise the AT command set (ESP8266ATCommandsSet) and familiarise yourself with its capabilities and operation. Apparently not all versions of the firmware or module board revisions use the same baud rate. Mine used 9600 baud (apparently common to later versions of the board) while others are set to 115200. Whatever, you’ll need to play a bit here. If you’ve just received your module, connect your USB interface and open a terminal (I use CoolTerm and TeraTerm interchangeably) . Initially set the connection baud rate to 9600, transmit to both CR and LF, and receive to ignore framing errors. Now try typing “AT” (no quotes) in the terminal. If all’s well you should see both the TX/TR light of the USB interface, and the little light of the ESP8266 module flicker and see the response “OK” in the terminal. If all’s well, try exercising the AT commands to join your local WiFi network.

Useful ESP8266 references

More soon…

7 thoughts on “ESP8266 WiFi Module: Getting started

  1. A M Morawala

    Hi Adrian.
    Finally I got the ESP to respond to AT commands. I used your MOSFET level translators. ESP now responds. But I still face some issues.
    The version of firmware is 0018000902-AI03 (0.9.2.4).
    Sometimes I have to give commands multiple times for a response. Should I flash the firmware to the latest version 0.9.5.0?
    How do I change the baudrate and other serial settings?

    I also want to use the 8266 controller’s capabilities to a good extent. Where will I get this documentation? I want to use the device as an IoT controller.

    Thanks for your help.
    A M Morawala

    Reply
  2. A M Morawala

    I bought two ESP8266-01 modules. Made a breadboard with all precautions: LM1117 -3.3 regulator for ESP’s Vcc, 4k7 / 2x4k7 level shifter for Rx pin, CH_PD and RST pulled up to Vcc by 10K, GPIO0 and GPIO1 pulled up by 6k8.

    I use a PC with TeraTerm and serial port (COM1). The RS232 of the serial port is connected to a RS 232 to TTL converter using MAX232 chip. I connect the TTL Rx to the ESP Rx (through the R/2R level shifter) and TTL Tx to ESP Tx.

    When I power on, I get the normal message with version (9.2.4) and READY. The blue LED flashes when sending this data. The baud rate is set at 9600.

    But the ESP does not respond to any AT command. I tried 9600 baud (CR&LF), 115200 (with only CR), and other baud rates. No response. The blue LED does not flash when I give commands through the TeraTerm. When I type AT & press ENTER (CR) and Cntrl J (LF), I do not get OK response. I tried with Cntrl m and Cntrl j also.

    Next, I tried flashing the ESP with binary version 9.5.0 using ESP flasher. here I get an error “failed to connect”.
    Anyone knows how the blue LED is connected on the ESP? Is it being driven by a GPIO line?

    Please help.

    Reply
    1. Adrian Post author

      The one thing that comes to mind is that the ESP is a 3.3V device and so its TX output may not be driving the TTL input hard enough. You may wish to consider using a level shifter (see my article about level-shifting). Also check your wiring as TX of one unit should be connected to the RX of the other and visa-versa. You may aslo want to post your question on the ESP8266.com website as well. Best of luck.

      Reply
      1. A M Morawala

        Hi Adrian. The ESP transmits the message after reset or power on with READY in the next line. I can see this on TeraTerm. That means the wiring is correct and it can drive the TTL part of the comm interface.
        What next?

        Reply
        1. Adrian Post author

          A M,
          Have you also checked to see that the voltage divider is correctly wired.
          In the past when I have used resistor chains I have found that 1K and 2K (to ground) works well as there is a fair amount of current needed to drive the ESP RX pin.

          Reply
          1. A M Morawala

            Hello Adrian. Thanks for your assistance.
            To clarify, I am not using any Arduino or intelligent device between the PC & ESP. I am directly connecting the PC’s COM1 port through the EIA / TTL converter to ESP.
            So the connection would be: TTL Rx (@5v ) to ESP Rx through R/2R network and ESP Tx (@3.3V) to TTL Tx. The resistor network attenuates 5V to about 3.3 V. But I read in the MAX232 datasheet that the Rx high level may be minimum 3.5V, in which case the Rx at ESP will be 2.33V. This is just a thought. I have to put on a ‘Scope and check. The fact that ESP transmits the reset message means the device is alive.
            Secondly, I just checked on my WiFi router, I get the ESP’s SSID. Is the ESP a delicate device? I hope the Rx pin is not damaged:( But this cannot be for both my devices?
            I have posted this problem on esp8266.com but not received any response yet.
            FYI, I tried flashing the device with version 9.5.0 using ESP flasher. I get an error message “Failed to Connect”. I suppose this is an extension of the Rx problem I have at present.
            Hope your expertise helps me.

Come on... leave a comment...